/* Intelus Studio — a closed set of primitives, on the Blue Whale tokens.
 *
 * Same vocabulary as the CRM (--paper / --ink / --line / --accent) and the same
 * three families doing the same three jobs: Archivo for headings, IBM Plex Sans
 * for body, IBM Plex Mono for every number, date, label and eyebrow. A figure is
 * set in the same face wherever it appears, so a column of dates lines up and
 * two rows can be compared at a glance.
 *
 * There is no utility layer here on purpose. Anything not below is a class this
 * app did not need, and adding one is a decision rather than a reflex. */

*, *::before, *::after { box-sizing: border-box; }

/* The primary button's fill-on-hover and its label colour. Light mode: a darker
   step of the same blue, carrying white. Dark mode overrides both — see the foot
   of this file for why the label stops being white there. */
:root { --accent-press: var(--color-accent-deep); --accent-ink: #fff; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: Archivo, "IBM Plex Sans", system-ui, sans-serif; letter-spacing: -0.022em; margin: 0; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

.mono, .num, time, .eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
}
.eyebrow {
  font-size: 11px; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.muted { color: var(--muted); }
.dim   { color: var(--ink-2); }

/* ---- shell ------------------------------------------------------------- */

.bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--card);
}
.brand { font-family: Archivo, sans-serif; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent); }
.bar .grow { flex: 1 1 auto; min-width: 0; }

main { max-width: 1040px; margin: 0 auto; padding: 28px 20px 72px; }
main.wide { max-width: 1220px; }

.head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.head .grow { flex: 1 1 auto; min-width: 0; }

/* ---- surfaces. ONE level of containment; never a card inside a card. ---- */

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.pad { padding: 20px; }

/* ---- controls ---------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .14s ease;
}
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-press); border-color: var(--accent-press); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 13px; border-radius: 9px; }
.btn-bad { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn-bad:hover { background: var(--bad-soft); }

.field { margin-bottom: 14px; }
.flabel { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
.fin {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--paper); color: var(--ink);
  font: inherit; font-size: 15px;
}
.fin:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[type="date"].fin { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }

.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 13px; cursor: pointer; user-select: none;
}
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); }
.check:focus-within { box-shadow: var(--ring); }
.check input { accent-color: var(--accent); margin: 0; }

/* ---- status. Colour never carries the meaning alone — the word is there. -- */

.state {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: "IBM Plex Mono", monospace; font-size: 12px; font-weight: 500;
}
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.state.active   { color: var(--ok); }
.state.expiring { color: var(--warn); }
.state.lapsed, .state.suspended, .state.company-suspended { color: var(--bad); }
.state.empty    { color: var(--muted); }

/* ---- table ------------------------------------------------------------- */

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-2);
  font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--raised); }
td.right, th.right { text-align: right; }
td.indent, th.indent { padding-left: 26px; }

/* A company is a CAPTION over its accounts, not another status row: the accounts
   below carry the state, and repeating it here is the same fact stated twice. */
