/* =====================================================================
   Mail2Me — design system v2 (temas)
   ===================================================================== */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* =====================================================================
   Temas
   - data-palette  : indigo | oceano | aurora | grafite  (cores da marca)
   - data-scheme   : light | dark  (resolvido por js/theme.js a partir de data-mode)
   Os neutros (fundo, superfícies, bordas) são derivados da cor principal com
   color-mix, então cada paleta ganha um "tom" próprio sem repetir tudo.
   ===================================================================== */
:root {
  /* paleta Índigo (padrão) */
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-strong: #4338ca;
  --accent: #ff6b4a;
  --link: var(--brand);
  --on-brand: #fff;
  --side-1: #1b1850;
  --side-2: #0e0c2b;
  --side-accent: #ff8a6e;
  --chart-delivered: #5b52f0;
  --chart-blocked: #ff6b4a;
  --chart-deferred: #f2b233;

  /* neutros — claro */
  --bg: color-mix(in oklab, var(--brand) 3%, #f5f6fa);
  --surface: #ffffff;
  --surface-2: color-mix(in oklab, var(--brand) 3%, #f8f9fc);
  --surface-3: color-mix(in oklab, var(--brand) 6%, #f1f3f8);
  --border: color-mix(in oklab, var(--brand) 6%, #e5e7ee);
  --border-strong: color-mix(in oklab, var(--brand) 8%, #d0d4df);
  --text: #11142a;
  --text-2: #484e66;
  --muted: #7a8098;
  --brand-soft: color-mix(in oklab, var(--brand) 10%, var(--surface));
  --accent-soft: color-mix(in oklab, var(--accent) 12%, var(--surface));
  --glow: color-mix(in oklab, var(--brand) 14%, transparent);

  --success: #0f8a5f;
  --success-soft: #e3f6ee;
  --warning: #a86200;
  --warning-soft: #fff3dd;
  --danger: #c93434;
  --danger-soft: #fdeaea;
  --info: #2667cc;
  --info-soft: #e7f0fd;
  --chart-grid: color-mix(in oklab, var(--brand) 5%, #eceef4);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(17, 20, 42, .04), 0 1px 1px rgba(17, 20, 42, .03);
  --shadow: 0 1px 2px rgba(17, 20, 42, .04), 0 10px 30px -12px rgba(17, 20, 42, .14);
  --shadow-brand: 0 6px 18px -6px color-mix(in oklab, var(--brand) 55%, transparent);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --sidebar: 260px;
  color-scheme: light;
}

/* neutros — escuro */
:root[data-scheme="dark"] {
  --on-brand: #0b0c16;
  --bg: color-mix(in oklab, var(--brand) 5%, #0b0d16);
  --surface: color-mix(in oklab, var(--brand) 5%, #12151f);
  --surface-2: color-mix(in oklab, var(--brand) 6%, #171a26);
  --surface-3: color-mix(in oklab, var(--brand) 8%, #1d2130);
  --border: color-mix(in oklab, var(--brand) 8%, #252a3a);
  --border-strong: color-mix(in oklab, var(--brand) 10%, #343a4f);
  --text: #eceef8;
  --text-2: #b6bbd2;
  --muted: #868ca8;
  --brand-soft: color-mix(in oklab, var(--brand) 16%, var(--surface));
  --accent-soft: color-mix(in oklab, var(--accent) 16%, var(--surface));
  --glow: color-mix(in oklab, var(--brand) 18%, transparent);
  --success: #45c991;
  --success-soft: #133127;
  --warning: #f2b233;
  --warning-soft: #33280f;
  --danger: #ff7b7b;
  --danger-soft: #3a1b21;
  --info: #79a9ff;
  --info-soft: #172843;
  --chart-grid: color-mix(in oklab, var(--brand) 8%, #22263a);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .6);
  --side-1: color-mix(in oklab, var(--brand) 12%, #0b0c14);
  --side-2: #07080d;
  color-scheme: dark;
}

/* Índigo — escuro */
:root[data-scheme="dark"]:not([data-palette]),
:root[data-palette="indigo"][data-scheme="dark"] {
  --brand: #8d8bff; --brand-2: #b794ff; --brand-strong: #a9a7ff; --accent: #ff8a6e;
  --chart-delivered: #8d8bff; --chart-blocked: #ff8a6e;
}

/* Oceano */
:root[data-palette="oceano"] {
  --brand: #0e7490; --brand-2: #0891b2; --brand-strong: #155e75; --accent: #f59e0b;
  --side-1: #0a3440; --side-2: #041a21; --side-accent: #fbbf24;
  --chart-delivered: #0e8aa8; --chart-blocked: #ef6351; --chart-deferred: #f5b42a;
}
:root[data-palette="oceano"][data-scheme="dark"] {
  --brand: #2cc1d9; --brand-2: #5eead4; --brand-strong: #67d8ea; --accent: #fbbf24;
  --chart-delivered: #2cc1d9; --chart-blocked: #ff7a6b; --chart-deferred: #fbbf24;
}

/* Aurora */
:root[data-palette="aurora"] {
  --brand: #7c3aed; --brand-2: #c026d3; --brand-strong: #6d28d9; --accent: #e11d74;
  --side-1: #2a1157; --side-2: #12062a; --side-accent: #f472b6;
  --chart-delivered: #8b5cf6; --chart-blocked: #e11d74; --chart-deferred: #f2b233;
}
:root[data-palette="aurora"][data-scheme="dark"] {
  --brand: #ad8bff; --brand-2: #ec7cf6; --brand-strong: #c4abff; --accent: #f472b6;
  --chart-delivered: #ad8bff; --chart-blocked: #f472b6;
}

/* Grafite */
:root[data-palette="grafite"] {
  --brand: #27272a; --brand-2: #52525b; --brand-strong: #09090b; --accent: #10b981;
  --link: #047857;
  --side-1: #18181b; --side-2: #09090b; --side-accent: #34d399;
  --chart-delivered: #10b981; --chart-blocked: #f97316; --chart-deferred: #eab308;
  --brand-soft: color-mix(in oklab, var(--accent) 10%, var(--surface));
  --glow: color-mix(in oklab, var(--accent) 10%, transparent);
  --shadow-brand: 0 6px 18px -8px rgba(9, 9, 11, .5);
}
:root[data-palette="grafite"][data-scheme="dark"] {
  --brand: #f4f4f5; --brand-2: #d4d4d8; --brand-strong: #ffffff; --accent: #34d399;
  --link: #34d399;
  --side-1: #141416; --side-2: #09090b;
  --bg: #0a0a0b; --surface: #131315; --surface-2: #18181b; --surface-3: #1f1f23;
  --border: #27272a; --border-strong: #3f3f46;
  --brand-soft: color-mix(in oklab, var(--accent) 14%, var(--surface));
  --chart-delivered: #34d399; --chart-blocked: #fb923c; --chart-grid: #232326;
}
/* no Grafite, os destaques "de marca" (navegação ativa, ícones) usam o verde */
:root[data-palette="grafite"] { --brand-ink: var(--link); }
:root { --brand-ink: var(--brand); }

/* ===================================================================== base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 1.7rem; font-weight: 720; letter-spacing: -.025em; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .98rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: var(--mono); font-size: .86em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
::selection { background: color-mix(in oklab, var(--brand) 25%, transparent); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
[hidden], input[type="hidden"] { display: none !important; }
.wordmark { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ícones */
.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }

/* logotipo (SVG inline que segue o tema) */
.logo-mark { width: 34px; height: 34px; flex: none; }
.logo-mark .lm-a { stop-color: var(--brand-2); }
.logo-mark .lm-b { stop-color: var(--brand); }
.logo-mark .lm-dot { fill: var(--accent); stroke: var(--side-2); }
.brand-dark .logo-mark .lm-dot, .auth-side .logo-mark .lm-dot { stroke: rgba(0, 0, 0, .25); }
:root[data-palette="grafite"] .logo-mark .lm-a { stop-color: #3f3f46; }
:root[data-palette="grafite"] .logo-mark .lm-b { stop-color: #18181b; }

/* ============================================================== layout */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background:
    radial-gradient(140% 50% at 0% 0%, color-mix(in oklab, var(--brand) 30%, transparent), transparent 70%),
    linear-gradient(180deg, var(--side-1), var(--side-2));
  color: rgba(255, 255, 255, .74);
  display: flex; flex-direction: column; padding: 20px 14px 16px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 10px 22px; color: var(--text); font-weight: 760; font-size: 1.24rem; letter-spacing: -.03em; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand .two { color: var(--accent); }
.sidebar .brand { color: #fff; }
.sidebar .brand .two, .auth-side .brand .two { color: var(--side-accent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: rgba(255, 255, 255, .42); font-weight: 650; padding: 18px 12px 6px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .72); font-weight: 520; transition: background .15s, color .15s;
}
.nav a .i { opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, .12); color: #fff; font-weight: 620; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
.nav a.active::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--side-accent);
}
.nav a.active .i { color: var(--side-accent); opacity: 1; }
.nav a .count { margin-left: auto; font-size: .72rem; background: var(--side-accent); color: #111; border-radius: 99px; padding: 0 7px; font-weight: 700; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar .btn-ghost { color: rgba(255, 255, 255, .7); }
.sidebar .btn-ghost:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.app-version { font-size: .72rem; color: rgba(255, 255, 255, .38); padding: 8px 12px 0; }
.tenant-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .05); margin-bottom: 6px; }
.avatar {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 60%, var(--brand-2))); color: #fff; font-weight: 700; font-size: .85rem;
}
.tenant-chip .who { min-width: 0; }
.tenant-chip .who strong { display: block; font-size: .86rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tenant-chip .who span { display: block; font-size: .75rem; color: rgba(255, 255, 255, .5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main {
  min-width: 0; display: flex; flex-direction: column;
  background: radial-gradient(900px 340px at 85% -120px, var(--glow), transparent 70%) no-repeat;
}
.topbar {
  display: flex; align-items: center; gap: 8px; padding: 12px 36px;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.topbar .menu-btn { display: none; }
.topbar .spacer { flex: 1; }
.topbar-title { font-size: .86rem; color: var(--muted); font-weight: 550; display: flex; align-items: center; gap: 8px; }
.topbar-title strong { color: var(--text); font-weight: 650; }
.topbar .user-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 4px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: .85rem;
}
.topbar .user-pill:hover { text-decoration: none; border-color: var(--border-strong); }
.topbar .user-pill .avatar { width: 28px; height: 28px; border-radius: 99px; font-size: .75rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); transition: color .15s, border-color .15s, transform .15s;
}
.icon-btn:hover { color: var(--brand-ink); border-color: var(--border-strong); text-decoration: none; }
.icon-btn:active { transform: scale(.94); }
.icon-btn .show-dark { display: none; }
:root[data-scheme="dark"] .icon-btn .show-dark { display: block; }
:root[data-scheme="dark"] .icon-btn .show-light { display: none; }

.content { padding: 12px 36px 56px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 26px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--text-2); }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); }

.banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 36px; font-size: .88rem;
  background: var(--warning-soft); color: var(--warning); border-bottom: 1px solid var(--border);
}
.banner.info { background: var(--info-soft); color: var(--info); }
.banner form { margin-left: auto; }

/* ================================================================ grid */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ================================================================ card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.card-head p { margin: 3px 0 0; color: var(--muted); font-size: .84rem; }
.card-body { padding: 20px 22px; }
.card-foot { padding: 12px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card.flush .card-body { padding: 0; }

/* =============================================================== stats */
.stat { padding: 20px 22px 18px; position: relative; overflow: hidden; isolation: isolate; }
.stat::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 130px; height: 130px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, var(--stat-tint, var(--glow)), transparent 70%); opacity: .9;
}
.stat .label { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: .84rem; font-weight: 560; }
.stat .value { font-size: 2.05rem; font-weight: 740; letter-spacing: -.035em; margin-top: 12px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .sub { color: var(--muted); font-size: .8rem; margin-top: 6px; }
.stat .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.stat-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: color-mix(in oklab, var(--stat-color, var(--brand)) 13%, var(--surface)); color: var(--stat-color, var(--brand));
}
.stat-icon .i { width: 18px; height: 18px; }
.stat-total { --stat-color: var(--brand-ink); }
.stat-delivered { --stat-color: var(--chart-delivered); --stat-tint: color-mix(in oklab, var(--chart-delivered) 16%, transparent); }
.stat-blocked { --stat-color: var(--chart-blocked); --stat-tint: color-mix(in oklab, var(--chart-blocked) 16%, transparent); }
.stat-deferred { --stat-color: color-mix(in oklab, var(--chart-deferred) 75%, var(--text)); --stat-tint: color-mix(in oklab, var(--chart-deferred) 20%, transparent); }
.dot-delivered { background: var(--chart-delivered); }
.dot-blocked { background: var(--chart-blocked); }
.dot-deferred { background: var(--chart-deferred); }
.dot-total { background: var(--text-2); }

.chart-box { position: relative; height: 290px; padding: 14px 18px 18px; }
.chart-box.sm { height: 180px; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--text-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { border-radius: 3px !important; }

/* barra horizontal (motivos) */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { border-radius: 8px; }
.bar-row .bar-top { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 6px; gap: 8px; }
.bar-row:hover .bar-top span { color: var(--brand-ink); }
.bar-track { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, color-mix(in oklab, var(--chart-blocked) 70%, var(--surface)), var(--chart-blocked)); border-radius: 99px; }
.bar-fill.brand { background: linear-gradient(90deg, var(--brand-2), var(--brand)); }
.bar-fill.warn { background: var(--chart-deferred); }

/* ============================================================= botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s, filter .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 1px; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), color-mix(in oklab, var(--brand) 70%, var(--brand-2)));
  color: var(--on-brand); box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); border-color: color-mix(in oklab, var(--brand) 30%, var(--border-strong)); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -6px color-mix(in oklab, var(--accent) 60%, transparent); }
.btn-sm { height: 31px; padding: 0 12px; font-size: .82rem; border-radius: 8px; }
.btn-icon { width: 34px; padding: 0; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn .htmx-indicator { display: none; }
.htmx-request .btn .htmx-indicator, .btn.htmx-request .htmx-indicator { display: inline; }
.htmx-request .btn .i-refresh, .btn.htmx-request .i-refresh { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
form.inline { display: inline; }

/* ============================================================== forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .label { font-weight: 600; font-size: .86rem; color: var(--text); }
.field .hint { font-size: .8rem; color: var(--muted); }
.input, select.input, textarea.input {
  height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; width: 100%;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input:hover { border-color: color-mix(in oklab, var(--brand) 25%, var(--border-strong)); }
.input:disabled { background: var(--surface-2); color: var(--muted); }
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .addon {
  display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); color: var(--text-2); font-weight: 550; white-space: nowrap;
}
.check { display: flex; align-items: flex-start; gap: 9px; font-size: .9rem; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { margin: 0; min-width: 140px; }
.filters .field.grow { flex: 1; min-width: 220px; }

/* ============================================================= badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px;
  font-size: .76rem; font-weight: 620; white-space: nowrap; background: var(--surface-3); color: var(--text-2);
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }

/* ============================================================= alerts */
.flashes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent); font-size: .9rem; background: var(--info-soft); color: var(--info);
}
.alert .i { margin-top: 1px; }
.alert p { margin: 0; color: inherit; }
.alert .close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; opacity: .7; padding: 0; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-error, .alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ============================================================= tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; font-size: .71rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  font-weight: 650; padding: 11px 22px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 13px 22px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
/* colunas numéricas: título e valor alinhados à direita, largura só do necessário */
.table th.right, .table td.right { text-align: right; width: 1%; white-space: nowrap; padding-left: 28px; }
.table th.center, .table td.center { text-align: center; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: color-mix(in oklab, var(--brand) 4%, var(--surface)); }
.table tr.clickable { cursor: pointer; }
.table .addr { font-weight: 600; color: var(--text); }
.table .sub { font-size: .8rem; color: var(--muted); }
.table .truncate { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { font-variant-numeric: tabular-nums; }

/* ============================================================== empty */
.empty { text-align: center; padding: 52px 20px; }
.empty .art {
  width: 68px; height: 68px; margin: 0 auto 16px; border-radius: 20px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-soft), color-mix(in oklab, var(--brand-2) 12%, var(--surface)));
  color: var(--brand-ink); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--brand) 12%, transparent);
}
.empty .art .i { width: 30px; height: 30px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--text-2); max-width: 460px; margin: 0 auto 16px; }

/* ========================================================= onboarding */
.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; counter-reset: step; }
.step {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface-2); font-size: .85rem; color: var(--text-2);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.step:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.step .n {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: .8rem;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2);
}
.step strong { color: var(--text); font-size: .88rem; }
.step.done { background: var(--success-soft); border-color: transparent; }
.step.done .n { background: var(--success); border-color: var(--success); color: #fff; }
.step.current { border-color: color-mix(in oklab, var(--brand) 45%, var(--border)); background: var(--brand-soft); box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand) 8%, transparent); }
.step.current .n { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* ================================================================ DNS */
.dns-list { display: flex; flex-direction: column; }
.dns-item { display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.dns-item:last-child { border-bottom: 0; }
.dns-state { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.dns-state.ok { background: var(--success-soft); color: var(--success); }
.dns-state.missing { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border-strong); }
.dns-state.wrong { background: var(--warning-soft); color: var(--warning); }
.dns-fields { display: grid; grid-template-columns: 76px minmax(200px, 1.25fr) minmax(0, 2.6fr); gap: 8px 12px; margin-top: 10px; align-items: start; }
.dns-fields .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; }
.copybox {
  display: flex; align-items: flex-start; gap: 6px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 6px 6px 6px 10px; font-family: var(--mono); font-size: .82rem; color: var(--text);
  word-break: break-all; min-height: 34px;
}
.copybox span { flex: 1; padding-top: 2px; }
.dns-name .copy-label { display: none; }
.dns-name .copybox span { word-break: normal; overflow-wrap: anywhere; }
.copybox.blank { border-style: dashed; background: transparent; color: var(--muted); font-family: var(--font); font-style: italic; }
.copy-btn {
  flex: none; background: var(--surface); color: var(--text-2); border-radius: 7px; height: 24px; padding: 0 8px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font: 600 .72rem var(--font); border: 1px solid var(--border);
}
.copy-btn:hover { color: var(--brand-ink); border-color: var(--brand-ink); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }
.current-values { margin-top: 8px; font-size: .8rem; color: var(--muted); }
.current-values code { color: var(--text-2); }

.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); border-radius: 99px; }
.progress.warn > div { background: var(--chart-deferred); }
.progress.full > div { background: var(--accent); }

