/* Answer sheets: the list of every exam stored on this laptop.
   Desktop: one table in a card, a <tbody> per day. Phone (<= 760px): each row becomes a card;
   the table keeps explicit ARIA roles in the markup, so its semantics survive the display change. */

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--ink); color: var(--ink-on); border-radius: var(--r-2); font-weight: 700; text-decoration: none; }
.skip:focus { top: 10px; color: var(--ink-on); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 var(--s-6) var(--s-12); }
main:focus { outline: none; }
.muted { color: var(--ink-3); }

/* ---------- page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-6); padding: var(--s-8) 0 var(--s-5); }
.page-head h1 { font-size: var(--t-30); font-weight: 750; font-stretch: 92%; letter-spacing: -.015em; line-height: 1.2; }
.page-head h1 .hi { font-weight: 600; color: var(--saffron); margin-left: .3em; font-size: .86em; }
.page-head .lead { color: var(--ink-2); margin-top: 6px; max-width: 62ch; }
.head-tools { flex: 0 1 380px; min-width: 260px; }

.search { position: relative; }
.search .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 18px; height: 18px; pointer-events: none; }
.search input { padding-left: 40px !important; }
.search input:disabled { background: var(--paper-sunk); border-color: var(--rule-strong); cursor: not-allowed; }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.status-line { color: var(--ink-3); font-size: var(--t-13); font-weight: 600; min-height: 1.5em; margin: 0 0 var(--s-3) 2px; }

/* ---------- the list */
.list-card { overflow: hidden; }
.sheets-table { table-layout: fixed; }
.sheets-table th:first-child, .sheets-table td:first-child { padding-left: var(--s-6); }
.sheets-table th:last-child, .sheets-table td:last-child { padding-right: var(--s-6); }
.sheets-table thead th { padding-top: 14px; padding-bottom: 10px; background: var(--paper-card); }
.sheets-table td { padding-top: 13px; padding-bottom: 13px; vertical-align: top; }
.sheets-table .c-student { width: 15%; }
.sheets-table .c-paper   { width: 20%; }
.sheets-table .c-when    { width: 7.5%; }
.sheets-table .c-time    { width: 11%; }
.sheets-table thead th { white-space: nowrap; }
.sheets-table .c-lang    { width: 8%; }
.sheets-table .c-ans     { width: 24%; }
.sheets-table .c-act     { width: 178px; }

/* day group heading */
.sheets-table .g-head th {
  padding: 9px var(--s-6); background: var(--paper-sunk);
  border-bottom: 1px solid var(--rule); border-top: 1px solid var(--rule);
  text-transform: none; letter-spacing: 0; color: var(--ink); font-size: var(--t-13); font-weight: 750;
}
.sheets-table tbody:first-of-type .g-head th { border-top: 0; }
.g-head th { display: table-cell; }
.g-label { font-weight: 750; }
.g-rel + .g-date::before { content: "·"; margin: 0 .45em; color: var(--ink-3); }
.g-date { font-weight: 600; color: var(--ink-2); }
.g-count { float: right; color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; }

.sheets-table tbody tr[data-id] { transition: background var(--dur-1) var(--ease); }
.sheets-table tbody tr[data-id]:hover { background: color-mix(in srgb, var(--marigold-tint) 32%, var(--paper-card)); }
.sheets-table tbody tr[data-id]:focus-within { background: color-mix(in srgb, var(--marigold-tint) 45%, var(--paper-card)); }
.sheets-table tbody tr:last-child td { border-bottom-color: var(--rule); }
.sheets-table tbody:last-of-type tr:last-child td { border-bottom: 0; }

.c-student, .c-paper, .c-when, .c-time, .c-ans { overflow-wrap: anywhere; }
.s-name { display: block; font-weight: 700; font-size: var(--t-16); line-height: 1.4; color: var(--ink); }
.s-name:lang(hi) { line-height: var(--lh-deva); }
.s-none { font-weight: 600; font-style: italic; color: var(--ink-3); font-size: var(--t-14); }
.s-roll { display: block; color: var(--ink-3); font-size: var(--t-13); margin-top: 1px; }
.p-title { display: block; font-weight: 650; line-height: 1.45; color: var(--ink); }
.p-title:lang(hi) { line-height: var(--lh-deva); }
.p-meta { display: block; color: var(--ink-3); font-size: var(--t-13); margin-top: 1px; }
.w-time { display: block; font-weight: 650; }
.w-date { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } /* the day heading shows it */
.t-total { display: block; font-weight: 650; }
.t-split { display: block; color: var(--ink-3); font-size: var(--t-13); }
.c-lang [lang="hi"] { font-weight: 600; }

.a-main { display: block; font-weight: 650; }
.a-none { color: var(--ink-3); font-weight: 600; }
.a-sub { display: block; color: var(--ink-3); font-size: var(--t-13); }
.a-tags { display: flex; flex-wrap: wrap; gap: 4px 5px; margin-top: 6px; }
.a-tags .tag { height: 22px; padding: 0 8px; font-size: 12px; }
.a-tags .tag .ico { width: 13px; height: 13px; }
.a-wait { display: block; padding-top: 4px; }
.sk-line, .sk { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--paper-sunk) 0%, var(--rule) 50%, var(--paper-sunk) 100%); background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; }
.sk-line { width: 82%; height: 12px; }
.sk-line::after { content: ""; display: block; width: 60%; height: 10px; margin-top: 18px; border-radius: 6px; background: inherit; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.c-act { padding-top: 10px !important; }
.acts { display: flex; gap: 8px; justify-content: flex-end; }
.acts .btn { min-width: 76px; }

.list-foot { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-6) var(--s-5); border-top: 1px solid var(--rule); }
.list-foot .hint { display: flex; align-items: flex-start; gap: 6px; text-align: center; justify-content: center; }
.list-foot .hint .ico { width: 15px; height: 15px; margin-top: 3px; color: var(--ok); }

