/* ----------------------------------------------------------------------
   Standard Construction — Compliance & Accounting Portal
   Palette: navy + slate + crisp white, professional/corporate
   Type: Inter + JetBrains Mono
   Status: traffic light (red/yellow/green) per client spec
---------------------------------------------------------------------- */

:root {
  /* Surfaces — clean, professional white with cool gray panels */
  --bg: #f4f6f9;
  --bg-elev: #ffffff;
  --bg-sunken: #e9edf2;
  --bg-panel: #f9fafc;

  /* Ink — cool navy-leaning grays */
  --ink: #0f1d33;
  --ink-2: #2a3a52;
  --ink-3: #5d6b7e;
  --ink-4: #95a0b0;

  /* Lines — soft cool grays */
  --line: #e1e6ee;
  --line-2: #c8d0db;
  --line-strong: #0f1d33;

  /* Brand accent — Standard Construction navy */
  --brand:        #1d33ad;
  --brand-deep:   #11226e;
  --brand-light:  #3a55d4;
  --brand-tint:   #dde3f6;
  --brand-tint-2: #eef1fb;
  --brand-red:    #c8262a;

  /* Status — Boyd's spec: bright yellow/red pop, light green recedes */
  --green:       #2f8d4f;
  --green-tint:  #e3f4e8;     /* light, easy on eye */
  --green-strong:#1f6e3a;
  --green-ink:   #144d27;

  --yellow:      #b27300;
  --yellow-tint: #ffd84a;     /* BRIGHT — needs to pop */
  --yellow-ink:  #4a3500;

  --red:         #b3201c;
  --red-tint:    #ff7a73;     /* BRIGHT — needs to pop */
  --red-ink:     #ffffff;     /* white text on red for readability */

  --grey:        #97a0ad;
  --grey-tint:   #e9ecf1;
  --grey-ink:    #4a5468;

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Sizing */
  --row-h: 40px;
  --radius: 6px;
  --radius-sm: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }

/* ---- Top header / app chrome ---- */
.appbar {
  display: flex;
  align-items: center;
  height: 60px;
  padding: 0 20px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 rgba(15, 29, 51, 0.02);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  width: 40px; height: 32px;
  background: transparent;
  display: block;
  background-image: url('assets/standard-logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.brand-mark.lg { width: 64px; height: 50px; }
.brand-mark.xl { width: 120px; height: 96px; }
.brand-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
}
.brand-divider { color: var(--ink-4); font-weight: 400; padding: 0 2px; }
.brand-sub { color: var(--ink-3); font-weight: 500; font-size: 13px; }

.appbar-spacer { flex: 1; }

/* Top nav (primary tabs) */
.topnav {
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 60px;
  margin-left: 20px;
}
.topnav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 60px;
  padding: 0 14px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.topnav a:hover { color: var(--ink); }
.topnav a.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

/* Search */
.search {
  display: flex; align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  height: 34px;
  width: 340px;
  color: var(--ink-3);
}
.search:focus-within {
  border-color: var(--brand);
  background: var(--bg-elev);
  box-shadow: 0 0 0 3px rgba(31, 58, 100, 0.08);
}
.search input {
  flex: 1; border: 0; background: transparent; outline: none;
  font: inherit; color: var(--ink);
}
.search input::placeholder { color: var(--ink-4); }
.search-clear {
  width: 20px; height: 20px;
  border: 0; background: var(--ink-4);
  color: #fff; font-size: 14px; line-height: 1;
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0; margin: 0;
  flex-shrink: 0;
  transition: background 0.15s;
}
.search-clear:hover { background: var(--ink-2); }
.search .kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
  background: var(--bg-elev);
}

/* Segmented toggle */
.seg {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px;
  height: 32px;
}
.seg button {
  border: 0; background: transparent;
  font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--ink-3);
  padding: 0 12px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.seg button.active {
  background: var(--bg-elev);
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 1px 1px rgba(15,29,51,0.06), 0 0 0 1px var(--line);
}
.seg button:hover:not(.active) { color: var(--ink); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  background: var(--bg-elev);
  color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn-primary {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn-ghost {
  background: transparent; border-color: transparent; color: var(--ink-2);
}
.btn-ghost:hover { background: var(--bg-sunken); }
.btn-danger {
  background: #fff; border-color: var(--red); color: var(--red);
}
.btn-danger:hover { background: var(--red-tint); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn-xs { height: 22px; padding: 0 7px; font-size: 11px; }

/* User chip */
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 8px 0 4px;
  height: 34px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink); font-size: 13px;
}
.user-chip:hover { background: var(--bg-sunken); }
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  font-family: var(--font-sans);
}

/* ---- Status ---- */
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.dot.green  { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red    { background: var(--red); }
.dot.grey   { background: transparent; border: 1px dashed var(--line-2); box-sizing: border-box; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 11px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.pill.green  { background: var(--green-tint);  color: var(--green-strong); }
.pill.yellow { background: var(--yellow-tint); color: var(--yellow); }
.pill.red    { background: var(--red-tint);    color: var(--red); }
.pill.grey   { background: var(--grey-tint);   color: var(--ink-3); }
.pill.brand  { background: var(--brand-tint);  color: var(--brand); }

.status-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}
.status-text.green  { color: var(--green-strong); }
.status-text.yellow { color: var(--yellow); }
.status-text.red    { color: var(--red); }

.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-3); }
.tiny  { font-size: 11px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
}

/* ---- Card / panel ---- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---- Footer attribution ---- */
.attribution {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.02em;
}
.attribution b { color: var(--ink-3); font-weight: 600; }

/* ---- Tooltip-style popover ---- */
.popover {
  position: absolute;
  background: var(--ink);
  color: #fff;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.4;
  width: 260px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.12);
  z-index: 100;
}
.popover .pop-head {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 4px;
}
.popover .pop-actions {
  margin-top: 10px;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.popover .pop-actions .btn {
  height: 24px; padding: 0 8px; font-size: 11px;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  color: #fff;
}
.popover .pop-actions .btn:hover { background: rgba(255,255,255,0.2); }

/* ---- Drawer (sub detail) ---- */
.drawer-back {
  position: fixed; inset: 0;
  background: rgba(15, 29, 51, 0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms;
}
.drawer-back.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 720px; max-width: 100vw;
  background: var(--bg);
  border-left: 1px solid var(--line);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }

/* ---- Scrollbars ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---- Modal ---- */
.modal-back {
  position: fixed; inset: 0;
  background: rgba(15, 29, 51, 0.4);
  z-index: 300;
  display: grid; place-items: center;
}
.modal {
  background: var(--bg-elev);
  border-radius: var(--radius);
  width: 480px; max-width: 92vw;
  padding: 24px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
}
.modal h3 {
  margin: 0 0 6px; font-size: 17px; font-weight: 600;
  letter-spacing: -0.01em;
}
.modal p { color: var(--ink-2); font-size: 13.5px; margin: 0 0 16px; line-height: 1.5; }
