.tbs{--ink:#0f172a;--muted:#6b7280;--line:#e2e8f0;--accent:#347451;--ok:#347451;--okbg:#e7f1e9;--warn:#9a6415;--bad:#a33b3b;--head:#1f4d38;
 color:var(--ink);font:16px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;max-width:100%;box-sizing:border-box}
.tbs *,.tbs *::before,.tbs *::after{box-sizing:border-box}
.tbs .wrap{max-width:900px;margin:0 auto;width:100%}
.tbs .card{background:#fff;border:1px solid var(--line);border-radius:14px;padding:18px;margin-top:16px}
.tbs h3{font-size:17px;margin:0 0 4px}
.tbs .step{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:999px;
 background:var(--accent);color:#fff;font-size:12px;font-weight:700;margin-right:8px;vertical-align:1px}
.tbs .sub{margin:0 0 12px;color:var(--muted);font-size:14px}
.tbs .hint{font-size:13px;color:var(--muted);margin:8px 0 0}

.tbs .modes{display:flex;gap:8px;margin:0 0 14px;flex-wrap:wrap}
.tbs .modes button{flex:1 1 180px;border:1px solid var(--line);background:#fff;border-radius:11px;padding:12px 14px;text-align:left;cursor:pointer;min-height:52px}
.tbs .modes button b{display:block;font-size:15px}
.tbs .modes button span{font-size:12.5px;color:var(--muted)}
.tbs .modes button[aria-pressed="true"]{border-color:var(--accent);background:#f3f8f4}
.tbs .modes button[aria-pressed="true"] b{color:#285f43}

.tbs .maxrow{display:flex;align-items:center;gap:10px;margin:0 0 12px;flex-wrap:wrap}
.tbs .maxrow label{font-size:14px;color:var(--muted)}
.tbs .maxrow input{width:80px;padding:9px 10px;border:1px solid var(--line);border-radius:9px;font:inherit;text-align:center}

.tbs .scroll{overflow:auto;max-width:100%;border:1px solid var(--line);border-radius:10px;background:#fff;max-height:58vh}
.tbs table{border-collapse:separate;border-spacing:0;width:100%;table-layout:fixed}
.tbs thead th{position:sticky;top:0;z-index:3;background:var(--head);color:#fff;border-bottom:1px solid var(--line);
 border-right:1px solid var(--line);padding:6px 2px;font-size:11px;font-weight:700;color:#ffffff;line-height:1.15;white-space:normal}
.tbs thead th:first-child{left:0;z-index:4;width:58px;min-width:58px;max-width:58px;text-align:left;padding-left:6px}
.tbs tbody th{position:sticky;left:0;z-index:2;background:var(--head);color:#fff;border-right:1px solid var(--line);border-bottom:1px solid var(--line);
 padding:6px 6px;text-align:left;font-size:12px;font-weight:600;color:#4b5158;white-space:nowrap}
.tbs tbody td{border-right:1px solid var(--line);border-bottom:1px solid var(--line);padding:0}
.tbs tbody tr:last-child th,.tbs tbody tr:last-child td{border-bottom:none}
.tbs tbody td:last-child,.tbs thead th:last-child{border-right:none}
.tbs .cell{width:100%;min-width:0;height:38px;border:0;background:#fff;cursor:pointer;font-size:16px;
 color:transparent;display:block;padding:0}
.tbs .cell:hover{background:#f3f8f4}
.tbs .cell[aria-pressed="true"]{background:var(--okbg);color:var(--ok);font-weight:700}
.tbs .score{width:100%;min-width:0;height:38px;border:0;background:var(--brand-50, #f3f8f4);text-align:center;font:15px/1 inherit;color:var(--ink);padding:0}
.tbs .score:focus{outline:2px solid var(--brand-600, #43845f);outline-offset:-2px;background:#fff}

.tbs .tools{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.tbs button{font:inherit;border-radius:10px;padding:10px 14px;border:1px solid transparent;cursor:pointer;min-height:42px}
.tbs .primary{background:var(--accent);color:#fff;font-weight:600;width:100%;font-size:17px;margin-top:12px}
.tbs .ghost{background:#fff;border-color:var(--line);color:var(--ink)}
.tbs .ghost:hover{border-color:var(--brand-600, #43845f)}
.tbs .small{padding:8px 12px;font-size:14px;min-height:38px}
.tbs .hidden{display:none !important}
.tbs .msg{margin:10px 0 0;font-size:14px;color:var(--bad)}
.tbs .summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(105px,1fr));gap:8px;margin:0 0 12px}
.tbs .stat{background:#fcfbf8;border:1px solid var(--line);border-radius:10px;padding:9px 11px}
.tbs .stat b{display:block;font-size:19px;line-height:1.2}
.tbs .stat span{color:var(--muted);font-size:12px}
.tbs .rhead{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:10px}
.tbs .actions{display:flex;gap:8px;flex-wrap:wrap}
.tbs .rtable{width:100%;border-collapse:collapse;font-size:14px;display:none}
.tbs .rtable th,.tbs .rtable td{padding:9px 6px;text-align:left;border-bottom:1px solid var(--line)}
.tbs .tag{display:inline-block;padding:2px 8px;border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap}
.tbs .tag.ok{background:var(--okbg);color:var(--ok)}
.tbs .tag.warn{background:#fbeed7;color:var(--warn)}
.tbs .tag.bad{background:#f8e2e2;color:var(--bad)}
.tbs .item{border:1px solid var(--line);border-radius:10px;padding:11px 13px;margin-bottom:8px}
.tbs .item .top{display:flex;justify-content:space-between;align-items:center;gap:8px}
.tbs .item b{font-size:15px}
.tbs .item dl{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;margin:6px 0 0;font-size:13px}
.tbs .item dt{color:var(--muted)}.tbs .item dd{margin:0}
.tbs .note{margin-top:12px;font-size:13px;color:var(--muted)}
@media(min-width:641px){.tbs .rtable{display:table}.tbs .cards{display:none}}
@media print{.tbs .noprint{display:none !important}.tbs .card{border:1px solid #ddd}.tbs .scroll{max-height:none;overflow:visible}}
/* Table layout fix: readable columns on mobile */
.tbs .scroll {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.tbs table#grid {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.tbs #grid thead th:first-child,
.tbs #grid tbody th {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  box-sizing: border-box;
}

.tbs #grid thead th:not(:first-child),
.tbs #grid tbody td {
  width: 96px;
  min-width: 96px;
  box-sizing: border-box;
}

.tbs #grid tbody th {
  left: 0;
  z-index: 2;
}

.tbs #grid thead th:first-child {
  left: 0;
  z-index: 4;
}

/* Fix answer cells: override generic button styles */
.tbs button.cell {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 38px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  line-height: 1;
}

.tbs button.cell[aria-pressed="true"] {
  background: var(--okbg);
  color: var(--ok);
}