/* ============================================================= listas */
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 10px 16px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 13px 22px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.symbols { display: flex; flex-wrap: wrap; gap: 6px; }
.symbol { font-size: .78rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 3px 8px; }
.symbol b { color: var(--accent); }
.tech { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-family: var(--mono); font-size: .8rem; white-space: pre-wrap; word-break: break-word; color: var(--text-2); }

/* log do servidor */
.logview {
  margin: 10px 0 0; padding: 12px 22px 18px; max-height: 70vh; overflow: auto; font-family: var(--mono); font-size: .78rem;
  line-height: 1.6; white-space: pre-wrap; word-break: break-all; background: var(--surface-2); border-top: 1px solid var(--border);
}
.logview .ll { display: block; color: var(--text-2); padding-left: 8px; border-left: 3px solid transparent; }
.logview .ll.ok { border-left-color: var(--success); color: var(--text); }
.logview .ll.bad { border-left-color: var(--danger); color: var(--danger); }
.logview .ll.warn { border-left-color: var(--warning); color: var(--warning); }
.logview .ll.info { color: var(--muted); }

/* senha exibida uma única vez */
.secret {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px dashed var(--accent); font-family: var(--mono); font-size: 1.05rem; font-weight: 650;
}
.secret span { flex: 1; letter-spacing: .04em; }

