/* LBC tool — base stylesheet from the MVP kit.
   Arial only, by instruction. Quiet by intention: one accent colour, generous
   space, no shadows, no gradients, nothing that moves. A tool people open every
   Monday morning should not shout at them. */

:root {
  /* LBC primaries */
  --navy: #18455D;
  --berg: #32778F;
  --ink:  #3C3C3B;

  --paper:   #FFFFFF;
  --canvas:  #F4F6F7;
  --line:    #DCE3E7;
  --line-soft: #EBEFF2;
  --muted:   #6A757C;

  --ok:   #2E6B54;  --ok-bg:  #EDF4F1;
  --err:  #9E3B33;  --err-bg: #FAEFED;

  --font: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  overflow-wrap: anywhere;   /* no text can ever run out of its box, whatever is typed */
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
}

h1, h2 { color: var(--navy); font-weight: bold; margin: 0; }
h1 { font-size: 22px; letter-spacing: -0.01em; }
h2 { font-size: 14px; letter-spacing: 0.02em; }

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

/* ---------------- the wordmark ----------------
   Set, not an image: one less request, and it stays crisp at any size. */
.wordmark {
  font-size: 14px; font-weight: bold; color: var(--navy);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.wordmark .sub, .brand .sub {
  font-weight: normal; text-transform: none; letter-spacing: 0;
  color: var(--muted);
}
.brand { margin-bottom: 26px; }
.brand .sub { display: block; font-size: 13px; margin-top: 2px; }

/* Environment badge: rendered only when config 'environment' is not production. */
.env-badge {
  display: inline-block; margin-top: 8px; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: bold; letter-spacing: .08em; text-transform: uppercase;
  background: var(--a-bg, #FBEFD6); color: var(--a-fg, #7A4F00);
}
.side .env-badge { display: block; width: max-content; margin: -8px 20px 16px; }

/* ---------------- centred auth screens ---------------- */
body.auth {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh; padding: 28px 18px;
}
.card, .notice {
  width: 100%; max-width: 420px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 32px 34px 30px;
}
.card h1 { margin-bottom: 6px; }
.foot {
  max-width: 420px; width: 100%;
  margin: 14px 0 0; padding: 0 4px;
  font-size: 12px; color: var(--muted);
}

body.plain {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 28px 18px;
}

p.lead { margin: 0 0 20px; color: var(--ink); }
p.hint { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------------- forms ---------------- */
label {
  display: block;
  margin: 18px 0 5px;
  font-size: 12.5px; font-weight: bold; color: var(--navy);
}
input[type="email"], input[type="password"], input[type="text"] {
  display: block; width: 100%;
  padding: 9px 11px;
  font-family: var(--font); font-size: 15px; color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0;
}
input:hover { border-color: #C3CDD3; }
input:focus {
  outline: none;
  border-color: var(--berg);
  /* A ring rather than a glow: visible, calm, and it does not shift layout. */
  box-shadow: 0 0 0 2px rgba(50, 119, 143, 0.18);
}

/* The one-time code: wide spacing, because it is read off a phone digit by digit. */
input.code {
  font-size: 22px; letter-spacing: 0.34em;
  text-align: center; padding: 11px 11px;
  font-variant-numeric: tabular-nums;
}

/* Scoped to the signed-out screens. Unscoped, this full-width rule leaked onto
   every .btn.primary in the application and stretched them across their row. */
body.auth button.primary, body.plain button.primary {
  display: block; width: 100%;
  margin-top: 24px; padding: 11px 14px;
  font-family: var(--font); font-size: 15px; font-weight: bold;
  color: #FFFFFF; background: var(--navy);
  border: 1px solid var(--navy); border-radius: 0;
  cursor: pointer;
}
body.auth button.primary:hover { background: #123646; border-color: #123646; }
body.auth button.primary:focus-visible { outline: 2px solid var(--berg); outline-offset: 2px; }

/* ---------------- messages ---------------- */
p.ok, p.bad {
  margin: 0 0 18px; padding: 9px 12px;
  font-size: 13.5px; border-left: 3px solid;
}
p.ok  { color: var(--ok);  background: var(--ok-bg);  border-color: var(--ok); }
p.bad { color: var(--err); background: var(--err-bg); border-color: var(--err); }

/* ---------------- the enrolment QR ----------------
   Rendered on our own server as inline SVG. Sending a 2FA seed to an external
   QR service would hand a second factor to a third party. */
.qr-wrap {
  margin: 14px 0 0;
  padding: 14px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  text-align: center;
}
svg.qr {
  display: block;
  width: 224px; height: 224px;
  max-width: 100%;
  margin: 0 auto;
  /* Modules must stay square-edged or a camera struggles at small sizes. */
  image-rendering: pixelated;
}

.fallback { margin-top: 12px; }
.fallback summary {
  font-size: 12.5px; color: var(--berg); cursor: pointer;
}
.fallback summary:hover { text-decoration: underline; }
.fallback[open] summary { margin-bottom: 4px; }

/* ---------------- the enrolment key ---------------- */
.key {
  margin: 12px 0 0; padding: 12px 14px;
  background: var(--canvas); border: 1px solid var(--line);
  font-size: 16px; font-weight: bold; letter-spacing: 0.12em;
  color: var(--navy); word-break: break-all;
  /* Selectable in one gesture, since it gets copied into a phone. */
  user-select: all;
}

.card h2 {
  margin: 30px 0 0; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.card h2:first-of-type { margin-top: 26px; }

/* ================================================================
   The application shell
   Layout, colour and spacing follow the design handoff. The typeface is
   Arial by instruction, so the handoff's Montserrat scale is set in Arial;
   sizes are nudged slightly where Arial's larger x-height needed it.
   ================================================================ */

:root {
  --ink-muted: #54636b;
  --ink-soft:  #75838a;
  --ink-faint: #9aa6ac;
  --card-border: #e2e7ea;
  --divider: #f0f3f4;
  --divider-soft: #f6f8f9;
  --hover-row: #f5f8f9;
  --subtle: #f2f5f6;

  --side: #18455d;
  --side-chip: #22566f;
  --side-chip-hover: #2a6482;
  --side-rule: #2a5c76;
  --side-text: #c3d7e0;
  --side-label: #7ea3b5;

  --g-fg: #2e7d5b;  --g-bg: #e6f1eb;
  --a-fg: #c08a2e;  --a-bg: #fbf2e2;
  --r-fg: #b3312c;  --r-bg: #fbe9e8;
  --b-fg: #18455d;  --b-bg: #e7f0f4;
}

body.app { background: var(--canvas); }
body.app .shell { display: flex; min-height: 100vh; align-items: flex-start; }

/* ---------------- sidebar ---------------- */
/* Sticky and viewport-tall so the logged-in user block at its foot is always
   visible, however far the page scrolls. The middle (nav) scrolls
   on its own when it runs long. */
.side {
  width: 228px; flex: none;
  background: var(--side);
  padding: 22px 0 18px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.side .logo { height: 52px; padding: 0 20px 22px; opacity: .96; object-fit: contain; object-position: left; }
.side-label {
  padding: 0 20px 7px;
  font-size: 9.5px; font-weight: bold; letter-spacing: .12em; text-transform: uppercase;
  color: var(--side-label);
}

.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 14px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500; color: var(--side-text); text-decoration: none;
}
.side-nav a:hover { background: var(--side-chip); text-decoration: none; }
.side-nav a.on { background: #fff; color: var(--side); font-weight: bold; }
.side-nav .ico {
  width: 15px; height: 15px; flex: none;
  border: 1.5px solid currentColor; border-radius: 3px;
}
/* Icons drawn, not fetched — keeps the page free of extra requests. */
.side-nav .ico-list {
  background:
    linear-gradient(currentColor, currentColor) no-repeat 2px 3px / 7px 1.5px,
    linear-gradient(currentColor, currentColor) no-repeat 2px 7px / 5px 1.5px;
}
.side-nav .ico-grid {
  background:
    linear-gradient(currentColor, currentColor) no-repeat 2.5px 2.5px / 3.5px 3.5px,
    linear-gradient(currentColor, currentColor) no-repeat 8px 2.5px / 3.5px 3.5px,
    linear-gradient(currentColor, currentColor) no-repeat 2.5px 8px / 3.5px 3.5px,
    linear-gradient(currentColor, currentColor) no-repeat 8px 8px / 3.5px 3.5px;
}
/* Scrollable middle: primary nav. */
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }

.side-user {
  display: flex; align-items: center; gap: 9px;
  margin: 0 14px; padding: 14px 6px 0;
  border-top: 1px solid var(--side-rule);
}
.side-user .avatar {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  background: var(--berg); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: bold;
}
.side-user .who { min-width: 0; flex: 1; line-height: 1.25; }
.side-user .nm {
  display: block; font-size: 12px; font-weight: bold; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-user .rl { display: block; font-size: 10.5px; color: #8fb2c2; }
.side-user .out {
  flex: none; padding: 4px 6px; border: 0; border-radius: 6px;
  background: transparent; color: var(--side-text);
  font-size: 14px; line-height: 1; cursor: pointer;
}
.side-user .out:hover { background: var(--side-chip); color: #fff; }

/* ---------------- top bar and main ---------------- */
body.app .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px; flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
  background: var(--paper); border-bottom: 1px solid var(--card-border);
}
.topbar h1 { font-size: 15px; font-weight: bold; letter-spacing: -.01em; }
.topbar .when { font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; }
.grow { flex: 1; }

.main {
  flex: 1; min-width: 0;
  padding: 22px 26px 44px;
  display: flex; flex-direction: column; gap: 16px;
}

/* ---------------- cards ---------------- */
.main .card {
  background: var(--paper);
  border: 1px solid var(--card-border); border-radius: 12px;
  padding: 18px 22px;
  box-shadow: 0 1px 2px rgba(24, 69, 93, .05);
  max-width: none;
}
.main .card h2 { font-size: 15px; margin: 0; padding: 0; border: 0; }
.main .card h3 {
  font-size: 13.5px; font-weight: bold; color: var(--navy); margin: 0 0 12px;
}
.main .card h3 .sub { font-weight: normal; font-size: 11.5px; color: var(--ink-soft); margin-left: 8px; }
.main .card p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--ink); }
.main .none { font-size: 12.5px; color: var(--ink-soft); }

.back {
  font-size: 12px; color: var(--ink-muted); text-decoration: none;
  align-self: flex-start;
}
.back:hover { color: var(--navy); text-decoration: underline; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 14px; flex: none;
  border: 1px solid var(--control-border, #d7dee1); border-radius: 8px;
  background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 12.5px; font-weight: bold;
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn:hover { border-color: var(--berg); color: var(--navy); text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--berg); border-color: var(--berg); color: #fff; }
.btn:focus-visible { outline: 2px solid var(--berg); outline-offset: 2px; }
/* The quiet one: an action that should be findable, not inviting. */
.btn.subtle { background: transparent; border-color: transparent; color: var(--ink-soft); font-weight: normal; }
.btn.subtle:hover { color: var(--r-fg); background: var(--r-bg); border-color: var(--r-bg); }

.add { font-size: 12.5px; font-weight: bold; color: var(--berg); text-decoration: none; }
.add:hover { text-decoration: underline; }

/* ---------------- form controls ----------------
   Declared before the components that use them. Put after, these generic rules
   would win on equal specificity and flatten every component's sizing. */
.main input[type="text"], .main input[type="date"], .main input[type="number"],
.main input[type="search"], .main select, .main textarea {
  font-family: var(--font); font-size: 12.5px; color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--control-border, #d7dee1); border-radius: 8px;
  padding: 8px 10px; width: 100%;
}
.main textarea { resize: vertical; line-height: 1.5; }
.main input:focus, .main select:focus, .main textarea:focus {
  outline: none; border-color: var(--berg); box-shadow: 0 0 0 2px rgba(50, 119, 143, .16);
}
.main select {
  appearance: none; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, #75838a 50%),
                    linear-gradient(135deg, #75838a 50%, transparent 50%);
  background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

/* ---------------- shared: avatars, generic table ---------------- */
.mini-av {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--berg); color: #fff; font-size: 9.5px; font-weight: bold; margin-right: 6px;
}
.mini-av.more { background: var(--line); color: var(--ink-soft); }
.tbl-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--divider-soft); vertical-align: middle; }
.tbl thead th { border-top: 0; font-size: 10.5px; font-weight: bold; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }

/* ---------------- narrower screens ---------------- */
@media (max-width: 900px) {
  .side { width: 64px; }
  .side .logo, .side .env-badge, .side-label, .side-nav a span:not(.ico), .side-user .who { display: none; }
  .side-nav { padding: 0 10px; }
  .side-nav a { justify-content: center; padding: 9px; }
  .side-user { justify-content: center; margin: 0 10px; }
  .main { padding: 16px 14px 40px; }
  .topbar { padding: 0 14px; }
  .topbar .when { display: none; }
}
@media (max-width: 480px) {
  .card, .notice { padding: 24px 20px 22px; border-left: 0; border-right: 0; }
}

/* ================================================================
   Idea boxes: the public page of a box
   ================================================================ */
body.ib .brand { display: flex; align-items: center; gap: 10px; }
body.ib .grow { flex: 1; }
.ib-lang { display: inline-flex; gap: 2px; font-size: 12px; font-weight: bold; letter-spacing: .04em; }
.ib-lang a, .ib-lang span { min-width: 36px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; text-decoration: none; }
.ib-lang a { color: var(--muted); }
.ib-lang a:hover { color: var(--navy); background: var(--b-bg); }
.ib-lang .on { color: var(--navy); background: var(--b-bg); }
body.ib textarea {
  display: block; width: 100%; min-height: 180px; padding: 10px 11px; resize: vertical;
  font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 0;
}
body.ib textarea:focus { outline: none; border-color: var(--berg); box-shadow: 0 0 0 2px rgba(50, 119, 143, 0.18); }
body.ib p.ib-hint { margin-top: 6px; }
/* The field people never see; only scripts fill it. Off-screen, not display:none, which some bots skip. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.ib-label { margin: 18px 0 5px; font-size: 12.5px; font-weight: bold; color: var(--navy); }
.key.ib-receipt { margin-top: 0; font-size: 22px; text-align: center; }
body.ib .button-link { display: inline-block; margin-top: 16px; }

/* ================================================================
   Idea boxes: the pages behind the sign-in
   ================================================================ */
.muted { color: var(--ink-soft); }
.main p.ok, .main p.bad { margin: 0 0 16px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--paper); border: 1px solid var(--card-border); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi .k { font-size: 10.5px; font-weight: bold; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.kpi .v { font-size: 24px; font-weight: bold; color: var(--navy); line-height: 1.2; }
.kpi .sub { font-size: 12px; color: var(--ink-soft); }
.kpi.warn .v { color: var(--a-fg); }

.list-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.list-head h2 { margin: 0; }
.list-head .muted { font-size: 12.5px; }

.ib-tbl th, .ib-tbl td { white-space: nowrap; vertical-align: top; }
.ib-tbl .c-name a { color: var(--navy); font-weight: bold; text-decoration: none; }
.ib-tbl .c-name a:hover { text-decoration: underline; }
.ib-tbl .ib-text { white-space: normal; width: 100%; min-width: 240px; }
.ib-tbl .ib-text a { color: var(--ink); text-decoration: none; }
.ib-tbl .ib-text a:hover { color: var(--navy); text-decoration: underline; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11.5px; font-weight: bold; }
.tag-open { background: var(--g-bg); color: var(--g-fg); }
.tag-closed { background: var(--subtle); color: var(--ink-muted); }

.ib-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.ib-cols .card { margin: 0; }
.ib-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ib-form input { flex: 1 1 160px; margin: 0; }
.ib-form-pw input { flex: 1 1 140px; }
.ib-close { margin-top: 10px; }
.ib-cols .ok, .ib-cols .bad { margin: 12px 0 0; }
.ib-danger { margin-top: 16px; }
.ib-remove { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn.btn-danger { background: var(--r-fg); border-color: var(--r-fg); color: #fff; }
.btn.btn-danger:hover { background: #962722; border-color: #962722; }

.main .card p.ib-meta { font-size: 12.5px; margin: 0; }
.main .card p.ib-body { white-space: normal; margin-top: 12px; font-size: 15px; line-height: 1.55; color: var(--ink); }

.ib-new { max-width: 560px; }
.ib-new label { display: block; margin-top: 16px; }
.ib-new input[type="text"], .ib-new select { width: 100%; }
.ib-new p.hint { margin-top: 5px; }
.ib-actions { display: flex; gap: 8px; margin-top: 20px; }

@media (max-width: 900px) { .ib-cols { grid-template-columns: 1fr; } }
