:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16202c;
  --muted: #64748b;
  --line: #e2e8f0;
  --navy: #12263f;
  --navy-soft: #1c3a5e;
  --accent: #0f6fc4;
  --green: #0f7b52;
  --amber: #b26a00;
  --red: #b42318;
  --green-bg: #e6f4ec;
  --amber-bg: #fdf3e2;
  --red-bg: #fdeceb;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only a UA rule of display:none, so any author rule
   with a class or id selector beats it - which would leave #app and
   .login-screen both on screen at once. Restate it as a winning rule. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* ---------------------------------------------------------------- login */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--navy), #0a1826);
  padding: 24px;
}

.login-card {
  background: var(--panel);
  padding: 32px;
  border-radius: 12px;
  width: min(380px, 100%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .32);
}

.login-card .brand { font-size: 20px; font-weight: 650; }
.login-sub { color: var(--muted); margin: 4px 0 22px; }

.login-card label {
  display: block;
  margin-bottom: 14px;
  font-weight: 550;
  font-size: 13px;
}

.login-card input {
  width: 100%;
  margin-top: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
}

.login-card input:focus,
.filters input:focus,
.filters select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.login-card button {
  width: 100%;
  padding: 11px;
  margin-top: 6px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.login-card button:disabled { opacity: .6; cursor: default; }

.anchor { margin-right: 4px; }

.error {
  color: var(--red);
  background: var(--red-bg);
  padding: 9px 11px;
  border-radius: var(--radius);
  margin: 14px 0 0;
  font-size: 13px;
}

/* ---------------------------------------------------------------- shell */

#app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--navy);
  color: #cbd8e6;
  display: flex;
  flex-direction: column;
  padding: 18px 0;
}

.sidebar .brand {
  font-size: 17px;
  font-weight: 650;
  color: #fff;
  padding: 0 18px 18px;
}

#nav { display: flex; flex-direction: column; flex: 1; }

#nav a {
  color: #cbd8e6;
  text-decoration: none;
  padding: 9px 18px;
  border-left: 3px solid transparent;
  font-size: 13.5px;
}

#nav a:hover { background: var(--navy-soft); color: #fff; }

