/* ==========================================================================
   The Steamboat Group · portal components
   Requires tokens.css. Two modes:
     .tsg-site   the public, editorial look: square edges, wide tracking, sand ground
     .tsg-admin  the team app: rounded cards, tighter tracking, paper ground, scaled 1.1 on desktop
   Every class below is used on the live platform; keep them the same so portals feel like one family.
   ========================================================================== */

/* ---- containers ----------------------------------------------------------- */
.container { margin: 0 auto; width: 100%; max-width: var(--col); padding-inline: var(--gutter); }
.container-narrow { margin: 0 auto; width: 100%; max-width: var(--col-narrow); padding-inline: var(--gutter); }
@media (min-width: 640px) { .container, .container-narrow { padding-inline: var(--gutter-sm); } }

/* ---- the header ------------------------------------------------------------
   Public site: espresso bar, white logo, Inter caps nav, gold-outlined sign in. Logo sits 3px low to centre optically.
   Team app: white bar, dark logo, nav pills; the active pill is ink with white text. */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--espresso); color: #fff; }
.site-header .row { display: flex; align-items: center; height: var(--header-h); gap: 18px; }
@media (min-width: 1024px) { .site-header .row { height: var(--header-h-lg); } }
.site-header .logo { position: relative; top: 3px; height: 52px; width: auto; }
@media (min-width: 1024px) { .site-header .logo { height: 60px; } }
.site-header nav { display: none; gap: 30px; margin-inline: auto; }
@media (min-width: 1024px) { .site-header nav { display: flex; } }
.site-header nav a { font-family: var(--font-label); font-size: 12px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255,255,255,.85); }
.site-header nav a:hover, .site-header nav a.on { color: var(--champagne); text-decoration: none; }

.admin-header { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.admin-header .row { display: flex; align-items: center; height: var(--admin-header); gap: 8px; padding-inline: 20px; }
.admin-header .logo { height: 40px; width: auto; margin-right: 12px; }
.admin-header nav { display: flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; }
.nav-pill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border-radius: var(--r-control); padding: 6px 10px; font-family: var(--font-sans); font-size: 13px; color: rgba(32,27,19,.75); transition: background-color var(--dur-fast), color var(--dur-fast); }
.nav-pill:hover { background: var(--sand); color: var(--ink); text-decoration: none; }
.nav-pill.on { background: var(--ink); color: #fff; }

/* ---- page titles -------------------------------------------------------------
   Kicker in Inter caps above a Cormorant title. This pairing opens every page. */
.kicker { display: block; font-family: var(--font-label); font-size: var(--fs-label); font-weight: 600; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--khaki); }
.kicker.gold { color: var(--gold); }
.page-title { margin-bottom: 20px; }
.page-title .kicker { margin-bottom: 6px; }
.page-title h1 { font-size: 34px; }
.page-title p { margin-top: 8px; max-width: 64ch; color: var(--khaki); font-size: 14.5px; }
@media (min-width: 1024px) { .page-title h1 { font-size: 40px; } }

