:root {
    --ink: #17202a;
    --muted: #667085;
    --line: #d9e2ec;
    --panel: #ffffff;
    --page: #f4f7fb;
    --primary: #2454d6;
    --primary-strong: #163aa2;
    --accent: #0f8b8d;
    --warn: #b45f06;
    --danger: #b42318;
    --soft-blue: #eaf1ff;
    --soft-green: #e7f6f2;
    --shadow: 0 16px 40px rgba(24, 39, 75, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    background: var(--page);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

.app-container {
    max-width: 1440px;
    padding-left: 24px;
    padding-right: 24px;
}

.app-nav {
    min-height: 64px;
    background:
        linear-gradient(90deg, rgba(36, 84, 214, 0.08), rgba(15, 139, 141, 0.10)),
        #ffffff;
    border-bottom: 1px solid #c9d7ef;
    box-shadow: 0 8px 22px rgba(36, 84, 214, 0.08);
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    color: #17202a;
    font-weight: 820;
    text-decoration: none;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
}

.brand-logo img {
    display: block;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    filter: drop-shadow(0 9px 16px rgba(66, 133, 244, 0.18));
}

.navbar-brand:hover,
.navbar-brand:focus {
    color: #163aa2;
}

.app-nav .nav-link {
    margin-left: 4px;
    padding: 7px 12px;
    border-radius: 8px;
    color: #475467;
    font-weight: 600;
}

.language-switcher-item {
    display: flex;
    align-items: center;
    margin-left: 6px;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 1px;
    border: 1px solid #b9c9ec;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(36, 84, 214, 0.10);
}

.language-switcher button {
    min-width: 26px;
    min-height: 19px;
    padding: 1px 6px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--primary-strong);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.language-switcher button.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(28, 74, 194, 0.24);
}

.language-switcher button:not(.active):hover {
    background: #eaf1ff;
    color: var(--primary);
}

.app-nav .nav-link.active,
.app-nav .nav-link:hover {
    background: #eaf1ff;
    color: var(--primary-strong);
}

.app-nav .navbar-toggler {
    border-color: #b8c7e6;
}

.app-nav .navbar-toggler-icon {
    filter: none;
}

.app-main {
    flex: 1;
}

.workspace-band {
    padding: 28px 0 36px;
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: end;
    margin-bottom: 22px;
}

.workspace-header h1,
.tool-panel h2 {
    margin: 0;
    line-height: 1.1;
    font-weight: 780;
}

.workspace-header h1 {
    font-size: 28px;
    max-width: 980px;
}

.tool-panel h2 {
    font-size: 21px;
}

.section-kicker {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
}

.status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.status-strip span,
.status-pill,
.time-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    color: #344054;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-pill.online {
    color: #027a48;
    border-color: #abefc6;
    background: #ecfdf3;
}

.status-pill.offline {
    color: #b42318;
    border-color: #fecdca;
    background: #fef3f2;
}

.tool-panel {
    height: 100%;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.tool-panel-spacious {
    padding: 24px;
}

.ui-small-text {
    font-size: 13px;
}

#loadingSpinner,
#resultsContent,
#articleLoadingSpinner,
#articleResultsContent,
#corpusSavedPill,
#tooltip {
    display: none;
}

.status-pill-saved {
    color: #027a48;
    border-color: #6ce9a6;
}

.corpus-filter-level {
    width: 140px;
}

.corpus-filter-year {
    width: 130px;
}

.vocab-pos-code {
    font-size: 12px;
}

.legend-dot-cet4 {
    background: #3b82f6;
}

.legend-dot-cet6 {
    background: #22c55e;
}

.legend-dot-other {
    background: #94a3b8;
}

.legend-dot-difficulty {
    background: #f59e0b;
}

.admin-login-wrap {
    min-height: calc(100vh - 128px);
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.admin-login-panel {
    width: min(420px, 100%);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.admin-login-panel h1 {
    margin-bottom: 8px;
    font-size: 24px;
}

.admin-login-error {
    font-size: 13px;
}

.admin-batch-progress {
    height: 8px;
}

.topic-legend {
    margin-top: 8px;
    text-align: center;
}

.topic-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 2px 6px;
    font-size: 11px;
}

.topic-legend-dot {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-radius: 50%;
}

.sent-explain-toggle {
    margin-top: 6px;
    cursor: pointer;
}

.sent-explain-label {
    font-size: 11px;
}

.sentence-detail-meta-spaced {
    margin-top: 6px;
}

.corpus-empty-icon {
    margin-bottom: 12px;
    font-size: 40px;
}

.panel-heading,
.result-topline,
.sample-header,
.action-row,
.input-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.form-label {
    margin-top: 18px;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

.sentence-box {
    min-height: 190px;
    resize: vertical;
    border-color: #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.6;
}

.sentence-box:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(36, 84, 214, 0.12);
}

.input-tools {
    margin-top: 12px;
}

.switch-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #344054;
    font-weight: 650;
}

.switch-line input {
    width: 18px;
    height: 18px;
}

