/* ═══════════════════════════════════════════════════════════
   Platform shell — header structure shared by every module,
   plus the login/launcher "mission briefing" theme. Colour for
   the header comes from each module's own class (.kitchen-header,
   .fin-header) — never from here.
   ═══════════════════════════════════════════════════════════ */

/* ── Header ─────────────────────────────────────────────────
   Shared shell for every module's header: a compact text block
   (title + status) on the left, action buttons vertically centred
   against the whole header on the right — single row at every width,
   so a long title truncates instead of wrapping and the action
   cluster never drifts into a dead gap as the header gets wider.
   Colour comes from each module's own class (.kitchen-header,
   .fin-header, …), never from this base rule. ───────────────── */
/* Corner brackets + monospace/uppercase status echo the launcher's "mission
   briefing" targeting-reticle motif (.module-tile in this same file) — the tie
   back to the spy theme. --mod-header-accent controls the bracket colour and
   defaults to a neutral translucent white; each module's own header class
   (.kitchen-header, .fin-header) sets it to something from that module's own
   palette, so the motif is shared but never introduces a shared colour. */
.mod-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-radius: var(--r-lg);
  margin-bottom: var(--s3);
  box-shadow: var(--shadow-raised);
  --mod-header-accent: rgba(255,255,255,0.35);
}

.mod-header::before,
.mod-header::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--mod-header-accent);
  pointer-events: none;
}
.mod-header::before {
  top: 7px; left: 7px;
  border-top: 1.5px solid; border-left: 1.5px solid;
}
.mod-header::after {
  bottom: 7px; right: 7px;
  border-bottom: 1.5px solid; border-right: 1.5px solid;
}

.mod-header-text {
  min-width: 0;
  flex: 1;
}

.mod-header-title {
  font-size: clamp(18px, 5.2vw, 28px);
  font-weight: 700;
  line-height: 1.2;
}

.mod-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Pulsing status dot, same shape/animation as the launcher's .home-status-dot
   and .module-tile-status-dot — takes its colour from the status text itself
   (currentColor) so it never needs a colour of its own per module. */
.mod-header-status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 4px currentColor;
  flex-shrink: 0;
  animation: ops-pulse 2s ease-in-out infinite;
}

.mod-header-actions {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-shrink: 0;
}

.home-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: var(--s1) var(--s2);
  border-radius: var(--r-sm);
  line-height: 1;
  flex-shrink: 0;
}

/* ── Settings icon button — reused by every module's own settings
   modal trigger, only the modal contents differ per module. ─── */
.settings-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: var(--s1) var(--s2);
  border-radius: var(--r-sm);
  line-height: 1;
}

/* ── Home / module launcher — "mission briefing" look ───────
   Deliberately its own visual system, isolated to #page-home /
   body.home-active. Never reused by a module's own screens — each
   module owns its look, this is just the launcher's. ──────── */
:root {
  --ops-bg:        #0a0d0b;
  --ops-bg-grid:   rgba(255,176,0,0.06);
  --ops-panel:     #121613;
  --ops-panel-2:   #161b17;
  --ops-border:    rgba(255,176,0,0.28);
  --ops-border-dim:rgba(255,176,0,0.12);
  --ops-accent:    #ffb000;
  --ops-accent-dim:#8a6000;
  --ops-green:     #3ddc84;
  --ops-text:      #eef0ec;
  --ops-text-dim:  #8a9088;
  --font-ops:      'Chakra Petch', var(--font-ui);
  --font-mono:     'Share Tech Mono', 'Courier New', monospace;
}

body.home-active {
  position: relative;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(255,176,0,0.08), transparent 62%),
    repeating-linear-gradient(0deg, var(--ops-bg-grid) 0px, transparent 1px, transparent 34px),
    repeating-linear-gradient(90deg, var(--ops-bg-grid) 0px, transparent 1px, transparent 34px),
    var(--ops-bg);
}

/* One-time "power on" reveal, not an endless decorative loop — motion tied to the
   moment a screen actually appears, replayed each time since these elements are
   toggled via display:none/block rather than staying mounted. */
.login-panel, .home-header, .module-grid, .home-grid-caption {
  animation: ops-materialize 0.55s var(--ease) both;
}
.module-grid  { animation-delay: 0.08s; }
.home-grid-caption { animation-delay: 0.16s; }

