/* =====================================================================
   Fireflies OS — house style
   Navy bands with white type, gold hairlines, ledger paper, figures set
   in tabular mono so columns of dirhams line up the way they should.
   ===================================================================== */

:root {
  --navy-900: #071528;
  --navy-800: #0B1F3A;
  --navy-700: #142F52;
  --navy-600: #24466F;
  --navy-100: #E7EBF2;

  --gold-600: #A8842F;
  --gold-500: #C8A24A;
  --gold-300: #E4C978;
  --gold-050: #FBF3DF;

  --paper:    #FBFAF7;
  --card:     #FFFFFF;
  --rule:     #E2E6EE;
  --rule-soft:#EFF2F6;

  --ink:      #1C2430;
  --ink-soft: #4A5666;
  --muted:    #7A8798;

  --neg:      #9B2C2C;
  --pos:      #1F6F52;
  --warn:     #A8660B;

  --shadow-sm: 0 1px 2px rgba(11,31,58,.06), 0 1px 1px rgba(11,31,58,.04);
  --shadow-md: 0 2px 4px rgba(11,31,58,.05), 0 8px 24px rgba(11,31,58,.07);

  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --rail: 244px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.01em; }

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -.02em;
}
.neg { color: var(--neg); }
.pos { color: var(--pos); }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--navy-700); }

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

.rail {
  width: var(--rail); flex: 0 0 var(--rail);
  background: var(--navy-900);
  color: #DDE4EE;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.brand { padding: 22px 20px 18px; border-bottom: 1px solid rgba(200,162,74,.22); }
.brand .mark { display: flex; align-items: center; gap: 10px; }
.brand .glow {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold-300);
  box-shadow: 0 0 0 3px rgba(228,201,120,.16), 0 0 14px 2px rgba(228,201,120,.5);
  animation: pulse 3.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .55; box-shadow: 0 0 0 3px rgba(228,201,120,.10), 0 0 10px 1px rgba(228,201,120,.35); }
  50%      { opacity: 1;   box-shadow: 0 0 0 4px rgba(228,201,120,.18), 0 0 18px 3px rgba(228,201,120,.6); }
}
.brand h1 { font-size: 17px; color: #fff; letter-spacing: .01em; }
.brand .sub {
  font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--gold-300); margin-top: 5px; padding-left: 19px;
}

.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav .group {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: #6C7E96; padding: 14px 10px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 5px;
  color: #C6D0DE; text-decoration: none; font-size: 14px;
  border-left: 2px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.on {
  background: rgba(200,162,74,.13);
  color: #fff; border-left-color: var(--gold-500);
}
.nav .ico { width: 16px; text-align: center; opacity: .82; font-size: 13px; }

.rail-foot {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px; color: #8494A8;
}
.rail-foot strong { color: #E6EBF2; font-weight: 500; display: block; }

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

.topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 26px 34px 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.topbar h2 { font-size: 25px; }
.topbar .eyebrow {
  font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--gold-600); margin-bottom: 6px; font-family: var(--sans); font-weight: 600;
}
.topbar .aside { font-size: 12.5px; color: var(--muted); text-align: right; }

.view { padding: 26px 34px 60px; max-width: 1240px; }

/* ------------------------------------------------------------------ */
/* Cards and tables                                                    */
/* ------------------------------------------------------------------ */
.card {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 4px; box-shadow: var(--shadow-sm);
  margin-bottom: 22px; overflow: hidden;
}
.card > header {
  padding: 13px 18px; border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card > header h3 { font-size: 15.5px; }
.card > header .hint { font-size: 12px; color: var(--muted); }
.card .body { padding: 18px; }
.card .body.flush { padding: 0; }

table { width: 100%; border-collapse: collapse; }

/* Column headings: navy band, white type. */
thead th {
  background: var(--navy-800); color: #fff;
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  text-align: left; padding: 10px 14px;
  border-bottom: 2px solid var(--gold-500);
  white-space: nowrap;
}
thead th.r { text-align: right; }
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--rule-soft); font-size: 14px; }
tbody td.r { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FCFCFA; }
tfoot td {
  padding: 11px 14px; font-weight: 600;
  border-top: 2px solid var(--navy-800); background: #F8F9FB; font-size: 14px;
}
tfoot td.r { text-align: right; }

.sub { font-size: 12px; color: var(--muted); }
.name { font-weight: 500; }

/* ------------------------------------------------------------------ */
/* The five-number brief                                               */
/* ------------------------------------------------------------------ */
.brief { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin-bottom: 24px;
  background: var(--card); border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: var(--shadow-sm); overflow: hidden; }