tr.group th {
  background: var(--raised); color: var(--ink);
  font-family: Archivo, sans-serif; font-size: 14px; font-weight: 600;
  letter-spacing: -0.01em; text-transform: none; padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
tr.group td { background: var(--raised); padding: 6px 12px; }
tr.group:hover th, tr.group:hover td { background: var(--raised); }
tr.group th .state { margin-left: 10px; }
td .rowact { display: flex; gap: 6px; justify-content: flex-end; }

/* ---- tool grid --------------------------------------------------------- */

.tools { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tool {
  display: block; padding: 20px; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .16s cubic-bezier(.16,1,.3,1), box-shadow .16s ease, border-color .16s ease;
}
.tool:hover { transform: translateY(-2px); box-shadow: var(--lift); border-color: var(--line-2); }
.tool:focus-visible { outline: none; box-shadow: var(--ring); }
.tool h3 { margin-bottom: 4px; }
.tool p { font-size: 14px; color: var(--muted); margin: 0; }

/* ---- flashes and empty states ------------------------------------------ */

.note { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.note.bad  { background: var(--bad-soft);  color: var(--bad); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.ok   { background: var(--ok-soft);   color: var(--ok); }

.empty {
  border: 1px dashed var(--line-2); border-radius: var(--radius);
  padding: 40px 24px; text-align: center; color: var(--muted);
}

/* ---- sign-in ----------------------------------------------------------- */

.signin { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.signin form { width: 100%; max-width: 360px; }

/* ---- drawer. One panel, opened over the table, for editing one row. ----- */

dialog {
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0;
  background: var(--card); color: var(--ink); max-width: 460px; width: calc(100% - 32px);
  box-shadow: var(--lift);
}
dialog::backdrop { background: rgba(var(--scrim), .72); backdrop-filter: blur(3px); }
dialog .pad { padding: 22px; }
dialog h2 { margin-bottom: 4px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.actions .grow { flex: 1 1 auto; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------------------------------------------------------------------------
 * DARK: the real-estate site's palette, not Blue Whale's derived navy.
 *
 * Blue Whale ships light only and derives its dark side by darkening the same
 * blues — canvas #04122e, card #0b2148, inset #072a6b, rule #123059, accent
 * #1567ff. Five blues stacked, and that is the blue-on-blue this replaces: when
 * every surface is already blue the accent has nothing to be an accent
 * AGAINST, so the kit's own rule — "blue only where it acts" — is broken by its
 * own dark mode.
 *
 * realestate.intelustechnologies.com had already solved it: a near-black
 * canvas, a warm cream ink, and one softer blue that appears only on actions.
 * These values are lifted from its [data-theme="dark"] block. Three do not come
 * across unchanged, each because the studio has a surface that landing page
 * does not:
 *   --color-canvas-inset  there it is a recessed section (#060606, DARKER than
 *                         the canvas); here it is a hover lift and a table
 *                         band, so it takes their rule colour and reads one
 *                         step UP from the card instead of down.
 *   --color-rule-strong   the studio has a second border weight; one step past
 *                         theirs.
 *   --color-accent-deep   theirs (#0B2E63) is a background. Here the token is
 *                         TEXT on a tint, so it has to be the light end of the
 *                         same blue or it is invisible.
 *
 * Repeated for the two dark states rather than shared, because a selector and a
 * media query cannot share one block — blue-whale.css does the same.
 *
 * This overrides the STUDIO only. blue-whale.css stays the shared source for
 * the CRM and the marketing site, which still carry the navy dark mode.
 * ------------------------------------------------------------------------- */

:root[data-theme="dark"] {
  /* surfaces — near-black, warm-neutral */
  --color-canvas:        #0a0a0a;
  --color-canvas-raised: #111111;
  --color-canvas-inset:  #1a1a18;
  /* text — warm cream, not blue-white */
  --color-ink:       #f5f2ec;
  --color-ink-muted: #e6e1d8;
  /* their #7e786d clears 4.5:1 on their canvas (#0a0a0a, 4.52) but NOT on the
     studio's card (#111111, 4.31) — this app puts secondary text on cards and
     they do not. Warmed one step: 5.09 on card, 5.34 on canvas, 4.70 on band. */
  --color-ink-dim:   #8a847a;
  /* rules */
  --color-rule:        #28251f;
  --color-rule-strong: #3b372f;
  /* THE one blue, and it only ever appears on something you can act on */
  --color-accent:      #4c86e0;
  --color-accent-soft: #7fa9ec;
  --color-accent-deep: #a9c8ec;
  --color-accent-tint: #14202f;
  /* THE BUTTON KEEPS THE EXACT BRAND BLUE; THE LABEL CHANGES. White on #4c86e0
     is 3.62:1 — under the floor, and this is the Sign in button. Rather than
     darken the brand colour to rescue white text, the label goes near-black
     (5.46:1) and hover moves one step LIGHTER in the same hue (8.29:1), so the
     most important control on the site is also the brightest thing on it. */
  --accent-ink:   #0a0a0a;
  --accent-press: #7fa9ec;
  /* semantics keep Blue Whale's dark values — they were picked for a dark
     ground and clear it on this one too */
  --color-ok:       #3be0a5;
  --color-ok-dot:   #3be0a5;
  --color-ok-tint:  #06301f;
  --color-warn:     #e0ac54;
  --color-warn-tint:#2e2208;
  --color-bad:      #ff9c95;
  --color-bad-dot:  #ff9c95;
  --color-bad-tint: #3a1512;
  /* depth from light, on a ground with no light to reflect */
  --rim:      rgba(255, 255, 255, .07);
  --lift:     0 14px 36px rgba(0, 0, 0, .6);
  --specular: inset 0 1px 0 rgba(255, 255, 255, .04);
  --ring:     0 0 0 4px rgba(76, 134, 224, .38);
  --shadow:   0 1px 2px rgba(0, 0, 0, .5);
  --scrim: 10, 10, 10;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  /* surfaces — near-black, warm-neutral */
  --color-canvas:        #0a0a0a;
  --color-canvas-raised: #111111;
  --color-canvas-inset:  #1a1a18;
  /* text — warm cream, not blue-white */
  --color-ink:       #f5f2ec;
  --color-ink-muted: #e6e1d8;
  /* their #7e786d clears 4.5:1 on their canvas (#0a0a0a, 4.52) but NOT on the
     studio's card (#111111, 4.31) — this app puts secondary text on cards and
     they do not. Warmed one step: 5.09 on card, 5.34 on canvas, 4.70 on band. */
  --color-ink-dim:   #8a847a;
  /* rules */
  --color-rule:        #28251f;
  --color-rule-strong: #3b372f;
  /* THE one blue, and it only ever appears on something you can act on */
  --color-accent:      #4c86e0;
  --color-accent-soft: #7fa9ec;
  --color-accent-deep: #a9c8ec;
  --color-accent-tint: #14202f;
  /* THE BUTTON KEEPS THE EXACT BRAND BLUE; THE LABEL CHANGES. White on #4c86e0
     is 3.62:1 — under the floor, and this is the Sign in button. Rather than
     darken the brand colour to rescue white text, the label goes near-black
     (5.46:1) and hover moves one step LIGHTER in the same hue (8.29:1), so the
     most important control on the site is also the brightest thing on it. */
  --accent-ink:   #0a0a0a;
  --accent-press: #7fa9ec;
  /* semantics keep Blue Whale's dark values — they were picked for a dark
     ground and clear it on this one too */
  --color-ok:       #3be0a5;
  --color-ok-dot:   #3be0a5;
  --color-ok-tint:  #06301f;
  --color-warn:     #e0ac54;
  --color-warn-tint:#2e2208;
  --color-bad:      #ff9c95;
  --color-bad-dot:  #ff9c95;
  --color-bad-tint: #3a1512;
  /* depth from light, on a ground with no light to reflect */
  --rim:      rgba(255, 255, 255, .07);
  --lift:     0 14px 36px rgba(0, 0, 0, .6);
  --specular: inset 0 1px 0 rgba(255, 255, 255, .04);
  --ring:     0 0 0 4px rgba(76, 134, 224, .38);
  --shadow:   0 1px 2px rgba(0, 0, 0, .5);
  --scrim: 10, 10, 10;
  color-scheme: dark;
  }
}

/* ---- the mark -----------------------------------------------------------
 * intelus-mark.png, taken from the real-estate site. It carries its own navy
 * ground and transparent corners, so one file serves both themes — no light
 * and dark variant to keep in step.
 *
 * Not the full lockup: that file is the REAL ESTATE sub-brand, wordmark and
 * all, and the studio is not that product. The mark plus the studio's own
 * wordmark says the right thing. */

.signin .mark {
  display: block; width: 56px; height: 56px;
  margin: 0 0 18px; border-radius: 50%;
}
.brand img {
  width: 26px; height: 26px; border-radius: 50%;
  vertical-align: -6px; margin-right: 9px;
}

/* ---- impersonation strip ------------------------------------------------
 * The owner looking through a customer's window. It is deliberately the
 * loudest thing on the page: a support session that does not announce itself
 * is how a note ends up written into the wrong company's file. */
#impersonation-bar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  flex-wrap: wrap; padding: 9px 16px;
  background: var(--warn-soft); color: var(--warn);
  border-bottom: 1px solid var(--warn);
  font-size: 13.5px;
}
#impersonation-bar b { font-weight: 600; }
#impersonation-bar button {
  border: 1px solid var(--warn); background: transparent; color: var(--warn);
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 3px 12px; border-radius: 999px; cursor: pointer; min-height: 28px;
}
#impersonation-bar button:hover { background: var(--warn); color: var(--paper); }
#impersonation-bar button:focus-visible { outline: none; box-shadow: var(--ring); }