@keyframes ops-materialize {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

#page-home, #page-login {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.home-header {
  background: var(--ops-panel);
  border: 1px solid var(--ops-border-dim);
  padding: var(--s4) var(--s5);
  border-radius: var(--r-lg);
  margin-bottom: var(--s4);
  position: relative;
  overflow: hidden;
}
.home-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--ops-accent) 0%, transparent 40%);
  opacity: 0.06;
  pointer-events: none;
}

.home-header-top {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s2);
}

.home-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ops-green);
  box-shadow: 0 0 6px var(--ops-green);
  flex-shrink: 0;
  animation: ops-pulse 2s ease-in-out infinite;
}

@keyframes ops-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.home-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ops-green);
  white-space: nowrap;
}

#page-home h1, #page-login h1 {
  font-family: var(--font-ops);
  font-weight: 600;
  font-size: 34px;
  letter-spacing: 0.01em;
  color: var(--ops-text);
  line-height: 1.05;
}

.home-subhead {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ops-text-dim);
  margin-top: var(--s1);
  letter-spacing: 0.02em;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--s3);
}

.module-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s5) var(--s3);
  background: var(--ops-panel-2);
  border: 1px solid var(--ops-border-dim);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--font-ops);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.module-tile:active {
  background: var(--ops-panel);
  border-color: var(--ops-border);
}

/* Targeting-reticle corner brackets */
.module-tile::before,
.module-tile::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--ops-accent-dim);
  transition: border-color 0.2s var(--ease);
}
.module-tile::before {
  top: 7px; left: 7px;
  border-top: 2px solid; border-left: 2px solid;
}
.module-tile::after {
  bottom: 7px; right: 7px;
  border-bottom: 2px solid; border-right: 2px solid;
}
.module-tile:active::before,
.module-tile:active::after {
  border-color: var(--ops-accent);
}

.module-tile-code {
  position: absolute;
  top: var(--s2);
  right: var(--s3);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ops-text-dim);
}

.module-tile-icon {
  width: 30px;
  height: 30px;
  color: var(--ops-accent);
}

.module-tile-label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ops-text);
}

/* Locked/placeholder slots — makes "one module today" read as "room to grow"
   rather than an empty, unfinished-looking grid. */
.module-tile--locked {
  cursor: default;
  border-style: dashed;
  opacity: 0.55;
}
.module-tile--locked .module-tile-icon {
  color: var(--ops-text-dim);
}
.module-tile--locked .module-tile-label {
  color: var(--ops-text-dim);
}
.module-tile--locked::before,
.module-tile--locked::after {
  border-color: var(--ops-border-dim);
}

.module-tile-status--locked {
  color: var(--ops-text-dim) !important;
}

.home-grid-caption {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ops-text-dim);
  margin-top: var(--s3);
  opacity: 0.7;
}

.module-tile-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ops-green);
}

.module-tile-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ops-green);
  box-shadow: 0 0 4px var(--ops-green);
}

/* ── Login screen — same "mission briefing" shell theme ────── */
.home-status-dot--amber {
  background: var(--ops-accent);
  box-shadow: 0 0 6px var(--ops-accent);
}

/* Dark mode is a shell-level, cross-module preference (a global body.dark
   class every module's own CSS responds to — see kitchen.css/finance.css),
   so its one control lives here on Home rather than inside any one module's
   settings. */
.home-icon-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--ops-border-dim);
  color: var(--ops-text-dim);
  padding: 5px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-icon-btn svg {
  width: 14px;
  height: 14px;
}
.home-icon-btn:active {
  border-color: var(--ops-border);
  color: var(--ops-text);
}
.home-icon-btn--on {
  border-color: var(--ops-accent);
  color: var(--ops-accent);
}

