/* ============================================================
   TCFB Beacon — Stylesheet
   Brand palette (official): Mykonos Blue #004559 · French Blue #2b7aba
   Tangerine #de7a1c · Moss Green #69732b · Avocado #c7ba24
   Seaglass #c7e3cc · Driftwood #edf5db
   Type: Segoe UI system stack. Asset tags & IDs in monospace.
   ============================================================ */

:root {
  /* Brand */
  --mykonos: #004559;
  --mykonos-700: #00374a;
  --mykonos-300: #2a6678;
  --french: #2b7aba;
  --french-700: #1f5e92;
  --french-600: #2569a3;
  --tangerine: #de7a1c;
  --tangerine-600: #c66c14;
  --tangerine-050: #fcf2e6;
  --moss: #69732b;
  --avocado: #c7ba24;
  --avocado-050: #faf7e0;
  --seaglass: #c7e3cc;
  --seaglass-050: #eef7f0;
  --driftwood: #edf5db;

  /* Neutrals */
  --ink: #1a2327;
  --ink-2: #44525a;
  --ink-3: #6b7780;
  --line: #e3e8ec;
  --line-2: #eef1f4;
  --surface: #ffffff;
  --bg: #f5f8f3;

  /* Status / priority */
  --urgent: #c0392b;
  --urgent-bg: #fbecea;
  --high: #de7a1c;
  --high-bg: #fcf2e6;
  --medium: #2b7aba;
  --medium-bg: #e9f2f9;
  --low: #7c8893;
  --low-bg: #eef1f3;
  --ok: #4f7a3a;
  --ok-bg: #eaf3e4;

  --radius: 10px;
  --radius-sm: 7px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(0, 40, 55, 0.06), 0 1px 3px rgba(0, 40, 55, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 40, 55, 0.10);
  --mono: ui-monospace, "Cascadia Mono", "Consolas", "SF Mono", Menlo, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { color: var(--mykonos); margin: 0 0 0.4em; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- App bar ---------- */
.appbar {
  background: var(--mykonos);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.appbar__brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.appbar__logo { height: 30px; width: auto; display: block; }
.appbar__wordmark {
  color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 0.02em;
  border-left: 1px solid rgba(255,255,255,0.25); padding-left: 11px; line-height: 1;
}
.appbar__nav { display: flex; gap: 2px; margin-left: 6px; }
.navlink {
  color: rgba(255,255,255,0.78);
  font-size: 13.5px;
  font-weight: 500;
  padding: 18px 12px;
  position: relative;
  text-decoration: none;
  transition: color 0.12s ease;
}
.navlink:hover { color: #fff; text-decoration: none; }
.navlink.is-active { color: #fff; }
.navlink.is-active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0;
  height: 3px; background: var(--tangerine); border-radius: 3px 3px 0 0;
}
.appbar__user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.userchip {
  display: flex; align-items: center; gap: 9px; color: #fff;
  font-size: 13px; text-decoration: none;
}
.userchip:hover { text-decoration: none; }
.avatar {
  width: 31px; height: 31px; border-radius: 50%; background: var(--tangerine);
  color: #fff; font-size: 12px; font-weight: 700; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.userchip__meta { display: flex; flex-direction: column; line-height: 1.15; }
.userchip__name { font-weight: 600; }
.userchip__role { font-size: 11px; color: rgba(255,255,255,0.7); text-transform: capitalize; }
.btn-signout {
  color: rgba(255,255,255,0.8); font-size: 12.5px; border: 1px solid rgba(255,255,255,0.28);
  padding: 6px 12px; border-radius: var(--radius-sm); text-decoration: none; white-space: nowrap;
}
.btn-signout:hover { background: rgba(255,255,255,0.1); text-decoration: none; color: #fff; }

/* mobile nav toggle */
.navtoggle { display: none; background: none; border: 0; color: #fff; cursor: pointer; padding: 8px; }

/* ---------- Dev banner ---------- */
.devbanner {
  background: var(--avocado); color: #3a3500; text-align: center;
  font-size: 12.5px; font-weight: 600; padding: 5px 12px; letter-spacing: 0.01em;
}

/* ---------- Layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 22px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head__titles { min-width: 0; }
.page-head h1 { margin-bottom: 2px; }
.page-head__sub { color: var(--ink-3); font-size: 13.5px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; font-family: var(--sans);
  font-size: 13.5px; font-weight: 600; padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.2;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--tangerine); color: #fff; }
.btn--primary:hover { background: var(--tangerine-600); color: #fff; }
.btn--ghost { background: var(--surface); color: var(--mykonos); border-color: var(--line); }
.btn--ghost:hover { background: var(--line-2); }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 16px; }
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card__pad { padding: 18px 20px; }
.card__head {
  font-size: 11px; font-weight: 700; color: var(--ink-3); letter-spacing: 0.06em;
  text-transform: uppercase; padding: 13px 20px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

/* ---------- Stat tiles ---------- */
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--mykonos);
}
.stat--accent::before { background: var(--tangerine); }
.stat--warn::before { background: var(--avocado); }
.stat--alert::before { background: var(--urgent); }
.stat--ok::before { background: var(--ok); }
.stat__n { font-size: 1.85rem; font-weight: 700; color: var(--ink); line-height: 1; }
.stat__l { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.stat__sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

/* ---------- Tables / lists ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; font-weight: 700; color: var(--ink-3);
  letter-spacing: 0.05em; text-transform: uppercase; padding: 10px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.rowlink { color: inherit; text-decoration: none; }
.table tbody tr { transition: background 0.1s ease; }
.table tbody tr:hover { background: var(--seaglass-050); }

/* row with priority/status rail */
.railrow { position: relative; }
.railrow > td:first-child { position: relative; padding-left: 18px; }
.railrow > td:first-child::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 3px;
  background: var(--low);
}
.railrow.p-urgent > td:first-child::before { background: var(--urgent); }
.railrow.p-high > td:first-child::before { background: var(--high); }
.railrow.p-medium > td:first-child::before { background: var(--medium); }
.railrow.p-low > td:first-child::before { background: var(--low); }

/* ---------- Tags / pills ---------- */
.tag {
  font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--mykonos);
  background: var(--seaglass-050); border: 1px solid var(--seaglass); border-radius: var(--radius-sm);
  padding: 2px 8px; white-space: nowrap; letter-spacing: -0.02em;
}
.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap;
}
.pill--critical { background: var(--urgent-bg); color: var(--urgent); }
.pill--oos { background: var(--urgent-bg); color: var(--urgent); }
.pill--ok { background: var(--ok-bg); color: var(--ok); }
.pill--muted { background: var(--low-bg); color: var(--ink-2); }
.pill--info { background: var(--medium-bg); color: var(--french-600); }
.pill--warn { background: var(--avocado-050); color: #8a7d00; }
.pill--moss { background: #eef0e2; color: var(--moss); }

.pill-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill); }
.s-new { background: var(--urgent-bg); color: var(--urgent); }
.s-in_progress { background: var(--medium-bg); color: var(--french-600); }
.s-on_hold { background: var(--avocado-050); color: #8a7d00; }
.s-pending_approval { background: var(--avocado-050); color: #8a7d00; }
.s-closed { background: var(--ok-bg); color: var(--ok); }

/* ---------- Filter bar ---------- */
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.chip-filter {
  font-size: 12.5px; font-weight: 500; color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 6px 13px;
  cursor: pointer; text-decoration: none;
}
.chip-filter:hover { background: var(--line-2); text-decoration: none; }
.chip-filter.is-active { background: var(--mykonos); color: #fff; border-color: var(--mykonos); }
.searchbox {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px;
  font-size: 13.5px; font-family: var(--sans); min-width: 220px; color: var(--ink);
}
.searchbox:focus { outline: 2px solid var(--tangerine); outline-offset: 1px; border-color: var(--tangerine); }

/* ---------- Detail layout ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; }
.kv dt { color: var(--ink-3); font-size: 12.5px; }
.kv dd { margin: 0; font-size: 13.5px; color: var(--ink); }
.notes-block {
  background: var(--driftwood); border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: 13.5px; color: var(--ink-2); line-height: 1.55;
}
.backlink { font-size: 13px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 5px; margin-bottom: 12px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty__icon {
  width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 14px;
  background: var(--seaglass-050); display: flex; align-items: center; justify-content: center;
}
.empty h3 { color: var(--ink-2); }

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--mykonos) 0%, var(--mykonos-700) 60%, #002b39 100%);
  padding: 24px;
}
.login-card {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-md);
  width: 100%; max-width: 400px; padding: 38px 34px; text-align: center;
}
.login-card__logo { height: 58px; margin: 0 auto 8px; display: block; }
.login-card h1 { color: var(--mykonos); font-size: 1.5rem; margin-bottom: 4px; }
.login-card__tag { color: var(--ink-3); font-size: 13.5px; margin-bottom: 26px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 14.5px; }
.login-card__foot { margin-top: 22px; font-size: 12px; color: var(--ink-3); }
.ms-logo { width: 18px; height: 18px; }

/* ---------- Footer ---------- */
.foot {
  text-align: center; color: var(--ink-3); font-size: 12px; padding: 24px;
  border-top: 1px solid var(--line-2);
}

/* ---------- Utility ---------- */
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.gap-12 { gap: 12px; }
.section-gap { margin-top: 22px; }
.count-badge {
  font-size: 11px; font-weight: 700; color: var(--ink-3); background: var(--line-2);
  border-radius: var(--radius-pill); padding: 2px 9px;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .cards-4 { grid-template-columns: repeat(2, 1fr); }
  .cards-3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .appbar__nav {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    background: var(--mykonos-700); flex-direction: column; gap: 0; padding: 6px 0;
  }
  .appbar__nav.is-open { display: flex; }
  .navlink { padding: 13px 22px; }
  .navlink.is-active::after { left: 22px; right: auto; width: 24px; }
  .navtoggle { display: block; }
  .userchip__meta { display: none; }
}
@media (max-width: 520px) {
  .cards-4 { grid-template-columns: 1fr; }
  .wrap { padding: 18px 14px 50px; }
  .table-scroll { overflow-x: auto; }
}

/* ---------- Accessibility ---------- */
:focus-visible { outline: 2px solid var(--tangerine); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
