*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.ei-page { margin: 0; background: var(--ei-bg); color: var(--ei-ink); font-family: var(--ei-font); font-size: 15px; line-height: 1.55; }
:where(.ei-page) a { color: var(--ei-blue); }
.ei-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ei-skip { position: absolute; left: -9999px; top: 8px; background: var(--ei-white); padding: 8px 12px; z-index: 100; }
.ei-skip:focus { left: 8px; }
.ei-page :focus-visible { outline: 3px solid var(--ei-focus); outline-offset: 2px; }
code { font-size: .9em; background: var(--ei-blue-tint); padding: 1px 5px; border-radius: 4px; }

.ei-header { background: var(--ei-white); border-bottom: 1px solid var(--ei-line); position: sticky; top: 0; z-index: 20; }
.ei-header-inner { max-width: 1240px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.ei-logo img { display: block; height: 24px; width: auto; }
.ei-menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border: 0; background: none; cursor: pointer; }
.ei-burger, .ei-burger::before, .ei-burger::after { display: block; width: 22px; height: 2px; background: var(--ei-ink); position: relative; content: ''; }
.ei-burger::before { position: absolute; top: -7px; }
.ei-burger::after { position: absolute; top: 7px; }
.ei-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--ei-white); border-bottom: 1px solid var(--ei-line); padding: 8px 16px 16px; flex-direction: column; gap: 2px; box-shadow: 0 8px 20px var(--ei-shadow); }
.ei-nav.is-open { display: flex; }
.ei-nav a { display: flex; align-items: center; min-height: 48px; padding: 0 12px; border-radius: 8px; color: var(--ei-ink); text-decoration: none; font-weight: 600; }
.ei-nav a[aria-current="page"] { background: var(--ei-blue-tint); color: var(--ei-blue); }
.ei-nav a:hover { color: var(--ei-blue); }
.ei-user { font-size: .85rem; color: var(--ei-muted); padding: 12px 12px 4px; }
.ei-logout { font: inherit; font-weight: 600; color: var(--ei-blue); background: none; border: 0; padding: 8px 12px; min-height: 44px; cursor: pointer; text-align: left; }

.ei-main { max-width: 950px; margin: 0 auto; padding: 20px 16px 48px; }
.ei-main-wide { max-width: 1240px; }
.ei-footer { text-align: center; color: var(--ei-muted); font-size: .8rem; padding: 24px 16px 40px; }
.ei-page h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 6px; }
.ei-page h2 { font-size: 1.15rem; margin: 0 0 12px; }
.ei-page h3 { font-size: 1rem; margin: 0 0 8px; }
.ei-muted { color: var(--ei-muted); }
.ei-small { font-size: .85rem; }
.ei-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 0 20px; }
.ei-page-head > div:first-child { min-width: 0; }
.ei-page-head p { margin: 0; }
.ei-page-head-narrow { display: block; max-width: 950px; margin: 0 auto 16px; }
.ei-crumbs { font-size: .85rem; }
.ei-page-head .ei-crumbs { margin: 0 0 6px; }
.ei-ref { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .8em; background: var(--ei-blue-tint); color: var(--ei-blue); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.ei-panel { background: var(--ei-white); border: 1px solid var(--ei-line); border-radius: 10px; padding: 18px 16px; margin: 0 0 16px; }
.ei-panel > :last-child { margin-bottom: 0; }
.ei-alert { background: var(--ei-white); border: 1px solid var(--ei-line); border-left: 4px solid var(--ei-blue); border-radius: 8px; padding: 12px 14px; margin: 0 0 16px; }
.ei-alert-warn { border-left-color: var(--ei-amber-line); background: var(--ei-warn-bg); }
.ei-alert-ok { border-left-color: var(--ei-ok); background: var(--ei-ok-bg); }
.ei-alert-error { border-left-color: var(--ei-error); background: var(--ei-error-bg); }

.ei-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; font: inherit; font-weight: 600; font-size: .92rem; line-height: 1.2; text-decoration: none; cursor: pointer; border-radius: 8px; border: 1.5px solid var(--ei-blue); background: var(--ei-white); color: var(--ei-blue); white-space: nowrap; }
.ei-btn:hover { background: var(--ei-blue-tint); }
.ei-btn-primary { background: var(--ei-blue); color: var(--ei-white); }
.ei-btn-primary:hover { background: var(--ei-blue-dark); border-color: var(--ei-blue-dark); }
.ei-btn-danger { border-color: var(--ei-error); color: var(--ei-error); }
.ei-btn-danger:hover { background: var(--ei-error-bg); }
.ei-btn-sm { min-height: 44px; padding: 6px 12px; font-size: .85rem; }
.ei-btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ei-btn-row form { margin: 0; }
.ei-form-actions { margin-top: 12px; }

