/* ===========================================================================
   KaPow Platform — base
   ---------------------------------------------------------------------------
   Primitives shared by every page: reset, type, buttons, inputs, pills.
   Load AFTER tokens.css and BEFORE any page stylesheet.

   Rule of thumb: if a rule is only true on one page, it belongs in that page's
   stylesheet, not here.
   =========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Headings use the condensed face; body copy does not. */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.015em;
  margin: 0;
  line-height: 1.15;
}
h1 { font-size: 32px; }
h2 { font-size: 21px; letter-spacing: -.01em; }
h3 { font-size: 16px; letter-spacing: 0; }

p { margin: 0; }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: #FF7A8C; text-decoration: underline; }

/* Small uppercase label — the app's most repeated text style. */
.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }

/* -- buttons --------------------------------------------------------------
   Exactly one .btn-primary per screen. Destructive actions are .btn-danger,
   which is OUTLINED rather than filled — the brand is red, so a red fill has
   to mean "the main action" and nothing else, or the two become
   indistinguishable (they currently are: #dd1a32 vs #b91c1c).
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .13s ease, border-color .13s ease, color .13s ease;
}
.btn:hover { background: var(--surface-3); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary { background: var(--surface-2); border-color: var(--border-strong); }

.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-danger { background: transparent; border-color: var(--accent-line); color: var(--accent-ink); }
.btn-danger:hover { background: var(--accent-soft); }

.btn:disabled,
.btn[disabled] { background: var(--surface-2); border-color: var(--border-2); color: var(--ink-dim); cursor: not-allowed; }

/* -- forms ---------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 8px; }

.field-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-2);
  border-radius: 9px;
  background: var(--field);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13.5px;
}
.input::placeholder { color: var(--ink-dim); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }

/* Wrapper for an input with a leading icon and/or a trailing control. */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input-icon {
  position: absolute; left: 14px; display: flex; pointer-events: none; color: var(--ink-dim);
}
.input-wrap .input-icon ~ .input { padding-left: 41px; }
.input-wrap .input-action {
  position: absolute; right: 10px; border: 0; background: none; cursor: pointer;
  color: var(--ink-faint); font-family: var(--font); font-size: 10.5px; font-weight: 700;
  letter-spacing: .09em; padding: 6px;
}
.input-wrap .input-action:hover { color: var(--ink); }

/* -- status pills --------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 23px; padding: 0 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.pill-idle { background: var(--st-idle-soft); color: var(--ink-muted); }
.pill-wait { background: var(--st-wait-soft); color: var(--st-wait); }
.pill-sent { background: var(--st-sent-soft); color: var(--st-sent); }
.pill-city { background: var(--st-city-soft); color: var(--st-city); }
.pill-done { background: var(--st-done-soft); color: var(--st-done); }
.pill-late { background: var(--st-late-soft); color: var(--st-late); }

/* -- surfaces -------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

/* -- hero app bar -----------------------------------------------------------
   Logo left, page role in caps on the right, auth status trailing it --
   the same header shell across every dashboard (accounting's four pages,
   the PM dashboard, admin) so they all read as one product.
   ------------------------------------------------------------------------- */
.app-bar {
  position: sticky; top: 0; z-index: 20; flex-shrink: 0;
  display: flex; align-items: center; gap: 24px;
  height: 56px; padding: 0 40px;
  background: #000; box-shadow: 0 2px 0 var(--accent), 0 10px 30px rgba(0,0,0,.45);
}
.app-bar .brand { display: flex; align-items: center; flex-shrink: 0; }
.app-bar .brand-logo { display: block; height: 34px; width: auto; }
.app-bar .spacer { flex: 1 1 auto; }
.app-bar .role {
  font-family: var(--font-display); font-size: 18px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink); line-height: 1;
}
.app-bar .auth-status { font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; }
.app-bar .auth-status a { color: var(--accent-ink); }
.app-bar .auth-status a:hover { color: #FF7A8C; }

/* -- landing-page nav tiles ----------------------------------------------
   A dashboard home that's a decision, not a list -- e.g. Accounting Home's
   "what do you need to work on?" menu, now shared with budget.php's Kash
   home too. `.card--centered` centers the tiles as a measured pair rather
   than stretching them to the page edges. */
.lead { margin-bottom: 26px; font-size: 14px; color: var(--ink-muted); }
.card--centered { display: flex; flex-direction: column; justify-content: center; }
.card--centered .choice-grid,
.card--centered .lead { width: 100%; max-width: 1060px; margin-left: auto; margin-right: auto; }
.card--centered .lead { text-align: center; }

/* auto-fit rather than a fixed column count -- reads as a pair at 2 cards, a
   row of 3 once a 3rd is added, and still wraps cleanly on a narrow screen. */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.choice-card {
  display: block; padding: 28px 26px; border: 1px solid var(--border-2); border-radius: 13px;
  background: var(--surface-2); color: inherit; text-decoration: none; cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.choice-card:hover {
  border-color: var(--accent); background: var(--surface-3); transform: translateY(-1px); text-decoration: none;
}
.choice-ic { display: flex; margin-bottom: 15px; color: var(--accent); }
.choice-title { font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 6px; display: flex; align-items: center; }
.choice-desc { font-size: 13.5px; line-height: 1.55; color: var(--ink-muted); }

/* -- tabs ------------------------------------------------------------------
   Originally accounting-only; budget.php's Kash Payment Approvals table
   uses this same tab bar to switch between Subcontractor and Vendor. */
.tab-bar { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab-btn {
  padding: 0 0 12px;
  border: 0; background: none; cursor: pointer;
  font-family: var(--font); font-size: 13.5px; font-weight: 500;
  color: var(--ink-muted);
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }

/* -- modal -------------------------------------------------------------- */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 1200; background: rgba(0,0,0,.65);
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  padding: 24px; max-width: 440px; width: 100%; box-shadow: var(--shadow-lg); max-height: 88vh; overflow-y: auto;
}
.modal-title {
  font-family: var(--font-display); font-size: 18px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .02em; color: var(--ink); margin-bottom: 16px;
}
.modal-box .field-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-faint); margin: 12px 0 5px;
}
.modal-box .field-label:first-child { margin-top: 0; }
.modal-box input, .modal-box select {
  width: 100%; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--border-2);
  background: var(--field); color: var(--ink); font-size: 13.5px; font-family: inherit;
}
.modal-box input:focus, .modal-box select:focus { outline: none; border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* -- feedback -------------------------------------------------------------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  color: var(--accent-ink); font-size: 13px; line-height: 1.45;
}

/* Respect a reduced-motion preference rather than animating regardless. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
