:root {
  color-scheme: light;
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-soft: #eef3f5;
  --ink: #111827;
  --muted: #64748b;
  --line: #d8e0e7;
  --navy: #10243f;
  --navy-2: #163a5f;
  --cyan: #0f9ca8;
  --green: #21865a;
  --gold: #b7791f;
  --red: #c8323c;
  --shadow: 0 22px 54px rgba(15, 23, 42, 0.12);
}

[data-color-mode="dark"] {
  color-scheme: dark;
  --bg: #10151c;
  --surface: #171f29;
  --surface-soft: #202a36;
  --ink: #eef4f8;
  --muted: #9fb0c2;
  --line: #314052;
  --navy: #d5e7ff;
  --navy-2: #8ec5ff;
  --shadow: 0 26px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.5;
}

.official-banner {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 44px;
  padding: 8px max(22px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid #c9d3dc;
  background: #e8edf2;
  color: #243447;
  font-size: 13px;
}

.official-banner strong {
  margin-right: 8px;
}

.official-banner span {
  color: #4b5b6b;
}

.official-banner a {
  font-weight: 900;
  text-decoration: underline;
}

[data-color-mode="dark"] .official-banner {
  border-color: #314052;
  background: #18212c;
  color: var(--ink);
}

[data-color-mode="dark"] .official-banner span {
  color: var(--muted);
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  border: 0;
}

.app-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  min-height: 76px;
  padding: 12px max(22px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(216, 224, 231, 0.78);
  background: rgba(242, 244, 247, 0.9);
  backdrop-filter: blur(18px);
}

[data-color-mode="dark"] .app-header {
  background: rgba(16, 21, 28, 0.9);
}

.brand,
.header-actions,
.top-nav,
.live-status,
.button-row,
.detail-topline,
.desk-filters,
.evidence-strip {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  min-width: 226px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--navy), var(--cyan));
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: var(--navy);
  font-size: 17px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.top-nav {
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.top-nav a {
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 8px;
}

.top-nav a:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.header-actions {
  justify-content: flex-end;
  gap: 10px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.primary-link,
.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.primary-link,
.button.primary {
  padding: 0 18px;
  background: var(--navy);
  color: #fff;
}

.button.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button.danger {
  background: var(--red);
  color: #fff;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

main {
  padding-bottom: 56px;
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  max-width: 1180px;
  margin: 0 auto;
  padding: 62px 22px 34px;
}

.intro-copy {
  max-width: 780px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 850px;
  margin-bottom: 16px;
  color: var(--navy);
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  color: var(--navy);
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  color: var(--navy);
  font-size: 22px;
  letter-spacing: 0;
}

.intro-copy p:last-child,
.security-band p,
.case-detail p,
.notice-panel p {
  color: var(--muted);
}

.live-status {
  min-width: 300px;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.live-status div {
  min-width: 78px;
}

.live-status span,
.timer-box span,
.protocol-box span,
.case-card span,
.audit-grid dt {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.live-status strong,
.timer-box strong,
.protocol-box strong {
  display: block;
  color: var(--navy);
  font-size: 22px;
  line-height: 1.1;
}

.field-office,
.workspace,
.desk-section,
.security-band {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px;
}

.field-office {
  padding-top: 0;
}

.office-hero,
.video-room {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.office-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: stretch;
  overflow: hidden;
  margin-bottom: 18px;
}

.office-hero > div:first-child {
  padding: 28px;
}

.office-hero p {
  max-width: 720px;
  color: var(--muted);
}

.office-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.office-actions .button {
  padding: 0 18px;
}

.office-card {
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(16, 36, 63, 0.94), rgba(22, 58, 95, 0.88)),
    var(--navy);
  color: #fff;
}

.office-card dl {
  display: grid;
  gap: 16px;
  margin: 0;
}

.office-card div {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.office-card div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.office-card dt {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.office-card dd {
  margin: 4px 0 0;
  font-weight: 850;
}

.video-room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0;
  overflow: hidden;
}

.call-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.45fr);
  gap: 14px;
  min-height: 430px;
  padding: 18px;
  background: #111821;
}

.remote-feed,
.local-feed {
  position: relative;
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #172230;
  color: #fff;
}

.remote-feed {
  place-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.remote-feed small,
#liveEmpty span {
  color: rgba(255, 255, 255, 0.72);
}

.officer-avatar {
  display: grid;
  width: 118px;
  height: 118px;
  place-items: center;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: linear-gradient(135deg, #0f9ca8, #315f96);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
}

.officer-avatar span {
  font-size: 36px;
  font-weight: 950;
}

.local-feed {
  min-height: 190px;
}

.local-feed video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 190px;
  object-fit: cover;
}

#liveEmpty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 4px;
  padding: 16px;
  text-align: center;
}

.call-side {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 18px;
  background: var(--surface);
}

.queue-ticket,
.transcript-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.queue-ticket {
  padding: 16px;
}

.queue-ticket span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.queue-ticket strong {
  display: block;
  color: var(--navy);
  font-size: 32px;
}

.queue-ticket small {
  color: var(--muted);
}

.call-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.icon-control {
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 950;
}

.icon-control.is-off {
  background: var(--gold);
  color: #fff;
}

.icon-control.end {
  background: var(--red);
  color: #fff;
  font-size: 26px;
}

.transcript-box {
  overflow: hidden;
}

.transcript-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--navy);
}

