/* ============================================================
   SCARLET OS NEXT — core/base.css
   Reset + componentes base. Depende de core/tokens.css.
   Liquid glass SÓ na navegação (.tabbar / .navbar / .island).
   Todo alvo tocável >= 44pt. Todo :active tem feedback <100ms.
   ============================================================ */

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-ui);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  color: var(--label);
  background: var(--bg);
  background-image: var(--bg-glow);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
  overscroll-behavior-y: none;
  transition: background-color var(--t-med) var(--ease), color var(--t-med) var(--ease);
}
h1, h2, h3, h4, p, figure { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--tint); text-decoration: none; }
img, svg, video { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--r-sm); }
:focus:not(:focus-visible) { outline: none; }
::selection { background: var(--tint); color: #fff; }
input::placeholder, textarea::placeholder { color: var(--label-4); }
/* inputs 16px+ => sem auto-zoom no iOS Safari */
input, textarea, select { font-size: var(--t-callout); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- TIPOGRAFIA UTIL ---------- */
.t-large   { font-size: var(--t-large);   font-weight: var(--w-bold); line-height: var(--lh-tight); letter-spacing: -0.021em; }
.t-title   { font-size: var(--t-title);   font-weight: var(--w-bold); line-height: var(--lh-tight); letter-spacing: -0.02em; }
.t-title2  { font-size: var(--t-title2);  font-weight: var(--w-bold); line-height: var(--lh-snug); }
.t-title3  { font-size: var(--t-title3);  font-weight: var(--w-semi); line-height: var(--lh-snug); }
.t-headline{ font-size: var(--t-body);    font-weight: var(--w-semi); line-height: var(--lh-snug); }
.t-body    { font-size: var(--t-body);    font-weight: var(--w-regular); }
.t-callout { font-size: var(--t-callout); font-weight: var(--w-regular); }
.t-subhead { font-size: var(--t-subhead); font-weight: var(--w-regular); }
.t-foot    { font-size: var(--t-footnote);font-weight: var(--w-regular); }
.t-caption { font-size: var(--t-caption); font-weight: var(--w-regular); }
.t-num     { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.dim  { color: var(--label-2); }
.dim2 { color: var(--label-3); }
.tint { color: var(--tint); }
.gold { color: var(--gold); }
.center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- LAYOUT DO SHELL ---------- */
#app { min-height: 100dvh; }

.appframe {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100dvh;
}
@media (min-width: 768px) {
  .appframe { grid-template-columns: var(--rail-w) 1fr; }
}

/* Coluna de conteúdo */
.viewport {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100dvh;
  /* espaço p/ tab bar no mobile */
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}
@media (min-width: 768px) {
  .viewport { padding-bottom: 0; }
}

#view { flex: 1; min-width: 0; }
.screen { padding: 0 var(--gutter) var(--s10); max-width: 860px; margin: 0 auto; width: 100%; }
@media (min-width: 768px) { .screen { padding-inline: var(--s6); } }

/* ---------- NAVBAR (large title que colapsa) ---------- */
.navbar {
  position: sticky; top: 0; z-index: 40;
  padding-top: var(--safe-top);
}
.navbar-compact {
  display: flex; align-items: center; justify-content: center;
  gap: var(--s2);
  height: var(--nav-h);
  padding: 0 var(--gutter);
  font-size: var(--t-body); font-weight: var(--w-semi);
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur-nav)) saturate(1.7);
  backdrop-filter: blur(var(--blur-nav)) saturate(1.7);
  border-bottom: 0.5px solid var(--glass-line);
  opacity: 0; transform: translateY(-4px);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  pointer-events: none;
}
.navbar.is-collapsed .navbar-compact { opacity: 1; transform: none; pointer-events: auto; }
.navbar-compact .nav-lead, .navbar-compact .nav-trail {
  position: absolute; display: flex; align-items: center; gap: var(--s1);
}
.navbar-compact .nav-lead { left: var(--gutter); }
.navbar-compact .nav-trail { right: var(--gutter); }

.large-title-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) var(--gutter) var(--s3);
}
.large-title { font-size: var(--t-large); font-weight: var(--w-bold); line-height: var(--lh-tight); letter-spacing: -0.021em; }
.title-sentinel { position: absolute; top: 0; height: 1px; width: 1px; }