.ei-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ei-field label { font-size: .8rem; font-weight: 600; color: var(--ei-muted); }
.ei-page input[type="text"], .ei-page input[type="search"], .ei-page input[type="password"], .ei-page input[type="date"], .ei-page select {
  width: 100%; min-height: 44px; font: inherit; font-size: 16px; color: var(--ei-ink); background: var(--ei-white);
  border: 1.5px solid var(--ei-line); border-radius: 8px; padding: 8px 10px; -webkit-appearance: none; appearance: none;
}
.ei-page select { background-image: linear-gradient(45deg, transparent 50%, var(--ei-muted) 50%), linear-gradient(135deg, var(--ei-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.ei-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.ei-filters .ei-field-wide { grid-column: 1 / -1; }
.ei-filters .ei-filter-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.ei-check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; min-height: 44px; }
.ei-check input { width: 20px; height: 20px; accent-color: var(--ei-blue); }

.ei-login { max-width: 420px; margin: 8vh auto 0; }
.ei-login form { display: grid; gap: 14px; }

.ei-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 16px; }
.ei-tile { background: var(--ei-white); border: 1px solid var(--ei-line); border-radius: 10px; padding: 14px; }
.ei-tile-num { font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: var(--ei-blue); }
.ei-tile-label { font-size: .8rem; font-weight: 600; color: var(--ei-muted); }

.ei-badge { display: inline-block; font-size: .75rem; font-weight: 700; border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.ei-badge-complete { background: var(--ei-ok-tint); color: var(--ei-ok); }
.ei-badge-in_progress { background: var(--ei-warn-tint); color: var(--ei-warn); }
.ei-badge-not_started { background: var(--ei-neutral-tint); color: var(--ei-muted); }
.ei-chip { display: inline-block; font-size: .75rem; font-weight: 600; background: var(--ei-blue-tint); color: var(--ei-blue); border-radius: 99px; padding: 2px 10px; margin: 2px 4px 2px 0; text-decoration: none; }
a.ei-chip:hover, .ei-chip[aria-current="true"] { background: var(--ei-blue); color: var(--ei-white); }
.ei-chip-count { opacity: .75; margin-left: 4px; }

.ei-table { width: 100%; border-collapse: collapse; background: var(--ei-white); }
.ei-table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ei-muted); font-weight: 700; }
.ei-table-wrap { background: var(--ei-white); border: 1px solid var(--ei-line); border-radius: 10px; overflow: hidden; }
@media (max-width: 799px) {
  .ei-table-cards thead { display: none; }
  .ei-table-cards tr { display: block; padding: 14px 16px; border-bottom: 1px solid var(--ei-line); }
  .ei-table-cards td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: .9rem; }
  .ei-table-cards td::before { content: attr(data-label); font-weight: 600; color: var(--ei-muted); font-size: .8rem; }
  .ei-table-cards td.ei-td-main { display: block; font-weight: 700; margin-bottom: 4px; }
  .ei-table-cards td.ei-td-main::before { content: none; }
  .ei-table-cards td.ei-td-actions { padding-top: 10px; }
  .ei-table-cards td.ei-td-actions::before { content: none; }
}
.ei-empty { text-align: center; padding: 40px 16px; color: var(--ei-muted); }

.ei-kv { margin: 0; }
.ei-kv div { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--ei-line-soft); }
.ei-kv div:last-child { border-bottom: 0; }
.ei-kv dt { font-size: .82rem; font-weight: 600; color: var(--ei-muted); }
.ei-kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.ei-kv dd.ei-none { color: var(--ei-faint); font-style: italic; }
.ei-section-block { border-top: 1px solid var(--ei-line); padding-top: 14px; margin-top: 14px; }
.ei-section-block h3 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ei-section-state { font-size: .75rem; font-weight: 600; color: var(--ei-muted); }
.ei-note-box { background: var(--ei-warn-bg); border-left: 3px solid var(--ei-amber-line); border-radius: 6px; padding: 10px 12px; margin-top: 8px; white-space: pre-wrap; font-size: .92rem; }

