.nlp-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.nlp-history { position: relative; overflow: hidden; border: 1px solid var(--t-line); border-radius: 12px; background: var(--t-surface); }
.nlp-history > header { display: flex; align-items: center; justify-content: space-between; padding: 20px 18px 16px; }
.nlp-history h2, .nlp-editor h2, .nlp-analysis h2 { margin: 0; color: var(--color-brand-navy); font-size: calc(20px * var(--ui-scale, 1)); font-weight: 700; }
.nlp-history > header > span { padding: 4px 8px; border-radius: 5px; background: var(--t-subtle); color: var(--color-brand-blue); font-size: calc(14px * var(--ui-scale, 1)); }
.nlp-history-search { margin: 0 16px; }
.nlp-history-count { margin: 13px 18px; color: var(--color-muted); font-size: calc(13px * var(--ui-scale, 1)); }
.nlp-history-list { margin: 0; padding: 0 16px; list-style: none; }
.nlp-history-list li { padding: 16px 0; border-top: 1px solid var(--t-line); }
.nlp-history-item-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nlp-history h3 { margin: 0; color: var(--color-brand-navy); font-size: calc(15px * var(--ui-scale, 1)); font-weight: 650; }
.nlp-history-item-heading > span { color: #39715e; font-size: calc(15px * var(--ui-scale, 1)); }
.nlp-history-list article > p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; margin: 8px 0; color: var(--color-muted); font-size: calc(14px * var(--ui-scale, 1)); line-height: 1.6; }
.nlp-history time { color: var(--t-muted); font-size: calc(12px * var(--ui-scale, 1)); }
.nlp-history-pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px; border-top: 1px solid var(--t-line); color: var(--color-muted); font-size: calc(12px * var(--ui-scale, 1)); }
.nlp-history-pagination label, .nlp-history-pagination nav { display: flex; align-items: center; gap: 7px; }
.nlp-history-pagination select, .nlp-history-pagination button { min-width: 28px; height: 29px; border: 1px solid var(--t-line); border-radius: 5px; background: var(--t-subtle); color: var(--color-brand-navy); font-size: calc(13px * var(--ui-scale, 1)); }
.nlp-history-pagination button { font-size: calc(19px * var(--ui-scale, 1)); cursor: pointer; }
.nlp-history-pagination button:disabled { opacity: .35; cursor: default; }
.nlp-history-empty { padding: 20px 18px; color: var(--color-muted); font-size: calc(15px * var(--ui-scale, 1)); }
.nlp-main { min-width: 0; }
.nlp-editor, .nlp-analysis { padding: 16px; border: 1px solid var(--t-line); border-radius: 12px; background: var(--t-surface); }
.nlp-editor > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.nlp-editor header p, .nlp-analysis-heading p:last-child { margin: 7px 0 0; color: var(--color-muted); font-size: calc(14px * var(--ui-scale, 1)); line-height: 1.6; }
.nlp-language { flex-shrink: 0; padding: 5px 8px; border-radius: 6px; background: var(--t-subtle); color: var(--color-brand-blue); font-size: calc(12px * var(--ui-scale, 1)); }
.nlp-editor textarea { width: 100%; min-height: 125px; padding: 16px; resize: vertical; border: 1px solid var(--t-line); border-radius: 9px; background: var(--t-subtle); color: var(--color-ink); font: inherit; font-size: calc(16px * var(--ui-scale, 1)); line-height: 1.9; }
.nlp-editor textarea:focus { outline: 2px solid #176b9f40; outline-offset: 1px; border-color: var(--color-brand-blue); }
.nlp-editor-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.nlp-photo-picker { position: relative; }
.nlp-photo-button, .nlp-upload-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 12px; border: 1px solid var(--t-line); border-radius: 8px; background: var(--t-surface); color: var(--color-brand-blue); font-size: calc(14px * var(--ui-scale, 1)); font-weight: 600; cursor: pointer; }
.nlp-photo-button:hover { background: var(--t-subtle); }
.nlp-photo-button:disabled { opacity: .5; cursor: default; }
.nlp-photo-chevron { margin-left: 2px; }
.nlp-photo-menu { position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; display: grid; width: 285px; padding: 7px; border: 1px solid var(--t-line); border-radius: 10px; background: var(--t-surface); box-shadow: 0 12px 30px rgba(22, 45, 73, .16); }
.nlp-photo-menu label { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 7px; color: var(--color-brand-navy); cursor: pointer; }
.nlp-photo-menu label:hover { background: var(--t-subtle); }
.nlp-photo-menu label > svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--color-brand-blue); }
.nlp-photo-menu label > span { display: grid; gap: 2px; }
.nlp-photo-menu strong { font-size: calc(13px * var(--ui-scale, 1)); font-weight: 650; }
.nlp-photo-menu small { color: var(--color-muted); font-size: calc(11px * var(--ui-scale, 1)); }
.nlp-upload-button { margin-left: auto; border-color: transparent; background: var(--color-brand-blue); color: #fff; }
.nlp-upload-button:hover { background: var(--color-brand-blue-dark); }
.nlp-editor-actions svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nlp-photo-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.nlp-analysis { margin-top: 16px; }
.nlp-analysis-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.nlp-analysis-summary > span { padding: 7px 10px; border-radius: 6px; background: var(--t-subtle); color: var(--t-muted); font-size: calc(13px * var(--ui-scale, 1)); }
.nlp-analysis-summary strong { color: var(--color-brand-navy); font-weight: 750; }
.nlp-analysis-summary .nlp-clean-summary { background: var(--t-subtle); color: #39715e; }
.nlp-sentences { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
 .nlp-sentence { padding: 13px 0; border: 0; border-bottom: 1px solid var(--t-line); border-radius: 0; }
.nlp-sentence > header { display: flex; align-items: flex-start; gap: 11px; }
.nlp-sentence-number { display: grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px; border-radius: 7px; background: var(--t-subtle); color: var(--color-brand-blue); font-size: calc(13px * var(--ui-scale, 1)); font-weight: 700; }
.nlp-original-label { color: var(--t-muted); font-size: calc(12px * var(--ui-scale, 1)); letter-spacing: .07em; }
.nlp-sentence header div { flex: 1; min-width: 0; }
.nlp-sentence header p { margin: 0; color: var(--color-brand-navy); font-size: calc(15px * var(--ui-scale, 1)); font-weight: 550; line-height: 1.7; }
.nlp-sentence-badge { flex-shrink: 0; padding: 4px 7px; border-radius: 5px; background: var(--t-subtle); color: var(--color-brand-red); font-size: calc(12px * var(--ui-scale, 1)); }
.nlp-sentence-badge.is-clean { background: var(--t-subtle); color: #39715e; }
.nlp-correction { margin-top: 15px; padding: 12px 14px; border-left: 3px solid var(--color-brand-blue); border-radius: 0 7px 7px 0; background: var(--t-subtle); }
.nlp-correction > span { color: var(--color-brand-blue); font-size: calc(12px * var(--ui-scale, 1)); font-weight: 600; }
.nlp-correction p { margin: 5px 0 0; color: var(--color-brand-navy); font-size: calc(15px * var(--ui-scale, 1)); line-height: 1.7; }
.nlp-errors { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 0 37px; padding: 0; list-style: none; }
.nlp-errors li { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 5px 8px; border: 1px solid var(--t-line); border-radius: 6px; background: var(--t-subtle); color: var(--t-muted); font-size: calc(12px * var(--ui-scale, 1)); }
.nlp-errors li > div > span { display: block; margin-bottom: 6px; color: var(--t-muted); font-size: calc(12px * var(--ui-scale, 1)); }
.nlp-errors strong { color: var(--t-muted); font-size: calc(13px * var(--ui-scale, 1)); font-weight: 550; }
.nlp-errors .nlp-error-word { color: var(--color-brand-red); font-size: calc(15px * var(--ui-scale, 1)); }
.nlp-confidence { text-align: right; }
.nlp-confidence strong { color: var(--color-brand-blue); font-size: calc(14px * var(--ui-scale, 1)); }
.nlp-no-errors { display: flex; align-items: center; gap: 8px; margin: 9px 0 0 37px; padding: 10px 12px; border: 1px solid var(--t-line); border-radius: 7px; background: var(--t-subtle); color: #39715e; font-size: calc(13px * var(--ui-scale, 1)); }
.nlp-no-errors > span { display: grid; place-items: center; flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; background: #dcefe5; color: #28704f; font-weight: 800; }
.nlp-no-errors strong { font-weight: 650; }
@media (max-width: 1100px) { .nlp-layout { grid-template-columns: 250px minmax(0, 1fr); gap: 18px; } .nlp-editor, .nlp-analysis { padding: 18px; } .nlp-sentence { padding: 14px; } }
@media (max-width: 900px) { .nlp-layout { grid-template-columns: 1fr; } .nlp-history { position: static; } }
@media (max-width: 600px) { .nlp-sentence > header { flex-wrap: wrap; } .nlp-sentence-badge { margin-left: 37px; } .nlp-errors li { grid-template-columns: minmax(0, 1fr) 65px; } .nlp-errors li > div:first-child { grid-column: 1 / -1; } .nlp-editor-actions > *:not(input) { width: 100%; margin-left: 0; } .nlp-photo-button, .nlp-photo-menu { width: 100%; } }

.nlp-analysis-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.nlp-analysis-heading > span { color: var(--color-muted); font-size: calc(13px * var(--ui-scale, 1)); }
.nlp-compact-correction { margin: 7px 0 0 37px; padding: 8px 10px; border-left: 3px solid var(--color-brand-blue); border-radius: 0 6px 6px 0; background: var(--t-subtle); color: var(--color-brand-navy); font-size: calc(14px * var(--ui-scale, 1)); line-height: 1.6; }
.nlp-compact-correction strong { font-weight: 700; }
.nlp-compact-confidence { color: var(--color-brand-blue); font-weight: 650; }
.nlp-sentence:last-child { border-bottom: 0; padding-bottom: 0; }

.nlp-demo-notice { margin: -8px 0 22px; padding: 12px 16px; border: 1px solid var(--t-line); border-radius: 8px; background: var(--t-subtle); color: var(--color-muted); font-size: calc(12px * var(--ui-scale, 1)); line-height: 1.6; }
.nlp-upload-course { margin: 14px 0; }
.nlp-history-search { display: grid; }
.nlp-history-entry { display: block; width: 100%; padding: 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.nlp-history-entry:hover { background: var(--t-subtle); }
.nlp-history-entry.is-selected { border-color: var(--t-line); background: var(--t-subtle); }
.nlp-history-item-heading > strong { color: var(--color-brand-navy); font-size: calc(15px * var(--ui-scale, 1)); font-weight: 650; }
.nlp-history-excerpt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin: 8px 0; color: var(--color-muted); font-size: calc(13px * var(--ui-scale, 1)); line-height: 1.6; overflow-wrap: anywhere; }
.nlp-history-date { color: var(--t-muted); font-size: calc(12px * var(--ui-scale, 1)); }
.nlp-character-count { margin: 6px 0 0; text-align: right; color: var(--color-muted); font-size: calc(11px * var(--ui-scale, 1)); }
.nlp-feedback, .nlp-analysis-empty { margin: 16px 0 0; color: var(--color-muted); font-size: calc(13px * var(--ui-scale, 1)); line-height: 1.7; overflow-wrap: anywhere; }
.nlp-upload-button:disabled { opacity: .5; cursor: default; }
.nlp-photo-picker:focus-within .nlp-photo-button { outline: 2px solid var(--color-brand-blue); outline-offset: 3px; }
.nlp-sentence header p, .nlp-compact-correction { overflow-wrap: anywhere; }
@media (max-width: 600px) { .nlp-analysis-heading { align-items: flex-start; flex-direction: column; } }
.nlp-history-search-form { display: flex; align-items: center; gap: 6px; margin: 14px 16px; }
.nlp-history-search-form label { flex: 1; min-width: 0; }
.nlp-history-search-form input { min-width: 0; }
.nlp-history-error { margin: 12px 16px; padding: 12px; background: var(--t-subtle); border-radius: 8px; color: #a33740; font-size: calc(12px * var(--ui-scale, 1)); }
.nlp-history-error p { margin: 0 0 8px; }
.nlp-upload-error { margin: 16px 0 0; color: #a33740; font-size: calc(13px * var(--ui-scale, 1)); line-height: 1.6; }
.nlp-history-entry:disabled { opacity: .65; cursor: default; }
