/*
  Proflight cargo console.

  The palette is the handset app's, so an administrator looking at a package on screen
  and a loader looking at it in their hand see the same colours mean the same things:
  navy is Proflight's own (#154574, sampled from the supplied artwork), amber is an
  incomplete set, green is done, red is a problem.
*/
:root {
  --bg: #F1F3F8;
  --surface: #FFFFFF;
  --surface-2: #F5F6FA;
  --ink: #171A2B;
  --sub: #6B7186;
  --line: #E4E7F1;

  --navy: #154574;
  --navy-dark: #0F3459;
  --navy-soft: #E7EFF7;
  --gold: #FFCB0C;

  --green-ink: #137A4E;
  --green-soft: #E4F4EC;
  --amber-ink: #9C6206;
  --amber-soft: #FBF0DA;
  --red-ink: #B93A33;
  --red-soft: #FBEBEA;

  --radius: 10px;
  --sidebar: 232px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

[x-cloak] { display: none !important; }

/* ---------- sign in ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 380px;
}
.gate-logo { display: block; height: 26px; margin: 0 auto 20px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar { background: var(--navy); color: #fff; padding: 18px 14px; display: flex; flex-direction: column; }
/* A white-on-transparent copy of the artwork. The supplied PNG has an opaque
   white background, so a CSS filter turns it into a solid block on the navy. */
.sidebar img { height: 22px; margin: 4px 6px 22px; }
.nav-group { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #8FB0CC; margin: 14px 8px 6px; font-weight: 600; }
.nav-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  color: #D6E3EF; font-weight: 500; border: 0; background: none; width: 100%;
  text-align: left; font-size: 14px; font-family: inherit;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: #fff; color: var(--navy); font-weight: 700; }
.nav-count { font-size: 11px; font-weight: 700; opacity: .8; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.15); padding-top: 12px; }
.sidebar-user { font-size: 12.5px; color: #C3D6E7; padding: 0 8px 8px; }
.sidebar-user b { display: block; color: #fff; font-size: 14px; }

.main { padding: 26px 30px 60px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 6px; }
h1 { font-size: 23px; margin: 0; letter-spacing: -.2px; }
h2 { font-size: 16px; margin: 0 0 2px; }
.page-sub { color: var(--sub); margin: 0 0 18px; }

/* ---------- panels, tables, forms ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }

.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

label { display: block; font-size: 12px; font-weight: 600; color: var(--sub); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy-soft); border-color: var(--navy); }
.field-row { display: flex; gap: 8px; align-items: flex-end; }
.field-row > div { flex: 1; }

button { font: inherit; cursor: pointer; }
.btn {
  border: 1px solid transparent; border-radius: 8px; padding: 9px 15px;
  font-weight: 600; background: var(--navy); color: #fff;
}
.btn:hover { background: var(--navy-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--navy); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--red-soft); color: var(--red-ink); border-color: #F0CFCD; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--sub); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.table-scroll { overflow-x: auto; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--sub); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- status ---------- */
.pill { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; border: 1px solid; }
.pill.neutral { background: var(--surface-2); color: var(--sub); border-color: var(--line); }
.pill.navy { background: var(--navy-soft); color: var(--navy); border-color: #CFE0EF; }
.pill.green { background: var(--green-soft); color: var(--green-ink); border-color: #C7E7D6; }
.pill.amber { background: var(--amber-soft); color: var(--amber-ink); border-color: #EFDCB4; }
.pill.red { background: var(--red-soft); color: var(--red-ink); border-color: #F0CFCD; }

.note { border: 1px solid; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-weight: 500; }
.note.info { background: var(--navy-soft); color: var(--navy); border-color: #CFE0EF; }
.note.error { background: var(--red-soft); color: var(--red-ink); border-color: #F0CFCD; }
.note.warn { background: var(--amber-soft); color: var(--amber-ink); border-color: #EFDCB4; }
.note.success { background: var(--green-soft); color: var(--green-ink); border-color: #C7E7D6; }

/* Paging controls. Always rendered when there are rows, so the range on screen is
   stated even on a single page — the previous silent 200-row cap is the thing being
   designed out. */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
.pager .range { color: var(--sub); font-size: 13px; }

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

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15,19,48,.45); display: grid; place-items: center; padding: 20px; z-index: 40; }
.modal { background: var(--surface); border-radius: 14px; padding: 22px; width: 100%; max-width: 470px; max-height: 88vh; overflow: auto; }
.modal h2 { margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* The generated invite code is read aloud or typed by hand, so it is shown large and
   spaced. It is the only time the console ever displays a password. */
.code {
  font-family: var(--mono); font-size: 26px; letter-spacing: .18em; font-weight: 700;
  color: var(--navy); background: var(--navy-soft); border: 1px solid #CFE0EF;
  border-radius: 8px; padding: 12px; text-align: center;
}

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--sub); font-weight: 600; }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 2px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .dot { width: 22px; height: 22px; border-radius: 11px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--navy); }
.timeline .dot.removed { background: var(--red-ink); }
.sig { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