.transcript-head span {
  color: var(--muted);
  font-weight: 900;
}

#callTranscript {
  display: grid;
  gap: 10px;
  max-height: 220px;
  margin: 0;
  padding: 14px 14px 14px 32px;
  overflow: auto;
  color: var(--muted);
  font-size: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.case-rail,
.report-form,
.case-detail,
.security-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.case-rail {
  position: sticky;
  top: 98px;
  padding: 18px;
}

.rail-title {
  margin-bottom: 18px;
}

.rail-title strong {
  display: block;
  color: var(--navy);
  font-size: 22px;
}

.step-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
}

.step-list li span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-soft);
  font-weight: 900;
}

.step-list li p {
  margin: 0;
  font-weight: 800;
}

.step-list li.is-active {
  border-color: rgba(15, 156, 168, 0.35);
  background: rgba(15, 156, 168, 0.1);
  color: var(--ink);
}

.step-list li.is-active span {
  background: var(--cyan);
  color: #fff;
}

.notice-panel {
  margin-top: 20px;
  padding: 14px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: color-mix(in srgb, var(--gold) 12%, var(--surface));
}

.notice-panel strong {
  color: var(--navy);
}

.notice-panel p {
  margin: 6px 0 0;
  font-size: 14px;
}

.report-form {
  overflow: hidden;
}

.form-panel {
  display: none;
  padding: 26px;
}

.form-panel.is-active {
  display: block;
}

.panel-heading,
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 132px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(15, 156, 168, 0.14);
}

.wide-label {
  margin-top: 16px;
}

.segment-row,
.quick-types {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.segment,
.type-card,
.filter,
.evidence-strip button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.segment {
  padding: 0 16px;
}

.segment.is-selected,
.filter.is-active {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #fff;
}

.quick-types {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.type-card {
  display: grid;
  min-height: 86px;
  align-content: center;
  justify-items: start;
  gap: 8px;
  padding: 14px;
}

.type-card span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-soft);
}

.type-card.is-selected {
  border-color: rgba(16, 36, 63, 0.5);
  background: color-mix(in srgb, var(--navy) 8%, var(--surface));
}

.type-card.is-selected span {
  background: var(--navy);
  color: #fff;
}

.media-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.7fr);
  gap: 18px;
}

.recorder {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(16, 36, 63, 0.9), rgba(15, 156, 168, 0.65)),
    #17202b;
}

.recorder video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
}

.recorder-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 22px;
  color: #fff;
  text-align: center;
}

.recorder-empty strong {
  font-size: 28px;
}

.recorder-empty span {
  color: rgba(255, 255, 255, 0.78);
}