.brief .cell { padding: 16px 18px; border-right: 1px solid var(--rule-soft); }
.brief .cell:last-child { border-right: 0; }
.brief .k {
  font-size: 10px; letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.brief .v { font-size: 21px; font-weight: 500; }
.brief .v .cur { font-size: 11px; color: var(--muted); margin-right: 3px; letter-spacing: .04em; }
.brief .note { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ------------------------------------------------------------------ */
/* Signature: the allocation ribbon                                    */
/* ------------------------------------------------------------------ */
.ribbon-wrap { padding: 4px 0 2px; }
.ribbon {
  display: flex; height: 62px; border-radius: 3px; overflow: hidden;
  border: 1px solid var(--navy-800);
}
.ribbon .seg {
  position: relative; display: flex; flex-direction: column;
  justify-content: center; padding: 0 12px; color: #fff;
  transition: flex-grow .5s cubic-bezier(.22,.8,.3,1);
  overflow: hidden; min-width: 0;
}
.ribbon .seg + .seg { border-left: 1px solid rgba(255,255,255,.22); }
.ribbon .seg .pct {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; opacity: .82;
}
.ribbon .seg .who {
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.ribbon .seg .amt { font-size: 14px; margin-top: 1px; }
.seg-finder   { background: var(--gold-600); flex-grow: 15; }
.seg-executor { background: var(--navy-600); flex-grow: 30; }
.seg-ops      { background: var(--navy-700); flex-grow: 5;  }
.seg-pool     { background: var(--navy-900); flex-grow: 50; }
.ribbon .seg.faded { opacity: .55; }

.ribbon-legend {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 9px; font-size: 12px; color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Forms                                                               */
/* ------------------------------------------------------------------ */
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }

label.f { display: block; }
label.f .lbl {
  display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 5px; font-weight: 600;
}
input[type=text], input[type=number], input[type=date], input[type=email], select, textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid #CFD6E0; border-radius: 3px; background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--gold-500); outline-offset: -1px; border-color: var(--gold-500);
}
input.money { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 3px; cursor: pointer;
  border: 1px solid var(--navy-800); background: var(--navy-800); color: #fff;
  font-weight: 500; font-size: 14px;
}
.btn:hover { background: var(--navy-700); }
.btn.ghost { background: #fff; color: var(--navy-800); }
.btn.ghost:hover { background: var(--navy-100); }
.btn.gold { background: var(--gold-600); border-color: var(--gold-600); }
.btn.gold:hover { background: var(--gold-500); }
.btn:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 2px; }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }

/* ------------------------------------------------------------------ */
/* Tags                                                                */
/* ------------------------------------------------------------------ */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 2px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  border: 1px solid var(--rule); background: #F7F9FB; color: var(--ink-soft);
  white-space: nowrap;
}
.tag.gold { background: var(--gold-050); border-color: #E8D7A6; color: var(--gold-600); }
.tag.navy { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.tag.pos  { background: #EAF5F0; border-color: #BFDECF; color: var(--pos); }
.tag.neg  { background: #FBEDED; border-color: #EBC8C8; color: var(--neg); }
.tag.warn { background: #FCF3E4; border-color: #EDD9B4; color: var(--warn); }

.stage-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-bar .step {
  flex: 1; min-width: 108px; padding: 9px 11px; border-radius: 3px;
  border: 1px solid var(--rule); background: #fff; text-align: center;
}
.stage-bar .step .n { font-size: 19px; font-weight: 500; }
.stage-bar .step .l { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.stage-bar .step.hot { border-color: var(--gold-500); background: var(--gold-050); }

.note-strip {
  border-left: 3px solid var(--gold-500); background: var(--gold-050);
  padding: 10px 14px; font-size: 13px; margin-bottom: 14px; border-radius: 0 3px 3px 0;
}
.note-strip.audit { border-left-color: var(--navy-600); background: #F4F7FB; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty h4 { font-size: 16px; color: var(--ink); margin-bottom: 6px; }

.bar-track { height: 6px; background: var(--navy-100); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--navy-600); }
.bar-fill.gold { background: var(--gold-500); }
.bar-fill.over { background: var(--neg); }

.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 90;
  background: var(--navy-900); color: #fff; padding: 12px 18px;
  border-radius: 3px; border-left: 3px solid var(--gold-500);
  box-shadow: var(--shadow-md); font-size: 14px;
  animation: rise .28s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------------ */
/* Responsive — the partners will open this on a phone at a client site */
/* ------------------------------------------------------------------ */
@media (max-width: 1080px) {
  .brief { grid-template-columns: repeat(2, 1fr); }
  .brief .cell { border-bottom: 1px solid var(--rule-soft); }
  .grid.c4 { grid-template-columns: repeat(2, 1fr); }
  .grid.c3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .rail {
    width: 100%; flex: none; height: auto; position: static;
    flex-direction: row; align-items: center; overflow-x: auto;
  }
  .brand { border-bottom: 0; border-right: 1px solid rgba(200,162,74,.22); padding: 12px 14px; flex: none; }
  .brand .sub, .rail-foot { display: none; }
  .nav { display: flex; padding: 6px; gap: 3px; }
  .nav .group { display: none; }
  .nav a { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; }
  .nav a.on { border-left: 0; border-bottom-color: var(--gold-500); }
  .topbar, .view { padding-left: 16px; padding-right: 16px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .brief { grid-template-columns: 1fr; }
  .table-scroll { overflow-x: auto; }
  .ribbon { height: 96px; flex-direction: column; }
  .ribbon .seg + .seg { border-left: 0; border-top: 1px solid rgba(255,255,255,.22); }
  .ribbon .seg { flex-direction: row; align-items: center; gap: 10px; }
  .ribbon .seg .amt { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .rail, .btn { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; page-break-inside: avoid; }
  thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
