/* Kestrel Lane Logistics: shipment exceptions. Restrained, data-forward ops styling. */
:root {
  color-scheme: light;
  --rst-bg: #f3f5f8;
  --rst-surface: #ffffff;
  --rst-surface-2: #eef1f5;
  --rst-text: #16202c;
  --rst-text-muted: #4b5868;
  --rst-line: #dde3ea;
  --rst-line-strong: #7a8696;
  --rst-accent: #1f3a5f;
  --rst-accent-strong: #152a46;
  --rst-accent-soft: #e6edf5;
  --rst-on-accent: #ffffff;
  --rst-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rst-radius: 6px;
  --rst-radius-sm: 4px;
  --rst-depth-ambient: rgba(22, 32, 44, 0.06);
  --rst-depth-contact: rgba(22, 32, 44, 0.10);
}

html, body { background: var(--rst-bg); color: var(--rst-text); font-family: var(--rst-font); }
body { margin: 0; }
*, *::before, *::after { box-sizing: border-box; }

/* Header band */
.band { background: var(--rst-accent); color: #ffffff; }
.band-inner {
  max-width: 64rem; margin: 0 auto; padding: 0.9rem 1rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.mark { flex: none; }
.org {
  margin: 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: #c9d6e6;
}
.band h1 { margin: 0; font-size: 1.35rem; line-height: 1.2; font-weight: 700; color: #ffffff; }

main.rst-page { padding-top: 1.25rem; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }

.notice {
  background: #fbe4e2; color: #8a1c13; border: 1px solid #f0b9b3;
  border-radius: var(--rst-radius); padding: 0.75rem 1rem; margin: 0 0 1rem; font-weight: 600;
}

/* Summary counts */
.stats {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--rst-surface); border: 1px solid var(--rst-line);
  border-radius: var(--rst-radius); margin-bottom: 1.25rem;
}
.stat { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.8rem 1rem; border-left: 1px solid var(--rst-line); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat-num { font-size: 1.75rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.sev-num-high { color: #8a1c13; }
.stat-label { font-size: 0.8rem; color: var(--rst-text-muted); }

/* Log form */
.panel {
  background: var(--rst-surface); border: 1px solid var(--rst-line);
  border-radius: var(--rst-radius); padding: 1rem; margin-bottom: 1.75rem;
}
.log-form {
  display: grid; gap: 0 1rem;
  grid-template-columns: 1.1fr 1fr 0.8fr 1fr;
  grid-template-areas: "ref kind sev owner" "note note note submit";
  align-items: end;
}
.log-form .rst-field { margin: 0.6rem 0 0; min-width: 0; }
.f-ref { grid-area: ref; } .f-kind { grid-area: kind; } .f-sev { grid-area: sev; }
.f-owner { grid-area: owner; } .f-note { grid-area: note; }
.f-submit { grid-area: submit; margin-top: 0.6rem; }
.f-submit button { width: 100%; }
.rst-field-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--rst-text-muted); margin-bottom: 0.3rem; }
.opt { font-weight: 400; }
.rst-input { min-height: 2.75rem; }
[rst-btn] { min-height: 2.75rem; }
input:is([type=date], [type=time], [type=datetime-local]) { min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; display: block; min-height: 2.75rem; }

/* Section heads */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.hint { margin: 0; font-size: 0.8rem; color: var(--rst-text-muted); }
.empty {
  background: var(--rst-surface); border: 1px dashed var(--rst-line-strong);
  border-radius: var(--rst-radius); padding: 1.25rem; color: var(--rst-text-muted); margin: 0;
}

/* Table */
.table-wrap {
  background: var(--rst-surface); border: 1px solid var(--rst-line);
  border-radius: var(--rst-radius); overflow-x: auto;
}
table.log { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.log th {
  text-align: left; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--rst-text-muted); background: var(--rst-surface-2);
  padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--rst-line); white-space: nowrap;
}
.log td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--rst-line); vertical-align: top; }
.log tbody tr:last-child td { border-bottom: 0; }
.log tbody tr:hover td { background: #f8fafc; }
.ref { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 600; white-space: nowrap; }
.num, .ref { font-variant-numeric: tabular-nums; }
.num { white-space: nowrap; }
.note { display: block; color: var(--rst-text-muted); font-size: 0.82rem; margin-top: 0.15rem; overflow-wrap: anywhere; }

.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; min-width: 0; }
.status-form { display: flex; align-items: center; gap: 0.4rem; max-width: 100%; }
.status-form select { width: 9.5rem; min-width: 0; flex: 0 1 auto; padding-top: 0.3rem; padding-bottom: 0.3rem; }
.log td > .chip { justify-self: start; }

