/* Ghost Spam Creator — interface web.
   Tokens derivados de assets/brand/palette.json (tema escuro). */

:root {
  color-scheme: dark;
  --bg: var(--ghost-bg);
  --bg-2: var(--ghost-inset);
  --surface: var(--ghost-surface);
  --surface-2: var(--ghost-raised);
  --surface-3: var(--ghost-hover);
  --border: var(--ghost-border);
  --border-2: var(--ghost-line);

  --accent: var(--ghost-accent);
  --accent-hover: var(--ghost-accent-hover);
  --accent-text: var(--ghost-link);
  --accent-lt: #FFA3C1;
  --accent-bg: var(--ghost-tint);

  --text: var(--ghost-text);
  --text-2: var(--ghost-secondary);
  --muted: var(--ghost-muted);
  --muted-2: #8A8B9B;
  --muted-3: #676876;

  --success: var(--ghost-success);
  --success-bg: #14271F;
  --warning: var(--ghost-warning);
  --warning-bg: #2B2416;
  --danger: var(--ghost-danger);
  --danger-bg: #301A20;
  --info: var(--ghost-info);
  --info-bg: #17202F;
  --violet: #B6A0EF;
  --violet-bg: #211D30;

  --font: var(--ghost-font);
  --font-display: var(--ghost-display);
  --mono: var(--ghost-mono);

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px; --r-full: 999px;
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 18px 50px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
  --ring: 0 0 0 3px rgba(255, 112, 158, 0.38);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 180ms;

  --sidebar-w: 256px;
  --content-max: 1280px;
  --topbar-h: 56px;
  --tabbar-h: 62px;
  --tap: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 400 15px/1.5 var(--font); letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, pre { font-family: var(--mono); }
hr.divider { border: 0; border-top: 1px solid var(--border); margin: var(--s-2) 0; }
::selection { background: rgba(208, 0, 74, 0.55); color: #fff; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent-lt); outline-offset: 2px; border-radius: 6px; }
.page-title:focus, .page-title:focus-visible, .main:focus { outline: none; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.break { overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.success-text { color: var(--success); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); }
.text-link { color: var(--accent-text); font-weight: 600; }
.section-title { font-size: 15px; font-weight: 650; margin-bottom: var(--s-3); }
.center-row { display: flex; justify-content: center; }
.note { display: flex; align-items: flex-start; gap: var(--s-2); color: var(--muted); font-size: 13px; }
.note .icon { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--accent-text); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.noscript { padding: var(--s-8); text-align: center; color: var(--muted); }

.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--s-6); }
.stack > div:empty, .stack-lg > div:empty { display: none; }
.grid-2 { display: grid; gap: var(--s-6); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2--top { align-items: start; }
.grid-3 { display: grid; gap: var(--s-6); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.form-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }

/* ---------------------------------------------------------------- ícones */
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- marca */
.brand { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--text); text-decoration: none; border-radius: var(--r); }
.brand:hover { text-decoration: none; }
.brand__logo { width: 38px; height: 38px; }
.brand--compact .brand__logo { width: 30px; height: 30px; }
.brand__name { display: flex; flex-direction: column; font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.12; letter-spacing: -0.015em; color: var(--text); }
.brand__name span:last-child { color: var(--accent-text); }
.brand--compact .brand__name { font-size: 13.5px; }
.brand__name--lg { font-size: 20px; align-items: center; text-align: center; }

/* ---------------------------------------------------------------- boot */
.boot { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-4); }
.boot__logo { width: 64px; height: 64px; }
.boot__spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--accent-text); animation: spin 0.9s linear infinite; margin-top: var(--s-2); }

/* ---------------------------------------------------------------- botões */
.btn {
  --h: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--h); padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform 80ms var(--ease);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn .icon { width: 18px; height: 18px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; opacity: 0.75; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--secondary { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }
.btn--secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn--ghost { background: transparent; color: var(--accent-text); }
.btn--ghost:hover:not(:disabled) { background: var(--accent-bg); }
.btn--danger { background: var(--danger-bg); border-color: rgba(255, 107, 118, 0.35); color: var(--danger); }
.btn--danger:hover:not(:disabled) { background: #3d1f27; }
.btn--sm { --h: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn--icon { padding: 0; width: var(--h); }
.btn--block { width: 100%; }
.linkish { background: none; border: 0; padding: 0; color: var(--text); font-weight: 600; cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.linkish:hover { color: var(--accent-text); }
.skip-link { position: fixed; left: var(--s-4); top: -60px; z-index: 100; background: var(--accent); color: #fff; border: 0; padding: 10px 16px; border-radius: 10px; font-weight: 600; }
.skip-link:focus-visible { top: var(--s-4); }

/* ---------------------------------------------------------------- shell */
.shell { min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); display: flex; flex-direction: column; gap: var(--s-6);
  padding: var(--s-6) var(--s-4) var(--s-4); background: var(--bg); border-right: 1px solid var(--border); overflow-y: auto; z-index: 20;
}
.sidebar > .brand { padding: 0 var(--s-2); }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar__section { font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); padding: var(--s-4) var(--s-3) var(--s-2); }
.sidebar__section:first-child { padding-top: 0; }
.sidebar__item {
  display: flex; align-items: center; gap: var(--s-3); min-height: 40px; padding: 0 var(--s-3); border-radius: 10px;
  color: var(--text-2); font-weight: 550; font-size: 14.5px; transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.sidebar__item:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.sidebar__item .icon { color: var(--muted); }
.sidebar__item.is-active { background: var(--accent-bg); color: var(--accent-lt); }
.sidebar__item.is-active .icon { color: var(--accent-text); }
.sidebar__label { flex: 1; min-width: 0; }
.nav__badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full); background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nav__badge[hidden] { display: none; }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-bg); color: var(--accent-lt); font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }
.avatar--lg { width: 44px; height: 44px; font-size: 15px; }
.avatar--xl { width: 56px; height: 56px; font-size: 18px; }
.avatar { position: relative; overflow: hidden; }
.avatar__image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
input[type="file"] { max-width: 100%; min-width: 0; }

.live { display: inline-flex; align-items: center; gap: var(--s-2); font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 4px 10px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border); width: fit-content; }
.live__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-3); }
.live[data-state="live"] { color: var(--success); }
.live[data-state="live"] .live__dot { background: var(--success); box-shadow: 0 0 0 0 rgba(88, 212, 154, 0.6); animation: pulse 2.4s var(--ease) infinite; }
.live[data-state="reconnecting"] { color: var(--warning); }
.live[data-state="reconnecting"] .live__dot { background: var(--warning); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(88, 212, 154, 0.55); } 70% { box-shadow: 0 0 0 7px rgba(88, 212, 154, 0); } 100% { box-shadow: 0 0 0 0 rgba(88, 212, 154, 0); } }

.topbar { display: none; }
.tabbar { display: none; }
.main { margin-left: var(--sidebar-w); min-height: 100vh; padding: var(--s-8) var(--s-8) var(--s-12); }
.content { max-width: var(--content-max); margin: 0 auto; display: flex; flex-direction: column; gap: var(--s-6); }
.has-savebar .main { padding-bottom: 120px; }