/* ---------- loading, empty, no match, error */
.loading-card { padding: var(--s-6); display: grid; gap: 18px; }
.loading-card .sk { height: 18px; }
.loading-card .sk:nth-child(2) { width: 86%; }
.loading-card .sk:nth-child(3) { width: 64%; }

.state-card { max-width: 680px; margin: var(--s-4) auto 0; padding: var(--s-10) var(--s-8); display: grid; justify-items: center; text-align: center; gap: var(--s-3); }
.state-card h2 { font-size: var(--t-20); font-weight: 750; line-height: 1.35; }
.state-card h2 .hi { display: block; font-size: var(--t-16); font-weight: 600; color: var(--saffron); margin-top: 2px; }
.state-card p { color: var(--ink-2); max-width: 54ch; }
.state-card .hint { color: var(--ink-3); }
.state-card .btn { margin-top: var(--s-2); }
.state-card code { font-family: var(--mono); font-size: .9em; background: var(--paper-sunk); border: 1px solid var(--rule); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.state-card.state-sm { padding: var(--s-8); }
.state-ico { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--marigold-tint); color: var(--saffron); border: 1px solid color-mix(in srgb, var(--saffron) 25%, transparent); margin-bottom: var(--s-2); }
.state-ico .ico { width: 30px; height: 30px; }
.state-ico.warn { background: var(--warn-tint); color: var(--warn); }
.state-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.state-actions .btn { margin-top: var(--s-2); }

/* ---------- laptop: keep the app bar on one line, stack the row actions */
.appbar-end { white-space: nowrap; }
@media (max-width: 1180px) and (min-width: 861px) {
  .appbar-in { gap: var(--s-5); }
  .appbar .tab .hi { display: none; }
}
@media (max-width: 1100px) {
  .sheets-table .c-student { width: 17%; }
  .sheets-table .c-paper   { width: 22%; }
  .sheets-table .c-when    { width: 9.5%; }
  .sheets-table .c-time    { width: 11.5%; }
  .sheets-table .c-lang    { width: 9.5%; }
  .sheets-table .c-ans     { width: 19%; }
  .sheets-table .c-act     { width: 112px; }
  .acts { flex-direction: column; align-items: stretch; }
}

/* ---------- phone: app bar on two lines, rows become cards */
@media (max-width: 860px) {
  .appbar-in { padding: 10px var(--s-4) 0; gap: var(--s-3); min-height: 56px; flex-wrap: wrap; }
  .appbar .wordmark { font-size: 18px; }
  .appbar .wordmark .hi, .appbar .wordmark .bar { display: none; }
  .appbar .tabs { order: 3; width: 100%; overflow-x: auto; margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-2); min-height: 44px; border-top: 1px solid var(--rule); scrollbar-width: none; }
  .appbar .tab { font-size: 13.5px; padding: 0 10px; }
  .appbar .tab .hi { display: none; }
  .appbar-end { display: none; }
}

@media (max-width: 760px) {
  .wrap { padding: 0 var(--s-4) var(--s-10); }
  .page-head { flex-direction: column; align-items: stretch; padding: var(--s-5) 0 var(--s-4); gap: var(--s-4); }
  .page-head h1 { font-size: 25px; }
  .page-head h1 .hi { display: block; margin: 2px 0 0; font-size: 18px; }
  .head-tools { flex: none; min-width: 0; }

  .list-card { background: transparent; border: 0; box-shadow: none; overflow: visible; border-radius: 0; }
  .sheets-table, .sheets-table tbody, .sheets-table tr, .sheets-table td, .sheets-table th { display: block; width: auto !important; }
  .sheets-table { table-layout: auto; }
  .sheets-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .sheets-table tbody + tbody { margin-top: var(--s-5); }

  .sheets-table .g-head th { padding: 0 2px 8px !important; background: none; border: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: var(--t-14); }
  .g-count { float: none; flex: none; }
  .g-date { display: block; font-size: var(--t-13); }
  .g-rel + .g-date::before { content: none; }

  .sheets-table tbody tr[data-id] {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 12px;
    margin-bottom: var(--s-3); padding: 14px 16px 16px;
    background: var(--paper-card); border: 1px solid var(--rule); border-radius: var(--r-3); box-shadow: var(--shadow-1);
  }
  .sheets-table tbody tr[data-id]:hover { background: var(--paper-card); }
  .sheets-table td { padding: 0 !important; border: 0 !important; }
  .sheets-table .c-student, .sheets-table .c-paper, .sheets-table .c-ans, .sheets-table .c-act { grid-column: 1 / -1; }
  .sheets-table .c-paper { padding-bottom: 12px !important; border-bottom: 1px dashed var(--rule) !important; }
  .s-name { font-size: var(--t-18); }
  .sheets-table td[data-label]::before { content: attr(data-label); display: block; font-size: var(--t-12); font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 2px; }
  .sheets-table .c-ans { padding-top: 12px !important; border-top: 1px dashed var(--rule) !important; }
  .sk-line { width: 60%; }
  .acts { flex-direction: row; }
  .acts .btn { flex: 1 1 0; min-height: 44px; }

  .list-foot { border-top: 0; padding: var(--s-2) 0 0; }
  .list-foot .btn { width: 100%; min-height: 44px; }
  .state-card { padding: var(--s-8) var(--s-5); margin-top: 0; }
}

@media print {
  .appbar, .skip, .head-tools, .acts, .list-foot .btn { display: none !important; }
  body { background: #fff; }
}