/* Chips: colour always paired with a text label */
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.75rem; font-weight: 700; line-height: 1.5;
  padding: 0.1rem 0.55rem; border-radius: 999px; white-space: nowrap;
}
.chip::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: currentColor; }
.sev-high { background: #fbe4e2; color: #8a1c13; }
.sev-medium { background: #fdf0d5; color: #7a4a00; }
.sev-low { background: #e5eef8; color: #1f4b7a; }
.st-open { background: #eef1f5; color: #2b3846; }
.st-investigating { background: #ece8f8; color: #4a2f8a; }
.st-resolved { background: #e3f1e7; color: #1e5b33; }

/* Resolved */
.resolved { margin-top: 1.75rem; }
.resolved summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0.25rem 0;
}
.resolved summary::-webkit-details-marker { display: none; }
.resolved summary::before { content: "▸"; color: var(--rst-text-muted); }
.resolved[open] summary::before { content: "▾"; }
.resolved summary h2 { display: inline-flex; align-items: center; gap: 0.5rem; }
.count {
  font-size: 0.75rem; font-weight: 700; background: var(--rst-surface-2); color: var(--rst-text-muted);
  border-radius: 999px; padding: 0.05rem 0.5rem; font-variant-numeric: tabular-nums;
}
.resolved .table-wrap, .resolved .empty { margin-top: 0.5rem; }

/* Tablet */
@media (max-width: 52rem) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(4) { border-left: 0; }
  .stat:nth-child(n+4) { border-top: 1px solid var(--rst-line); }
  .log-form { grid-template-columns: 1fr 1fr; grid-template-areas: "ref kind" "sev owner" "note note" "submit submit"; }
}

/* Phone: stack table rows */
@media (max-width: 40rem) {
  .band h1 { font-size: 1.2rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-left: 0; border-top: 1px solid var(--rst-line); }
  .stat:first-child { grid-column: 1 / -1; border-top: 0; }
  .stat:nth-child(even) { border-left: 0; }
  .stat:nth-child(odd):not(:first-child) { border-left: 1px solid var(--rst-line); }
  .log-form { grid-template-columns: 1fr; grid-template-areas: "ref" "kind" "sev" "owner" "note" "submit"; }
  .table-wrap { background: transparent; border: 0; overflow: visible; }
  table.log, .log tbody, .log tr, .log td { display: block; width: 100%; }
  .log thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .log tr {
    background: var(--rst-surface); border: 1px solid var(--rst-line);
    border-radius: var(--rst-radius); margin-bottom: 0.6rem; padding: 0.35rem 0;
  }
  .log td { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0.5rem; border: 0; padding: 0.35rem 0.75rem; }
  .log td::before { content: attr(data-label); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--rst-text-muted); padding-top: 0.15rem; }
  .log tbody tr:hover td { background: transparent; }
  .ref { white-space: normal; overflow-wrap: anywhere; }
  .status-form { width: 100%; }
  .status-form select { width: auto; flex: 1 1 auto; }
}

/* Example mode: one-line note at the top of the showcase copy. */
.example-note { display: block; width: 100%; box-sizing: border-box; margin: 0; padding: 0.5rem 1rem; text-align: center; font-family: var(--rst-font, system-ui, sans-serif); font-size: 0.875rem; line-height: 1.4; font-weight: 400; letter-spacing: normal; text-transform: none; background: var(--rst-accent-soft); color: var(--rst-text); }
.example-note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