/* ---------------------------------------------------------------- cabeçalho da página */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.page-header__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.page-title { font-family: var(--font-display); font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.022em; overflow-wrap: anywhere; }
.page-subtitle { color: var(--muted); font-size: 15px; max-width: 70ch; }
.page-header__actions { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); font-weight: 600; font-size: 14px; margin-left: -4px; min-height: 32px; width: fit-content; }
.back-link .icon { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- cartões */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); padding: var(--s-5) var(--s-6) 0; flex-wrap: wrap; }
.card__titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 220px; }
.card__title { font-size: 17px; font-weight: 650; letter-spacing: -0.012em; }
.card__subtitle { color: var(--muted); font-size: 14px; }
.card__actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; min-width: 0; max-width: 100%; }
.card__actions > * { min-width: 0; max-width: 100%; }
.card__body { padding: var(--s-5) var(--s-6) var(--s-6); min-width: 0; }
.card__head + .card__body { padding-top: var(--s-4); }
.card__foot { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); padding: var(--s-3) var(--s-6); border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.card--inset { background: var(--bg-2); box-shadow: none; }
.card--inset .card__head { padding: var(--s-4) var(--s-5) 0; }
.card--inset .card__body { padding: var(--s-4) var(--s-5) var(--s-5); }

/* ---------------------------------------------------------------- métricas */
.metrics { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); }
.metrics--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.metric__label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 550; }
.metric__label .icon { width: 16px; height: 16px; }
.metric__value { font-family: var(--font-display); font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
.metric__hint { color: var(--muted-2); font-size: 12.5px; }
.metric--success .metric__label .icon, .metric--success .metric__value { color: var(--success); }
.metric--warning .metric__label .icon, .metric--warning .metric__value { color: var(--warning); }
.metric--danger .metric__label .icon, .metric--danger .metric__value { color: var(--danger); }
.metric--accent .metric__label .icon, .metric--accent .metric__value { color: var(--accent-text); }
.metric--partial .metric__label .icon { color: var(--warning); }

/* ---------------------------------------------------------------- pílulas de estado */
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 10px 2px 8px; border-radius: var(--r-full); font-size: 13px; font-weight: 600; line-height: 1.25; border: 1px solid transparent; max-width: 100%; }
.pill .icon { width: 15px; height: 15px; stroke-width: 2; }
.pill--sm { min-height: 22px; font-size: 12px; padding: 1px 8px 1px 6px; }
.pill--sm .icon { width: 13px; height: 13px; }
.pill--waiting { background: var(--surface-3); color: var(--text-2); border-color: var(--border-2); }
.pill--running { background: var(--accent-bg); color: var(--accent-lt); border-color: rgba(255, 112, 158, 0.3); }
.pill--external { background: var(--info-bg); color: var(--info); border-color: rgba(122, 169, 244, 0.3); }
.pill--done { background: var(--success-bg); color: var(--success); border-color: rgba(88, 212, 154, 0.28); }
.pill--partial { background: var(--warning-bg); color: var(--warning); border-color: rgba(237, 194, 105, 0.3); }
.pill--interrupted { background: var(--violet-bg); color: var(--violet); border-color: rgba(182, 160, 239, 0.3); }
.pill--failed { background: var(--danger-bg); color: var(--danger); border-color: rgba(255, 107, 118, 0.32); }
.pill--accent { background: var(--accent-bg); color: var(--accent-lt); }

.level { width: 28px; height: 28px; flex: none; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.level .icon { width: 16px; height: 16px; }
.level--info { background: var(--surface-3); color: var(--text-2); }
.level--success { background: var(--success-bg); color: var(--success); }
.level--warning { background: var(--warning-bg); color: var(--warning); }
.level--danger { background: var(--danger-bg); color: var(--danger); }

/* ---------------------------------------------------------------- avisos */
.callout { display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r); border: 1px solid var(--border-2); background: var(--surface-2); }
.callout > .icon { margin-top: 1px; }
.callout__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; align-items: flex-start; }
.callout__title { font-weight: 650; }
.callout__text { color: var(--text-2); font-size: 14px; }
.callout--info > .icon { color: var(--info); }
.callout--accent { background: var(--accent-bg); border-color: rgba(255, 112, 158, 0.3); }
.callout--accent > .icon { color: var(--accent-text); }
.callout--warning { background: var(--warning-bg); border-color: rgba(237, 194, 105, 0.32); }
.callout--warning > .icon, .callout--warning .callout__title { color: var(--warning); }
.callout--danger { background: var(--danger-bg); border-color: rgba(255, 107, 118, 0.35); }
.callout--danger > .icon, .callout--danger .callout__title { color: var(--danger); }
.callout--success { background: var(--success-bg); border-color: rgba(88, 212, 154, 0.3); }
.callout--success > .icon { color: var(--success); }
.issues { list-style: disc; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 14px; }

.form-error { display: flex; gap: var(--s-2); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r); background: var(--danger-bg); border: 1px solid rgba(255, 107, 118, 0.35); color: #ffc9ce; font-size: 14px; }
.form-error[hidden] { display: none; }
.form-error .icon { color: var(--danger); width: 18px; height: 18px; margin-top: 1px; }

/* ---------------------------------------------------------------- vazio, erro, carregando */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-2); padding: var(--s-8) var(--s-4); }
.empty__icon { width: 48px; height: 48px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); margin-bottom: var(--s-2); }
.empty__icon .icon { width: 22px; height: 22px; }
.empty__title { font-weight: 650; font-size: 15.5px; }
.empty__text { color: var(--muted); font-size: 14px; max-width: 46ch; }
.empty .btn { margin-top: var(--s-3); }
.empty--error .empty__icon { color: var(--danger); background: var(--danger-bg); border-color: rgba(255, 107, 118, 0.3); }

.skeleton-wrap { width: 100%; }
.skeleton { display: grid; gap: var(--s-3); }
.skeleton__item { border-radius: var(--r); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 40%, var(--surface) 80%); background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite; border: 1px solid var(--border); }
.skeleton--lines .skeleton__item { height: 16px; border: 0; border-radius: 6px; }
.skeleton--lines .skeleton__item:nth-child(3n) { width: 70%; }
.skeleton--rows .skeleton__item { height: 56px; }
.skeleton--cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.skeleton--cards .skeleton__item { height: 180px; border-radius: var(--r-lg); }
.skeleton--metrics { grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); }
.skeleton--metrics .skeleton__item { height: 104px; border-radius: var(--r-lg); }
.skeleton--page .skeleton__item:first-child { height: 40px; width: 40%; border: 0; }
.skeleton--page .skeleton__item { height: 140px; border-radius: var(--r-lg); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------------------------------------------------------------- formulários */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 13.5px; font-weight: 600; color: var(--text-2); display: flex; gap: var(--s-2); align-items: baseline; }
.field__optional { font-weight: 500; color: var(--muted-2); font-size: 12.5px; }
.field__hint { font-size: 13px; color: var(--muted); }
.field__error { font-size: 13px; color: var(--danger); font-weight: 550; }
.field__error[hidden] { display: none; }
.input {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border-2);
  color: var(--text); font-size: 15px; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input::placeholder { color: var(--muted-2); }
.input:hover:not(:disabled) { border-color: #4a4c5a; }
.input:focus, .input:focus-visible { outline: none; border-color: var(--accent-text); box-shadow: var(--ring); }
.input[aria-invalid] { border-color: var(--danger); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }
.input[readonly] { color: var(--text-2); }
.input--mono { font-family: var(--mono); font-size: 13.5px; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
input[type="number"] { font-variant-numeric: tabular-nums; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) var(--s-4); border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--border); cursor: pointer; min-height: 56px; position: relative; }
.switch__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch__text strong { font-weight: 600; font-size: 14.5px; }
.switch__text small { color: var(--muted); font-size: 13px; }
.switch__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 46px; height: 28px; border-radius: var(--r-full); background: var(--surface-3); border: 1px solid var(--border-2); position: relative; flex: none; transition: background var(--dur) var(--ease); }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); transition: transform var(--dur) var(--ease); }
.switch__input:checked + .switch__track { background: var(--accent); border-color: var(--accent); }
.switch__input:checked + .switch__track::after { transform: translateX(18px); }
.switch__input:focus-visible + .switch__track { box-shadow: var(--ring); }
.switch.is-disabled { opacity: 0.5; cursor: not-allowed; }

