:root {
  --bg: #0a0f14;
  --bg-alt: #101820;
  --surface: #f5f7f5;
  --surface-2: #e8eeec;
  --ink: #101820;
  --ink-soft: #52616a;
  --line: #cad4d2;
  --line-dark: #263844;
  --panel: #101a22;
  --panel-2: #15232d;
  --text: #f7faf8;
  --muted: #aab7b8;
  --brand: #24c4c9;
  --green: #40b36f;
  --amber: #d89a2b;
  --red: #d65b5b;
  --blue: #4d83c5;
  --radius: 8px;
  --shadow: 0 18px 44px rgba(5, 12, 18, .28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, "Segoe UI", Arial, sans-serif;
}

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

button,
input,
select,
textarea,
a {
  border-radius: var(--radius);
}

button {
  min-height: 38px;
  border: 1px solid transparent;
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: .62;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 8px 10px;
}

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

label {
  color: var(--ink-soft);
  font-size: .78rem;
  font-weight: 800;
}

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

h1,
h2,
h3 {
  letter-spacing: 0;
}

a {
  color: #0d7176;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--brand);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  background:
    linear-gradient(90deg, rgba(10, 15, 20, .86), rgba(10, 15, 20, .62)),
    url("assets/oravega-forensics-mark.svg") right 7vw center / min(44vw, 520px) no-repeat,
    linear-gradient(135deg, #0a0f14 0%, #13222a 52%, #202923 100%);
}

.login-brief {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 42px clamp(24px, 5vw, 72px);
}

.brand-lockup,
.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.brand-lockup img,
.brand-link img {
  width: 52px;
  height: 52px;
}

.brand-lockup strong,
.brand-link strong {
  display: block;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.brand-lockup small,
.brand-link small {
  color: var(--brand);
  display: block;
  font-weight: 900;
  text-transform: uppercase;
}

.login-brief .brand-lockup {
  margin-bottom: 40px;
}

.login-brief h1 {
  max-width: 850px;
  margin-bottom: 18px;
  font-size: clamp(2.5rem, 5vw, 5.7rem);
  line-height: .96;
}

.login-copy {
  max-width: 740px;
  color: #dce7e4;
  font-size: 1.08rem;
}

.login-metrics {
  width: min(100%, 850px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 26px;
}

.login-metrics article {
  min-height: 118px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(11, 21, 28, .7);
  padding: 14px;
}

.login-metrics span {
  color: var(--amber);
  display: block;
  font-weight: 900;
  margin-bottom: 8px;
}

.login-metrics strong,
.login-metrics small {
  display: block;
}

.login-metrics small {
  color: var(--muted);
  margin-top: 6px;
}

.auth-panel {
  align-self: center;
  display: grid;
  gap: 10px;
  margin: 28px;
  border: 1px solid rgba(255, 255, 255, .78);
  background: rgba(245, 247, 245, .96);
  color: var(--ink);
  padding: 22px;
  box-shadow: var(--shadow);
}

.panel-heading {
  border-bottom: 1px solid var(--line);
  margin: -4px -4px 10px;
  padding: 4px 4px 16px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.18rem;
}

.form-help {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: .82rem;
}

.form-error {
  margin: 0;
  border: 1px solid rgba(214, 91, 91, .42);
  background: rgba(214, 91, 91, .12);
  color: #8e2525;
  padding: 10px;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line-dark);
  background: #0b1218;
  padding: 18px 14px;
}

.brand-link {
  padding: 4px 4px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-link:hover {
  text-decoration: none;
}

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-list button {
  width: 100%;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
  padding: 0 12px;
}

.nav-list button:hover,
.nav-list button.active {
  border-color: rgba(36, 196, 201, .35);
  background: rgba(36, 196, 201, .1);
  color: var(--text);
}

.session-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
  padding: 12px;
}

.session-card strong,
.session-card small {
  display: block;
}

.session-card small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.pulse {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 16px rgba(64, 179, 111, .75);
}

.workspace {
  min-width: 0;
  background: var(--surface-2);
  color: var(--ink);
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.65rem, 2vw, 2.25rem);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-action,
.secondary-action,
.danger-action,
.text-action {
  font-weight: 900;
  padding: 0 13px;
}

.primary-action {
  border-color: #106e72;
  background: #106e72;
  color: #fff;
}

.primary-action:hover {
  background: #0b595c;
}

.secondary-action {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.secondary-action:hover {
  border-color: #8da19f;
  background: #eef3f1;
}

.danger-action {
  border-color: rgba(214, 91, 91, .45);
  background: #fff1ef;
  color: #9a2f2f;
}

.danger-action:hover {
  background: #ffdeda;
}

.text-action {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  color: #0d7176;
}

.text-action:hover {
  background: rgba(36, 196, 201, .12);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-grid article,
.surface {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .55);
}

.metric-grid article {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
}

.metric-grid span {
  color: var(--ink-soft);
  font-size: .82rem;
  font-weight: 800;
}

.metric-grid strong {
  color: #0d3638;
  display: block;
  font-size: 2.45rem;
  line-height: 1;
}

.dashboard-grid,
.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.wide {
  grid-column: 1 / -1;
}

.surface {
  min-width: 0;
  padding: 15px;
}

.surface + .surface {
  margin-top: 14px;
}

.surface-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.surface-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.inline-filters {
  max-width: 780px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 170px 170px auto;
  gap: 8px;
}

.case-selector {
  max-width: 360px;
}

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

.form-grid.compact {
  margin-top: 12px;
}

.span-all {
  grid-column: 1 / -1;
}

.check-row {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.check-row input {
  width: auto;
  min-height: auto;
}

.permission-note {
  margin: 0;
  border: 1px dashed var(--line);
  color: var(--ink-soft);
  padding: 12px;
}

.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink-soft);
  font-size: .76rem;
  font-weight: 900;
  padding: 4px 9px;
  white-space: nowrap;
}

.status-pill.soft {
  background: #edf8f8;
  border-color: #b8dfdf;
  color: #0d7176;
}

.status-pill.ok {
  border-color: rgba(64, 179, 111, .35);
  background: rgba(64, 179, 111, .12);
  color: #267549;
}

.status-pill.warn {
  border-color: rgba(216, 154, 43, .4);
  background: rgba(216, 154, 43, .12);
  color: #875813;
}

.status-pill.danger {
  border-color: rgba(214, 91, 91, .4);
  background: rgba(214, 91, 91, .12);
  color: #9a2f2f;
}

.stack-list,
.event-stream,
.timeline-list,
.data-table {
  display: grid;
  gap: 8px;
}

.list-row,
.event-row,
.timeline-row,
.table-row,
.empty-state {
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 11px;
}

.list-row {
  display: grid;
  gap: 6px;
}

.row-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.row-head strong,
.event-row strong,
.timeline-row strong,
.table-row strong {
  overflow-wrap: anywhere;
}

.row-meta,
.muted,
.hash-text {
  color: var(--ink-soft);
  font-size: .82rem;
}

.hash-text {
  font-family: Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-list span {
  border: 1px solid #d8dedc;
  background: #f6f7f5;
  color: var(--ink-soft);
  font-size: .75rem;
  font-weight: 800;
  padding: 3px 7px;
}

.detail-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

.detail-panel dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 10px;
  margin: 0;
}

.detail-panel dt {
  color: var(--ink-soft);
  font-weight: 800;
}

.detail-panel dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.data-table {
  overflow-x: auto;
}

.table-row {
  min-width: min(100%, 780px);
  display: grid;
  grid-template-columns: 1.1fr .75fr .7fr .9fr auto;
  gap: 10px;
  align-items: center;
}

.table-row.evidence-row {
  grid-template-columns: 1.1fr .7fr .7fr 1.2fr auto;
}

.table-row.audit-row {
  grid-template-columns: .9fr .8fr .9fr 1.1fr;
}

.table-row button,
.list-row button {
  min-height: 32px;
}

.event-row,
.timeline-row {
  position: relative;
  display: grid;
  gap: 5px;
  padding-left: 16px;
}

.event-row::before,
.timeline-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 5px;
  height: calc(100% - 24px);
  background: var(--brand);
}

.timeline-row[data-kind="report"]::before {
  background: var(--blue);
}

.timeline-row[data-kind="evidence"]::before {
  background: var(--green);
}

.timeline-row[data-kind="custody"]::before {
  background: var(--amber);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: 390px;
  border: 1px solid var(--line-dark);
  background: #0b1218;
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  padding: 12px 14px;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
}

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

@media (max-width: 1120px) {
  .login-view,
  .app-shell,
  .dashboard-grid,
  .split-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .nav-list button {
    text-align: center;
  }

  .session-card {
    margin-top: 0;
  }

  .login-brief {
    min-height: auto;
  }

  .auth-panel {
    margin: 0 24px 32px;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 14px;
  }

  .topbar,
  .surface-heading,
  .row-head {
    display: grid;
  }

  .metric-grid,
  .login-metrics,
  .form-grid,
  .inline-filters,
  .nav-list {
    grid-template-columns: 1fr;
  }

  .table-row,
  .table-row.evidence-row,
  .table-row.audit-row {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .case-selector {
    max-width: none;
  }

  .auth-panel,
  .login-brief {
    margin: 0;
    padding: 20px;
  }

  .login-view {
    gap: 0;
  }
}