.recording-dot {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(10, 15, 20, 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.recording-dot span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff4757;
  box-shadow: 0 0 0 6px rgba(255, 71, 87, 0.22);
}

.media-tools {
  display: grid;
  gap: 14px;
  align-content: start;
}

.timer-box,
.upload-drop,
.protocol-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.timer-box {
  padding: 18px;
}

.button-row {
  flex-wrap: wrap;
  gap: 10px;
}

.button-row .button {
  flex: 1 1 110px;
}

.upload-drop {
  min-height: 118px;
  place-content: center;
  justify-items: center;
  padding: 18px;
  border-style: dashed;
  text-align: center;
  cursor: pointer;
}

.upload-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-drop span {
  color: var(--navy);
  font-weight: 900;
}

.upload-drop small {
  color: var(--muted);
}

.reference-video {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: center;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.reference-video strong {
  color: var(--navy);
}

.reference-video video {
  width: 100%;
  max-height: 260px;
  border-radius: 8px;
  background: #0b1118;
}

.consent-list {
  display: grid;
  gap: 12px;
}

.consent-list label {
  grid-template-columns: 20px 1fr;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.consent-list input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.protocol-box {
  margin-top: 18px;
  padding: 18px;
  border-color: rgba(33, 134, 90, 0.5);
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
}

.protocol-box p {
  margin: 8px 0 0;
  color: var(--muted);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 26px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-soft) 58%, var(--surface));
}

.form-actions .button {
  min-width: 128px;
  padding: 0 18px;
}

.desk-section {
  padding-top: 38px;
}

.desk-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr);
  gap: 22px;
}

.desk-filters {
  gap: 8px;
}

.filter {
  padding: 0 13px;
}

.case-list {
  display: grid;
  gap: 12px;
}

.case-card {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.case-card.is-active {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(15, 156, 168, 0.12);
}

.case-card strong {
  color: var(--navy);
  font-size: 17px;
}

.case-card p {
  margin: 0;
  color: var(--muted);
}

.case-card footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.case-detail {
  min-height: 434px;
  padding: 22px;
}

.detail-topline {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.status-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(33, 134, 90, 0.14);
  color: var(--green);
}

.evidence-strip {
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0;
}

.evidence-strip button {
  flex: 1 1 160px;
  padding: 0 12px;
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.audit-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.audit-grid dd {
  margin: 4px 0 0;
  color: var(--navy);
  font-weight: 900;
}

.security-band {
  display: grid;
  grid-template-columns: minmax(230px, 0.65fr) minmax(0, 1.35fr);
  gap: 24px;
  margin-top: 18px;
  padding: 26px;
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.security-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.security-grid strong {
  display: block;
  margin-bottom: 8px;
  color: var(--navy);
}

.security-grid p {
  margin: 0;
  font-size: 14px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 44px));
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 980px) {
  .app-header,
  .intro-band,
  .office-hero,
  .video-room,
  .workspace,
  .desk-layout,
  .security-band {
    grid-template-columns: 1fr;
  }

  .app-header {
    position: relative;
  }

  .top-nav {
    justify-content: start;
    overflow-x: auto;
  }

  .header-actions {
    justify-content: start;
  }

  .intro-band {
    align-items: start;
    padding-top: 38px;
  }

  .live-status {
    width: 100%;
    min-width: 0;
  }

  .case-rail {
    position: static;
  }

  .step-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .step-list li {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .media-grid,
  .reference-video,
  .call-stage,
  .security-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-header {
    gap: 14px;
    padding: 12px 16px;
  }

  .brand {
    min-width: 0;
  }

  .primary-link {
    display: none;
  }

  .intro-band,
  .field-office,
  .workspace,
  .desk-section,
  .security-band {
    padding-right: 16px;
    padding-left: 16px;
  }

  h1 {
    font-size: 38px;
  }

  h2 {
    font-size: 23px;
  }

  .form-grid,
  .quick-types,
  .audit-grid {
    grid-template-columns: 1fr;
  }

  .form-panel,
  .case-detail,
  .security-band {
    padding: 18px;
  }

  .panel-heading,
  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .step-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
    padding: 16px 18px;
  }

  .form-actions .button {
    width: 100%;
  }

  .official-banner {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 16px;
  }

  .office-hero > div:first-child,
  .office-card,
  .call-side {
    padding: 18px;
  }

  .call-stage {
    min-height: auto;
  }
}
