/* ============================================================
   BOARD SYSTEM — design system
   Ported from the Sulubei Operations Console. Direction:
   institutional / infrastructure. Light, dense, built to be read
   across a boardroom table and to print.

   Chrome is greyscale. Colour is reserved for status, so anything
   coloured on this screen is telling you something.
   ============================================================ */

:root{
  /* surfaces */
  --canvas:#F4F5F6;
  --canvas-2:#EDEFF1;
  --surface:#FFFFFF;
  --surface-2:#FAFAFB;
  --surface-3:#F0F1F2;
  --sidebar:#36454F;
  --sidebar-2:#43535E;

  /* ---- rail ink -------------------------------------------------
     The sidebar background is user-settable, so everything drawn on
     it is a token. A light background flips these in the generated
     per-user stylesheet; nothing on the rail is a literal colour.
     --------------------------------------------------------------- */
  --rail-ink:#CBD2D6;
  --rail-ink-strong:#FFFFFF;
  --rail-ink-nav:#BCC9D9;
  --rail-ink-dim:#66788F;
  --rail-ink-muted:#7E8FA1;
  --rail-ink-muted-hover:#9FAEBC;
  --rail-ink-code:#A8B6C4;
  --rail-surface:rgba(255,255,255,.05);
  --rail-surface-2:rgba(255,255,255,.07);
  --rail-hover:rgba(255,255,255,.06);
  --rail-hover-soft:rgba(255,255,255,.04);
  --rail-line:rgba(255,255,255,.08);
  --rail-line-2:rgba(255,255,255,.09);
  --rail-mark-bg:#FFFFFF;
  --rail-mark-ink:#36454F;
  --rail-active-bg:#708090;
  --rail-active-ink:#FFFFFF;

  /* ink */
  --ink:#1F272C;
  --ink-2:#4C5860;
  --ink-3:#68727A;   /* 4.9:1 on white, 4.5:1 on canvas — passes AA at 10px */
  --ink-inv:#FFFFFF;

  /* structure */
  --line:#DFE2E4;
  --line-2:#EDEEF0;

  /* brand + status */
  --brand:#36454F;
  --brand-2:#708090;
  --brand-soft:#EBEEEF;
  --green:#0A6E4A;
  --green-bg:#E6F4EE;
  --amber:#8F5E00;
  --amber-bg:#FDF3E0;
  --red:#A82A1F;
  --red-bg:#FBEBE9;

  /* ---- button fills ----------------------------------------------
     Vertical, single-hue, and shallow: light stop on top, one step
     darker underneath, the way a real lit surface falls off. The old
     pairs swept 135° between two different hues, which is what made
     them read as decoration rather than as a material.

     Each pair still clears WCAG AA for white text against BOTH stops,
     not only the darker one — a gradient is only as readable as its
     palest point. Worst (lightest) stop per variant:
     primary 5.9 · danger 4.8 · success 5.5 · warning 4.6 · info 5.4.
     ----------------------------------------------------------------- */
  --grad-primary:linear-gradient(180deg,#5B52E8 0%,#4A3FD4 100%);
  --grad-primary-hover:linear-gradient(180deg,#6B62F0 0%,#584DDF 100%);
  --grad-primary-ring:rgba(91,82,232,.32);
  --grad-primary-cast:79,70,229;

  --grad-danger:linear-gradient(180deg,#CE3345 0%,#C81E3C 100%);
  --grad-danger-hover:linear-gradient(180deg,#D23E51 0%,#D62847 100%);
  --grad-danger-ring:rgba(224,55,75,.30);
  --grad-danger-cast:220,38,60;

  --grad-success:linear-gradient(180deg,#07845F 0%,#04684C 100%);
  --grad-success-hover:linear-gradient(180deg,#098762 0%,#057456 100%);
  --grad-success-ring:rgba(5,150,105,.30);
  --grad-success-cast:4,120,87;

  --grad-warning:linear-gradient(180deg,#B45309 0%,#96430A 100%);
  --grad-warning-hover:linear-gradient(180deg,#BE5A0C 0%,#A44B0B 100%);
  --grad-warning-ring:rgba(180,83,9,.30);
  --grad-warning-cast:180,83,9;

  --grad-info:linear-gradient(180deg,#11809E 0%,#0C6580 100%);
  --grad-info-hover:linear-gradient(180deg,#13819E 0%,#0F7291 100%);
  --grad-info-ring:rgba(17,128,158,.30);
  --grad-info-cast:14,116,144;

  /* The quiet default: sober rather than tinted. A pressed sheet of
     near-white with the board's own charcoal on it — the same slate the
     sidebar and headings already speak in, so a secondary action sits in
     the page's voice instead of borrowing the primary's colour. Nothing
     here competes with the filled variants above; that is the point. */
  --grad-neutral:linear-gradient(180deg,#FFFFFF 0%,#F1F3F5 100%);
  --grad-neutral-hover:linear-gradient(180deg,#FBFCFD 0%,#E7EAEE 100%);
  --neutral-ink:#36454F;
  --neutral-ink-hover:#1F272C;
  --neutral-line:#D5DBE0;
  --neutral-line-hover:#BAC3CB;

  /* ---- button elevation -------------------------------------------
     Two tight layers rather than one soft blur: a hairline contact
     shadow that keeps the edge crisp, and a short ambient one under
     it. Filled variants tint theirs with the button's own hue via
     --grad-*-cast, so the shadow looks cast by the button rather
     than by a grey object sitting where it is.
     ------------------------------------------------------------------ */
  --btn-shadow:
    var(--sheen),
    0 1px 1px rgba(16,24,40,.06),
    0 2px 4px -1px rgba(16,24,40,.10),
    0 4px 10px -4px rgba(16,24,40,.10);
  --btn-shadow-hover:
    var(--sheen),
    0 1px 2px rgba(16,24,40,.07),
    0 6px 12px -2px rgba(16,24,40,.13),
    0 14px 24px -10px rgba(16,24,40,.18);
  /* pressed: the sheet goes into the page, so the light on its top edge
     is gone and the shadow moves inside it */
  --btn-shadow-press:
    inset 0 2px 4px rgba(16,24,40,.16),
    inset 0 1px 1px rgba(16,24,40,.10);

  --radius-sm:8px;
  --radius:11px;
  --radius-lg:16px;

  /* ---- elevation ------------------------------------------------
     A material ladder rather than a single soft blur. Every step
     stacks three casts, which is what makes a surface read as a
     physical sheet lifted off the page instead of a rectangle with a
     grey smudge behind it:

       key      a tight, dark contact shadow that keeps the edge crisp
       penumbra the wider soft falloff that carries the sense of height
       ambient  a faint far spread, the light bouncing off the canvas

     Height is carried almost entirely by the penumbra's blur and
     offset; the key stays small at every step, because in real light a
     lifted object's contact shadow tightens as its soft one grows.
     Tinted toward the ink so cards sit on the canvas, not over white.
     --------------------------------------------------------------- */
  --shadow-sm:
    0 1px 1px rgba(31,39,44,.05),
    0 2px 4px -1px rgba(31,39,44,.07),
    0 1px 8px -4px rgba(31,39,44,.05);
  --shadow:
    0 1px 1.5px rgba(31,39,44,.05),
    0 4px 8px -2px rgba(31,39,44,.09),
    0 8px 20px -8px rgba(31,39,44,.10);
  --shadow-md:
    0 1px 2px rgba(31,39,44,.06),
    0 8px 16px -4px rgba(31,39,44,.11),
    0 18px 36px -12px rgba(31,39,44,.14);
  --shadow-lg:
    0 2px 4px rgba(31,39,44,.06),
    0 14px 28px -6px rgba(31,39,44,.14),
    0 32px 56px -20px rgba(31,39,44,.20);
  --ring-soft:0 0 0 1px rgba(31,39,44,.05);

  /* The lit top edge of a material sheet. Sits inside the surface, so
     it draws the catch of light on the bevel without adding a border. */
  --sheen:inset 0 1px 0 rgba(255,255,255,.9);
  --sheen-soft:inset 0 1px 0 rgba(255,255,255,.65);

  --sidebar-w:250px;

  /* type — Inter on screen for a refined, premium read; DejaVu and the
     metric-compatible fallbacks stay in the stack so print/PDF and any
     machine without Inter still land the same layout */
  --font-head:'Inter Tight','Inter','DejaVu Sans','Bitstream Vera Sans',Verdana,'Segoe UI',system-ui,sans-serif;
  --font-body:'Inter','DejaVu Sans','Bitstream Vera Sans',Verdana,'Segoe UI',system-ui,sans-serif;
  --font-mono:'DejaVu Sans Mono','Bitstream Vera Sans Mono','Liberation Mono',Consolas,ui-monospace,monospace;

  /* hand the tokens to Bootstrap so its own components inherit them */
  --bs-body-font-family:var(--font-body);
  --app-font-size:13.5px;
  --bs-body-font-size:var(--app-font-size);
  --bs-body-color:var(--ink);
  --bs-body-bg:var(--canvas);
  --bs-border-color:var(--line);
  --bs-primary:#36454F;
  --bs-link-color:#36454F;
  --bs-link-hover-color:#708090;
  --bs-focus-ring-color:rgba(112,128,144,.20);
}

*,*::before,*::after{box-sizing:border-box;}

body{
  background:var(--canvas);
  background-image:radial-gradient(1200px 600px at 100% -5%,rgba(112,128,144,.06),transparent 60%),
                   linear-gradient(180deg,var(--canvas) 0%,var(--canvas-2) 100%);
  background-attachment:fixed;
  color:var(--ink);
  font-family:var(--font-body);
  font-size:var(--app-font-size);
  letter-spacing:-.006em;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  text-rendering:optimizeLegibility;
  font-feature-settings:"cv05" 1,"ss01" 1;
}

.mono{
  font-family:var(--font-mono);
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum";
  letter-spacing:-.01em;
}

:focus-visible{outline:2px solid var(--brand-2);outline-offset:2px;border-radius:3px;}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important;}}

/* ---------- brand mark ---------- */
.brand-mark{
  width:34px;height:34px;border-radius:9px;background:var(--rail-mark-bg);color:var(--rail-mark-ink);
  font-family:var(--font-head);font-weight:700;font-size:17px;
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
  box-shadow:0 2px 6px -1px rgba(0,0,0,.25),inset 0 1px 0 rgba(255,255,255,.4);
}
.brand-text h1{
  font-family:var(--font-head);font-size:13px;font-weight:700;
  letter-spacing:.02em;color:var(--rail-ink-strong);margin:0;line-height:1.25;
}
.brand-text p{
  font-size:10.5px;color:var(--rail-ink-dim);margin:3px 0 0;letter-spacing:.01em;
}

/* ============================================================
   BUTTONS
   Gradient-filled. Every coloured variant carries white text on
   a pair of stops picked so the LIGHTER end still clears WCAG AA
   — a gradient is only as readable as its palest point.

   The default variant stays a quiet neutral wash on purpose: if
   every button shouted, the one that matters would not.
   ============================================================ */
.btn-board{
  position:relative;
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  font-family:inherit;font-size:13px;font-weight:600;
  letter-spacing:-.011em;line-height:1.2;
  padding:9px 16px;border-radius:10px;cursor:pointer;white-space:nowrap;
  background:var(--grad-neutral);color:var(--neutral-ink);
  border:1px solid var(--neutral-line);
  /* several of these are anchors — Export CSV, All teams, Tree — and
     Bootstrap underlines every <a>. A button is not a link. */
  text-decoration:none;
  box-shadow:var(--btn-shadow);
  /* the label's own edges, not the browser's greyscale default */
  -webkit-font-smoothing:antialiased;
  transition:background-image .18s ease,border-color .18s ease,box-shadow .2s ease,
             color .18s ease,transform .18s cubic-bezier(.2,.7,.3,1);
}
.btn-board:hover{
  background:var(--grad-neutral-hover);
  border-color:var(--neutral-line-hover);color:var(--neutral-ink-hover);
  box-shadow:var(--btn-shadow-hover);
  transform:translateY(-1px);
  text-decoration:none;
}
.btn-board:active{
  box-shadow:var(--btn-shadow-press);
  transform:translateY(0);
  transition-duration:.05s;
}
.btn-board:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px var(--grad-primary-ring),var(--btn-shadow);
}

/* ---- coloured variants ----
   No text-shadow: an embossed label is the single thing that dates a
   button fastest, and on a fill this dark it only blurs the type. The
   crispness comes from a hairline of light along the top edge instead,
   and from a shadow tinted with the button's own hue. */
.btn-board.primary,
.btn-board.danger,
.btn-board.success,
.btn-board.warning,
.btn-board.info{
  --btn-cast:16,24,40;
  color:#fff;border-color:transparent;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.20),
    0 1px 1px rgba(var(--btn-cast),.24),
    0 3px 6px -2px rgba(var(--btn-cast),.30),
    0 6px 14px -6px rgba(var(--btn-cast),.36);
}
.btn-board.primary:hover,
.btn-board.danger:hover,
.btn-board.success:hover,
.btn-board.warning:hover,
.btn-board.info:hover{
  color:#fff;border-color:transparent;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.24),
    0 2px 3px rgba(var(--btn-cast),.22),
    0 8px 16px -4px rgba(var(--btn-cast),.34),
    0 16px 28px -12px rgba(var(--btn-cast),.44);
}
.btn-board.primary:active,
.btn-board.danger:active,
.btn-board.success:active,
.btn-board.warning:active,
.btn-board.info:active{
  box-shadow:
    inset 0 2px 5px rgba(0,0,0,.28),
    inset 0 1px 2px rgba(0,0,0,.16);
}

.btn-board.primary{background:var(--grad-primary);--btn-cast:var(--grad-primary-cast);}
.btn-board.primary:hover{background:var(--grad-primary-hover);}
.btn-board.primary:focus-visible{box-shadow:0 0 0 3px var(--grad-primary-ring);}

.btn-board.danger{background:var(--grad-danger);--btn-cast:var(--grad-danger-cast);}
.btn-board.danger:hover{background:var(--grad-danger-hover);}
.btn-board.danger:focus-visible{box-shadow:0 0 0 3px var(--grad-danger-ring);}

.btn-board.success{background:var(--grad-success);--btn-cast:var(--grad-success-cast);}
.btn-board.success:hover{background:var(--grad-success-hover);}
.btn-board.success:focus-visible{box-shadow:0 0 0 3px var(--grad-success-ring);}

.btn-board.warning{background:var(--grad-warning);--btn-cast:var(--grad-warning-cast);}
.btn-board.warning:hover{background:var(--grad-warning-hover);}
.btn-board.warning:focus-visible{box-shadow:0 0 0 3px var(--grad-warning-ring);}

.btn-board.info{background:var(--grad-info);--btn-cast:var(--grad-info-cast);}
.btn-board.info:hover{background:var(--grad-info-hover);}
.btn-board.info:focus-visible{box-shadow:0 0 0 3px var(--grad-info-ring);}

.btn-board.block{width:100%;padding:12px 16px;font-size:13.5px;}
.btn-board:disabled,.btn-board.disabled{
  opacity:.45;cursor:not-allowed;transform:none;
  box-shadow:var(--btn-shadow);filter:saturate(.7);
}
.btn-board:disabled:hover,.btn-board.disabled:hover{transform:none;}

/* a square, icon-only button — the same surface as every other button,
   sized to sit flush beside a field rather than inside one */
.btn-board.icon{width:38px;height:38px;padding:0;flex-shrink:0;border-radius:10px;}

/* the compact row-action version — View / Edit / Delete in a table cell,
   an icon and a tooltip rather than a word, so a row of actions reads as
   one tidy cluster instead of a run of buttons competing for width.
   padding is repeated here, not left to .icon: .small carries its own
   padding at equal specificity and is declared later, so without this
   the icon would sit inside an 8×18px box instead of a centred 30×30
   one — this is what was clipping and off-centring it. */
.btn-board.icon.small{width:30px;height:30px;padding:0;border-radius:7px;}
.btn-board.icon.small .icon{width:15px;height:15px;}

@media (prefers-reduced-motion:reduce){
  .btn-board,.btn-board:hover,.btn-board:active{transition:none;transform:none;}
}

/* ---------- forms ---------- */
.f-label{
  display:block;font-size:11px;font-weight:600;letter-spacing:.05em;
  text-transform:uppercase;color:var(--ink-3);margin-bottom:6px;
}
.f-control{
  width:100%;font-family:inherit;font-size:13px;color:var(--ink);
  background:var(--surface);border:1px solid var(--line);
  border-radius:9px;padding:10px 12px;outline:none;
  /* a soft ambient shadow under the field, not just the inset groove, so it
     sits slightly raised off the panel rather than looking painted on */
  box-shadow:var(--shadow-sm),inset 0 1px 2px rgba(31,39,44,.03);
  transition:border-color .15s,box-shadow .15s,background .15s;
}
.f-control:hover{border-color:#CFD7E4;}
.f-control:focus{
  border-color:var(--brand-2);background:#fff;
  box-shadow:0 0 0 3px rgba(112,128,144,.16),var(--shadow),inset 0 1px 2px rgba(31,39,44,.02);
}
.f-control::placeholder{color:var(--ink-3);}
.f-control.is-invalid{border-color:var(--red);background:#FFFCFC;}
.f-control.is-invalid:focus{box-shadow:0 0 0 3px rgba(168,42,31,.12);}
select.f-control{
  appearance:none;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237C889C' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat:no-repeat;background-position:right 11px center;padding-right:32px;
}
/* "(optional)" sits inside an uppercase micro-label and must not inherit it */
.f-label .f-optional{
  text-transform:none;letter-spacing:0;font-weight:400;color:var(--ink-3);
}

/* a short muted note sitting on the same line as something else */
.hint-inline{font-size:11.5px;color:var(--ink-3);white-space:nowrap;}

/* a label paired with a value or a link on the same line */
.field-meta{
  display:flex;align-items:baseline;justify-content:space-between;gap:12px;
}
.field-meta a{font-size:11.5px;color:var(--brand);font-weight:600;text-decoration:none;}
.field-meta a:hover{text-decoration:underline;}

/* the red * that marks a field as required */
.req{color:var(--red);font-weight:700;margin-left:1px;}
.req-key{
  margin-right:auto;font-size:11.5px;color:var(--ink-3);
  display:inline-flex;align-items:center;gap:3px;
}

.field{margin-bottom:14px;}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:14px;}
.hint{font-size:11.5px;color:var(--ink-3);margin-top:6px;line-height:1.45;}
.f-error{font-size:11.5px;color:var(--red);margin-top:6px;font-weight:500;display:flex;gap:5px;align-items:flex-start;}

/* ---------- badges ---------- */
.badge-board{
  display:inline-flex;align-items:center;gap:5px;white-space:nowrap;
  font-size:11px;font-weight:600;padding:3px 9px;border-radius:7px;
  letter-spacing:.005em;box-shadow:inset 0 0 0 1px rgba(31,39,44,.03);
}
.badge-board.good{background:var(--green-bg);color:var(--green);}
.badge-board.warn{background:var(--amber-bg);color:var(--amber);}
.badge-board.crit{background:var(--red-bg);color:var(--red);}
.badge-board.primary{background:var(--brand-soft);color:var(--brand);}

/* batch code — reads as a stamped carton mark */
.stamp{
  display:inline-flex;align-items:center;font-family:var(--font-mono);
  font-size:11px;font-weight:600;letter-spacing:.01em;white-space:nowrap;
  color:var(--brand);background:var(--brand-soft);
  border:1px solid #CFD7E4;border-left:3px solid var(--brand);
  padding:3px 8px;border-radius:4px;
}

/* ---------- panels ---------- */
.panel{
  position:relative;
  background:linear-gradient(180deg,#FFFFFF 0%,var(--surface-2) 100%);
  border:1px solid var(--line);
  border-radius:var(--radius-lg);padding:20px 22px;margin-bottom:18px;
  /* sheen first: the lit top bevel of the sheet, then the elevation
     under it. Together they read as a card with thickness rather than
     an outlined rectangle. */
  box-shadow:var(--sheen),var(--shadow),var(--ring-soft);
  transition:box-shadow .22s ease,border-color .22s ease,transform .22s cubic-bezier(.2,.7,.3,1);
}
/* the sheet lifts as attention lands on it — the shadow grows and softens
   the way a real card's would if you raised it off the desk */
.panel:hover{
  box-shadow:var(--sheen),var(--shadow-md),var(--ring-soft);
  border-color:#D2D9DD;
  transform:translateY(-1px);
}
@media (prefers-reduced-motion:reduce){
  .panel,.panel:hover{transform:none;}
}
.panel-head{
  display:flex;align-items:flex-start;justify-content:space-between;
  gap:14px;flex-wrap:wrap;margin-bottom:16px;
}
.panel-title{
  font-family:var(--font-head);font-size:calc(var(--app-font-size) * 1.07);font-weight:650;
  letter-spacing:-.005em;color:var(--ink);
}
.panel-title span{
  display:block;font-family:var(--font-body);font-size:calc(var(--app-font-size) * .89);
  font-weight:400;color:var(--ink-3);margin:3px 0 0;letter-spacing:0;
  max-width:62ch;line-height:1.45;
}

/* ---------- status line ---------- */
.live-pill{
  display:inline-flex;align-items:center;gap:7px;
  background:var(--green-bg);color:var(--green);
  font-size:10.5px;font-weight:600;letter-spacing:.06em;
  padding:5px 11px;border-radius:99px;white-space:nowrap;
  font-family:var(--font-mono);
}
.live-dot{width:6px;height:6px;border-radius:50%;background:var(--green);animation:pulse 2.4s infinite;}
@keyframes pulse{0%,100%{opacity:1;}50%{opacity:.35;}}

/* ---------- icons ----------
   Every icon in the set carries .icon, so one lands at a sane size even in a
   component nobody wrote a rule for. An inline SVG with a viewBox and no
   width falls back to 300x150, which is how a missing rule shows up as a
   "broken" page rather than a slightly-off one. Component rules override. */
.icon{width:16px;height:16px;flex-shrink:0;display:inline-block;vertical-align:middle;}

/* an icon sitting on the text baseline inside a button or label */
.icon-inline{width:15px;height:15px;flex-shrink:0;}

/* compact variant, for action cells in dense tables */
.btn-board.small{padding:6px 11px;font-size:12px;border-radius:8px;}