/* ---------- TAB BAR (mobile) / RAIL (desktop) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  display: flex;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur-nav)) saturate(1.8);
  backdrop-filter: blur(var(--blur-nav)) saturate(1.8);
  border-top: 0.5px solid var(--glass-line);
}
.tab {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  min-height: var(--tap);
  color: var(--label-3);
  font-size: var(--t-caption2); font-weight: var(--w-medium);
  -webkit-tap-highlight-color: transparent;
  transition: color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.tab .ic { width: 26px; height: 26px; }
.tab .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab:active { transform: scale(.92); }
.tab[aria-current="page"] { color: var(--tint); font-weight: var(--w-semi); }
.tab[aria-current="page"] .ic { filter: drop-shadow(0 0 8px var(--tint-weak)); }

/* Rail lateral no desktop */
@media (min-width: 768px) {
  .tabbar {
    position: sticky; top: 0; bottom: auto; right: auto;
    flex-direction: column; align-items: stretch;
    width: var(--rail-w); height: 100dvh;
    padding: calc(var(--safe-top) + var(--s5)) var(--s3) var(--s5);
    gap: 2px;
    border-top: 0; border-right: 0.5px solid var(--glass-line);
  }
  .rail-brand {
    display: flex; align-items: center; gap: var(--s3);
    padding: 0 var(--s3) var(--s5); margin-bottom: var(--s2);
    font-size: var(--t-title3); font-weight: var(--w-bold); letter-spacing: -0.02em;
  }
  .rail-brand .mark { width: 30px; height: 30px; color: var(--tint); }
  .tab {
    flex: 0 0 auto; flex-direction: row; justify-content: flex-start;
    gap: var(--s3); padding: 0 var(--s3);
    height: 46px; border-radius: var(--r-md);
    font-size: var(--t-subhead); font-weight: var(--w-medium);
  }
  .tab .ic { width: 22px; height: 22px; }
  .tab:hover { background: var(--hover); color: var(--label); }
  .tab[aria-current="page"] { background: var(--tint-weak); color: var(--tint); }
  .rail-spacer { flex: 1; }
}
@media (max-width: 767px) { .rail-brand, .rail-spacer, .rail-only { display: none; } }
@media (min-width: 768px) { .mobile-only { display: none !important; } }

/* ---------- BOTÕES ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s5);
  border-radius: var(--r-full);
  font-size: var(--t-body); font-weight: var(--w-semi);
  color: #fff; background: var(--tint);
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), opacity var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn .ic { width: 20px; height: 20px; }
.btn:active { transform: scale(.96); opacity: .9; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.btn.block { display: flex; width: 100%; }
.btn.sm { min-height: 36px; padding: 0 var(--s4); font-size: var(--t-subhead); }
.btn.lg { min-height: 52px; font-size: var(--t-body); }

.btn.primary { background: var(--tint); color: #fff; }
.btn.primary:hover { background: var(--tint-strong); }
.btn.gold { background: var(--gold); color: #201700; }
.btn.ghost { background: var(--bg-elev2); color: var(--label); }
.btn.ghost:hover { background: var(--press); }
.btn.tinted { background: var(--tint-weak); color: var(--tint); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger.ghost { background: var(--danger-weak); color: var(--danger); }
.btn.plain { background: none; color: var(--tint); padding-inline: var(--s2); min-height: 40px; }

/* Botão-ícone com área de toque 44 mesmo com ícone pequeno */
.iconbtn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-full);
  color: var(--label-2);
  transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.iconbtn::before { content: ""; position: absolute; inset: -4px; } /* expande p/ 48 */
.iconbtn .ic { width: 24px; height: 24px; }
.iconbtn:hover { background: var(--hover); color: var(--label); }
.iconbtn:active { transform: scale(.9); }
.iconbtn.on { color: var(--tint); }

/* segmented control iOS */
.seg {
  display: inline-flex; position: relative;
  padding: 3px; gap: 2px;
  background: var(--bg-inset); border-radius: var(--r-full);
  width: 100%;
}
.seg-opt {
  position: relative; z-index: 1; flex: 1;
  min-height: 34px; padding: 0 var(--s3);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--t-subhead); font-weight: var(--w-medium);
  color: var(--label-2); border-radius: var(--r-full);
  transition: color var(--t-fast) var(--ease);
  white-space: nowrap;
}
.seg-opt[aria-selected="true"] { color: var(--label); }
.seg-thumb {
  position: absolute; z-index: 0; top: 3px; bottom: 3px;
  border-radius: var(--r-full);
  background: var(--bg-elev); box-shadow: var(--shadow-1);
  transition: transform var(--t-med) var(--ease), width var(--t-med) var(--ease);
}