.sentence-stats {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.corpus-save-quota {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.corpus-save-quota.is-exhausted {
    color: #b42318;
}

.corpus-save-quota.is-unlimited {
    color: #027a48;
}

.sample-area {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.sample-header {
    align-items: center;
    margin-bottom: 12px;
}

.sample-header span {
    color: #344054;
    font-size: 13px;
    font-weight: 750;
}

.sample-header .form-select {
    max-width: 260px;
    border-radius: 8px;
}

.sample-chips {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.sample-chip {
    min-height: 68px;
    padding: 9px 10px 9px 12px;
    border: 1px solid #d4def2;
    border-left: 3px solid var(--primary);
    border-radius: 8px;
    background: #fbfdff;
    color: #1f3f91;
    text-align: left;
    width: 100%;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.sample-chip strong,
.sample-chip span {
    display: block;
    min-width: 0;
}

.sample-chip strong {
    color: var(--primary-strong);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

.sample-chip span {
    margin-top: 5px;
    color: #667085;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sample-chip:hover,
.sample-chip:focus {
    background: #f4f8ff;
    border-color: var(--primary);
    box-shadow: 0 6px 14px rgba(36, 84, 214, 0.10);
    outline: 3px solid rgba(36, 84, 214, 0.10);
    outline-offset: 1px;
}

.action-row {
    margin-top: 22px;
}

.action-row .btn-outline-secondary {
    min-width: 92px;
}

.action-row .btn-primary {
    min-width: 132px;
}

.btn {
    --bs-btn-padding-x: 14px;
    --bs-btn-padding-y: 8px;
    --bs-btn-border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0;
    box-shadow: 0 2px 7px rgba(24, 39, 75, 0.06);
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease,
        box-shadow 0.16s ease,
        transform 0.16s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(24, 39, 75, 0.08);
}

.btn:focus-visible {
    outline: 3px solid rgba(36, 84, 214, 0.20);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(36, 84, 214, 0.10);
}

.btn:disabled,
.btn.disabled {
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.58;
}

.btn-sm {
    --bs-btn-padding-x: 10px;
    --bs-btn-padding-y: 5px;
    min-height: 28px;
    font-size: 12px;
    font-weight: 800;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(36, 84, 214, 0.18);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
    color: #ffffff;
    box-shadow: 0 9px 18px rgba(36, 84, 214, 0.22);
}

.btn-outline-primary {
    background: #f5f8ff;
    border-color: #b9c9ec;
    color: var(--primary-strong);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: #eaf1ff;
    border-color: var(--primary);
    color: var(--primary-strong);
    box-shadow: 0 6px 14px rgba(36, 84, 214, 0.13);
}

.btn-outline-secondary {
    background: #ffffff;
    border-color: #cfd8e6;
    color: #344054;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background: #f6f8fb;
    border-color: #98a7bc;
    color: #182230;
    box-shadow: 0 6px 14px rgba(24, 39, 75, 0.10);
}

.btn-outline-danger {
    background: #fff8f7;
    border-color: #f4b5b0;
    color: var(--danger);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
    background: #fee4e2;
    border-color: #f97066;
    color: #912018;
    box-shadow: 0 6px 14px rgba(180, 35, 24, 0.13);
}

.btn-close {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 999px;
    background-color: #f8fafc;
    border: 1px solid #d8e1ee;
    background-size: 10px;
    opacity: 1;
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.btn-close:hover,
.btn-close:focus {
    background-color: #eef4ff;
    border-color: #b9c9ec;
    box-shadow: 0 5px 12px rgba(36, 84, 214, 0.12);
    transform: translateY(-1px);
}

.result-panel {
    min-height: 540px;
}

.empty-state,
.loading-state {
    display: flex;
    height: 100%;
    min-height: 420px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--muted);
}

.empty-state h2 {
    color: var(--ink);
    margin-bottom: 8px;
}

.empty-state p {
    max-width: 520px;
    margin: 0;
}

.loading-state p {
    margin: 12px 0 0;
    font-weight: 700;
}

.loading-estimate {
    display: block;
    max-width: 460px;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}

.loading-steps {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 520px;
    margin-top: 16px;
}

.loading-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.loading-step::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c8d2e0;
}

.loading-step.is-active {
    border-color: #b9c9ec;
    background: #f4f7ff;
    color: var(--primary);
}

.loading-step.is-active::before {
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(36, 84, 214, 0.12);
}

.loading-step.is-done {
    color: var(--ink);
}

.loading-step.is-done::before {
    background: #16a34a;
}

.result-topline {
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

#sentenceType {
    font-size: 23px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: 10px 0 12px;
}

.summary-item {
    min-height: 46px;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.summary-item span {
    display: block;
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 750;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-item strong {
    display: block;
    margin-top: 3px;
    color: #182230;
    font-size: 14px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.confidence-warning {
    border: 1px solid rgba(217, 119, 6, 0.28);
    border-left-width: 3px;
    border-radius: 6px;
    margin: 0 0 8px;
    padding: 5px 8px;
    background: #fff7ed;
    color: #7c2d12;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.confidence-warning strong {
    display: inline;
    font-size: 11.5px;
    margin-right: 6px;
}

.confidence-warning p {
    display: inline;
    margin: 0;
    color: inherit;
    font-size: 11px;
    line-height: 1.25;
}

.confidence-warning-medium {
    border-color: rgba(37, 99, 235, 0.22);
    background: #eff6ff;
    color: #1e3a8a;
}

.learning-guide-panel {
    margin: 0 0 18px;
    padding: 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fbfdff;
}

.learning-guide-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.learning-guide-head h3 {
    margin: 0;
    color: #182230;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 780;
}

.reading-difficulty {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid #bfd7d8;
    border-radius: 999px;
    background: #eef8f8;
    color: #0e6f72;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.sentence-core-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.sentence-core-grid div {
    min-height: 82px;
    padding: 12px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #ffffff;
}

.sentence-core-grid span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.sentence-core-grid strong {
    display: block;
    color: #182230;
    font-size: 14px;
    line-height: 1.35;
    font-weight: 780;
    overflow-wrap: anywhere;
}

.reading-tip-box {
    margin-top: 6px;
    padding: 5px 8px;
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    background: #f0fdfa;
    white-space: nowrap;
    overflow: hidden;
}

.reading-tip-box p {
    margin: 0;
    color: #184e4f;
    font-size: 11px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
}

.explanation-focus-panel {
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid #d5e3f8;
    border-radius: 8px;
    background: #f8fbff;
}

.explanation-focus-panel .section-heading-row {
    margin-bottom: 8px;
}

.analysis-feedback-btn {
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #ffffff;
    color: #475467;
    font-size: 11px;
    font-weight: 750;
    line-height: 1;
    padding: 6px 9px;
    white-space: nowrap;
}

.analysis-feedback-btn:hover:not(:disabled) {
    border-color: #94a3b8;
    color: #334155;
}

.analysis-feedback-btn:disabled {
    opacity: 0.72;
}

.analysis-feedback-btn.is-saved {
    border-color: #99d5b8;
    color: #057647;
    background: #ecfdf3;
}

.parser-debug-panel {
    min-height: 160px;
    margin: 0;
    padding: 12px;
    border-radius: 8px;
    background: #101828;
    color: #d0d5dd;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.explanation-focus-panel h3 {
    margin: 0;
    color: #182230;
    font-size: 17px;
    line-height: 1.3;
    font-weight: 800;
}

.explanation-focus-panel .explanation-container {
    padding: 0;
    border: 0;
    background: transparent;
}

.section-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.section-heading-row h3 {
    margin: 0;
    color: #182230;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 780;
}

.step-meta {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #ffffff;
    color: #475467;
    font-size: 12px;
    font-weight: 750;
}

.advanced-result-panel {
    margin-top: 16px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.advanced-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid #cfd8e6;
    border-radius: 999px;
    background: #ffffff;
    color: #182230;
    text-align: left;
    font-weight: 800;
    box-shadow: 0 2px 7px rgba(24, 39, 75, 0.05);
    transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.advanced-toggle:hover,
.advanced-toggle:focus-visible {
    background: #f6f8fb;
    border-color: #b9c9ec;
    box-shadow: 0 6px 14px rgba(24, 39, 75, 0.09);
    transform: translateY(-1px);
}

.advanced-toggle:focus-visible {
    outline: 3px solid rgba(36, 84, 214, 0.14);
    outline-offset: 2px;
}

.advanced-toggle small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.advanced-toggle::after {
    content: "⌃";
    color: var(--muted);
    font-size: 16px;
    line-height: 1;
}

.advanced-toggle.collapsed::after {
    content: "⌄";
}

.advanced-result-panel .collapse,
.advanced-result-panel .collapsing {
    padding-top: 14px;
}

.component-mark {
    display: inline;
    padding: 0 2px 3px;
    border-radius: 3px;
    font-weight: 720;
    text-underline-offset: 5px;
    text-decoration-thickness: 2px;
}

.mark-subject {
    color: #b42318;
    text-decoration-line: underline;
    text-decoration-style: double;
    text-decoration-color: #d92d20;
}

.mark-predicate {
    color: #9c5f00;
    text-decoration-line: underline;
    text-decoration-style: wavy;
    text-decoration-color: #f4b400;
}

.mark-object {
    color: #175cd3;
    text-decoration-line: underline;
    text-decoration-style: solid;
    text-decoration-color: #175cd3;
}

.mark-predicative {
    color: #7f56d9;
    text-decoration-line: underline;
    text-decoration-style: dashed;
    text-decoration-color: #7f56d9;
}

.mark-attributive {
    color: #0f766e;
}

.mark-attributive::before {
    content: "(";
    color: #0f766e;
    font-weight: 850;
}

.mark-attributive::after {
    content: ")";
    color: #0f766e;
    font-weight: 850;
}

.mark-adverbial {
    color: #854d0e;
}

.mark-adverbial::before {
    content: "[";
    color: #854d0e;
    font-weight: 850;
}

.mark-adverbial::after {
    content: "]";
    color: #854d0e;
    font-weight: 850;
}

.mark-complement {
    color: #c11574;
}

.mark-complement::before {
    content: "\3008";
    color: #c11574;
    font-weight: 850;
}

.mark-complement::after {
    content: "\3009";
    color: #c11574;
    font-weight: 850;
}

.legend-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    padding: 0 5px;
    border-radius: 5px;
    background: #ffffff;
    font-style: normal;
    font-size: 12px;
    line-height: 1;
}

.result-tabs {
    gap: 6px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

.result-tabs .nav-link {
    min-height: 32px;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: #ffffff;
    color: #475467;
    font-size: 13px;
    font-weight: 750;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.result-tabs .nav-link:hover,
.result-tabs .nav-link:focus-visible {
    background: #f5f8ff;
    border-color: #c8d6f2;
    color: var(--primary-strong);
    box-shadow: 0 4px 10px rgba(36, 84, 214, 0.10);
}

.result-tabs .nav-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 5px 12px rgba(36, 84, 214, 0.16);
}

.article-vocab-drawer-btn {
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.article-result-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0 10px;
}

.article-result-section-head h3 {
    margin: 0;
    color: #182230;
    font-size: 15px;
    font-weight: 840;
}

.result-tab-content {
    padding-top: 16px;
}

.explanation-container {
    min-height: 240px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
    color: #1f2937;
    line-height: 1.65;
    white-space: pre-line;
}

.analysis-table {
    margin-bottom: 0;
    border-color: var(--line);
}

.analysis-table th {
    color: #344054;
    background: #f8fafc;
    font-size: 12px;
    text-transform: uppercase;
}

.analysis-table td {
    vertical-align: top;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--soft-green);
    color: #096b5a;
    font-size: 12px;
    font-weight: 750;
}

.vocabulary-stats {
    margin-bottom: 14px;
}

.vocabulary-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.vocabulary-stat-grid div {
    min-height: 70px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.vocabulary-stat-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
}

.vocabulary-stat-grid strong {
    display: block;
    margin-top: 6px;
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
}

.vocab-level {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3538cd;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.vocab-level.cet4 {
    background: #ecfdf3;
    color: #027a48;
}

.vocab-level.cet6 {
    background: #fff7ed;
    color: #c2410c;
}

.vocab-level.both {
    background: #eff8ff;
    color: #175cd3;
}

.vocab-level.kaoyan {
    background: #f5f3ff;
    color: #6d28d9;
}

.vocab-level.out_of_list {
    background: #fef3f2;
    color: #b42318;
}

.article-box {
    min-height: clamp(500px, 62vh, 780px);
    resize: vertical;
    border-color: #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.65;
}

.article-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
    margin-bottom: 4px;
}

.article-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.article-metric-grid div {
    min-height: 76px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.article-metric-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
}

.article-metric-grid strong {
    display: block;
    margin-top: 6px;
    color: var(--ink);
    font-size: 23px;
    line-height: 1;
}

.article-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.article-result-panel {
    min-height: 240px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.article-result-panel h3 {
    margin: 0 0 12px;
    color: #182230;
    font-size: 16px;
    font-weight: 780;
}

.distribution-list {
    display: grid;
    gap: 10px;
}

.distribution-item {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) 120px 42px;
    gap: 10px;
    align-items: center;
}

.distribution-item strong,
.distribution-item span {
    display: block;
}

.distribution-item strong {
    color: #182230;
    font-size: 13px;
}

.distribution-item span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.distribution-bar {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e4e7ec;
}

.distribution-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.reading-signal p {
    margin: 0 0 10px;
    color: #475467;
    line-height: 1.65;
}

.reading-signal p:last-child {
    margin-bottom: 0;
}

.article-stats-summary-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 0;
    height: 26px;
    margin: 0 0 4px;
    padding: 0 !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
}

.article-stats-label {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    line-height: 1;
    text-transform: uppercase;
}

.article-summary-grid {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.article-summary-grid::-webkit-scrollbar {
    display: none;
}

.article-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    min-height: 22px;
}

.article-stat-item span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
    line-height: 1;
    white-space: nowrap;
}

.article-stat-item strong {
    color: #182230;
    font-size: 12px;
    line-height: 1;
    font-weight: 850;
}

@media (max-width: 576px) {
    .article-stats-summary-panel {
        height: 26px;
    }
}

.reading-signal-tip {
    display: flex;
    align-items: center;
    min-height: 26px;
    margin: 0 0 10px;
    padding: 5px 8px;
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    background: #f0fdfa;
    overflow-wrap: anywhere;
}

.reading-signal-tip p {
    margin: 0;
    color: #184e4f;
    font-size: 12px;
    line-height: 1.35;
}

.article-hidden-metrics {
    display: none;
}

.article-panel-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    margin-bottom: 10px;
}

.article-panel-head h3 {
    margin-bottom: 0;
}

.article-panel-head span {
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
}

.word-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.word-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #dbe4f0;
    border-radius: 999px;
    background: #ffffff;
}

.word-chip strong {
    color: #182230;
    font-size: 13px;
}

.word-chip em {
    color: var(--primary);
    font-size: 12px;
    font-style: normal;
    font-weight: 750;
}

.word-chip small {
    color: var(--muted);
    font-size: 12px;
}

.article-vocabulary-drawer {
    --bs-offcanvas-width: min(420px, 92vw);
}

.article-vocabulary-drawer .offcanvas-header {
    border-bottom: 1px solid var(--line);
}

.article-vocabulary-drawer .offcanvas-body {
    display: grid;
    align-content: start;
    gap: 14px;
    background: #f8fafc;
}

.article-drawer-section {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.article-drawer-section h3 {
    margin: 0 0 10px;
    color: #182230;
    font-size: 14px;
    font-weight: 820;
}

.sentence-detail-list {
    display: grid;
    gap: 10px;
}

.article-sentences-pane .sentence-detail-list {
    max-height: clamp(360px, 58vh, 620px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 6px;
}

.article-sentences-pane .sentence-detail-list::-webkit-scrollbar {
    width: 8px;
}

.article-sentences-pane .sentence-detail-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #cbd5e1;
}

.article-sentences-pane .sentence-detail-list::-webkit-scrollbar-track {
    background: transparent;
}

.sentence-detail-item {
    position: relative;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.sentence-detail-recommended {
    border-color: #93c5fd;
    background: #f8fbff;
    box-shadow: inset 3px 0 0 #3b82f6;
}

.close-reading-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8 !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-transform: none !important;
}

.sentence-detail-head,
.sentence-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}

.sentence-detail-head span,
.sentence-detail-meta span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
}

.sentence-detail-head strong {
    color: var(--primary);
    font-size: 13px;
}

.sentence-detail-item p {
    margin: 10px 0;
    color: #182230;
    line-height: 1.65;
}

.syntax-tree-container {
    width: 100%;
    height: 430px;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.syntax-tree-container svg {
    display: block;
    max-width: none;
}

.syntax-tree-scrollable {
    cursor: grab;
}

.legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    color: #475467;
    font-size: 13px;
    font-weight: 650;
}

.legend-circle {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    margin-right: 5px;
}

.legend-circle.sentence { background-color: #4c6fff; }
.legend-circle.np { background-color: #16a085; }
.legend-circle.vp { background-color: #f97316; }
.legend-circle.noun { background-color: #dc2626; }
.legend-circle.verb { background-color: #0284c7; }
.legend-circle.adj { background-color: #7c3aed; }
.legend-circle.prep { background-color: #65a30d; }

.node circle {
    fill: #fff;
    stroke-width: 1.5px;
}

.node text {
    font: 12px sans-serif;
    paint-order: stroke;
    stroke: #ffffff;
    stroke-width: 3px;
    stroke-linejoin: round;
    fill: #1f2937;
}

.link {
    fill: none;
    stroke: #cbd5e1;
    stroke-width: 1.5px;
}

.footer {
    padding: 18px 0;
    color: #667085;
    background: #ffffff;
    border-top: 1px solid var(--line);
    font-size: 13px;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 18px;
}

.beian-links {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
}

.beian-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #749ae3;
    text-decoration: none;
}

.beian-link:hover,
.beian-link:focus {
    color: var(--primary);
    text-decoration: underline;
}

.about-hero {
    padding: 30px 0 18px;
}

.about-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 28px;
    align-items: stretch;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.about-hero-copy {
    display: flex;
    min-height: 236px;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
}

.about-hero h1 {
    max-width: 820px;
    margin: 0;
    color: var(--ink);
    font-size: 28px;
    line-height: 1.1;
    font-weight: 780;
}

@media (min-width: 768px) {
    .workspace-header h1,
    .about-hero h1 {
        white-space: nowrap;
    }
}

.about-lead {
    max-width: 860px;
    margin: 16px 0 0;
    color: #475467;
    font-size: 17px;
    line-height: 1.7;
}

.about-lead-secondary {
    margin-top: 10px;
    font-size: 15px;
    line-height: 1.65;
}

.about-purpose-points {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.about-purpose-points span {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid #c9d7ef;
    border-radius: 999px;
    background: #f7faff;
    color: #2454d6;
    font-size: 12px;
    font-weight: 750;
}

.about-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-self: stretch;
}

.about-metrics div {
    min-height: 72px;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.about-metrics strong {
    display: block;
    color: var(--primary);
    font-size: 25px;
    line-height: 1;
}

.about-metrics span {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
}

.about-content-band {
    padding: 8px 0 38px;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.about-panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(24, 39, 75, 0.07);
}

.about-panel-main,
.about-panel-wide {
    grid-column: 1 / -1;
}

.about-panel h2 {
    margin: 0 0 12px;
    color: #182230;
    font-size: 21px;
    line-height: 1.25;
    font-weight: 780;
}

.about-panel p {
    margin: 0 0 12px;
    color: #475467;
    line-height: 1.75;
}

.about-panel p:last-child {
    margin-bottom: 0;
}

.feature-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.feature-list li {
    position: relative;
    padding-left: 18px;
    color: #475467;
    line-height: 1.6;
}

.feature-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
}

.roadmap-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.roadmap-grid div {
    min-height: 132px;
    padding: 14px;
    border: 1px solid #dbe4f0;
    border-radius: 8px;
    background: #fbfdff;
}

.roadmap-grid strong {
    display: block;
    margin-bottom: 8px;
    color: #182230;
    font-size: 15px;
}

.roadmap-grid span {
    display: block;
    color: #667085;
    font-size: 13px;
    line-height: 1.6;
}

@media (max-width: 991px) {
    .workspace-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .status-strip {
        justify-content: flex-start;
    }

    .about-hero-inner,
    .about-grid,
    .roadmap-grid,
    .article-section-grid {
        grid-template-columns: 1fr;
    }

    .article-metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sentence-core-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .app-container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .workspace-band {
        padding-top: 18px;
    }

    .workspace-header h1,
    .about-hero h1 {
        font-size: 24px;
    }

    .about-hero-inner {
        padding: 20px;
    }

    .about-hero-copy {
        min-height: 0;
        justify-content: flex-start;
    }

    .about-lead {
        font-size: 15px;
    }

    .tool-panel {
        padding: 16px;
    }

    .sample-header,
    .panel-heading,
    .action-row {
        align-items: stretch;
        flex-direction: column;
    }

    .result-topline {
        align-items: center;
        flex-direction: row;
    }

    .sample-header .form-select {
        max-width: none;
    }

    .sample-chips {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .summary-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
    }

    .summary-item {
        min-height: 42px;
        padding: 6px 5px;
    }

    .summary-item span {
        font-size: 8.5px;
    }

    .summary-item strong {
        font-size: 12px;
    }

    .article-meta-grid,
    .article-metric-grid {
        grid-template-columns: 1fr;
    }

    .vocabulary-stat-grid {
        grid-template-columns: 1fr;
    }

    .learning-guide-head {
        flex-direction: column;
    }

    .sentence-core-grid {
        grid-template-columns: 1fr;
    }

    .advanced-toggle {
        align-items: flex-start;
        flex-direction: column;
    }

    .action-row .btn,
    .modal-footer .btn {
        width: 100%;
    }
}

/* Consolidated page styles */

/* Page styles moved from admin.html */
.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}
.admin-compact-panel {
    padding: 16px 18px;
}
.admin-import-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}
.import-zone {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    min-height: 76px;
    text-align: left;
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.88));
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.import-zone:hover {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 5%, transparent);
    transform: translateY(-1px);
}
.import-zone input[type=file] {
    display: none;
}
.import-zone label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    width: 100%;
    height: 100%;
    margin: 0;
}
.import-icon {
    display: inline-grid;
    grid-template-columns: repeat(3, 5px);
    align-items: end;
    gap: 3px;
    width: 34px;
    height: 34px;
    padding: 7px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--primary) 12%, white);
    color: var(--primary);
    flex: 0 0 auto;
}
.import-icon i {
    display: block;
    width: 5px;
    border-radius: 3px 3px 1px 1px;
    background: currentColor;
}
.import-icon i:nth-child(1) { height: 10px; opacity: .65; }
.import-icon i:nth-child(2) { height: 16px; opacity: .95; }
.import-icon i:nth-child(3) { height: 12px; opacity: .78; }
.import-label {
    display: block;
    font-weight: 800;
    margin-bottom: 2px;
}
.import-hint {
    display: block;
    font-size: 12px;
    color: var(--muted);
}
.admin-logout-item {
    display: flex;
    align-items: center;
    margin-left: 8px;
    padding-left: 10px;
    border-left: 1px solid rgba(180, 95, 6, 0.16);
}
.admin-logout-form {
    display: flex;
    align-items: center;
    margin: 0;
}
.admin-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 25px;
    padding: 3px 9px;
    border: 1px solid #f4b5b0;
    border-radius: 999px;
    background: #fff8f7;
    color: #b42318;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 2px 7px rgba(180, 35, 24, 0.07);
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.admin-logout-btn:hover {
    background: #fee4e2;
    border-color: #f97066;
    color: #912018;
    box-shadow: 0 5px 12px rgba(180, 35, 24, 0.13);
    transform: translateY(-1px);
}
.admin-logout-btn:focus-visible {
    outline: 3px solid rgba(249, 112, 102, 0.28);
    outline-offset: 2px;
}
.admin-logout-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(180, 35, 24, 0.10);
}
.admin-logout-icon {
    position: relative;
    width: 11px;
    height: 11px;
    flex: 0 0 auto;
}
.admin-logout-icon::before {
    content: "";
    position: absolute;
    inset: 2px 1px 1px;
    border: 1.7px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
}
.admin-logout-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    width: 1.8px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
    transform: translateX(-50%);
}
.admin-import-format {
    font-size: 12px;
    color: var(--muted);
}
.admin-import-format summary {
    cursor: pointer;
    color: var(--muted);
    font-weight: 700;
}
.admin-maintenance-actions {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
}
.admin-maintenance-actions .admin-small-text {
    min-width: 0;
}
.admin-maintenance-actions .btn {
    flex: 0 0 auto;
}
.admin-section-title-sm {
    font-size: 18px;
    margin-bottom: 4px;
}
.admin-section-title {
    font-size: 20px;
    margin-bottom: 6px;
}
.admin-small-text {
    font-size: 13px;
}
.admin-import-errors {
    font-size: 12px;
}
.admin-pending-note {
    font-size: 13px;
}
.admin-panel-spacious {
    padding: 24px;
}
.admin-format-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 13px;
}
#importResult {
    font-size: 13px;
}
.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}
.admin-toolbar .form-select,
.admin-toolbar .form-control {
    width: 150px;
}
.admin-toolbar .status-select {
    width: 170px;
}
.admin-batch-status {
    display: none;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    font-size: 13px;
}
.admin-batch-status-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--muted);
}
.admin-batch-errors {
    margin: 8px 0 0;
    padding-left: 18px;
    color: #b42318;
    font-size: 12px;
}
.admin-batch-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.admin-feedback {
    display: none;
    margin-bottom: 14px;
    font-size: 13px;
}
.admin-article-list {
    display: grid;
    gap: 12px;
}
.admin-article-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: var(--panel);
}
.admin-article-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px;
}
.admin-article-title {
    font-weight: 800;
}
.admin-article-meta {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 10px;
}
.admin-article-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    position: relative;
}
.admin-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.admin-stat-row span {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    color: var(--muted);
}
.admin-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}
.admin-article-content {
    height: 100%;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    resize: none;
}
#adminArticleModal .modal-dialog {
    max-width: min(1120px, calc(100vw - 32px));
}
#adminArticleModal .modal-content {
    height: 60vh;
}
#adminArticleModal .modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#adminArticleModal .modal-body textarea {
    flex: 1 1 auto;
}
.admin-confirm-popover {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    font-size: 12px;
    white-space: nowrap;
}
.admin-confirm-popover::before {
    content: "";
    position: absolute;
    right: 44px;
    bottom: -6px;
    width: 10px;
    height: 10px;
    background: var(--panel);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transform: rotate(45deg);
}
@media (max-width: 576px) {
    #adminArticleModal .modal-content {
        height: 72vh;
        min-height: 0;
    }
    .admin-confirm-popover {
        white-space: normal;
    }
}
@media (max-width: 992px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
    .admin-logout-item {
        justify-content: flex-start;
        margin: 8px 0 0;
        padding: 8px 0 0;
        border-left: 0;
        border-top: 1px solid rgba(180, 95, 6, 0.16);
    }
    .admin-article-head {
        flex-direction: column;
    }
    .admin-article-actions {
        justify-content: flex-start;
    }
}