.check { display: flex; align-items: flex-start; gap: var(--s-3); cursor: pointer; padding: var(--s-3) var(--s-4); border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--border-2); position: relative; min-height: var(--tap); }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check__box { width: 22px; height: 22px; flex: none; border-radius: 6px; border: 1.5px solid var(--muted-2); display: inline-flex; align-items: center; justify-content: center; color: transparent; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); margin-top: 1px; }
.check__box .icon { width: 15px; height: 15px; stroke-width: 2.6; }
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent); color: #fff; }
.check input:focus-visible + .check__box { box-shadow: var(--ring); }
.check__text { display: flex; flex-direction: column; gap: 2px; font-weight: 600; font-size: 14.5px; }
.check__text small { font-weight: 400; color: var(--muted); }

.radio-cards { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.radio-cards legend { margin-bottom: var(--s-2); }
.radio-card { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4); border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--border-2); cursor: pointer; position: relative; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.radio-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio-card__dot { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 1.5px solid var(--muted-2); margin-top: 1px; position: relative; }
.radio-card input:checked ~ .radio-card__dot { border-color: var(--accent-text); }
.radio-card input:checked ~ .radio-card__dot::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent-text); }
.radio-card:has(input:checked) { border-color: rgba(255, 112, 158, 0.55); background: var(--accent-bg); }
.radio-card input:focus-visible ~ .radio-card__dot { box-shadow: var(--ring); }
.radio-card__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.radio-card__text strong { font-weight: 650; }
.radio-card__text small { color: var(--muted); font-size: 13px; }
.radio-card.is-disabled { opacity: 0.5; cursor: not-allowed; }

.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--border); max-width: 100%; }
.segmented--scroll { overflow-x: auto; scrollbar-width: none; }
.segmented--scroll::-webkit-scrollbar { display: none; }
.segmented__item { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; flex: none; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.segmented__item:hover { color: var(--text); }
.segmented__item[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.segmented__count { font-size: 12px; color: var(--muted-2); background: var(--surface-2); border-radius: var(--r-full); padding: 0 7px; min-width: 22px; text-align: center; }
.segmented__item[aria-pressed="true"] .segmented__count { color: var(--accent-lt); background: var(--accent-bg); }

.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.dl__row { padding: var(--s-3) var(--s-4); display: flex; flex-direction: column; gap: 3px; min-width: 0; box-shadow: 1px 1px 0 var(--border); }
.dl__row dt { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.dl__row dd { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.dl.dl--compact { grid-template-columns: minmax(0, 1fr); }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; right: var(--s-6); bottom: var(--s-6); z-index: 200; display: flex; flex-direction: column; gap: var(--s-2); width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-2) var(--s-3) var(--s-4); border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border-2); box-shadow: var(--shadow-2); animation: toast-in 220ms var(--ease); }
.toast > .icon { margin-top: 1px; }
.toast__text { flex: 1; font-size: 14px; padding-top: 1px; overflow-wrap: anywhere; }
.toast .btn { --h: 28px; margin: -3px 0; color: var(--muted); }
.toast--success > .icon { color: var(--success); }
.toast--error { border-color: rgba(255, 107, 118, 0.45); }
.toast--error > .icon { color: var(--danger); }
.toast--warning > .icon { color: var(--warning); }
.toast--info > .icon { color: var(--accent-text); }
.toast.is-leaving { animation: toast-out 180ms var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------------------------------------------------------------- diálogos */
.dialog { padding: 0; border: 0; background: transparent; color: var(--text); width: min(560px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 48px); overflow: visible; }
.dialog--sm { width: min(440px, calc(100vw - 32px)); }
.dialog--lg { width: min(780px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(5, 6, 9, 0.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade-in 200ms var(--ease); }
.dialog__panel { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-xl); box-shadow: var(--shadow-2); animation: dialog-in 220ms var(--ease); overflow: hidden; }
.dialog.is-leaving .dialog__panel { animation: dialog-out 160ms var(--ease) forwards; }
.dialog.is-leaving::backdrop { opacity: 0; transition: opacity 160ms; }
.dialog__grabber { display: none; }
.dialog__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); padding: var(--s-5) var(--s-5) var(--s-3) var(--s-6); }
.dialog__title { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.015em; }
.dialog__desc { color: var(--muted); font-size: 14px; margin-top: 4px; }
.dialog__close { --h: 36px; color: var(--muted); margin: -4px -4px 0 0; }
.dialog__content { padding: var(--s-2) var(--s-6) var(--s-5); overflow-y: auto; overscroll-behavior: contain; }
.dialog__footer { display: flex; justify-content: flex-end; gap: var(--s-3); padding: var(--s-4) var(--s-6); border-top: 1px solid var(--border); background: var(--bg-2); flex-wrap: wrap; }
.dialog__footer[hidden] { display: none; }
.dialog__message { color: var(--text-2); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }

/* ---------------------------------------------------------------- telas públicas */
.public { min-height: 100vh; min-height: 100dvh; background: radial-gradient(1000px 520px at 50% -10%, rgba(208, 0, 74, 0.16), transparent 70%), var(--bg); }
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-5); padding: var(--s-8) var(--s-4); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: var(--s-8); box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: var(--s-4); }
.auth-card__brand { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); margin-bottom: var(--s-2); }
.auth-card__brand img { width: 56px; height: 56px; }
.auth-card--status .auth-card__brand img { width: 40px; height: 40px; }
.auth-card--status .auth-card__brand .brand__name { flex-direction: column; align-items: center; font-size: 14px; }
.auth-card__title { font-family: var(--font-display); font-size: 24px; font-weight: 700; text-align: center; letter-spacing: -0.02em; }
.auth-card__subtitle { color: var(--muted); text-align: center; font-size: 14.5px; margin-top: -6px; }
.auth-card__footer { text-align: center; color: var(--muted); font-size: 14px; padding-top: var(--s-4); border-top: 1px solid var(--border); }
.auth__legal { color: var(--muted-2); font-size: 12.5px; text-align: center; max-width: 420px; }
.auth-success { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3); padding: var(--s-2) 0; }
.auth-success__icon, .status-badge { width: 56px; height: 56px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: var(--success-bg); color: var(--success); }
.auth-success__icon .icon, .status-badge .icon { width: 26px; height: 26px; }
.auth-success__title { font-weight: 700; font-size: 18px; }
.auth-success__text { color: var(--muted); font-size: 14.5px; }
.auth-success .btn { margin-top: var(--s-2); }
.status-badge { align-self: center; }
.status-badge--waiting { background: var(--surface-3); color: var(--text-2); }
.status-badge--failed { background: var(--danger-bg); color: var(--danger); }
.status-badge--partial { background: var(--warning-bg); color: var(--warning); }