#nav a.active {
  background: var(--navy-soft);
  color: #fff;
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar-foot { padding: 14px 18px 0; border-top: 1px solid rgba(255,255,255,.12); }
.who { font-size: 13px; color: #fff; display: flex; flex-direction: column; }
.who small { color: #93a7bd; font-size: 11.5px; text-transform: capitalize; }

.link {
  background: none;
  border: 0;
  color: #93a7bd;
  cursor: pointer;
  padding: 8px 0 0;
  font-size: 12.5px;
  text-decoration: underline;
  font-family: inherit;
}
.link:hover { color: #fff; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 26px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar h1 { font-size: 19px; margin: 0; font-weight: 620; }

.ghost {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 13px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
}
.ghost:hover { background: var(--bg); }

.view { padding: 22px 26px 60px; }

/* ---------------------------------------------------------------- cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 13px;
  margin-bottom: 26px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
}

.card .n { font-size: 27px; font-weight: 640; letter-spacing: -.5px; }
.card .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card.red .n { color: var(--red); }
.card.amber .n { color: var(--amber); }
.card.green .n { color: var(--green); }

h2.section { font-size: 15px; margin: 26px 0 11px; font-weight: 620; }

/* ---------------------------------------------------------------- table */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

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

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

th {
  text-align: left;
  padding: 10px 13px;
  background: #f1f4f8;
  border-bottom: 1px solid var(--line);
  font-weight: 620;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  white-space: nowrap;
}

td { padding: 10px 13px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }

.empty { padding: 34px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- bits */

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 11px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.red   { background: var(--red-bg);   color: var(--red); }
.pill.grey  { background: #eef1f5;         color: var(--muted); }

.filters { display: flex; gap: 9px; margin-bottom: 14px; flex-wrap: wrap; }

.filters input, .filters select {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--panel);
}
.filters input { min-width: 220px; }

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12.5px;
  cursor: pointer;
  margin-right: 5px;
  font-family: inherit;
}
.btn.ok     { border-color: #a5d6bd; color: var(--green); }
.btn.ok:hover     { background: var(--green-bg); }
.btn.warn   { border-color: #eccf9a; color: var(--amber); }
.btn.warn:hover   { background: var(--amber-bg); }
.btn.danger { border-color: #eeb4ae; color: var(--red); }
.btn.danger:hover { background: var(--red-bg); }
.btn:disabled { opacity: .5; cursor: default; }

.banner {
  padding: 11px 14px;
  border-radius: var(--radius);
  margin-bottom: 15px;
  font-size: 13.5px;
}
.banner.info { background: #e8f1fa; color: #10456f; }
.banner.err  { background: var(--red-bg); color: var(--red); }

.loading { padding: 34px; text-align: center; color: var(--muted); }

@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; gap: 8px; }
  .sidebar .brand { padding: 0 10px 0 6px; }
  #nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  #nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 7px 11px; }
  #nav a.active { border-left: 0; border-bottom-color: var(--accent); }
  .sidebar-foot { border-top: 0; display: flex; gap: 12px; align-items: center; padding: 0 8px; }
  .view { padding: 16px 14px 50px; }
}

/* ---------------------------------------------------------------- forms */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar .filters { margin-bottom: 0; }

button.primary {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 8px 15px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
button.primary:hover { background: #0c5ea6; }
button.primary:disabled { opacity: .6; cursor: default; }

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(11, 22, 36, .55);
  display: grid;
  place-items: start center;
  padding: 34px 16px;
  overflow-y: auto;
  z-index: 50;
}

.modal {
  background: var(--panel);
  border-radius: 10px;
  width: min(720px, 100%);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .3);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 640; }

.modal-head .x {
  border: 0;
  background: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}
.modal-head .x:hover { color: var(--ink); }

.modal-body { padding: 18px 20px; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.modal .error { margin: 0 20px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }

label.f { display: block; font-size: 12.5px; font-weight: 600; color: #3a4756; }
label.f > span { display: block; margin-bottom: 4px; }

label.f input, label.f select, label.f textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--panel);
}
label.f input:focus, label.f select:focus, label.f textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
label.f small { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; }
label.f input[type=file] { padding: 6px; background: var(--bg); }

h4.fh {
  font-size: 13px;
  margin: 20px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-weight: 640;
}
h4.fh small { font-weight: 400; }

/* ---------------------------------------------------------------- record */

.back { display: inline-block; margin-bottom: 10px; color: var(--accent); text-decoration: none; font-size: 13px; }
.back:hover { text-decoration: underline; }

.rec-title { font-size: 18px; margin: 0; font-weight: 640; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.panel.pad { padding: 16px 18px; }

.kvs { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 13px 20px; }
.kv { display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; }
.kv span { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }

.req { color: var(--red); font-weight: 700; }

h2.section .muted { font-weight: 400; font-size: 12.5px; margin-left: 6px; }

td a, .kv a { color: var(--accent); text-decoration: none; }
td a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 11px 18px;
  border-radius: 7px;
  font-size: 13.5px;
  box-shadow: 0 8px 26px rgba(0,0,0,.28);
  z-index: 60;
  transition: opacity .4s, transform .4s;
}
.toast.err { background: var(--red); }
.toast.out { opacity: 0; transform: translateX(-50%) translateY(8px); }

@media (max-width: 620px) {
  .grid2 { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- portage */

.bill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 15px;
  margin: 18px 0 10px;
}
.bill-head .pill { margin-left: 7px; }

/* Shaded on the paper form = calculated here. Deliberately the same pink so
   the screen reads like the workbook the crew already know. */
table.portage th.calc, table.portage td.calc { background: #fbe7e6; }
table.portage th.calc { color: #8a3a33; }
table.portage td.calc { color: #6d2b25; }

table.portage th { font-size: 10.5px; line-height: 1.25; white-space: normal; vertical-align: bottom; }
table.portage td { white-space: nowrap; }
table.portage tr.sec td {
  background: #eef1f5;
  font-weight: 640;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
}
table.portage tfoot td {
  background: #f1f4f8;
  font-weight: 640;
  border-top: 2px solid var(--line);
}
.pad-cell { padding: 14px 13px; }

.note {
  background: #f1f4f8;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--muted);
  margin: 14px 0 0;
}

label.inline { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
label.inline input {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13.5px;
}
.resultline { margin: 0 0 10px; font-size: 13px; }
a.btn { text-decoration: none; color: var(--ink); display: inline-block; }

/* ---------------------------------------------------------- entry form */

.entry-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 18px;
  box-shadow: 0 6px 22px rgba(18, 38, 63, .07);
}

.entry-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  background: #f8fafc;
  border-radius: var(--radius) var(--radius) 0 0;
}
.entry-head h3 { margin: 0; font-size: 16px; font-weight: 640; }

.entry-cols { display: grid; grid-template-columns: 1fr 290px; }
.entry-manual { padding: 6px 20px 20px; }
.entry-manual h4.fh.first { margin-top: 16px; padding-top: 0; border-top: 0; }

.entry-calc {
  background: #fbe7e6;
  border-left: 1px solid #f0cfcd;
  padding: 20px;
  border-radius: 0 var(--radius) 0 0;
}
.entry-calc h4 { margin: 0 0 3px; font-size: 13px; font-weight: 640; color: #8a3a33; }
.calc-note { margin: 0 0 14px; font-size: 11.5px; color: #9c5850; line-height: 1.4; }

.entry-calc dl { margin: 0; }
.entry-calc dl > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #f2d6d3;
  font-size: 13px;
}
.entry-calc dl > div:last-child { border-bottom: 0; }
.entry-calc dt { color: #8a3a33; }
.entry-calc dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  color: #5f231e;
}
.entry-calc dd strong { font-size: 14px; }

.entry-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}
.entry-form .error { margin: 0 20px 4px; }

@media (max-width: 900px) {
  .entry-cols { grid-template-columns: 1fr; }
  .entry-calc { border-left: 0; border-top: 1px solid #f0cfcd; border-radius: 0; }
}

/* ---------------------------------------------------- portage records */

/* Field primitive: label above value. `calc` marks a value the database
   computed, tinted the same pink the paper form shades. */
.fld { min-width: 0; }
.fld.boxed { background: #fbe7e6; border: 1px solid #f0cfcd; border-radius: 6px; padding: 7px 10px; }
.fld .fl {
  display: block;
  font-size: 10px;
  letter-spacing: .6px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 3px;
}
.fld .fv { font-size: 14px; color: var(--ink); display: block; }
.fld .fn {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--ink);
  display: block;
}
.fld .strong { font-weight: 640; }
.fld .dim { color: #94a3b8; }
.fld.calc .fl { color: #9c5850; }
.fld.calc .fv, .fld.calc .fn { color: #5f231e; }

/* -- document header ------------------------------------------------- */

.doc {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 6px;
}
.doc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 18px 22px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}
.doc-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-title-row h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.2px; }
.doc-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.doc-total { text-align: right; }
.doc-total-n {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 640;
  letter-spacing: -.5px;
}
.doc-total-s { font-size: 12px; color: var(--muted); }
.doc-fields { padding: 18px 22px; }

/* -- section heading ------------------------------------------------- */

.sec-head { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 12px; }
.sec-head h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 640;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: #475569;
}
.sec-head .rule { flex: 1; border: 0; border-top: 1px solid var(--line); margin: 0; }

/* -- crew record ----------------------------------------------------- */

.rec {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}
.rec-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.rec-no {
  width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: 50%;
  background: #eef1f5;
  color: #475569;
  font-size: 12px;
  font-weight: 640;
  display: flex; align-items: center; justify-content: center;
}
.rec-id { flex: 1; min-width: 140px; }
.rec-name { font-size: 15px; font-weight: 640; }
.rec-rank { font-size: 12.5px; color: var(--muted); }
.rec-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.rec-actions { display: flex; gap: 5px; }
.rec-actions .btn { margin-right: 0; }

.rec-group { padding: 16px 20px 0; }
.rec-group + .rec-group { border-top: 1px solid var(--line); margin-top: 16px; }
.rec-group-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.rec-group-title {
  font-size: 11px;
  font-weight: 640;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #94a3b8;
}
.rec-group-note { font-size: 11px; color: #9c5850; }

.rec-fields {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px 22px;
}

.rec-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 14px 20px;
  background: #fbe7e6;
  border-top: 1px solid #f0cfcd;
}
.rec-attest {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  flex: 1;
  min-width: 240px;
}
.rec-balance { text-align: right; flex: 0 0 auto; }
.rec-balance .fl { color: #9c5850; }
.rec-balance-n {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 650;
  color: #5f231e;
  letter-spacing: -.4px;
}

/* -- totals ---------------------------------------------------------- */

.totals {
  margin-top: 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.totals-head {
  padding: 14px 22px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 640;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: #475569;
}
.totals-fields { padding: 18px 22px; gap: 18px 22px; }
.totals-net {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 16px 22px;
  background: var(--navy);
  color: #fff;
}
.totals-net-l {
  font-size: 12px;
  color: #93a7bd;
  letter-spacing: .4px;
  text-transform: uppercase;
  font-weight: 600;
}
.totals-net-s { font-size: 12.5px; color: #cbd8e6; margin-top: 2px; }
.totals-net-n {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -.6px;
}

@media (max-width: 1180px) {
  .rec-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .doc-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .rec-fields, .doc-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec-attest { grid-template-columns: 1fr; }
}

/* ------------------------------------------------- crew list & crumbs */

table.crewlist td { white-space: nowrap; }
table.crewlist tr.sec td {
  background: #f1f4f8;
  font-weight: 640;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
}
table.crewlist tr.sec .sec-count {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 8px;
  color: #94a3b8;
}
table.crewlist .pill { margin-right: 4px; }

.sec-head .ghost, .sec-head .primary { flex: 0 0 auto; }

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 14px;
}
.crumb strong { color: var(--ink); font-weight: 640; }
.crumb .sep { color: #cbd5e1; }

input.sla {
  width: 110px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  background: var(--panel);
  color: var(--ink);
}
input.sla:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

table.crewlist tr.sec .sec-add {
  float: right;
  margin: -2px 0 0;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

/* ------------------------------------------------- crew requests */

.fill { display: flex; flex-direction: column; gap: 1px; }
.fill-n {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 640;
  font-size: 13.5px;
}
.fill .muted { font-size: 11.5px; }

.doc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

/* ------------------------------------------------- workflow & comments */

.bill-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 4px; }
.ghost.danger-text { color: var(--red); border-color: #eeb4ae; }
.ghost.danger-text:hover { background: var(--red-bg); }

.thread { display: flex; flex-direction: column; gap: 10px; }

.cmt {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
  padding: 12px 15px;
}
.cmt.done { border-left-color: var(--green); opacity: .72; }
.cmt header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.cmt header .when { margin-left: auto; }
.cmt header .muted { text-transform: capitalize; }
.cmt p { margin: 8px 0 0; font-size: 13.5px; white-space: pre-wrap; }

.cmt-add {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 15px;
  margin-top: 12px;
}
.cmt-add textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 13.5px;
  resize: vertical;
}
.cmt-add textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.cmt-add-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 9px; }
.cmt-add-foot select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 13.5px;
  background: var(--panel);
}

/* ---------------------------------------------------------- crew picker
   Search sits above the typed fields: pick from the record, or type someone
   new. The result list is a list of buttons, so it works from the keyboard. */
.crew-pick { margin: 0 0 14px; }
.crew-pick .f { margin: 0; }

ul.crew-hits { list-style: none; margin: 6px 0 0; padding: 0;
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  max-height: 250px; overflow-y: auto; }
ul.crew-hits li + li { border-top: 1px solid var(--line); }
ul.crew-hits button { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  width: 100%; text-align: left; padding: 8px 10px; background: none;
  border: 0; cursor: pointer; font: inherit; color: inherit; }
ul.crew-hits button:hover,
ul.crew-hits button:focus-visible { background: var(--bg); outline: none; }
ul.crew-hits .muted { font-size: 12px; }

.from-record { margin: 0 0 12px; padding: 8px 10px; font-size: 13px;
  background: var(--bg); border-left: 3px solid var(--accent); border-radius: 4px; }
.from-record .tag { font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; font-weight: 600; margin-right: 6px; }

/* A leg of the form that needs a sentence of context before its fields. */
.leg-note { margin: -4px 0 10px; font-size: 12.5px; color: var(--muted); }