/* Page styles moved from articles.html */
/* ── Corpus list styles ── */
.corpus-article-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    transition: box-shadow 0.15s;
}
.corpus-article-card:hover { box-shadow: 0 4px 12px rgba(24,39,75,0.08); }
.corpus-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 6px;
}
.corpus-card-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
}
.corpus-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.corpus-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: var(--soft-blue);
    color: var(--primary);
}
.corpus-meta {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
}
.corpus-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.corpus-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    min-width: 56px;
}
.corpus-stat strong { font-size: 16px; font-weight: 800; }
.corpus-stat span   { color: var(--muted); font-weight: 600; }
/* AI topic badge */
.topic-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
    vertical-align: middle;
}
/* Long sentence explanation */
.sent-explain-box {
    background: #f8fafc;
    border-left: 3px solid var(--primary);
    border-radius: 0 6px 6px 0;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--ink);
    margin-top: 4px;
    line-height: 1.7;
}
.article-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
    margin-bottom: 4px;
}
.article-title-field {
    grid-column: 1 / -1;
}
.article-meta-grid .form-label,
label[for="articleText"] {
    margin-top: 0;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}
.article-meta-grid .form-control,
.article-meta-grid .form-select {
    min-height: 34px;
    padding-top: 5px;
    padding-bottom: 5px;
    font-size: 13px;
}
.article-box {
    min-height: clamp(500px, 62vh, 780px);
}
#pageTabs + .tab-content {
    min-height: calc(100vh - 220px);
}
#tabAnalyze,
#tabAnalyze > .row {
    min-height: inherit;
}
#tabAnalyze .input-panel {
    display: flex;
    flex-direction: column;
}
#articleText {
    flex: 1 1 auto;
}
.article-options .switch-line span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}
.sent-explain-toggle:hover small { text-decoration: underline; }
.page-tabs-nav {
    display: inline-flex;
    align-items: flex-end;
    gap: 24px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    margin-bottom: 14px;
}
.page-tabs-nav .nav-link {
    position: relative;
    min-height: 32px;
    border: 0;
    border-radius: 0;
    padding: 0 0 9px;
    background: transparent;
    font-size: 14px;
    font-weight: 800;
    color: var(--muted);
    transition: color 0.16s ease;
}
.page-tabs-nav .nav-link:hover {
    color: var(--primary-strong);
}
.page-tabs-nav .nav-link.active {
    color: var(--primary);
    background: transparent;
    box-shadow: none;
}
.page-tabs-nav .nav-link.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    border-radius: 999px;
    background: var(--primary);
}
.corpus-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}
#corpusListArea { min-height: 200px; }
.snapshot-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    background: #dcfce7;
    color: #15803d;
}
.no-snapshot-badge {
    background: #f1f5f9;
    color: #64748b;
}
.student-article-content {
    min-height: 54vh;
    max-height: 68vh;
    overflow: auto;
    white-space: pre-wrap;
    line-height: 1.75;
    font-size: 15px;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

/* Page styles moved from stats.html */
/* ── Stats page extras ── */
.stats-kpi-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.kpi-chip {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 156px;
    min-height: 58px;
    padding: 10px 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}
.kpi-chip .kpi-value {
    font-size: 21px;
    font-weight: 800;
    line-height: 1;
    order: 2;
}
.kpi-chip .kpi-label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 750;
    text-transform: uppercase;
    margin-top: 0;
    text-align: center;
}
.chart-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
}
.chart-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: .05em;
    margin-bottom: 6px;
}
.scope-note {
    margin: 0 0 14px;
    color: #667085;
    font-size: 12px;
    line-height: 1.45;
}
.scope-note strong {
    color: #344054;
    font-weight: 800;
}
.stats-scope-summary {
    margin: -4px 0 18px;
    color: #475467;
    font-size: 13px;
    line-height: 1.55;
}
svg text { font-family: inherit; }
.axis line, .axis path { stroke: var(--line); }
.axis text { fill: var(--muted); font-size: 11px; }
.grid line { stroke: var(--line); stroke-dasharray: 3,3; }
.chart-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
}
.chart-scroll svg {
    display: block;
}
.x-year-label text {
    text-anchor: end;
}
.bar-cet4  { fill: #3b82f6; }
.bar-cet6  { fill: #22c55e; }
.bar-other { fill: #94a3b8; }
.line-difficulty { fill: none; stroke: #f59e0b; stroke-width: 2.5; }
.line-cet4  { fill: none; stroke: #3b82f6; stroke-width: 2; }
.line-cet6  { fill: none; stroke: #22c55e; stroke-width: 2; }
.dot { cursor: pointer; }
.tooltip-box {
    position: absolute;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    z-index: 100;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, .9fr);
    gap: 20px;
    align-items: start;
}
.insight-panel {
    background: linear-gradient(135deg, #ffffff 0%, #f6fbff 100%);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 20px;
}
.insight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.signal-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    min-height: 112px;
}
.signal-card strong {
    display: block;
    font-size: 22px;
    line-height: 1;
    margin: 8px 0;
}
.signal-card span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}
.signal-card p {
    margin: 0;
    color: #475467;
    font-size: 12px;
    line-height: 1.45;
}
.signal-good { border-color: #abefc6; background: #f6fef9; }
.signal-warn { border-color: #fedf89; background: #fffcf5; }
.signal-risk { border-color: #fecdca; background: #fffbfa; }
.recent-list {
    display: grid;
    gap: 10px;
}
.recent-item {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.recent-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    font-weight: 750;
}
.recent-meta,
.recent-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}
.recent-metrics span {
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f2f4f7;
    color: #344054;
    font-weight: 700;
}
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12px; }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot  { width: 10px; height: 10px; border-radius: 50%; }
.loading-placeholder {
    display: flex; align-items: center; justify-content: center;
    height: 170px; color: var(--muted); font-size: 14px;
    text-align: center;
}
#noDataNote,
#noAnalysisNote { display: none; }
@media (max-width: 991px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .insight-grid { grid-template-columns: 1fr; }
}

/* Page styles moved from vocabulary.html */
/* ── Vocab page extras ── */
.vocab-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.vocab-stat-chip {
    display: grid;
    align-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 64px;
    padding: 10px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}
.vocab-stat-chip .chip-count {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.1;
    min-width: 0;
    overflow-wrap: anywhere;
}
.vocab-stat-chip .chip-label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 750;
    text-transform: uppercase;
    margin-top: 0;
    min-width: 0;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.level-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}
.level-CET4  { background: #dbeafe; color: #1d4ed8; }
.level-CET6  { background: #dcfce7; color: #15803d; }
.level-BOTH  { background: #fef3c7; color: #b45309; }
.level-KAOYAN { background: #f3e8ff; color: #7e22ce; }
.level-OTHER { background: #f1f5f9; color: #64748b; }

.difficulty-bar {
    display: inline-block;
    width: 48px;
    height: 6px;
    border-radius: 3px;
    background: var(--line);
    position: relative;
    vertical-align: middle;
}
.difficulty-bar i {
    position: absolute; left: 0; top: 0; height: 100%;
    border-radius: 3px;
    background: var(--primary);
}
.vocab-table td, .vocab-table th {
    vertical-align: middle;
    font-size: 14px;
    padding: .42rem .5rem;
}
.vocab-table thead th {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    border-top: none;
}
.vocab-meaning-cell {
    min-width: 240px;
    max-width: 420px;
}
.vocab-meaning-short {
    display: inline;
    color: var(--ink);
    line-height: 1.45;
}
.vocab-meaning-action {
    margin-left: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}
.vocab-meaning-action:hover,
.vocab-meaning-action:focus {
    color: var(--primary-strong);
    text-decoration: underline;
}
.vocab-detail-drawer .offcanvas-header {
    border-bottom: 1px solid var(--line);
}
.vocab-detail-drawer .offcanvas-body {
    display: grid;
    align-content: start;
    gap: 16px;
}
.vocab-detail-word {
    display: grid;
    gap: 6px;
}
.vocab-detail-word h2 {
    margin: 0;
    font-size: 26px;
}
.vocab-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.vocab-detail-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 9px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}
.vocab-detail-section h3 {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--muted);
    font-weight: 850;
    text-transform: uppercase;
}
.vocab-detail-meaning {
    margin: 0;
    line-height: 1.7;
    white-space: pre-wrap;
}
.pagination-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}