/* ---------------------------------------------------------------- lote */
.countbar { display: flex; height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; gap: 2px; }
.countbar__seg { height: 100%; min-width: 4px; }
.countbar__seg--done { background: var(--success); }
.countbar__seg--partial { background: var(--warning); }
.countbar__seg--failed { background: var(--danger); }
.countbar__seg--interrupted { background: var(--violet); }
.countbar__seg--running { background: var(--accent-text); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-full); background: var(--bg-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.chip strong { color: var(--text); }
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.chip--running .chip__dot { background: var(--accent-text); }
.chip--done .chip__dot { background: var(--success); }
.chip--failed .chip__dot { background: var(--danger); }
.chip--partial .chip__dot { background: var(--warning); }
.chip--interrupted .chip__dot { background: var(--violet); }

.batch-summary { display: flex; flex-direction: column; gap: var(--s-3); }
.batch-summary__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.batch-summary__time { font-size: 13px; }
.batch-summary__main { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.batch-summary__title { font-size: 18px; font-weight: 650; letter-spacing: -0.012em; }
.batch-summary__count { color: var(--text-2); font-size: 14px; }
.batch-summary__count strong { color: var(--text); font-size: 16px; }
.batch-summary__reason { color: var(--text-2); font-size: 14px; }
.batch-summary__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; padding-top: var(--s-1); }

.batch-head { padding: var(--s-5) var(--s-6) var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); }
.batch-head__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.batch-head__count { font-size: 15px; color: var(--text-2); }
.batch-head__count strong { font-family: var(--font-display); font-size: 24px; color: var(--text); letter-spacing: -0.02em; }
.batch-head__reason { color: var(--text-2); }

.batch-list { display: flex; flex-direction: column; }
.batch-list > li + li { border-top: 1px solid var(--border); }
.batch-row { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-3) var(--s-2); margin: 0 calc(var(--s-2) * -1); border-radius: var(--r); color: var(--text); min-height: 56px; flex-wrap: wrap; }
.batch-row:hover { background: var(--surface-2); text-decoration: none; }
.batch-row__main { display: flex; align-items: center; gap: var(--s-3); flex: 1 1 260px; min-width: 0; }
.batch-row__title { font-weight: 600; }
.batch-row__meta { display: flex; gap: var(--s-4); align-items: center; flex-wrap: wrap; font-size: 13.5px; color: var(--text-2); }
.batch-row__chev { color: var(--muted-2); }

.ops-top { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.route-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.route-steps li { display: flex; flex-direction: column; gap: 2px; padding: var(--s-3); border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--border); }
.route-steps span { color: var(--accent-text); font-size: 12px; font-weight: 700; }
.route-steps b { font-size: 13.5px; font-weight: 600; }
.delivery { display: flex; gap: var(--s-4); align-items: flex-start; padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); border: 1px dashed var(--border-2); background: var(--bg-2); }
.delivery__icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--accent-bg); color: var(--accent-text); flex: none; }
.delivery strong { display: block; font-weight: 650; }
.delivery small { color: var(--muted); font-size: 13px; }

.capacity { display: flex; flex-direction: column; gap: var(--s-2); }
.capacity__main { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.015em; }
.capacity__sub { font-size: 14px; }
.meter { display: flex; gap: 4px; margin-top: var(--s-2); flex-wrap: wrap; }
.meter__slot { width: 22px; height: 10px; border-radius: 4px; background: var(--surface-3); }
.meter__slot.is-on { background: var(--accent-text); }

/* ---------------------------------------------------------------- tabela de contas (tabela no desktop, cartões em telas estreitas) */
.jtable-wrap { container-type: inline-size; }
.jtable { display: flex; flex-direction: column; }
.jrow { display: grid; grid-template-columns: 44px minmax(150px, 1.15fr) minmax(110px, 1fr) minmax(85px, 0.9fr) minmax(120px, 1.2fr) 72px minmax(125px, 1.4fr) 116px; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-2); border-top: 1px solid var(--border); cursor: pointer; border-radius: 0; }
.jrow:hover { background: var(--bg-2); }
.jrow--head { cursor: default; border-top: 0; color: var(--muted); font-size: 12.5px; font-weight: 600; padding-top: 0; padding-bottom: var(--s-2); }
.jrow--head:hover { background: none; }
.jrow__cell { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; overflow-wrap: anywhere; }
.jrow__ord { color: var(--muted); }
.jrow__account small, .jrow__stage small, .jrow__last small { font-size: 12.5px; }
.jrow__zip { align-items: flex-end; }
.jrow__zip small { max-width: 150px; text-align: right; font-size: 12px; line-height: 1.35; }
.uncertain { display: inline-flex; align-items: flex-start; gap: 4px; color: var(--warning); font-size: 12.5px; font-weight: 600; }
.uncertain .icon { width: 14px; height: 14px; margin-top: 2px; }
.jrow--uncertain { box-shadow: inset 3px 0 0 var(--warning); }

@container (max-width: 1030px) {
  .jrow--head { display: none; }
  .jrow { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "state state zip" "account account account" "rest rest rest"; gap: var(--s-2) var(--s-3); padding: var(--s-4); margin-top: var(--s-3); border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-2); }
  .jrow:first-of-type { margin-top: 0; }
  .jrow:hover { background: var(--surface-2); }
  .jrow__ord { display: none; }
  .jrow__state { grid-area: state; flex-direction: row; }
  .jrow__zip { grid-area: zip; }
  .jrow__account { grid-area: account; font-size: 15.5px; }
  .jrow__cell[data-label]:not(.jrow__state):not(.jrow__account):not(.jrow__zip):not(.jrow__ord) { grid-column: 1 / -1; display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: var(--s-3); }
  .jrow__cell[data-label]:not(.jrow__state):not(.jrow__account):not(.jrow__zip):not(.jrow__ord)::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  .jrow__cell[data-label] > small { grid-column: 2; }
}

/* ---------------------------------------------------------------- eventos */
.log-card .card__body { padding-top: var(--s-3); }
.events { display: flex; flex-direction: column; max-height: 520px; overflow-y: auto; overscroll-behavior: contain; }
.event { display: flex; gap: var(--s-3); padding: var(--s-3) 0; border-top: 1px solid var(--border); }
.event:first-child { border-top: 0; }
.event__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.event__msg { font-size: 14px; overflow-wrap: anywhere; }
.event__meta { color: var(--muted); font-size: 12.5px; }
.events__empty { list-style: none; }