/* ---------- CARD ---------- */
.card {
  background: var(--bg-elev);
  border: 0.5px solid var(--separator);
  border-radius: var(--r-lg);
  padding: var(--s4);
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: var(--s3); }
.card.pad0 { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.card-title { font-size: var(--t-subhead); font-weight: var(--w-semi); color: var(--label-2); text-transform: uppercase; letter-spacing: .04em; }

/* stat / bento */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .val { font-size: var(--t-title); font-weight: var(--w-bold); font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat .lbl { font-size: var(--t-footnote); color: var(--label-2); }
.stat .delta { font-size: var(--t-caption); font-weight: var(--w-semi); }
.stat .delta.up { color: var(--ok); }
.stat .delta.down { color: var(--danger); }
.grid { display: grid; gap: var(--s3); }
.grid.g2 { grid-template-columns: 1fr 1fr; }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 600px) { .grid.g2\@md { grid-template-columns: 1fr 1fr; } }

/* ---------- LIST / ROW ---------- */
.list {
  background: var(--bg-elev);
  border: 0.5px solid var(--separator);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.list.plain { background: none; border: 0; border-radius: 0; }
.row {
  display: flex; align-items: center; gap: var(--s3);
  min-height: var(--tap); padding: var(--s3) var(--s4);
  position: relative;
  transition: background-color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.row + .row::before {
  content: ""; position: absolute; left: var(--s4); right: 0; top: 0;
  border-top: 0.5px solid var(--separator);
}
a.row, button.row, .row.tap { cursor: pointer; width: 100%; text-align: left; }
a.row:active, button.row:active, .row.tap:active { background: var(--press); }
.row .body { flex: 1; min-width: 0; }
.row .title { font-size: var(--t-body); font-weight: var(--w-medium); }
.row .sub { font-size: var(--t-subhead); color: var(--label-2); }
.row .trail { margin-left: auto; color: var(--label-3); display: flex; align-items: center; gap: var(--s2); }
.row .chev { width: 18px; height: 18px; color: var(--label-3); }

/* ---------- AVATAR ---------- */
.avatar {
  position: relative; flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: var(--r-full);
  background: var(--bg-elev2); color: var(--label-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--t-subhead); font-weight: var(--w-semi);
  overflow: hidden; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; font-size: var(--t-caption); }
.avatar.lg { width: 64px; height: 64px; font-size: var(--t-title3); }
.avatar .ring-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 12px; height: 12px; border-radius: var(--r-full);
  border: 2px solid var(--bg-elev);
}

/* ---------- BADGE ---------- */
.badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-full);
  font-size: var(--t-caption2); font-weight: var(--w-bold); line-height: 1;
  background: var(--tint); color: #fff;
}
.badge.count { background: var(--tint); }
.badge.mut { background: var(--bg-elev2); color: var(--label-2); }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.danger { background: var(--danger-weak); color: var(--danger); }
.badge.gold { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold); }
.badge .ic { width: 12px; height: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: var(--s1);
  height: 26px; padding: 0 var(--s3);
  border-radius: var(--r-full);
  font-size: var(--t-caption); font-weight: var(--w-medium);
  background: var(--bg-elev2); color: var(--label-2);
}
.chip .ic { width: 14px; height: 14px; }
.chip.on { background: var(--tint-weak); color: var(--tint); }

/* pill de status (dot + texto) */
.pill {
  display: inline-flex; align-items: center; gap: var(--s2);
  height: 28px; padding: 0 var(--s3);
  border-radius: var(--r-full);
  font-size: var(--t-footnote); font-weight: var(--w-medium);
  background: var(--bg-elev2);
}
.dot { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--label-3); flex: 0 0 auto; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-weak); }
.dot.danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-weak); }
.dot.warn { background: var(--warn); }
.dot.live { background: var(--ok); animation: pulse-dot 2s var(--ease) infinite; }
@keyframes pulse-dot { 0%,100% { box-shadow: 0 0 0 0 var(--ok-weak); } 50% { box-shadow: 0 0 0 5px transparent; } }

/* ---------- ÍCONE (uso genérico) ---------- */
.ic { width: 24px; height: 24px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: inherit; }

/* ---------- SHEET (bottom sheet arrastável) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: var(--scrim);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-med) var(--ease);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 201;
  display: flex; flex-direction: column;
  max-height: 92dvh;
  background: var(--bg-elev);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-pop);
  transform: translateY(101%);
  transition: transform var(--t-slow) var(--ease);
  will-change: transform;
}
.sheet.open { transform: translateY(0); }
.sheet-grab {
  flex: 0 0 auto;
  width: 100%; padding: var(--s2) 0 var(--s1);
  display: flex; justify-content: center;
  cursor: grab; touch-action: none;
}
.sheet-grab::before { content: ""; width: 40px; height: 5px; border-radius: var(--r-full); background: var(--label-4); }
.sheet-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s1) var(--s4) var(--s3);
}
.sheet-head .sheet-title { flex: 1; font-size: var(--t-title3); font-weight: var(--w-bold); }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 var(--s4) var(--s3); }
.sheet-actions {
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: var(--s2);
  padding: var(--s3) var(--s4) calc(var(--s4) + var(--safe-bottom));
  border-top: 0.5px solid var(--separator);
}
/* Desktop: sheet vira dialog centrado */
@media (min-width: 768px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    transform: translate(-50%, -50%) scale(.96);
    width: min(92vw, 480px); max-height: 86dvh;
    border-radius: var(--r-xl);
    opacity: 0;
    transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease);
  }
  .sheet.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .sheet-grab { display: none; }
  .sheet-actions { flex-direction: row; justify-content: flex-end; padding-bottom: var(--s4); }
  .sheet-actions .btn { width: auto; }
}

