:root {
    --ch-bg: #f7f4ef;
    --ch-card: #fff;
    --ch-soft: #f0ede6;
    --ch-border: #e2ddd4;
    --ch-text: #1a1816;
    --ch-muted: #6d675f;
    --ch-accent: #2d5f4d;
    --ch-accent-soft: #e6eee9;
    --ch-reading: #087b5b;
    --ch-listening: #2d61b4;
    --ch-writing: #7a43ad;
    --ch-speaking: #b73f76;
}

html.dark-mode {
    --ch-bg: #1a1a1a;
    --ch-card: #232323;
    --ch-soft: #2d2d2d;
    --ch-border: #383838;
    --ch-text: #f2efeb;
    --ch-muted: #aaa49d;
    --ch-accent: #82ad91;
    --ch-accent-soft: #29382f;
}

.celpip-history-page { min-height: 100vh; background: var(--ch-bg); color: var(--ch-text); }
.celpip-history-page * { box-sizing: border-box; }
.ch-container { width: min(100% - 2rem, 92rem); margin: 0 auto; padding: 2.5rem 0 5rem; }
.ch-header { max-width: 46rem; margin-bottom: 2rem; }
.ch-kicker { margin: 0 0 0.4rem; color: var(--ch-accent); font: 700 0.74rem/1.2 Poppins, sans-serif; letter-spacing: 0.12em; text-transform: uppercase; }
.ch-header h1 { margin: 0; font: 400 clamp(2.7rem, 7vw, 4.8rem)/0.98 'Instrument Serif', Georgia, serif; }
.ch-header > p:last-child { margin: 1rem 0 0; color: var(--ch-muted); font: 400 1.02rem/1.6 Inter, sans-serif; }
.ch-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.85rem; margin-bottom: 2.75rem; }
.ch-summary-card { min-height: 112px; padding: 1.15rem; border: 1px solid var(--ch-border); border-radius: 14px; background: var(--ch-card); }
.ch-summary-card span { display: block; color: var(--ch-muted); font: 600 0.78rem/1.3 Poppins, sans-serif; }
.ch-summary-card strong { display: block; margin-top: 0.6rem; font: 700 2rem/1 Poppins, sans-serif; }
.ch-skeleton strong, .ch-row-skeleton { animation: ch-pulse 1.4s ease-in-out infinite; background: linear-gradient(90deg, var(--ch-soft), var(--ch-card), var(--ch-soft)); background-size: 200% 100%; color: transparent; }
.ch-resume, .ch-history { margin-top: 2.6rem; }
.ch-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.ch-section-heading h2 { margin: 0; font: 600 clamp(1.45rem, 3vw, 2rem)/1.15 Poppins, sans-serif; }
.ch-resume-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem; }
.ch-resume-card { display: flex; flex-direction: column; min-height: 170px; padding: 1.15rem; border: 1px solid var(--ch-border); border-radius: 14px; background: var(--ch-card); }
.ch-resume-card .ch-meta { margin-bottom: 0.65rem; }
.ch-resume-card h3 { margin: 0; font: 650 1rem/1.4 Poppins, sans-serif; }
.ch-resume-card p { margin: 0.5rem 0 1rem; color: var(--ch-muted); font: 400 0.86rem/1.45 Inter, sans-serif; }
.ch-resume-card a { margin-top: auto; }
.ch-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; padding: 1rem; border: 1px solid var(--ch-border); border-radius: 14px; background: var(--ch-card); }
.ch-filters label { color: var(--ch-muted); font: 650 0.72rem/1.2 Poppins, sans-serif; letter-spacing: 0.04em; }
.ch-filters select { width: 100%; min-height: 44px; margin-top: 0.4rem; padding: 0 2rem 0 0.75rem; border: 1px solid var(--ch-border); border-radius: 9px; background: var(--ch-bg); color: var(--ch-text); font: 500 0.86rem/1 Inter, sans-serif; }
.ch-filters select:focus-visible, .ch-primary-button:focus-visible, .ch-secondary-button:focus-visible, .ch-text-button:focus-visible, .ch-row-action:focus-visible { outline: 3px solid color-mix(in srgb, var(--ch-accent), transparent 55%); outline-offset: 2px; }
.ch-quality { margin: 1rem 0; padding: 0.8rem 1rem; border-left: 3px solid #b98522; border-radius: 6px; background: #fff5db; color: #6a4a12; font: 500 0.84rem/1.5 Inter, sans-serif; }
html.dark-mode .ch-quality { background: #3b321f; color: #f0d498; }
.ch-list { display: grid; gap: 0.75rem; margin-top: 1rem; }
.ch-history-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(130px, 0.6fr) minmax(130px, 0.65fr) auto; align-items: center; gap: 1rem; padding: 1.05rem; border: 1px solid var(--ch-border); border-radius: 14px; background: var(--ch-card); }
.ch-row-main { display: flex; align-items: flex-start; gap: 0.85rem; min-width: 0; }
.ch-section-icon { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; border-radius: 11px; color: var(--ch-accent); background: var(--ch-accent-soft); }
.ch-section-icon svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ch-section-icon.reading { color: var(--ch-reading); }.ch-section-icon.listening { color: var(--ch-listening); }.ch-section-icon.writing { color: var(--ch-writing); }.ch-section-icon.speaking { color: var(--ch-speaking); }
.ch-row-copy { min-width: 0; }
.ch-row-copy h3 { margin: 0.15rem 0 0.25rem; overflow: hidden; font: 650 0.98rem/1.35 Poppins, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.ch-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.65rem; color: var(--ch-muted); font: 500 0.72rem/1.35 Inter, sans-serif; }
.ch-pill { display: inline-flex; align-items: center; min-height: 22px; padding: 0.2rem 0.5rem; border-radius: 999px; background: var(--ch-soft); color: var(--ch-muted); font: 650 0.67rem/1 Poppins, sans-serif; }
.ch-row-result span, .ch-row-date span { display: block; color: var(--ch-muted); font: 550 0.7rem/1.3 Poppins, sans-serif; }
.ch-row-result strong, .ch-row-date strong { display: block; margin-top: 0.25rem; color: var(--ch-text); font: 650 0.88rem/1.35 Poppins, sans-serif; }
.ch-comparison { margin-top: 0.3rem; color: var(--ch-muted); font: 500 0.7rem/1.4 Inter, sans-serif; }
.ch-row-actions { display: flex; min-width: 0; max-width: 100%; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; }
.ch-primary-button, .ch-secondary-button, .ch-row-action { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0.65rem 0.9rem; border-radius: 9px; font: 650 0.8rem/1 Poppins, sans-serif; text-decoration: none; cursor: pointer; }
.ch-row-action { min-width: 0; white-space: nowrap; }
.ch-primary-button, .ch-row-action.primary { border: 1px solid var(--ch-accent); background: var(--ch-accent); color: #fff; }
.ch-secondary-button, .ch-row-action.secondary { border: 1px solid var(--ch-border); background: transparent; color: var(--ch-text); }
.ch-text-button { border: 0; background: none; color: var(--ch-accent); font: 650 0.82rem/1 Poppins, sans-serif; cursor: pointer; }
.ch-loading { display: grid; gap: 0.75rem; margin-top: 1rem; }
.ch-row-skeleton { height: 106px; border-radius: 14px; }
.ch-error, .ch-empty { margin-top: 1rem; padding: 3rem 1.5rem; border: 1px solid var(--ch-border); border-radius: 14px; background: var(--ch-card); text-align: center; }
.ch-error h3, .ch-empty h3 { margin: 0; font: 650 1.2rem/1.3 Poppins, sans-serif; }
.ch-error p, .ch-empty p { margin: 0.55rem auto 1.25rem; max-width: 35rem; color: var(--ch-muted); font: 400 0.9rem/1.55 Inter, sans-serif; }
.ch-empty svg { width: 48px; margin-bottom: 0.9rem; fill: none; stroke: var(--ch-accent); stroke-width: 1.5; }
.ch-load-more-wrap { display: flex; justify-content: center; margin-top: 1rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes ch-pulse { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .ch-skeleton strong, .ch-row-skeleton { animation: none; } }
@media (max-width: 1120px) { .ch-history-row { grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.65fr); }.ch-row-date { grid-column: 1; padding-left: 3.6rem; }.ch-row-actions { grid-column: 2; grid-row: 2; width: 100%; } }
@media (max-width: 900px) { .ch-summary { grid-template-columns: repeat(2, 1fr); }.ch-resume-grid { grid-template-columns: 1fr; }.ch-filters { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .ch-container { width: calc(100% - 1.25rem); padding-top: 2rem; }.ch-summary { gap: 0.55rem; }.ch-summary-card { min-height: 94px; padding: 0.9rem; }.ch-summary-card strong { font-size: 1.55rem; }.ch-filters { grid-template-columns: 1fr; }.ch-history-row { grid-template-columns: 1fr; gap: 0.75rem; }.ch-row-result, .ch-row-date, .ch-row-actions { grid-column: 1; grid-row: auto; padding-left: 3.6rem; }.ch-row-actions { justify-content: stretch; }.ch-row-action { flex: 1; }.ch-section-heading-list { align-items: center; }.ch-row-copy h3 { white-space: normal; } }