.timeline { display: flex; flex-direction: column; position: relative; }
.timeline__item { display: flex; gap: var(--s-3); padding: var(--s-2) 0; position: relative; }
.timeline__item::before { content: ""; position: absolute; left: 13.5px; top: 40px; bottom: -6px; width: 1px; background: var(--border-2); }
.timeline__item:last-child::before { display: none; }
.timeline__body { min-width: 0; padding-top: 3px; }
.timeline__msg { font-size: 14px; overflow-wrap: anywhere; }
.timeline__meta { color: var(--muted); font-size: 12.5px; }
.job-head { display: flex; flex-direction: column; gap: var(--s-3); align-items: flex-start; }
.job-head__name { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.job-head .callout { width: 100%; }

/* ---------------------------------------------------------------- biblioteca */
.library { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.library__folders { position: sticky; top: var(--s-6); }
.folder-list { display: flex; flex-direction: column; gap: 2px; }
.folder { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: var(--tap); padding: 0 var(--s-3); border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; text-align: left; font-weight: 550; }
.folder:hover { background: var(--surface-2); color: var(--text); }
.folder .icon { color: var(--muted); }
.folder.is-active { background: var(--accent-bg); color: var(--accent-lt); border-color: rgba(255, 112, 158, 0.25); }
.folder.is-active .icon { color: var(--accent-text); }
.folder__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder__tag { font-size: 11px; font-weight: 700; color: var(--accent-text); background: var(--accent-bg); padding: 1px 6px; border-radius: 6px; }
.folder__count { font-size: 12.5px; color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: var(--s-3); }
.photo { display: flex; flex-direction: column; border-radius: var(--r); overflow: hidden; background: var(--bg-2); border: 1px solid var(--border); }
.photo__frame { aspect-ratio: 1; background: var(--surface-2); }
.photo__frame img { width: 100%; height: 100%; object-fit: cover; }
.photo__meta { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: 4px 4px 4px var(--s-3); }
.uploads { display: flex; flex-direction: column; gap: var(--s-2); }
.upload { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; grid-template-areas: "ic name size" "ic status status" "bar bar bar"; gap: 2px var(--s-3); align-items: center; padding: var(--s-2) var(--s-3); border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--border); }
.upload > .icon { grid-area: ic; color: var(--muted); }
.upload__name { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.upload__size { grid-area: size; font-size: 12.5px; }
.upload__status { grid-area: status; font-size: 12.5px; color: var(--muted); }
.upload__bar { grid-area: bar; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 4px; }
.upload__fill { display: block; height: 100%; width: 0; background: var(--accent-text); transition: width 120ms linear; }
.upload[data-state="done"] .upload__status { color: var(--success); }
.upload[data-state="done"] .upload__fill { background: var(--success); }
.upload[data-state="error"] .upload__status { color: var(--danger); }
.upload[data-state="error"] .upload__fill { background: var(--danger); width: 100%; }
.move-preview img { width: 72px; height: 72px; border-radius: var(--r); object-fit: cover; }

/* ---------------------------------------------------------------- configurações */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs__item { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 40px; padding: 0 14px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; flex: none; }
.tabs__item:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.tabs__item .icon { width: 17px; height: 17px; }
.tabs__item.is-active { background: var(--surface-3); color: var(--text); }
.tabs__item.is-active .icon { color: var(--accent-text); }
.settings-tabs { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 6px; min-width: 0; }
.settings-tabs.has-overflow { grid-template-columns: auto minmax(0, 1fr) auto; }
.settings-tabs .settings-tabs__arrow { display: none; width: 36px; height: 42px; border: 1px solid var(--border); border-radius: 10px; }
.settings-tabs.has-overflow .settings-tabs__arrow { display: inline-flex; }
.settings-tabs .tabs { min-width: 0; }
.settings-tabs__position { display: none; grid-column: 1 / -1; width: 100%; height: 16px; margin: 0; padding: 0; appearance: none; background: transparent; border: 0; cursor: ew-resize; }
.settings-tabs.has-overflow .settings-tabs__position { display: block; }
.settings-tabs__position::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--border); }
.settings-tabs__position::-webkit-slider-thumb { appearance: none; width: 36px; height: 8px; margin-top: -2px; border-radius: 4px; background: var(--muted-2); }
.settings-tabs__position::-moz-range-track { height: 4px; border-radius: 4px; background: var(--border); }
.settings-tabs__position::-moz-range-thumb { width: 36px; height: 8px; border: 0; border-radius: 4px; background: var(--muted-2); }
.settings-tabs__position:hover::-webkit-slider-thumb { background: var(--muted); }
.settings-tabs__position:hover::-moz-range-thumb { background: var(--muted); }
.settings-panel { display: flex; flex-direction: column; gap: var(--s-6); }
.savebar { position: fixed; left: calc(var(--sidebar-w) + var(--s-6)); right: var(--s-6); bottom: var(--s-5); z-index: 30; display: flex; justify-content: center; animation: toast-in 220ms var(--ease); pointer-events: none; }
.savebar[hidden] { display: none; }
.savebar__inner { pointer-events: auto; width: min(760px, 100%); display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-5); border-radius: 16px; background: rgba(32, 33, 39, 0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border-2); box-shadow: var(--shadow-2); flex-wrap: wrap; }
.savebar__text { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; font-size: 14.5px; }
.savebar__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
.savebar__actions { display: flex; gap: var(--s-2); margin-left: auto; }
.info-block { display: flex; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); background: var(--bg-2); border: 1px solid var(--border); }
.info-block > .icon { color: var(--accent-text); margin-top: 2px; }
.info-block strong { display: block; font-weight: 650; margin-bottom: 2px; }
.info-block p { color: var(--muted); font-size: 14px; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s-3); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: var(--s-3) var(--s-4); border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--border); }
.stat__label { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat__value { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; }
.mono-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.mono-list li { padding: 6px 10px; background: var(--bg-2); border-radius: 8px; border: 1px solid var(--border); overflow-wrap: anywhere; }
.bio-preview { padding: var(--s-4); border-radius: var(--r); background: var(--bg-2); border: 1px dashed var(--border-2); display: flex; flex-direction: column; gap: var(--s-2); }
.bio-preview__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.bio-preview__text { font-family: var(--font); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; margin: 0; color: var(--text); }
.requirements { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s-2); }
.requirements li { display: flex; flex-direction: column; gap: 2px; padding: var(--s-3) var(--s-4); border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.requirements b { color: var(--text); font-size: 14px; font-weight: 600; }
.quote { display: flex; flex-direction: column; gap: var(--s-2); }
.mailbox-list { display: flex; flex-direction: column; }
.mailbox { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto auto; gap: var(--s-3); align-items: center; padding: var(--s-3) 0; border-top: 1px solid var(--border); }
.mailbox:first-child { border-top: 0; }
.mailbox > .icon { color: var(--muted); }
.mailbox__main { display: flex; flex-direction: column; min-width: 0; }
.mailbox__email { font-family: var(--mono); font-size: 13.5px; overflow-wrap: anywhere; }
.mailbox__remaining { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.targets { display: flex; flex-direction: column; gap: var(--s-3); }
.target { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; padding: var(--s-4); border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--border); }
.target__index { color: var(--accent-text); font-weight: 700; font-size: 13px; padding-top: 32px; }
.target__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.target > .btn { margin-top: 26px; }

/* ---------------------------------------------------------------- conta */
.profile { display: flex; align-items: center; gap: var(--s-4); min-width: 0; }
.profile > div { min-width: 0; }
.profile__name { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.profile .muted { overflow-wrap: anywhere; }
.profile__pills { display: flex; gap: var(--s-2); margin-top: 6px; flex-wrap: wrap; }
.sessions { display: flex; flex-direction: column; }
.session { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; border-top: 1px solid var(--border); }
.session:first-child { border-top: 0; }
.session__icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--bg-2); border: 1px solid var(--border); color: var(--muted); flex: none; }
.session__main { flex: 1; min-width: 0; }
.session__title { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; flex-wrap: wrap; }