.ei-view { display: grid; gap: 16px; align-items: start; }
.ei-q-label { font-size: .85rem; font-weight: 600; color: var(--ei-muted); margin: 12px 0 2px; }
.ei-section-block .ei-q-label:first-child { margin-top: 0; }
.ei-q-answer { margin: 0 0 6px; font-weight: 600; }
.ei-q-answer.ei-none { color: var(--ei-faint); font-style: italic; font-weight: 400; }
.ei-code-sm { display: inline-block; background: var(--ei-blue); color: var(--ei-white); font-size: .72rem; font-weight: 700; border-radius: 4px; padding: 1px 6px; margin-right: 4px; }
.ei-panel-private { border-color: var(--ei-gold-line); background: var(--ei-cream); }
.ei-page .ei-obs-title { margin-top: 16px; }

.ei-chart { margin: 0; }
.ei-chart-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 10px; }
.ei-chart-head h3 { margin: 0; }
.ei-chart-n { font-size: .8rem; color: var(--ei-muted); white-space: nowrap; }
.ei-bars { display: grid; gap: 8px; }
.ei-bar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr; gap: 10px; align-items: center; font-size: .88rem; }
.ei-bar-label { overflow-wrap: anywhere; }
.ei-bar-track { position: relative; height: 26px; background: var(--ei-bg); border-radius: 6px; overflow: hidden; }
.ei-bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--ei-blue); border-radius: 6px; min-width: 2px; }
.ei-bar-value { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: .78rem; font-weight: 700; color: var(--ei-ink); }
.ei-chart-grid { display: grid; gap: 16px; }
.ei-xtab-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ei-xtab { border-collapse: collapse; font-size: .85rem; min-width: 100%; }
.ei-xtab th, .ei-xtab td { padding: 8px 10px; border-bottom: 1px solid var(--ei-line-soft); text-align: left; white-space: nowrap; }
.ei-xtab thead th { font-size: .75rem; color: var(--ei-muted); text-transform: uppercase; letter-spacing: .03em; }
.ei-xtab td { position: relative; min-width: 96px; }
.ei-xtab .ei-cell-bar { position: absolute; left: 0; top: 4px; bottom: 4px; background: var(--ei-blue-tint); border-radius: 4px; z-index: 0; }
.ei-xtab .ei-cell-text { position: relative; z-index: 1; font-weight: 600; }
.ei-xtab .ei-cell-pct { position: relative; z-index: 1; color: var(--ei-muted); font-weight: 400; margin-left: 4px; }
.ei-page .ei-section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ei-muted); margin: 24px 0 10px; }

.ei-note-item { background: var(--ei-white); border: 1px solid var(--ei-line); border-radius: 10px; padding: 14px 16px; margin: 0 0 10px; }
.ei-note-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--ei-muted); margin-bottom: 6px; align-items: center; }
.ei-note-text { white-space: pre-wrap; word-break: break-word; margin: 0; }
.ei-note-text.ei-note-trans { margin-top: 6px; }
.ei-note-tags { margin: 0 0 6px; }
.ei-phrases { margin: 0; }
mark { background: var(--ei-mark); padding: 0 2px; border-radius: 2px; }

@media (min-width: 600px) {
  .ei-tiles { grid-template-columns: repeat(4, 1fr); }
  .ei-kv div { grid-template-columns: minmax(160px, 42%) 1fr; gap: 12px; }
  .ei-panel { padding: 22px 24px; }
}
@media (min-width: 800px) {
  .ei-table th, .ei-table td { padding: 12px 14px; border-bottom: 1px solid var(--ei-line); vertical-align: middle; }
  .ei-table tr:last-child td { border-bottom: 0; }
  .ei-table tbody tr:hover { background: var(--ei-row-hover); }
  .ei-filters { grid-template-columns: repeat(5, 1fr); }
  .ei-filters .ei-field-wide { grid-column: span 2; }
  .ei-filters .ei-filter-actions { grid-column: auto; }
  .ei-chart-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  .ei-menu-btn { display: none; }
  .ei-nav { display: flex; position: static; flex-direction: row; align-items: center; padding: 0; border: 0; box-shadow: none; gap: 4px; }
  .ei-nav a { min-height: 40px; }
  .ei-user { padding: 0 6px 0 16px; border-left: 1px solid var(--ei-line); margin-left: 8px; }
  .ei-logo img { height: 28px; }
  .ei-view { grid-template-columns: minmax(280px, 360px) 1fr; }
}

.ei-audio-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.ei-audio-head h2 { margin: 0; }
.ei-audio-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.ei-audio-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 0; border-top: 1px solid var(--ei-line); }
.ei-audio-meta { min-width: 150px; }
.ei-audio-list audio { flex: 1 1 260px; max-width: 100%; height: 40px; }
@media print {
  .ei-header, .ei-footer, .ei-btn, .ei-filters { display: none !important; }
  body.ei-page { background: var(--ei-white); }
  .ei-audio { display: none; }
}
