/*
 * Gatish console.
 *
 * Hand-written rather than generated, for two reasons: there is no build step to run on
 * a server, and a console this dense is easier to control directly than through utility
 * classes. The design tokens are the same ones the apps use — one product, one palette.
 *
 * The look is deliberately SOFTWARE, not website. Tight rows, real tables, tabular
 * figures, no hero sections. An owner reconciling a day's takings needs density, not air.
 */

:root {
  --ink: #12244C;
  --ink-raised: #1B3160;
  --ink-soft: #22396B;
  --signal: #F26A21;
  --signal-soft: #FDEEE3;
  --signal-text: #A34B0D;

  --paper: #F3F5FA;
  --surface: #FFFFFF;
  --line: #E2E7F1;
  --line-2: #D5DDEA;
  --line-3: #C7D0E0;

  --t1: #12244C;
  --t2: #4E5A72;
  --t3: #8792A8;
  --on-ink-muted: #93A2BE;
  --on-ink-soft: #D6DEEC;

  --in: #12805C;
  --in-soft: #E3F2EA;
  --in-text: #0A5C40;
  --due: #B5730A;
  --due-soft: #FBF0DC;
  --due-text: #8A5606;
  --out: #C4271B;
  --out-soft: #FBE9E7;
  --out-text: #93190F;

  --info: #16336E;
  --info-soft: #E8EDF7;

  --r-sm: 4px;
  --r-md: 7px;
  --r-lg: 10px;

  --sidebar: 216px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: Archivo, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--t1);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* Money and counts must line up down a column or nobody can scan them. */
.num, td.num, th.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.shell { display: flex; min-height: 100vh; }

.side {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}

.side-brand .mark {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--signal);
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px;
}

.side-brand .name { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; }
.side-brand .sub { font-size: 10px; letter-spacing: 1.4px; color: var(--on-ink-muted); font-weight: 700; }

.side-biz {
  padding: 11px 16px;
  border-bottom: 1px solid var(--ink-soft);
  font-size: 12.5px;
}
.side-biz strong { display: block; font-size: 13.5px; }
.side-biz span { color: var(--on-ink-muted); font-size: 11px; }

.side-nav { padding: 8px 0; overflow-y: auto; flex: 1; }

.side-nav .group {
  padding: 12px 16px 5px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.9px;
  color: var(--on-ink-muted);
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  color: var(--on-ink-soft);
  font-size: 13px;
  border-left: 2px solid transparent;
}
.side-nav a:hover { background: var(--ink-raised); text-decoration: none; color: #fff; }
.side-nav a.on {
  background: var(--ink-raised);
  color: #fff;
  border-left-color: var(--signal);
  font-weight: 600;
}
.side-nav a .badge {
  margin-left: auto;
  background: var(--signal);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.side-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--ink-soft);
  font-size: 11.5px;
  color: var(--on-ink-muted);
}
.side-foot a { color: var(--on-ink-soft); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -0.2px; }
.topbar .spacer { flex: 1; }

.content { padding: 18px 20px 40px; }

/* ---- cards and stats --------------------------------------------------- */

.grid { display: grid; gap: 12px; }
.grid.k2 { grid-template-columns: repeat(2, 1fr); }
.grid.k3 { grid-template-columns: repeat(3, 1fr); }
.grid.k4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1100px) {
  .grid.k4 { grid-template-columns: repeat(2, 1fr); }
  .grid.k3 { grid-template-columns: repeat(2, 1fr); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.card-head {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-head h2 { margin: 0; font-size: 13px; font-weight: 700; }
.card-head .spacer { flex: 1; }
.card-body { padding: 14px; }

.stat { padding: 13px 14px; }
.stat .label {
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.8px; color: var(--t3);
  text-transform: uppercase;
}
.stat .value {
  font-size: 24px; font-weight: 700; letter-spacing: -0.7px; margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.stat .caption { font-size: 11.5px; color: var(--t3); margin-top: 2px; }
.stat .value.in { color: var(--in); }
.stat .value.due { color: var(--due); }
.stat .value.out { color: var(--out); }

/* ---- tables ------------------------------------------------------------ */

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }

table.data th {
  text-align: left;
  padding: 8px 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  color: var(--t3);
  text-transform: uppercase;
  white-space: nowrap;
  position: sticky;
  top: 52px;
}

table.data td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data tbody tr:hover { background: #FAFBFE; }
table.data tbody tr:last-child td { border-bottom: 0; }

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

.reg {
  font-weight: 700;
  letter-spacing: 0.6px;
  font-variant-numeric: tabular-nums;
}

.muted { color: var(--t3); }
.small { font-size: 11.5px; }

/* ---- chips ------------------------------------------------------------- */

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.chip.in   { background: var(--in-soft);   color: var(--in-text); }
.chip.due  { background: var(--due-soft);  color: var(--due-text); }
.chip.out  { background: var(--out-soft);  color: var(--out-text); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.grey { background: var(--paper);     color: var(--t2); }

/* ---- buttons and forms ------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--t1);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--paper); text-decoration: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-raised); }
.btn.danger { color: var(--out-text); border-color: #F0C4BF; }
.btn.sm { padding: 4px 9px; font-size: 12px; }

input[type=text], input[type=tel], input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--t1);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--ink);
  outline-offset: -1px;
  border-color: var(--ink);
}

label.field { display: block; margin-bottom: 12px; }
label.field .lbl {
  display: block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--t3);
  text-transform: uppercase;
  margin-bottom: 5px;
}

.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.row > .fixed { flex: 0 0 auto; min-width: 0; }
/* A row whose two halves push apart — label on the left, action on the right. */
.row.between { justify-content: space-between; align-items: center; flex-wrap: nowrap; }
.row.between > * { flex: 0 1 auto; min-width: 0; }

/* The sentence under a field that says what the value actually does. Not a placeholder:
   placeholders vanish the moment someone types, which is exactly when they were reading. */
.hint {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--t3);
}

/* ---- notices ----------------------------------------------------------- */

.notice {
  padding: 11px 13px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.notice.due  { background: var(--due-soft);  color: var(--due-text);  border: 1px solid #EDD5A8; }
.notice.out  { background: var(--out-soft);  color: var(--out-text);  border: 1px solid #F0C4BF; }
.notice.in   { background: var(--in-soft);   color: var(--in-text);   border: 1px solid #BFE0C8; }
.notice.info { background: var(--info-soft); color: var(--info);      border: 1px solid #CBD8EE; }

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--t3);
}
.empty strong { display: block; color: var(--t2); font-size: 14px; margin-bottom: 4px; }

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

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--ink);
  padding: 24px;
}
/* Sign-in is one narrow column; registration needs a wider one, so the width is a
   modifier rather than a number repeated inline on every card. */
.login-card.wide { max-width: 100%; }
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 14px;
  padding: 28px;
}
.login-brand { color: #fff; text-align: center; margin-bottom: 22px; }
.login-brand .name { font-size: 34px; font-weight: 700; letter-spacing: -1px; }
.login-brand .sub { font-size: 12px; color: var(--on-ink-muted); letter-spacing: 2px; font-weight: 700; }

.otp-input {
  text-align: center;
  font-size: 26px !important;
  font-weight: 700;
  letter-spacing: 10px;
}

/* ---- print ------------------------------------------------------------- */

@media print {
  .side, .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .card { border: 0; }
}