/* ---------------------------------------------------------------- administração */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.toolbar__filters { min-width: 0; max-width: 100%; }
.toolbar__search { position: relative; flex: 0 1 320px; min-width: 200px; }
.toolbar__search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.toolbar__search .input { padding-left: 38px; }
.utable { container-type: inline-size; display: flex; flex-direction: column; }
.urow { display: grid; grid-template-columns: minmax(220px, 1.6fr) minmax(120px, 0.9fr) minmax(140px, 1fr) minmax(170px, 1fr) minmax(110px, 0.8fr) auto; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-2); border-top: 1px solid var(--border); cursor: pointer; }
.urow:hover { background: var(--bg-2); }
.urow--head { border-top: 0; cursor: default; color: var(--muted); font-size: 12.5px; font-weight: 600; padding-top: 0; }
.urow--head:hover { background: none; }
.urow__cell { min-width: 0; font-size: 14px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.urow__user { flex-wrap: nowrap; gap: var(--s-3); }
.urow__user > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.urow__user strong, .urow__user small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urow__open { justify-content: flex-end; }
@container (max-width: 860px) {
  .urow--head { display: none; }
  .urow--head + .urow { border-top: 0; }
  .urow { grid-template-columns: minmax(0, 1fr) auto; padding: var(--s-4) var(--s-2); }
  .urow__user { grid-column: 1; }
  .urow__open { grid-column: 2; grid-row: 1; }
  .urow__cell[data-label] { grid-column: 1 / -1; font-size: 13.5px; color: var(--text-2); }
  .urow__cell[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
}
.copy-row { display: flex; gap: var(--s-2); width: 100%; margin-top: var(--s-2); }
.copy-row .input { flex: 1; min-width: 0; }
.mini-list { display: flex; flex-direction: column; }
.mini-list li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) 0; border-top: 1px solid var(--border); font-size: 14px; flex-wrap: wrap; }
.mini-list li:first-child { border-top: 0; }
.mini-list li > span:nth-child(2) { flex: 1; min-width: 120px; }
.admin-batches { display: flex; flex-direction: column; }
.admin-batch { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-3) 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.admin-batch:first-child { border-top: 0; }
.admin-batch__main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.admin-batch__top { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.admin-batch__main .muted { overflow-wrap: anywhere; }
.admin-batch__meta { display: flex; flex-direction: column; align-items: flex-end; font-size: 14px; }

.monitor-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
.mon { padding: var(--s-4) var(--s-5) var(--s-5); display: flex; flex-direction: column; gap: 6px; }
.mon__head { display: flex; align-items: center; gap: var(--s-2); color: var(--muted); font-weight: 600; font-size: 13.5px; }
.mon__head .pill { margin-left: auto; }
.mon__value { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.mon .dl { margin-top: var(--s-2); grid-template-columns: 1fr; }
.mon .dl__row { flex-direction: row; justify-content: space-between; align-items: baseline; padding: 6px 10px; gap: var(--s-2); }
.mon .dl__row dd { font-size: 13.5px; }
.spark { width: 100%; height: 64px; margin-top: var(--s-2); overflow: visible; }
.spark__base { stroke: var(--border-2); stroke-width: 1; }
.spark__line { fill: none; stroke: var(--accent-text); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark__area { fill: rgba(255, 112, 158, 0.12); stroke: none; }
.bar { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; margin-top: var(--s-2); }
.bar__fill { display: block; height: 100%; background: var(--success); }
.bar--warning .bar__fill { background: var(--warning); }
.bar--danger .bar__fill { background: var(--danger); }
.stable { container-type: inline-size; display: flex; flex-direction: column; }
.srow { display: grid; grid-template-columns: minmax(140px, 1.2fr) minmax(120px, 1fr) 80px 100px 120px 80px minmax(110px, 1fr) 110px; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-2); border-top: 1px solid var(--border); font-size: 14px; }
.srow--head { border-top: 0; padding-top: 0; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.srow__name { display: flex; align-items: center; gap: var(--s-2); }
.srow__name .icon { color: var(--muted); }
@container (max-width: 900px) {
  .srow--head { display: none; }
  .srow--head + .srow { border-top: 0; }
  .srow { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: var(--s-4) var(--s-2); }
  .srow__name { grid-column: 1 / -1; }
  .srow > [data-label] { display: flex; flex-direction: column; gap: 2px; }
  .srow > [data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; }
}
.atable { container-type: inline-size; display: flex; flex-direction: column; }
.arow { display: grid; grid-template-columns: 110px minmax(140px, 1fr) minmax(140px, 1fr) minmax(120px, 1fr) minmax(180px, 2fr) 110px; gap: var(--s-3); align-items: start; padding: var(--s-3) var(--s-2); border-top: 1px solid var(--border); font-size: 14px; }
.arow > div { min-width: 0; overflow-wrap: anywhere; }
.arow--head { border-top: 0; padding-top: 0; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.arow__when { color: var(--text-2); }
@container (max-width: 860px) {
  .arow--head { display: none; }
  .arow--head + .arow { border-top: 0; }
  .arow { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: var(--s-4) var(--s-2); }
  .arow > [data-label] { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: var(--s-2); }
  .arow > [data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  .arow__when { font-weight: 600; }
}

/* ---------------------------------------------------------------- "Mais" (celular) */
.more-list { display: flex; flex-direction: column; gap: 2px; }
.more-user { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) 0 var(--s-4); border-bottom: 1px solid var(--border); margin-bottom: var(--s-2); min-width: 0; }
.more-user > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.more-user small { color: var(--muted); overflow-wrap: anywhere; }
.more-list__item { display: flex; align-items: center; gap: var(--s-3); min-height: 50px; padding: 0 var(--s-3); border-radius: 12px; color: var(--text); font-weight: 550; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; font-size: 15.5px; }
.more-list__item:hover { background: var(--surface-2); text-decoration: none; }
.more-list__item > .icon:first-child { color: var(--accent-text); }
.more-list__item > span { flex: 1; }
.more-list__chev { color: var(--muted-2); }
.more-list__item--danger, .more-list__item--danger > .icon:first-child { color: var(--danger); }

/* ================================================================ responsivo */
@media (max-width: 1240px) {
  .monitor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .ops-top { grid-template-columns: minmax(0, 1fr); }
}

/* Navegação inferior em tablets e celulares */
@media (max-width: 1023px) {
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
    position: sticky; top: 0; z-index: 25; height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) var(--s-4) 0;
    background: rgba(13, 14, 18, 0.86); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--border);
  }
  .main { margin-left: 0; padding: var(--s-6) var(--s-5) calc(var(--tabbar-h) + var(--safe-b) + var(--s-8)); min-height: 0; }
  .has-savebar .main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 140px); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: rgba(13, 14, 18, 0.9); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-top: 1px solid var(--border);
  }
  .tabbar__item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; background: none; border: 0; cursor: pointer; position: relative; min-width: 0; padding: 0 2px; -webkit-tap-highlight-color: transparent; }
  .tabbar__item:hover { text-decoration: none; color: var(--text); }
  .tabbar__item .icon { width: 23px; height: 23px; }
  .tabbar__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar__item.is-active { color: var(--accent-text); }
  .tabbar__item .nav__badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 10.5px; }
  .toasts { left: 50%; right: auto; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--s-3)); }
  .savebar { left: var(--s-3); right: var(--s-3); bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--s-3)); }
  .library { grid-template-columns: minmax(0, 1fr); }
  .library__folders { position: static; }
  .folder-list { flex-direction: row; overflow-x: auto; gap: var(--s-2); padding-bottom: 2px; scrollbar-width: none; }
  .folder-list::-webkit-scrollbar { display: none; }
  .folder-list li { flex: none; }
  .folder { width: auto; border-color: var(--border); background: var(--bg-2); max-width: 240px; }
}

@media (max-width: 760px) {
  .grid-2, .form-grid--3 { grid-template-columns: minmax(0, 1fr); }
  .metrics--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .target__fields { grid-template-columns: minmax(0, 1fr); }
}

