:root {
  color-scheme: light;
  --navy: #071f3d;
  --blue: #9a7738;
  --aqua: #c6a15b;
  --ink: #111827;
  --muted: #657985;
  --line: #d9e4e9;
  --soft: #f3f7f8;
  --white: #ffffff;
  --success: #9a6f22;
  --danger: #a4433d;
  --warning: #9b6a18;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(145deg, #eef1f5 0%, #ffffff 48%, #f3f4f6 100%);
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }

.hidden { display: none !important; }

.site-header {
  min-height: 76px;
  padding: 14px clamp(20px, 4vw, 58px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 32px rgba(8, 45, 72, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--navy);
  text-decoration: none;
  letter-spacing: 0.08em;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--blue);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.header-actions { display: flex; align-items: center; gap: 18px; }
.language-picker { margin: 0; }
.language-picker select {
  min-width: 132px;
  padding: 8px 30px 8px 10px;
  border-color: var(--line);
  font-size: .82rem;
  font-weight: 700;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.secure-label { color: var(--muted); font-size: 0.9rem; }
.text-button { border: 0; background: transparent; color: var(--blue); cursor: pointer; }
.dashboard-link { color: var(--navy); font-size: .88rem; font-weight: 800; text-decoration: none; }

main { padding: clamp(24px, 4vw, 52px); }

.login-card {
  width: min(460px, 100%);
  margin: 6vh auto 0;
  padding: clamp(28px, 5vw, 48px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(8, 45, 72, 0.12);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2 { margin-top: 0; color: var(--navy); }
h1 { font-size: clamp(1.65rem, 3vw, 2.4rem); }
h2 { font-size: 1.15rem; }
.muted, .panel-intro { color: var(--muted); }

form { display: grid; gap: 10px; }
label { margin-top: 8px; color: var(--navy); font-weight: 700; font-size: 0.9rem; }
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #bdcdd4;
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(56, 182, 201, 0.18);
  border-color: var(--aqua);
}

.primary {
  margin-top: 12px;
  padding: 13px 18px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: var(--white);
  font-weight: 800;
  cursor: pointer;
}
.primary:disabled { opacity: 0.55; cursor: not-allowed; }
.form-status { min-height: 1.3em; color: var(--danger); }

.workspace {
  width: min(1560px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(250px, 330px) minmax(0, 1fr);
  gap: 22px;
}

.surveyor-overview {
  grid-column: 1 / -1;
  padding: clamp(22px, 3vw, 34px);
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--aqua);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(8, 45, 72, 0.07);
}
.overview-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.overview-heading h1 { margin-bottom: 5px; }
.surveyor-identity {
  display: inline-flex;
  margin: 12px 0 4px;
  padding: 7px 11px;
  border: 1px solid rgba(201, 159, 79, .55);
  border-radius: 999px;
  background: #fff9ee;
  color: #73531d;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.secondary-button {
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--navy);
  font-weight: 800;
  cursor: pointer;
}
.overview-metrics { margin-top: 24px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.overview-metrics article { padding: 16px; display: grid; gap: 4px; background: var(--soft); border-radius: 11px; border-left: 3px solid var(--line); }
.overview-metrics article.attention-metric { border-left-color: var(--warning); background: #fff9ee; }
.overview-metrics span { color: var(--navy); font-family: Georgia, serif; font-size: 1.9rem; }
.overview-metrics strong { color: var(--navy); }
.overview-metrics small { color: var(--muted); }

.queue-panel, .case-panel, .review-card, .document-card, .empty-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(8, 45, 72, 0.07);
}
.queue-panel { padding: 22px; align-self: start; position: sticky; top: 20px; }
.case-panel { padding: clamp(20px, 3vw, 34px); min-height: 70vh; }
.panel-heading, .case-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.count-badge, .status-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff7e8;
  color: var(--blue);
  font-weight: 800;
  font-size: 0.78rem;
  white-space: nowrap;
}
.status-verified { background: #e1f2e9; color: var(--success); }
.status-rejected { background: #f9e7e5; color: var(--danger); }
.status-unable_to_confirm, .status-expired { background: #f5eddd; color: var(--warning); }

.assignment-queue { display: grid; gap: 9px; margin-top: 18px; }
.queue-controls { margin-top: 16px; display: grid; gap: 7px; }
.queue-controls label { margin: 0; font-size: .75rem; }
.queue-controls input, .queue-controls select { padding: 9px 10px; font-size: .82rem; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.crew-assignment-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
}
.crew-group-toggle {
  width: 100%;
  padding: 14px 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border: 0;
  background: #f8fafb;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.crew-group-toggle:hover { background: #fff9ee; }
.crew-group-toggle[aria-expanded="true"] {
  background: #fff7e8;
  border-bottom: 1px solid rgba(198, 161, 91, .38);
}
.crew-group-identity { min-width: 0; display: grid; gap: 3px; }
.crew-group-identity strong { overflow-wrap: anywhere; color: var(--navy); }
.crew-group-identity small { color: var(--muted); font-size: .7rem; }
.crew-group-summary { display: grid; justify-items: end; gap: 2px; }
.crew-group-summary small { color: var(--blue); font-size: .7rem; font-weight: 800; }
.crew-group-summary .queue-alert { color: var(--warning); }
.crew-group-chevron {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  font-weight: 800;
}
.crew-document-list { padding: 8px; display: grid; gap: 7px; }
.assignment-item {
  width: 100%;
  padding: 13px;
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
}
.assignment-item.selected { border-color: var(--aqua); background: #fff8ea; }
.assignment-item small { color: var(--muted); }
.assignment-item .queue-status { color: var(--blue); font-weight: 800; }
.assignment-item .queue-alert { color: var(--warning); font-weight: 850; }
.assignment-item.attention { border-left: 4px solid var(--warning); }
.assignment-item .queue-meta { display: flex; justify-content: space-between; gap: 8px; }
.empty-card { padding: 50px; text-align: center; }

.case-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.12fr) minmax(330px, 0.88fr);
  gap: 20px;
  align-items: start;
}
.document-card, .review-card { padding: 20px; }
.review-column { display: grid; gap: 16px; }
.evidence-frame {
  min-height: 420px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid #cbd8dd;
  background: #dfe8eb;
}
.evidence-frame img { max-width: 100%; max-height: 72vh; object-fit: contain; }
.privacy-note, .warning-note, .final-warning {
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.5;
}
.privacy-note { background: #fffaf0; color: #355865; }
.warning-note, .final-warning { background: #fff7e8; color: #73511c; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.facts div { padding: 10px; background: var(--soft); border-radius: 10px; }
.facts dt { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; }
.facts dd { margin: 4px 0 0; font-weight: 700; }
.summary p { margin: 7px 0; line-height: 1.45; }
.finding-list { padding-left: 20px; }
.finding-list li { margin: 6px 0; }
.confirmation-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 9px;
  font-weight: 500;
  line-height: 1.45;
}
.confirmation-row input { width: auto; margin-top: 4px; }

html[dir="rtl"] body { direction: rtl; }
html[dir="rtl"] .assignment-item { text-align: right; }
html[dir="rtl"] .crew-group-toggle { text-align: right; }
html[dir="rtl"] .crew-group-summary { justify-items: start; }
html[dir="rtl"] .assignment-item.attention {
  border-left: 1px solid var(--line);
  border-right: 4px solid var(--warning);
}
html[dir="rtl"] .overview-metrics article {
  border-left: 0;
  border-right: 3px solid var(--line);
}
html[dir="rtl"] .overview-metrics article.attention-metric {
  border-right-color: var(--warning);
}
html[dir="rtl"] .finding-list { padding-left: 0; padding-right: 20px; }
html[dir="rtl"] .language-picker select { padding: 8px 10px 8px 30px; }

@media (max-width: 980px) {
  .workspace, .case-grid { grid-template-columns: 1fr; }
  .queue-panel { position: static; }
  .assignment-queue { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .site-header { align-items: flex-start; }
  .header-actions { align-items: flex-end; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
  .secure-label { display: none; }
  main { padding: 16px; }
  .assignment-queue, .facts { grid-template-columns: 1fr; }
  .overview-heading { flex-direction: column; }
  .overview-metrics, .filter-row { grid-template-columns: 1fr; }
  .case-heading { flex-direction: column; }
  .evidence-frame { min-height: 300px; }
}
