:root {
  color-scheme: light;
  --ink: #14211d;
  --muted: #61716a;
  --paper: #f7f5ef;
  --card: #ffffff;
  --line: #d9ded9;
  --green: #173f35;
  --green-light: #dcece4;
  --orange: #d96b32;
  --shadow: 0 12px 32px rgba(23, 63, 53, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(145deg, #eef2eb 0%, var(--paper) 52%);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}
.site-header, main { width: min(960px, calc(100% - 32px)); margin-inline: auto; }
.site-header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 18px 24px;
  padding: 36px 0 24px;
}
.site-header > div { flex: 1 1 620px; }
.site-header .header-actions { flex: 1 1 420px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.7rem, 5vw, 2.7rem); line-height: 1.05; }
h2 { font-size: clamp(1.35rem, 4vw, 2rem); line-height: 1.2; }
.eyebrow { color: var(--orange); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 8px; }
.panel, .card {
  background: color-mix(in srgb, var(--card) 96%, transparent);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.panel { padding: clamp(22px, 5vw, 40px); margin-bottom: 28px; }
.card { padding: 20px; }
.lead { color: var(--muted); max-width: 62ch; }
.input-row { display: flex; gap: 10px; }
input, textarea, select {
  width: 100%; min-width: 0; padding: 14px 16px; border: 1px solid #aab7b0;
  border-radius: 12px; font: inherit; background: white;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 3px solid var(--green-light); border-color: var(--green); }
.choices, .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button {
  border: 0; border-radius: 999px; padding: 12px 18px; font: inherit; font-weight: 750;
  cursor: pointer; background: var(--green); color: white;
}
.button:hover { filter: brightness(1.08); }
.button:disabled { cursor: wait; opacity: .58; }
.button-secondary { background: var(--green-light); color: var(--green); }
.button-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--green); color: var(--green); }
.button-quiet { background: transparent; color: var(--green); padding-inline: 8px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 22px 0; }
.plan-grid .card { box-shadow: none; }
.structure-activities { display: grid; gap: 2px; margin-top: 8px; font-size: .86rem; line-height: 1.25; }
.structure-activities span { overflow-wrap: anywhere; }
.minutes { color: var(--muted); font-weight: 650; }
.current { border: 2px solid var(--green); }
.activity-list { padding-left: 20px; margin: 14px 0 22px; }
.activity-list li + li { margin-top: 7px; }
.notice { background: #fff2e8; border-left: 4px solid var(--orange); padding: 12px 14px; border-radius: 8px; }
.import-processing { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.import-processing[hidden] { display: none; }
.import-processing > span:last-child { flex-basis: 100%; color: var(--muted); font-size: .9rem; }
.analysis-dots { display: inline-flex; align-items: center; gap: 5px; min-width: 43px; }
.analysis-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--orange); animation: import-dot-pulse 1.2s ease-in-out infinite; }
.analysis-dots i:nth-child(2) { animation-delay: .16s; }
.analysis-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes import-dot-pulse {
  0%, 60%, 100% { opacity: .32; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  .analysis-dots i { animation: none; opacity: 1; transform: none; }
}
.complete-block { padding: 18px 0; border-top: 1px solid var(--line); }
.complete-block:first-of-type { border-top: 0; }
.complete-block h3 { margin-bottom: 6px; }
.history-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.history-heading h2 { margin-bottom: 0; }
.history-view-toggle { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--green-light); }
.history-view-toggle .button { min-height: 40px; padding: 8px 16px; }
.history-nav { display: grid; grid-template-columns: auto minmax(220px, 1fr) auto; align-items: end; gap: 12px; margin: 22px 0; }
.jump-form { min-width: 0; }
.jump-form label { display: block; margin-bottom: 5px; color: var(--muted); font-size: .85rem; font-weight: 700; }
.jump-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; min-width: 0; }
.jump-controls input { width: 100%; min-width: 0; max-width: 100%; }
.history-list { display: grid; gap: 10px; }
.history-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; color: var(--ink); }
.history-entry:hover { border-color: var(--green); }
.history-open { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-width: 0; border: 0; padding: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.history-entry-copy { display: grid; min-width: 0; }
.history-entry-copy span, .history-duration, .empty { color: var(--muted); }
.history-entry-copy span { overflow-wrap: anywhere; }
.history-duration { white-space: nowrap; }
.history-edit { white-space: nowrap; }
.history-save { margin: 22px 0 6px; padding: 18px; background: var(--green-light); border-radius: 14px; }
.history-save h3 { margin-bottom: 4px; }
.metadata-form { display: grid; grid-template-columns: minmax(170px, .7fr) minmax(240px, 1.3fr); gap: 12px; margin: 18px 0 22px; }
.metadata-form label { color: var(--muted); font-size: .85rem; font-weight: 700; }
.metadata-form input { margin-top: 5px; color: var(--ink); font-size: 1rem; font-weight: 400; }
.metadata-form .actions { grid-column: 1 / -1; }
.history-save, .metadata-form, .metadata-form label { min-width: 0; max-width: 100%; }
.success { background: var(--green-light); border-color: var(--green); margin-top: 22px; }
.drill-details-cue { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 16px 0; }
.drill-details-cue .button { flex: 0 0 auto; text-decoration: none; }
.saved-summary { display: grid; gap: 14px; }
.saved-summary h2, .saved-summary p { margin-bottom: 0; }
.saved-practice-details { display: grid; gap: 3px; padding: 14px; border-radius: 12px; background: var(--green-light); }
.saved-practice-details span { color: var(--muted); }
.library-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0; }
.import-source-form { margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--green-light); }
.import-source-form input[type="file"] { min-height: 54px; padding: 10px; }
.paste-import { margin: 18px 0 26px; }
.paste-import summary { color: var(--green); font-weight: 800; cursor: pointer; padding: 10px 0; }
.paste-import .drill-form { padding-top: 12px; }
.field-help { margin: 0; color: var(--muted); font-size: .84rem; }
.dictation-hint { margin-bottom: 10px; }
.intake-helper-mobile { display: none; }
.import-batch-list, .import-candidate-list { display: grid; gap: 12px; }
.import-batch-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; width: 100%; color: var(--ink); text-align: left; cursor: pointer; }
.import-batch-entry span:first-child { display: grid; }
.import-batch-entry small, .import-batch-entry > span:last-child { color: var(--muted); }
.import-candidate { min-width: 0; box-shadow: none; }
.import-candidate.resolved { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.import-candidate.resolved h3 { margin: 8px 0 0; }
.import-review-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin: 18px 0 12px; text-align: center; }
.candidate-source { color: var(--muted); font-size: .82rem; margin-bottom: 8px; }
.candidate-evidence { padding: 10px 12px; border-radius: 10px; background: #f2f4ef; color: var(--muted); font-size: .88rem; }
.import-queue { margin-top: 16px; }
.import-queue summary { color: var(--green); font-weight: 800; cursor: pointer; padding: 10px 0; }
.import-queue > div { display: grid; gap: 6px; }
.import-queue-item { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.import-queue-item.active { border-color: var(--green); background: var(--green-light); }
.import-queue-item small { color: var(--muted); text-transform: capitalize; }
.duplicate-warning { margin-bottom: 16px; }
.duplicate-override { background: #fffaf5; }
.import-candidate textarea, .import-candidate input, .import-candidate select { max-width: 100%; }
.drill-list { display: grid; gap: 10px; }
.drill-entry { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; width: 100%; text-align: left; color: var(--ink); cursor: pointer; }
.drill-entry span { color: var(--muted); }
.status-pill { display: inline-block; width: fit-content; padding: 4px 9px; border-radius: 999px; background: var(--green-light); color: var(--green); font-size: .78rem; font-weight: 800; }
.status-pill.incomplete { background: #fff2e8; color: #8a421f; }
.drill-form { display: grid; gap: 14px; }
.drill-form[hidden] { display: none; }
.replacement-search[hidden] { display: none; }
.drill-form label { color: var(--muted); font-size: .85rem; font-weight: 700; }
.drill-form input, .drill-form textarea, .drill-form select { margin-top: 5px; color: var(--ink); font-size: 1rem; font-weight: 400; }
.tag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.check-option { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink) !important; font-size: .9rem !important; }
.check-option input { width: auto; margin: 0; }
.personnel-list { display: grid; gap: 8px; }
.personnel-row { display: grid; grid-template-columns: minmax(120px, 1fr) auto auto auto auto; align-items: center; gap: 8px; }
.personnel-row input { margin: 0; }
.personnel-row input[type="number"] { width: 72px; }
.personnel-row .button { padding: 8px 12px; min-height: 40px; }
.custom-library-offer { margin-top: 18px; padding: 16px; border: 1px solid var(--line); background: var(--paper); border-radius: 14px; scroll-margin-top: 16px; }
.custom-drill-list { display: grid; gap: 10px; }
.custom-drill-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.custom-drill-item > div { display: grid; }
.custom-drill-item > div span { color: var(--muted); font-size: .88rem; }
.custom-drill-item .drill-form { grid-column: 1 / -1; }
.replacement-search { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.replacement-search fieldset { margin: 14px 0; border: 0; padding: 0; }
.replacement-search legend { margin-bottom: 8px; font-weight: 800; }
.search-name-label { display: grid; gap: 5px; color: var(--muted); font-size: .85rem; font-weight: 700; }
.focus-family-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.search-results { display: grid; gap: 8px; margin-top: 12px; }
.search-result { display: grid; gap: 2px; width: 100%; text-align: left; color: var(--ink); cursor: pointer; box-shadow: none; }
.search-result span, .search-result small { color: var(--muted); }
.compact-filters { display: grid; gap: 10px; margin: 12px 0; }
.selected-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-chip { border: 1px solid var(--green); border-radius: 999px; padding: 6px 10px; background: var(--green-light); color: var(--green); font: inherit; font-size: .85rem; cursor: pointer; }
.empty-filter { color: var(--muted); font-size: .9rem; }
.filter-dialog { width: min(620px, calc(100% - 24px)); max-height: min(78vh, 720px); padding: 0; border: 0; border-radius: 18px; color: var(--ink); background: var(--card); box-shadow: 0 24px 70px rgba(20, 33, 29, .3); }
.filter-dialog::backdrop { background: rgba(20, 33, 29, .55); }
.filter-dialog-content { padding: 20px; overflow-y: auto; max-height: min(78vh, 720px); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 18px 0; }
.detail-grid div { padding: 12px; background: var(--paper); border-radius: 10px; }
.detail-grid strong { display: block; margin-bottom: 4px; }
.total { display: inline-block; background: var(--green-light); color: var(--green); padding: 7px 12px; border-radius: 999px; font-weight: 800; }
.toast { position: fixed; right: 18px; bottom: 18px; background: var(--ink); color: white; padding: 10px 14px; border-radius: 10px; opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
.error { color: #9e2f28; }
@media (max-width: 620px) {
  .intake-helper-desktop { display: none; }
  .intake-helper-mobile { display: inline; }
  .site-header { align-items: start; padding: 20px 0 14px; flex-direction: column; gap: 12px; }
  .site-header > div, .site-header .header-actions { flex: none; width: 100%; }
  .header-actions { justify-content: flex-start; }
  .input-row { flex-direction: column; }
  .history-nav { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .history-nav > .button { padding-inline: 12px; font-size: .92rem; }
  .jump-form { grid-column: 1 / -1; grid-row: 1; width: 100%; min-width: 0; }
  .jump-controls .button { min-width: 64px; padding-inline: 14px; }
  .metadata-form { grid-template-columns: 1fr; }
  .metadata-form label { min-width: 0; }
  .metadata-form input { display: block; width: 100%; min-width: 0; min-height: 52px; }
  .metadata-form input[type="date"] { inline-size: -webkit-fill-available; width: -webkit-fill-available; max-inline-size: 100%; }
  .history-entry { grid-template-columns: 1fr; }
  .history-open { align-items: flex-start; }
  .history-edit { justify-self: start; }
  .personnel-row { grid-template-columns: minmax(0, 1fr) auto minmax(64px, 74px) auto; }
  .personnel-row .optional-control { grid-column: 1 / -1; }
  .button { min-height: 46px; }
  .choices .button, .actions .button { flex: 1 1 145px; }
}

@media (max-width: 480px) {
  .drill-details-cue { align-items: stretch; flex-direction: column; }
  .drill-details-cue .button { width: 100%; text-align: center; }
  .history-heading { align-items: flex-start; flex-direction: column; }
  .history-view-toggle { width: 100%; }
  .history-view-toggle .button { flex: 1; }
  .jump-controls { grid-template-columns: minmax(0, 1fr); }
  .jump-controls .button { width: 100%; }
  .history-open { display: grid; gap: 4px; }
  .history-duration { white-space: normal; }
  .history-save { padding: 14px; }
  .history-save .actions .button { width: 100%; }
  .custom-drill-item { grid-template-columns: minmax(0, 1fr); }
  .custom-drill-item .button, .custom-drill-item .status-pill { justify-self: start; }
  .category-grid { grid-template-columns: minmax(0, 1fr); }
  .filter-dialog { width: calc(100% - 20px); max-height: 82dvh; margin-bottom: 8px; }
  .filter-dialog-content { max-height: 82dvh; padding: 16px; }
  .filter-dialog .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-dialog .check-option { padding: 8px; font-size: .82rem !important; }
  .import-panel { padding-inline: 16px; }
  .import-batch-entry { grid-template-columns: minmax(0, 1fr); }
  .import-candidate { padding: 16px; }
  .import-candidate.resolved { align-items: flex-start; flex-direction: column; }
  .import-candidate .actions .button { width: 100%; }
  .import-review-nav { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .import-review-nav strong { grid-column: 1 / -1; grid-row: 1; }
  .import-review-nav .button { grid-row: 2; }
  .import-queue-item { align-items: flex-start; flex-direction: column; gap: 2px; }
}

@media (min-width: 621px) {
  .completed-panel { padding-block: 26px; }
  .completed-panel > h2 { margin-bottom: 10px; }
  .completed-panel .history-save { margin: 14px 0 4px; padding: 14px 16px; }
  .completed-panel .metadata-form { margin: 10px 0 12px; }
  .completed-panel .complete-block { padding: 11px 0; }
  .completed-panel .activity-list { margin: 7px 0 9px; }
  .completed-panel .complete-actions { margin-top: 10px; }
}