/* Celular */
@media (max-width: 640px) {
  :root { --tap: 46px; }
  body { font-size: 15.5px; }
  .main { padding: var(--s-5) var(--s-4) calc(var(--tabbar-h) + var(--safe-b) + var(--s-8)); }
  .content { gap: var(--s-5); }
  .stack-lg { gap: var(--s-5); }
  .page-title { font-size: 26px; }
  .page-subtitle { font-size: 14.5px; }
  .page-header { align-items: stretch; flex-direction: column; }
  .page-header__actions { width: 100%; }
  .page-header__actions > .btn { flex: 1 1 auto; }
  .btn { --h: 44px; }
  .btn--sm { --h: 40px; }
  .card { border-radius: 14px; }
  .card__head { padding: var(--s-4) var(--s-4) 0; }
  .card__body { padding: var(--s-4); }
  .card__head + .card__body { padding-top: var(--s-3); }
  .card__foot { padding: var(--s-3) var(--s-4); }
  .card__actions { width: 100%; }
  .card__actions > .segmented { width: 100%; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
  .metrics:not(.metrics--3) > .metric:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .metrics--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric { padding: var(--s-3) var(--s-4); }
  .metric__value { font-size: 26px; }
  .metric__hint { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .route-steps { grid-template-columns: minmax(0, 1fr); }
  .route-steps li { flex-direction: row; align-items: center; gap: var(--s-3); }
  .form-actions > .btn { flex: 1 1 auto; }
  .monitor-grid { grid-template-columns: minmax(0, 1fr); }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar__search { flex: 1 1 auto; min-width: 0; }
  .segmented__item { min-height: 38px; }
  .tabs__item { min-height: 42px; }
  .dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mailbox { grid-template-columns: 20px minmax(0, 1fr); }
  .mailbox > .pill, .mailbox__remaining { grid-column: 2; justify-self: start; }
  .target { grid-template-columns: minmax(0, 1fr) auto; }
  .target__index { display: none; }
  .savebar__inner { padding: var(--s-3); }
  .savebar__actions { width: 100%; }
  .savebar__actions .btn { flex: 1; }
  .auth { justify-content: flex-start; padding-top: var(--s-10); }
  .auth-card { padding: var(--s-6) var(--s-5); border-radius: 20px; }
  .batch-row__meta { width: 100%; padding-left: 0; }
  .batch-row__chev { display: none; }
  .admin-batch__meta { align-items: flex-start; flex-direction: row; gap: var(--s-3); }

  /* Diálogos viram bottom sheets */
  .dialog, .dialog--sm, .dialog--lg { width: 100%; max-width: 100%; margin: auto 0 0; max-height: calc(100dvh - 24px); }
  .dialog__panel { border-radius: 22px 22px 0 0; max-height: calc(100dvh - 24px); border-bottom: 0; animation: sheet-in 280ms var(--ease); padding-bottom: var(--safe-b); }
  .dialog.is-leaving .dialog__panel { animation: sheet-out 200ms var(--ease) forwards; }
  .dialog__grabber { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border-2); margin: 8px auto 0; }
  .dialog__header { padding: var(--s-3) var(--s-4) var(--s-2) var(--s-5); }
  .dialog__content { padding: var(--s-2) var(--s-5) var(--s-5); }
  .dialog__footer { padding: var(--s-3) var(--s-5); }
  .dialog__footer > .btn { flex: 1 1 auto; }
}

@media (max-width: 380px) {
  .main { padding-left: var(--s-3); padding-right: var(--s-3); }
  .metrics--3 { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .brand--compact .brand__name { font-size: 12.5px; }
  .live { padding: 3px 8px; font-size: 12px; }
}

@media (pointer: coarse) {
  .btn { --h: 44px; }
  .btn--sm { --h: 40px; }
  .sidebar__item { min-height: 44px; }
  .segmented__item { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .spin, .boot__spinner { animation: none !important; }
  .live[data-state="live"] .live__dot { animation: none; }
}

@media (forced-colors: active) {
  .pill, .btn, .card, .callout { border: 1px solid CanvasText; }
}

/* ===== Acabamento da base original (aprovado) ===== */
/* Leitura confortável, mantendo cores e composição da primeira versão. */
body { font-size: 15px; line-height: 1.55; }
.sidebar__section { text-transform: none; letter-spacing: 0.01em; font-size: 12.5px; }
.card__title { letter-spacing: -0.01em; }

/* Execução desativada: uma linha calma, detalhes ao clicar ou pelo teclado */
.quiet-note { border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.quiet-note summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px; color: var(--muted); font-size: 14px; border-radius: var(--r); }
.quiet-note summary::-webkit-details-marker { display: none; }
.quiet-note summary:focus-visible { box-shadow: var(--ring); outline: none; }
.quiet-note__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); flex: none; }
.quiet-note summary .icon { margin-left: auto; width: 16px; height: 16px; transition: transform var(--dur) var(--ease); }
.quiet-note[open] summary .icon { transform: rotate(180deg); }
.quiet-note p { margin: 0; padding: 0 16px 12px 34px; color: var(--muted); font-size: 14px; max-width: 72ch; }

/* Totais gerais: título discreto que separa os números do usuário dos números do lote */
.totals .section-title { color: var(--muted); font-size: 13.5px; font-weight: 600; margin: 0 0 var(--s-2); }

/* Sua capacidade: o cartão acompanha o conteúdo, sem esticar até a altura do lote */
.grid-3 { align-items: start; }

@media (max-width: 640px) {
  /* Indicadores um pouco mais compactos no celular, legíveis */
  .metrics { gap: 8px; }
  .metric { padding: 12px 14px; gap: 4px; border-radius: var(--r); }
  .metric__label { font-size: 12.5px; }
  .metric__value { font-size: 24px; }
}
/* Celular: nada escondido em rolagem horizontal. Seções e filtros mostram os nomes completos. */
@media (max-width: 760px) {
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; gap: 4px; }
  .tabs__item { white-space: normal; min-height: 48px; padding: 8px 12px; line-height: 1.25; }
  .segmented, .segmented--scroll { display: flex; flex-wrap: wrap; overflow: visible; width: 100%; }
  .segmented__item { flex: 1 1 auto; justify-content: center; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .quiet-note summary .icon { transition: none; } }

/* ===== Configurações: barra de salvamento fixa no fluxo, Stories e destaque, fotos (paridade) ===== */
/* Barra sempre presente no fim da página e presa à base da tela enquanto se rola. */
.savebar.savebar--sticky { position: sticky; left: auto; right: auto; bottom: max(var(--s-5), calc(var(--kb, 0px) + var(--s-2))); z-index: 30; pointer-events: auto; animation: none; }
.savebar--sticky .savebar__text { outline: none; min-width: 0; }
.savebar--sticky .savebar__label { overflow-wrap: anywhere; }
.savebar--sticky .savebar__dot { flex: none; background: var(--muted-2); }
.savebar--sticky[data-state="dirty"] .savebar__dot { background: var(--warning); }
.savebar--sticky[data-state="saving"] .savebar__dot { background: var(--accent-text); }
.savebar--sticky[data-state="saved"] .savebar__dot { background: var(--success); }
.savebar--sticky[data-state="error"] .savebar__dot { background: var(--danger); }
.savebar--sticky[data-state="error"] .savebar__text { color: #ffc9ce; }
.savebar--sticky[data-state="idle"] .savebar__text, .savebar--sticky[data-state="saved"] .savebar__text { color: var(--text-2); font-weight: 550; }

/* Resumo do que muda antes de salvar */
.change-summary__title { font-size: 13.5px; font-weight: 650; color: var(--accent-text); margin-bottom: var(--s-2); }
.change-list { display: flex; flex-direction: column; gap: var(--s-2); }
.change-list__item { display: flex; flex-direction: column; gap: 2px; padding: var(--s-2) var(--s-3); border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--border); font-size: 14px; }
.change-list__label { color: var(--text-2); font-weight: 600; overflow-wrap: anywhere; }
.change-list__values { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; overflow-wrap: anywhere; min-width: 0; }
.change-list__old { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted-2); }
.change-list__arrow { color: var(--muted-2); }
.change-list__new { color: var(--text); font-weight: 600; }