/* paginação */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 22px; border-top: 1px solid var(--border); font-size: .85rem; color: var(--muted); }

/* drawer de detalhes */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(8, 10, 22, .42); backdrop-filter: blur(2px); z-index: 60; display: none; }
.drawer {
  position: fixed; top: 10px; right: 10px; bottom: 10px; width: min(560px, calc(100% - 20px)); background: var(--surface); z-index: 61;
  border-radius: var(--radius); box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .35); transform: translateX(110%);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1); overflow-y: auto; border: 1px solid var(--border);
}
.drawer.open { transform: none; }
.drawer.open + .drawer-backdrop, .drawer-backdrop.open { display: block; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.drawer-body { padding: 20px 22px 32px; }

/* planos */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plan { position: relative; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.plan.selected, .plan.current { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.plan .price { font-size: 1.7rem; font-weight: 760; letter-spacing: -.03em; }
.plan .price small { font-size: .8rem; color: var(--muted); font-weight: 550; }
.plan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: .86rem; color: var(--text-2); }
.plan ul li { display: flex; gap: 8px; align-items: center; }
.plan ul .i { color: var(--success); }
.plan-radio { position: absolute; opacity: 0; }
label.plan { cursor: pointer; }
label.plan:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
label.plan:has(.plan-radio:checked) { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
label.plan:has(.plan-radio:focus-visible) { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); }

/* ========================================================= aparência */
.themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.theme-opt { position: relative; cursor: pointer; display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s; }
.theme-opt:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.theme-opt input { position: absolute; opacity: 0; }
.theme-opt:has(input:checked) { border-color: var(--brand-ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-ink) 16%, transparent); }
.theme-opt:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--brand-ink) 35%, transparent); }
.theme-opt .tick { position: absolute; top: 6px; right: 6px; z-index: 1; width: 24px; height: 24px; border-radius: 50%; display: none; place-items: center; background: var(--brand-ink); color: var(--on-brand); box-shadow: 0 0 0 3px var(--surface); }
.theme-opt:has(input:checked) .tick { display: grid; }
.theme-opt .name { font-weight: 650; font-size: .92rem; }
.theme-opt .desc { font-size: .8rem; color: var(--muted); line-height: 1.4; }
/* miniatura do painel */
.mini { height: 104px; border-radius: 10px; overflow: hidden; display: grid; grid-template-columns: 30% 1fr; border: 1px solid var(--border); }
.mini .m-side { padding: 10px 8px; display: flex; flex-direction: column; gap: 6px; }
.mini .m-side i { display: block; height: 6px; border-radius: 3px; background: rgba(255,255,255,.22); }
.mini .m-side i.on { background: var(--m-acc); width: 80%; }
.mini .m-main { background: #f6f7fb; padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.mini .m-row { display: flex; gap: 6px; }
.mini .m-card { flex: 1; height: 26px; border-radius: 6px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08); position: relative; }
.mini .m-card::after { content: ""; position: absolute; left: 6px; bottom: 6px; width: 40%; height: 5px; border-radius: 3px; background: var(--m-brand); }
.mini .m-card.alt::after { background: var(--m-acc); }
.mini .m-chart { flex: 1; border-radius: 6px; background: #fff; display: flex; align-items: flex-end; gap: 4px; padding: 6px; }
.mini .m-chart b { flex: 1; border-radius: 2px 2px 0 0; background: var(--m-brand); }
.mini .m-chart b:nth-child(3n) { background: var(--m-acc); }
.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border); }
.segmented label { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: .86rem; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s; }
.segmented input { position: absolute; opacity: 0; }
.segmented label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--brand-ink); }