.home-logout-btn {
  background: none;
  border: 1px solid var(--ops-border-dim);
  color: var(--ops-text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.home-logout-btn:active {
  border-color: var(--ops-border);
  color: var(--ops-text);
}

#page-login {
  justify-content: center;
  align-items: center;
}

.login-panel {
  position: relative;
  width: 100%;
  max-width: 340px;
  background:
    repeating-linear-gradient(180deg, rgba(255,176,0,0.02) 0px, transparent 1px, transparent 3px),
    linear-gradient(160deg, var(--ops-panel) 0%, var(--ops-panel-2) 100%);
  border: 1px solid var(--ops-border-dim);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow:
    0 24px 60px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.login-panel::before,
.login-panel::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--ops-accent);
  opacity: 0.85;
}
.login-panel::before {
  top: -1px; left: -1px;
  border-top: 2px solid; border-left: 2px solid;
  border-radius: var(--r-lg) 0 0 0;
}
.login-panel::after {
  bottom: -1px; right: -1px;
  border-bottom: 2px solid; border-right: 2px solid;
  border-radius: 0 0 var(--r-lg) 0;
}

.login-panel-topline {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.ops-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ops-text-dim);
  border: 1px solid var(--ops-border-dim);
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}
/* On login there's nothing after it, so it's the one pushed to the trailing edge;
   on Operations, .home-logout-btn's own auto margin does that job instead, so the
   badge just sits with its normal gap after the eyebrow text. */
.login-panel-topline .ops-badge {
  margin-left: auto;
}
.login-panel-topline .home-eyebrow {
  color: var(--ops-accent);
}

.ops-cursor {
  display: inline-block;
  margin-left: 2px;
  animation: ops-blink 1s step-end infinite;
}
@keyframes ops-blink {
  50% { opacity: 0; }
}

.login-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--ops-border) 0%, transparent 90%);
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ops-text-dim);
}

.login-input {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--ops-border-dim);
  border-bottom: 2px solid var(--ops-border-dim);
  border-radius: var(--r-sm);
  color: var(--ops-accent);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.04em;
  padding: 12px;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.login-input::placeholder {
  color: rgba(238,240,236,0.2);
}
.login-input:focus {
  border-color: var(--ops-accent);
  background: rgba(0,0,0,0.5);
  box-shadow: 0 0 0 3px rgba(255,176,0,0.1), 0 0 18px rgba(255,176,0,0.18);
}

.login-error {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #ff6a5e;
}

.login-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  background: linear-gradient(180deg, #ffc655 0%, var(--ops-accent) 100%);
  color: #1a1200;
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font-ops);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 13px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(255,176,0,0.28), inset 0 1px 0 rgba(255,255,255,0.4);
  transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}
.login-submit-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(255,176,0,0.25), inset 0 1px 0 rgba(255,255,255,0.3);
}
.login-submit-btn:disabled { opacity: 0.6; cursor: default; }
.login-btn-arrow { font-size: 16px; line-height: 1; }

/* ── Launcher settings modal ─────────────────────────────────
   .modal-backdrop/.modal-sheet's structural rules come from kitchen.css
   (loaded globally, and — unlike shell.css — loaded AFTER this file).
   Its own .modal-sheet background rule (and dark-mode variant) is a
   same-specificity single-class selector, so a same-specificity override
   here would lose the cascade purely on load order. Compounding the
   selector with .modal-sheet (matching classList order-independently)
   keeps this always winning regardless of dark mode or file order —
   this is launcher chrome, always the ops theme, never Kitchen's cream. */
.modal-sheet.shell-modal-sheet,
body.dark .modal-sheet.shell-modal-sheet {
  background: var(--ops-panel);
  border-top: 1px solid var(--ops-border-dim);
}
.shell-modal-sheet .modal-sheet-title {
  font-family: var(--font-ops);
  color: var(--ops-text);
}
.shell-modal-sheet .modal-sheet-sub {
  color: var(--ops-text-dim);
  font-family: var(--font-ui);
}
.shell-modal-sheet .modal-close-btn {
  background: var(--ops-panel-2);
  color: var(--ops-text-dim);
}
.shell-modal-sheet .modal-confirm-btn {
  background: var(--ops-accent);
  color: #1a1400;
  font-family: var(--font-ops);
}
.shell-modal-sheet .modal-confirm-btn:disabled { opacity: 0.5; }

.shell-settings-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--s3) 0;
  background: none;
  border: none;
  border-top: 1px solid var(--ops-border-dim);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ops-text);
}
.shell-settings-nav-row:first-of-type { border-top: none; }
.shell-settings-nav-row:active { background: var(--ops-panel-2); }
.shell-settings-nav-chevron {
  font-size: 20px;
  color: var(--ops-text-dim);
  line-height: 1;
}