/* ---------- TOAST ---------- */
.toast-stack {
  position: fixed; z-index: 300;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--s3));
  display: flex; flex-direction: column-reverse; gap: var(--s2);
  width: min(92vw, 420px);
  pointer-events: none;
}
@media (min-width: 768px) { .toast-stack { left: auto; right: var(--s6); transform: none; bottom: var(--s6); } }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  background: var(--bg-elev2);
  border: 0.5px solid var(--glass-line);
  box-shadow: var(--shadow-2);
  -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
  font-size: var(--t-subhead); font-weight: var(--w-medium);
  transform: translateY(12px); opacity: 0;
  transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease);
}
.toast.in { transform: none; opacity: 1; }
.toast.leaving { transform: translateY(8px); opacity: 0; }
.toast .ic { width: 20px; height: 20px; flex: 0 0 auto; }
.toast.ok .ic { color: var(--ok); }
.toast.error .ic { color: var(--danger); }
.toast.info .ic { color: var(--info); }
.toast .msg { flex: 1; min-width: 0; }

/* ---------- SKELETON ---------- */
.skeleton {
  position: relative; overflow: hidden;
  background: var(--skeleton-base);
  border-radius: var(--r-sm);
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 25%, var(--skeleton-sheen) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: sk-sheen 1.3s ease-in-out infinite;
}
.sk-line { height: 12px; border-radius: var(--r-full); }
.sk-title { height: 18px; width: 55%; border-radius: var(--r-full); }
.sk-circle { border-radius: var(--r-full); }
@keyframes sk-sheen { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } .skeleton { opacity: .7; } }

/* ---------- EMPTY STATE ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--s3); padding: var(--s12) var(--s5);
  color: var(--label-2);
}
.empty .empty-ic {
  width: 56px; height: 56px; border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev2); color: var(--label-3);
}
.empty .empty-ic .ic { width: 30px; height: 30px; }
.empty .empty-title { font-size: var(--t-title3); font-weight: var(--w-semi); color: var(--label); }
.empty .empty-hint { font-size: var(--t-subhead); color: var(--label-2); max-width: 30ch; }
.empty .btn { margin-top: var(--s2); }

/* ---------- CHART (container) ---------- */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis-lbl { font-size: 9px; fill: var(--label-3); font-family: var(--font-ui); }
.chart .grid-line { stroke: var(--separator); stroke-width: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s3); font-size: var(--t-caption); color: var(--label-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: var(--s1); }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- INPUT / FIELD ---------- */
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field label { font-size: var(--t-subhead); font-weight: var(--w-medium); color: var(--label-2); }
.input, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: var(--s3) var(--s4);
  background: var(--bg-inset);
  border: 0.5px solid var(--separator);
  border-radius: var(--r-md);
  color: var(--label);
  transition: border-color var(--t-fast), background-color var(--t-fast);
}
.textarea { min-height: 92px; resize: vertical; line-height: var(--lh-body); }
.input:focus, .textarea:focus { outline: none; border-color: var(--tint); background: var(--bg-elev); }

/* ---------- LOGIN ---------- */
.login-wrap {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--safe-top) + var(--s6)) var(--s5) calc(var(--safe-bottom) + var(--s6));
}
.login-card {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: var(--s5);
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: var(--s3); text-align: center; }
.login-mark { width: 68px; height: 68px; color: var(--tint); filter: drop-shadow(0 6px 24px var(--tint-weak)); }
.login-name { font-size: var(--t-title); font-weight: var(--w-bold); letter-spacing: -0.02em; }
.login-tag { font-size: var(--t-subhead); color: var(--label-2); }
.login-form { display: flex; flex-direction: column; gap: var(--s3); }
.login-err {
  font-size: var(--t-subhead); color: var(--danger);
  background: var(--danger-weak); border-radius: var(--r-md);
  padding: var(--s3) var(--s4); text-align: center;
}
.login-err[hidden] { display: none; }

/* ---------- UTIL ---------- */
[hidden] { display: none !important; }
.stack { display: flex; flex-direction: column; }
.stack.g2 { gap: var(--s2); } .stack.g3 { gap: var(--s3); } .stack.g4 { gap: var(--s4); } .stack.g5 { gap: var(--s5); }
.hrow { display: flex; align-items: center; gap: var(--s3); }
.spacer { flex: 1; }
.section-title { font-size: var(--t-subhead); font-weight: var(--w-semi); color: var(--label-2); text-transform: uppercase; letter-spacing: .05em; padding: var(--s5) var(--s1) var(--s2); }