/* =============================================================== auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.auth-side {
  background:
    radial-gradient(90% 70% at 100% 100%, color-mix(in oklab, var(--accent) 45%, transparent), transparent 60%),
    radial-gradient(120% 90% at 0% 0%, color-mix(in oklab, var(--brand-2) 80%, transparent), transparent 65%),
    linear-gradient(160deg, var(--brand), var(--side-2));
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; isolation: isolate;
}
.auth-side::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(80% 60% at 30% 40%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(80% 60% at 30% 40%, #000, transparent 75%);
}
.auth-side .brand { color: #fff; padding: 0; }
.auth-side h2 { font-size: 2.2rem; line-height: 1.12; max-width: 440px; letter-spacing: -.035em; font-weight: 760; }
.auth-side p { color: rgba(255, 255, 255, .8); max-width: 420px; font-size: 1rem; }
.flow { display: flex; align-items: center; gap: 10px; margin-top: 26px; flex-wrap: wrap; position: relative; z-index: 1; }
.flow .pill { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .24); border-radius: 99px; padding: 7px 14px; font-family: var(--mono); font-size: .85rem; backdrop-filter: blur(6px); }
.flow .arrow { color: var(--side-accent); }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 1; }
.auth-points li { display: flex; gap: 12px; align-items: center; color: rgba(255, 255, 255, .9); }
.auth-points li .i { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: rgba(255,255,255,.12); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card.wide { max-width: 760px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .lead { color: var(--text-2); margin-bottom: 24px; }
.auth-foot { margin-top: 18px; font-size: .88rem; color: var(--text-2); text-align: center; }
.public-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(800px 400px at 50% -100px, var(--glow), transparent 70%) no-repeat, var(--bg); }
.public-card { max-width: 520px; width: 100%; text-align: center; padding: 36px 32px; }
.public-card .brand { justify-content: center; }

/* ======================================================== movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ======================================================== responsivo */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; width: 272px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .drawer-backdrop { display: block; }
  .topbar { padding: 10px 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar .user-pill > span:not(.avatar) { display: none; }
  .topbar .user-pill { padding: 0 4px; }
  .topbar-title { display: none; }
  .content { padding: 4px 16px 40px; }
  .banner { padding: 10px 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .dns-fields { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .drawer { top: 0; right: 0; bottom: 0; width: 100%; border-radius: 0; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr; }
  .stat .value { font-size: 1.7rem; }
}
.auth-side .logo-mark { border-radius: 13px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .35), 0 8px 20px -6px rgba(0, 0, 0, .45); }