/* Stories e destaque */
.story-style { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: var(--s-6); align-items: start; }
.story-folder.is-focused { border-color: rgba(255, 112, 158, 0.45); box-shadow: 0 0 0 1px rgba(255, 112, 158, 0.25), var(--shadow-1); }
.story-folder .card__title:focus { outline: none; }
.story-folder__grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.story-folder__grid .textarea { min-height: 88px; }
.story-folder__ranges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.range-field__row { display: flex; align-items: center; gap: var(--s-3); }
.range-field__num { width: 76px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.range { flex: 1; min-width: 0; height: var(--tap); accent-color: var(--accent); background: transparent; cursor: pointer; }
.range:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 10px; }
.title-counter.is-over { color: var(--danger); }
.color-field__row { display: flex; align-items: center; gap: var(--s-2); }
.color-field__picker { width: 52px; height: var(--tap); flex: none; padding: 4px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border-2); cursor: pointer; }
.color-field__picker:focus-visible { outline: none; box-shadow: var(--ring); }
.color-field__hex { min-width: 0; }
.story-preview-wrap { display: flex; flex-direction: column; gap: var(--s-2); align-items: center; margin: 0; }
.story-preview { --x: 50; --y: 65; --w: 70; --h: 8.86; --rot: 0deg; --fg: #2d8fd5; --bg: #ffffff;
  position: relative; width: 100%; max-width: 180px; aspect-ratio: 9 / 16; border-radius: var(--r); overflow: hidden; container-type: size;
  background: linear-gradient(160deg, #2a2b33 0%, #1a1b21 55%, #2B1520 100%); border: 1px solid var(--border-2); }
.story-preview__button { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); width: calc(var(--w) * 1%); height: calc(var(--h) * 1cqw * 1.7778);
  transform: translate(-50%, -50%) rotate(var(--rot)); display: flex; align-items: center; justify-content: center; gap: 4%;
  border-radius: calc(var(--h) * 0.26 * 1cqw * 1.7778); background: var(--bg); color: var(--fg); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  font-weight: 650; font-size: calc(var(--h) * 0.4 * 1cqw * 1.7778); white-space: nowrap; overflow: hidden; padding: 0 6%; line-height: 1; }
.story-preview__button[hidden], .story-preview__off[hidden], .story-preview__icon[hidden] { display: none; }
.story-preview__icon { display: inline-flex; flex: none; }
.story-preview__icon .icon { width: 1.05em; height: 1.05em; stroke: currentColor; }
.story-preview__label { overflow: hidden; text-overflow: ellipsis; }
.story-preview__off { position: absolute; inset: auto 8px 8px; text-align: center; font-size: 12px; color: var(--muted); }
.story-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-2); }
.story-media__item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2); border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--border); min-width: 0; }
.story-media__thumb { width: 45px; height: 80px; flex: none; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.story-media__thumb img { width: 100%; height: 100%; object-fit: cover; }
.story-media__video { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 650; color: var(--accent-lt); }
.story-media__video .icon { width: 18px; height: 18px; }
.story-media__meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.story-media__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.story-media__remove { flex: none; }

/* Pastas e fotos: mover e remover lado a lado */
.photo__actions { display: flex; gap: 2px; flex: none; }
.photo__meta { flex-wrap: wrap; }

@media (max-width: 1180px) {
  .story-folder__grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  /* Seção ímpar no fim ocupa a linha inteira: sem lacunas na grade de seções */
  .tabs__item:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .story-style { grid-template-columns: minmax(0, 1fr); }
  .story-style .story-preview-wrap { order: -1; }
  .story-folder__ranges { grid-template-columns: minmax(0, 1fr); }
  .story-media { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  /* Acima da barra inferior e do teclado virtual */
  .savebar.savebar--sticky { left: auto; right: auto; bottom: max(calc(var(--tabbar-h) + var(--safe-b) + var(--s-2)), calc(var(--kb, 0px) + var(--s-2))); }
}
@media (max-width: 1023px), (pointer: coarse) {
  /* Alvos de toque dos controles novos com pelo menos 44px */
  .savebar--sticky .btn, .story-media__remove, .photo__actions .btn, .library__story-link, .story-folder .btn { --h: 44px; }
  .story-media__remove, .photo__actions .btn { width: 44px; }
}
/* Celular: os dois botões dividem a largura sem estourar a tela */
@media (max-width: 640px) {
  .savebar--sticky .savebar__actions .btn { flex: 1 1 0; min-width: 0; white-space: normal; line-height: 1.2; padding: 6px 10px; text-align: center; }
  .savebar--sticky .savebar__actions .btn .icon { display: none; }
}
/* Avisos acima da barra de salvamento para não cobrir Salvar/Descartar */
body:has(.savebar--sticky:not([hidden])) .toasts { bottom: calc(var(--s-6) + 88px); }
@media (max-width: 1023px) {
  body:has(.savebar--sticky:not([hidden])) .toasts { bottom: calc(var(--tabbar-h) + var(--safe-b) + 136px); }
}

/* ===== Painel como central de operação: novo lote, lote exibido e "Este lote" ===== */
/* Encaixes atualizados por partes: sem caixa própria, não criam lacunas no fluxo. */
.slot { display: contents; }
.page-header__actions[hidden], .panel-batch__pick[hidden] { display: none; }
.hub--active .hub__batch { order: -1; }
.new-batch__mode { width: 100%; }
.new-batch__mode .segmented__item { flex: 1 1 0; justify-content: center; text-align: center; white-space: normal; line-height: 1.2; min-height: 40px; }
.panel-batch__bar { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.panel-batch__title { margin: 0; font-size: 17px; }
.panel-batch__title:focus, .new-batch__lock:focus { outline: none; }
.panel-batch__pick { display: flex; align-items: center; gap: var(--s-2); color: var(--muted); font-size: 13.5px; min-width: 0; }
.panel-batch__pick .select { width: auto; max-width: min(440px, 100%); }
.batch-head__state { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; min-width: 0; }
.batch-head__title { font-weight: 650; font-size: 16px; }
.batch-head__actions { display: flex; flex-direction: column; gap: var(--s-3); }
.totals__sub { color: var(--muted-2); font-size: 13px; margin: -4px 0 var(--s-2); }
/* "Este lote" fica num quadro próprio para não se confundir com os totais gerais */
.totals--batch { padding: var(--s-4) var(--s-5); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-2); }
@media (max-width: 1023px), (pointer: coarse) {
  /* Alvos de toque do Painel com pelo menos 44px */
  .new-batch__mode .segmented__item, .panel-batch .segmented__item { min-height: 44px; }
}
@media (max-width: 640px) {
  .panel-batch__pick { flex-direction: column; align-items: stretch; width: 100%; }
  .panel-batch__pick .select { max-width: none; width: 100%; }
  .totals--batch { padding: var(--s-3); }
}
.topbar__actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar__account { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 40px; }
@media (max-width: 380px) {
  .topbar { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .topbar .live { padding: 5px; }
  .topbar .live__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* Shared shell and controls; layout remains the Creator's existing layout. */
.main { min-height: calc(100dvh - var(--ghost-header)); }
.sidebar__section { text-transform: none; letter-spacing: 0; font-size: 12px; }
.sidebar__item { min-height: 44px; border-radius: 11px; }
.input { border-radius: 11px; transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease); }
.input:focus { border-color: var(--accent-text); box-shadow: var(--ghost-focus); }
.card, .metric { border-radius: 18px; }
.modal { border-radius: 22px; }
.dialog__title { font-family: var(--font-display); }
.tabbar { height: calc(64px + var(--safe-b)); background: var(--ghost-header-bg); }
.tabbar__item { font-size: 11px; font-weight: 550; }
@media (max-width: 640px) {
  .page-title { font-size: 26px; }
  .card, .metric { border-radius: 16px; }
}