/* ---- buttons ----------------------------------------------------------------
   Gold is the primary and there is one per view. Outline is the second choice. Ghost is for quiet actions.
   Public site: square, 0.22em tracking, generous padding. Team app: rounded 8px, 0.08em tracking, smaller. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--r-site); padding: 17px 34px; font-family: var(--font-label); font-size: 11.5px; font-weight: 600; letter-spacing: var(--track-btn); line-height: 1.6; text-transform: uppercase; cursor: pointer; text-decoration: none; transition: background-color var(--dur), color var(--dur), border-color var(--dur), transform var(--dur) var(--ease), box-shadow var(--dur); }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--gold); color: #fff; }
.btn-primary:hover { background: #8A6A3D; }
.btn-dark { background: var(--espresso); color: #fff; }
.btn-dark:hover { background: #2A2219; }
.btn-outline { background: transparent; color: var(--ink); border-color: rgba(32,27,19,.45); }
.btn-outline:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--sand); box-shadow: none; transform: none; }
.btn-danger { background: var(--bad); color: #fff; }
.tsg-admin .btn { border-radius: var(--r-control); letter-spacing: 0.08em; padding: 10px 16px; font-size: 11px; }
.btn.sm { padding: 8px 14px; font-size: 10.5px; }
.btn.lg { padding: 18px 40px; font-size: 12px; }
.btn.block { width: 100%; }

/* ---- pills (filters, toggles, small choices) ---------------------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(139,131,113,.5); border-radius: 2px; background: #fff; padding: 6px 12px; font-family: var(--font-label); font-size: 14px; color: var(--ink); cursor: pointer; user-select: none; transition: border-color var(--dur-fast), background-color var(--dur-fast), color var(--dur-fast); }
.pill:hover { border-color: var(--ink); }
.pill.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tsg-admin .pill { border-radius: var(--r-control); font-size: 12.5px; padding: 5px 11px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- form controls ------------------------------------------------------- */
.label { display: block; margin-bottom: 4px; font-family: var(--font-label); font-size: var(--fs-label); font-weight: 400; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--khaki); }
.input, .select, .textarea { width: 100%; box-sizing: border-box; border: 1px solid rgba(139,131,113,.5); border-radius: var(--r-site); background: #fff; padding: 9px 12px; font-family: var(--font-sans); font-size: 15px; color: var(--charcoal); transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.input::placeholder { color: var(--khaki); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 1px rgba(165,121,63,.4); }
.tsg-admin .input, .tsg-admin .select, .tsg-admin .textarea { border-radius: var(--r-control); border-color: rgba(32,27,19,.12); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field { display: grid; gap: 4px; }
.field .hint { font-size: 12px; color: var(--khaki); }
.field .error { font-size: 12.5px; color: var(--bad); }
.input.invalid { border-color: var(--bad); }
@media (max-width: 640px) { .input, .select, .textarea { font-size: 16px; } }   /* iOS won't zoom the page */
.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }

/* ---- cards and panels ---------------------------------------------------- */
.card { background: #fff; border: 1px solid rgba(139,131,113,.25); border-radius: var(--r-site); overflow: hidden; }
.tsg-admin .card { border-radius: var(--r-admin); border-color: var(--line); }
.card .pad { padding: 20px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r-admin); }
.panel > .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.panel > .head h2 { font-family: var(--font-label); font-size: 13px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); }
.panel > .body { padding: 16px 20px; }
.card-dark { background: var(--espresso); color: #fff; border-radius: var(--r-admin); padding: 24px; }
.card-dark .kicker { color: var(--champagne); }
.card-gold { background: var(--gold); color: #fff; border-radius: var(--r-admin); padding: 26px 30px; }
.card-gold .kicker { color: rgba(255,255,255,.8); }

/* ---- stat tile ------------------------------------------------------------- */
.stat { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; height: 100%; background: #fff; border: 1px solid var(--line); border-radius: var(--r-admin); padding: 20px; transition: box-shadow var(--dur-fast); }
.stat:hover { box-shadow: var(--shadow-card); }
.stat .k { display: flex; align-items: center; gap: 8px; font-family: var(--font-label); font-size: 11px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--khaki); }
.stat .v { margin-top: 8px; font-family: var(--font-display); font-size: 34px; line-height: 1; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.stat .h { margin-top: 8px; font-size: 12px; color: var(--khaki); }

/* ---- badges (meaning at a glance) ------------------------------------------ */
.badge { display: inline-block; border-radius: 6px; padding: 2px 6px; font-size: 11px; font-weight: 500; line-height: 1.5; background: rgba(0,0,0,.05); color: rgba(32,27,19,.7); white-space: nowrap; }
.badge.green  { background: #E7EDE6; color: #3F5F45; }
.badge.blue   { background: #E8EBEF; color: #44546A; }
.badge.copper { background: rgba(165,121,63,.15); color: #7D5C31; }
.badge.red    { background: #F3E4E0; color: #8A3B2E; }
.badge.purple { background: #EBE6F0; color: #5B4A70; }
.tag { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-pill); background: var(--sand); padding: 2px 10px; font-size: 11px; color: var(--ink); }
.tag.locked { background: #E6E0D3; }
.severity { display: inline-block; border-radius: var(--r-pill); padding: 2px 8px; font-family: var(--font-label); font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.severity.crit { background: var(--bad-soft); color: #7A331A; }
.severity.high { background: #F7E6C5; color: #7A5410; }
.severity.med  { background: #E9ECF1; color: #2E4664; }
.severity.low  { background: #E3EFE6; color: #2B5E41; }

/* ---- tables -------------------------------------------------------------------
   Inter caps headers, hairline rows, right-aligned tabular numbers, a hover tint. Tables scroll inside
   their card on phones; the page never scrolls sideways. */
.tablewrap { overflow-x: auto; max-width: 100%; }
table.tsg { width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: 14px; }
table.tsg th { position: sticky; top: 0; z-index: 2; background: #fff; text-align: left; padding: 11px 14px; font-family: var(--font-label); font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--khaki); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.tsg td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tsg tr:last-child td { border-bottom: 0; }
table.tsg tbody tr:hover td { background: rgba(241,237,226,.55); }
table.tsg .num { text-align: right; font-variant-numeric: lining-nums tabular-nums; }
table.tsg th.sortable { cursor: pointer; }
table.tsg th.sorted::after { content: " ↓"; color: var(--ink); }
.tsg-admin table.tsg { min-width: 640px; }

/* ---- avatar ----------------------------------------------------------------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-family: var(--font-label); font-weight: 600; background: hsl(210 22% 42%); }

/* ---- progress bar (gold fills as you go) -------------------------------------- */
.bar { position: relative; height: 3px; width: 100%; overflow: hidden; border-radius: var(--r-pill); background: rgba(32,27,19,.1); }
.bar > i { position: absolute; inset: 0 auto 0 0; display: block; border-radius: var(--r-pill); background: linear-gradient(90deg, #D3B076, #B8905A, #A5793F); transition: width var(--dur-fast) ease-out; }
.bar.thick { height: 14px; background: rgba(255,255,255,.28); }
.bar.thick > i { background: #fff; }

/* ---- notices, toasts, empty states -------------------------------------------- */
.notice { border-radius: var(--r-admin); padding: 12px 16px; font-size: 13.5px; }
.notice.info { background: var(--info-soft); color: #2E4664; }
.notice.good { background: var(--good-soft); color: #2B5E41; }
.notice.warn { background: var(--warn-soft); color: #7A5410; }
.notice.bad  { background: var(--bad-soft);  color: #7A331A; }
.callout { border: 1px solid rgba(165,121,63,.4); background: #FFFAF0; border-radius: var(--r-admin); padding: 12px 16px; }
.callout .kicker { color: var(--gold); margin-bottom: 4px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; background: var(--espresso); color: #fff; border-radius: var(--r-pill); padding: 10px 18px; font-size: 13.5px; box-shadow: var(--shadow-sheet); }
.toast.err { background: var(--bad); }
.empty { padding: 40px 20px; text-align: center; color: var(--khaki); font-family: var(--font-label); font-size: 14px; }

/* ---- sheets and dialogs ---------------------------------------------------------
   Dialogs on the public site are cream, square, over a dark blurred scrim. Sheets in the team app slide up
   from the bottom on a phone and sit centred on a desktop. */
.scrim { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: flex-end; justify-content: center; background: rgba(12,10,6,.62); backdrop-filter: blur(3px); }
@media (min-width: 640px) { .scrim { align-items: center; padding: 24px; } }
.sheet { width: 100%; max-width: 560px; background: var(--cream); padding: 28px; box-shadow: 0 40px 100px rgba(0,0,0,.45); animation: sheetUp .32s var(--ease); }
@media (min-width: 640px) { .sheet { border-radius: 2px; } }
.tsg-admin .sheet { border-radius: var(--r-admin); background: #fff; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

/* ---- dividers ------------------------------------------------------------------- */
.rule { height: 1px; background: var(--line-strong); }
.rule-gold { height: 1px; background: rgba(165,121,63,.4); }
.day-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; font-family: var(--font-label); font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--khaki); }
.day-divider::before, .day-divider::after { content: ""; flex: 1; height: 1px; background: rgba(32,27,19,.08); }

/* ---- message bubbles (texting) ---------------------------------------------------- */
.bubble { display: inline-block; max-width: 80%; padding: 9px 16px; border-radius: 20px; font-size: 16px; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.out { background: var(--ch-text); color: #fff; }
.bubble.in { background: #fff; color: var(--ink); border: 1px solid rgba(32,27,19,.08); }

/* ---- utilities ------------------------------------------------------------------- */
.muted { color: var(--khaki); }
.gold { color: var(--gold); }
.small { font-size: 13px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
