:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17212b;
  background: #f4f6f7;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f4f6f7; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
.page { min-height: 100vh; }

.auth-view { width: min(420px, calc(100% - 32px)); margin: 0 auto; padding-top: min(22vh, 180px); text-align: center; }
.brand-mark { display: grid; width: 52px; height: 52px; margin: 0 auto 18px; place-items: center; border: 2px solid #176b5b; border-radius: 8px; color: #176b5b; font-weight: 800; }
.product-name { margin: 0 0 4px; color: #51606d; font-size: 0.82rem; font-weight: 700; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 1.7rem; line-height: 1.2; }
h2 { margin-bottom: 4px; font-size: 1rem; }
.muted { color: #60707d; }
.auth-view .button { margin-top: 18px; }
.google-sign-in { display: inline-grid; min-width: 230px; min-height: 44px; margin-top: 18px; padding: 0 14px; grid-template-columns: 22px 1fr; align-items: center; gap: 12px; border: 1px solid #747775; border-radius: 4px; background: #fff; color: #1f1f1f; font-weight: 650; }
.google-sign-in:hover { background: #f8fafd; border-color: #5f6368; }
.google-sign-in img { width: 20px; height: 20px; }
.google-sign-in span { text-align: center; }
.console { padding-bottom: 40px; }

.topbar { display: flex; min-height: 80px; padding: 18px clamp(20px, 4vw, 52px); align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid #d8dee3; background: #fff; }
.topbar h1 { margin: 0; font-size: 1.35rem; }
.identity { display: flex; align-items: center; gap: 10px; }
.identity-badge { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 50%; background: #e3f0ed; color: #12584c; font-size: 0.8rem; font-weight: 800; }
.identity-copy { display: grid; min-width: 0; }
.identity-copy strong, .identity-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-copy span { color: #64727d; font-size: 0.78rem; }
.identity-copy #identity-role { color: #176b5b; font-weight: 700; }

.status-tabs { display: flex; padding: 0 clamp(20px, 4vw, 52px); gap: 24px; border-bottom: 1px solid #d8dee3; background: #fff; }
.status-tab { min-height: 54px; padding: 0 2px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #566571; font-weight: 700; }
.status-tab.active { border-bottom-color: #176b5b; color: #17212b; }
.status-tab span { margin-left: 6px; color: #176b5b; }
.status-count { display: inline-block; min-width: 2.2ch; text-align: left; }

.toolbar, .queue-heading, .table-wrap, .pagination, .batch-bar { width: min(1500px, calc(100% - 40px)); margin-left: auto; margin-right: auto; }
.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto; gap: 14px; margin-top: 24px; align-items: end; }
label { display: grid; gap: 6px; color: #42515d; font-size: 0.8rem; font-weight: 700; }
input[type="search"], select, textarea { width: 100%; min-height: 40px; border: 1px solid #b9c3ca; border-radius: 6px; background: #fff; color: #17212b; padding: 8px 10px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid rgba(37, 112, 176, 0.22); outline-offset: 1px; }
.button { display: inline-flex; min-height: 38px; padding: 7px 13px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 6px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.button.primary, .button.approve { background: #176b5b; color: #fff; }
.button.secondary { border-color: #b9c3ca; background: #fff; color: #263640; }
.button.titan { background: #2b5e9a; color: #fff; }
.button.reject { border-color: #a43b3b; background: #fff; color: #8d2f2f; }
.toolbar-button { min-width: 88px; }

.batch-bar { display: flex; min-height: 54px; margin-top: 16px; padding: 8px 12px; align-items: center; gap: 10px; border: 1px solid #a9c9c1; border-radius: 6px; background: #eef7f5; }
.batch-bar strong { margin-right: auto; }
.queue-heading { display: flex; margin-top: 28px; margin-bottom: 12px; align-items: end; justify-content: space-between; gap: 16px; }
.queue-heading p { margin: 0; font-size: 0.85rem; }
.queue-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.loading { color: #176b5b; font-weight: 700; }

.queue-loader { display: flex; width: min(1500px, calc(100% - 40px)); min-height: 112px; margin: 0 auto; padding: 24px; align-items: center; gap: 16px; border: 1px solid #c9d3d8; border-radius: 7px; background: #fff; }
.queue-loader[hidden] { display: none; }
.queue-loader div { display: grid; gap: 4px; }
.queue-loader strong { font-size: 0.95rem; }
.queue-loader span:not(.loading-indicator) { color: #60707d; font-size: 0.82rem; }
.queue-loader .button { margin-left: auto; }
.loading-indicator { width: 24px; height: 24px; flex: 0 0 24px; border: 3px solid #c9d8d4; border-top-color: #176b5b; border-radius: 50%; animation: loading-spin 0.85s linear infinite; }
@keyframes loading-spin { to { transform: rotate(360deg); } }

.table-wrap { overflow: hidden; border: 1px solid #d4dbe0; border-radius: 7px; background: #fff; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 13px 12px; border-bottom: 1px solid #e1e6e9; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
th { background: #eef1f3; color: #475661; font-size: 0.73rem; text-transform: uppercase; }
td { font-size: 0.84rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafb; }
th:nth-child(2) { width: 21%; }
th:nth-child(3), th:nth-child(4) { width: 18%; }
th:nth-child(5) { width: 10%; }
th:nth-child(6) { width: 9%; }
.check-column { width: 42px; text-align: center; }
.actions-column { width: 170px; }
.cell-title { display: block; margin-bottom: 4px; font-weight: 750; }
.cell-detail { display: block; color: #64727d; font-size: 0.75rem; line-height: 1.4; }
.source-tag, .confidence { display: inline-block; padding: 3px 6px; border-radius: 4px; background: #edf0f2; color: #40505b; font-size: 0.72rem; font-weight: 750; }
.confidence { margin-top: 6px; background: #e8eef7; color: #254f80; }
details { margin-top: 8px; color: #50606b; }
summary { cursor: pointer; font-size: 0.75rem; font-weight: 700; }
details p { margin: 8px 0 0; line-height: 1.45; white-space: pre-wrap; }
.row-actions { display: grid; gap: 6px; }
.row-actions .button { width: 100%; min-height: 32px; padding: 5px 8px; font-size: 0.75rem; }
.preliminary-review { display: grid; margin-bottom: 8px; padding: 7px; gap: 2px; border-left: 3px solid #2b5e9a; background: #eef3f9; color: #29445f; font-size: 0.72rem; line-height: 1.35; }
.preliminary-review span { color: #60707d; }
.empty-state { padding: 54px 20px; color: #65747f; text-align: center; }
.pagination { display: flex; margin-top: 14px; align-items: center; justify-content: flex-end; gap: 6px; }
.pagination[hidden] { display: none; }
.pagination.compact { width: auto; margin: 0; }
.pagination .button { min-width: 38px; padding-left: 10px; padding-right: 10px; }
.pagination .page-button { min-width: 36px; }
.pagination .page-button[aria-current="page"] { border-color: #176b5b; background: #176b5b; color: #fff; }
.pagination .page-gap { min-width: 22px; color: #60707d; text-align: center; }

dialog { width: min(560px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 18px 50px rgba(18, 31, 42, 0.24); }
dialog::backdrop { background: rgba(21, 31, 40, 0.55); }
dialog form { padding: 22px; }
dialog header, dialog footer { display: flex; align-items: center; gap: 10px; }
dialog header { justify-content: space-between; margin-bottom: 18px; }
dialog footer { justify-content: flex-end; margin-top: 20px; }
dialog h2 { margin: 0; font-size: 1.15rem; }
.close-button { width: 34px; height: 34px; border: 0; background: transparent; color: #53616c; font-size: 1.5rem; line-height: 1; }
.review-summary { margin-bottom: 16px; padding: 12px; border-left: 4px solid #176b5b; background: #f1f5f4; line-height: 1.5; }
.toast { position: fixed; right: 18px; bottom: 18px; max-width: min(420px, calc(100% - 36px)); padding: 12px 14px; border-radius: 6px; background: #17212b; color: #fff; box-shadow: 0 8px 24px rgba(18, 31, 42, 0.22); }
.toast.error { background: #842f2f; }

@media (max-width: 900px) {
  .topbar { align-items: flex-start; }
  .identity-copy { display: none; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar-button { grid-column: 2; justify-self: end; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 1050px; }
}

@media (max-width: 620px) {
  .topbar { padding: 16px; flex-wrap: wrap; }
  .topbar .product-name { max-width: 180px; }
  .identity { margin-left: auto; }
  .identity-badge { display: none; }
  .status-tabs { padding: 0 16px; gap: 18px; overflow-x: auto; }
  .toolbar, .queue-heading, .queue-loader, .table-wrap, .pagination, .batch-bar { width: calc(100% - 24px); }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar-button { grid-column: auto; justify-self: stretch; }
  .batch-bar { flex-wrap: wrap; }
  .batch-bar strong { width: 100%; }
  .queue-heading { align-items: flex-start; }
  .queue-heading-actions { align-items: flex-end; flex-direction: column; gap: 8px; }
  .pagination .page-edge-label { display: none; }
  .pagination { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .loading-indicator { animation-duration: 1.8s; }
}
