:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17211d;
  background: #eef2ef;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #eef2ef; }
button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.topbar {
  min-height: 88px;
  padding: max(18px, env(safe-area-inset-top)) 20px 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  background: #ffffff;
  border-bottom: 1px solid #d4ddd8;
}

.eyebrow { margin: 0 0 3px; color: #58655f; font-size: 12px; text-transform: uppercase; font-weight: 700; }
h1 { margin: 0; font-size: 25px; white-space: nowrap; }
h2 { font-size: 19px; }
.status { color: #126149; font-size: 13px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.refresh-button { min-height: 40px; padding: 0 12px; border: 1px solid #aab8b0; border-radius: 6px; background: #fff; color: #17211d; font-weight: 700; }
.refresh-button:disabled { cursor: wait; opacity: 0.65; }
main { width: min(920px, 100%); margin: 0 auto; padding: 18px 16px 88px; }

.login-panel { max-width: 440px; margin: 40px auto; }
.login-panel p { color: #58655f; }
label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 700; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
input { min-width: 0; padding: 12px; border: 1px solid #aab8b0; border-radius: 6px; background: #fff; }
.input-row button { padding: 0 18px; border: 0; border-radius: 6px; background: #126149; color: #fff; font-weight: 700; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid #c9d3cd; margin-bottom: 18px; }
.tab { min-height: 44px; border: 0; background: transparent; color: #58655f; font-weight: 700; }
.tab.active { color: #126149; border-bottom: 3px solid #126149; }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.notification-button { margin: 0 0 18px; padding: 10px 14px; border: 0; border-radius: 6px; background: #126149; color: #fff; font-weight: 700; }
.metric { padding: 12px; background: #fff; border: 1px solid #d4ddd8; border-radius: 6px; }
.metric span { display: block; color: #65716b; font-size: 12px; }
.metric strong { display: block; margin-top: 4px; font-size: 21px; }

.case-list { display: grid; gap: 22px; }
.case-group { display: grid; gap: 10px; }
.group-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; padding: 0 2px; }
.group-head h2 { margin: 0; font-size: 16px; }
.group-head p { margin: 3px 0 0; color: #65716b; font-size: 12px; }
.group-count { min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: #dce7e1; color: #24463a; font-size: 12px; font-weight: 800; }
.group-list { display: grid; gap: 10px; }
.case-card { width: 100%; padding: 15px; text-align: left; border: 1px solid #d4ddd8; border-radius: 6px; background: #fff; color: inherit; }
.case-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.case-title { margin: 0; font-size: 17px; white-space: nowrap; }
.case-head time { display: block; margin-top: 3px; }
.case-summary { margin: 10px 0 0; color: #44514b; line-height: 1.45; }
time { color: #65716b; font-size: 12px; }
.badge { flex: 0 0 auto; padding: 4px 7px; border-radius: 4px; background: #e4eee9; color: #126149; font-size: 11px; font-weight: 800; }
.badge.filtered { background: #ecefed; color: #59645f; }
.badge.waiting { background: #fff0c7; color: #755300; }
.empty-state { padding: 40px 0; text-align: center; color: #58655f; }

dialog { width: min(680px, calc(100% - 24px)); max-height: calc(100vh - 24px); border: 0; border-radius: 8px; padding: 22px; overflow: auto; }
dialog::backdrop { background: rgb(15 28 22 / 58%); }
.close-button { float: right; width: 36px; height: 36px; border: 0; background: #edf1ef; border-radius: 50%; font-size: 24px; line-height: 1; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.detail-item { padding: 10px; border-left: 3px solid #9fb3a8; background: #f5f7f6; }
.detail-item span { display: block; color: #65716b; font-size: 12px; }
.detail-item strong { display: block; margin-top: 3px; }
.decision-bar { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 20px; }
.decision-bar button { min-height: 46px; border: 0; border-radius: 6px; font-weight: 800; }
.yes { background: #126149; color: #fff; }
.no { background: #a52a2a; color: #fff; }
.monitor { background: #e4a725; color: #201700; }
.notice { margin-top: 14px; padding: 10px; border-left: 3px solid #e4a725; background: #fff6dc; }

@media (max-width: 560px) {
  .topbar { display: grid; gap: 8px; align-items: start; }
  .topbar-actions { justify-content: space-between; }
  .status { max-width: none; text-align: left; }
  .case-head { align-items: flex-start; flex-wrap: wrap; }
  .badge { max-width: 100%; text-align: left; white-space: normal; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .metric:last-child { grid-column: 1 / -1; }
  .detail-grid { grid-template-columns: 1fr; }
  .decision-bar { grid-template-columns: 1fr; }
}
