/* CNC Connect — estilos do painel */

:root {
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #f1f1ed;
  --surface-3: #e7e7e2;
  --border: #e4e4df;
  --border-strong: #d3d3cd;
  --text: #17181a;
  --text-2: #55585e;
  --text-3: #85888e;
  --brand: #ff6b1a;
  --brand-hover: #f25a07;
  --brand-ink: #c2410c;
  --brand-soft: #fff0e6;
  --on-brand: #1b0f05;
  --ink: #17181a;
  --on-ink: #ffffff;
  --ok: #12804a;
  --ok-soft: #e5f4eb;
  --warn: #9a5b06;
  --warn-soft: #fdf3e0;
  --info: #1d5fd8;
  --info-soft: #e8f0fe;
  --danger: #c8291d;
  --danger-soft: #fdecea;
  --shadow-sm: 0 1px 2px rgba(23, 24, 26, 0.05);
  --shadow-lg: 0 24px 60px rgba(23, 24, 26, 0.18), 0 2px 6px rgba(23, 24, 26, 0.06);
  --radius: 14px;
  --chart: #e8590c;
  --font-display: "Sora", "Inter", system-ui, sans-serif;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f11;
    --surface: #16171a;
    --surface-2: #1d1f22;
    --surface-3: #282a2e;
    --border: #26282c;
    --border-strong: #35383d;
    --text: #ececea;
    --text-2: #a7aaaf;
    --text-3: #75787e;
    --brand: #ff7a2f;
    --brand-hover: #ff8f4f;
    --brand-ink: #ff9a5c;
    --brand-soft: rgba(255, 122, 47, 0.13);
    --ink: #ececea;
    --on-ink: #16171a;
    --ok: #46d690;
    --ok-soft: rgba(70, 214, 144, 0.12);
    --warn: #f3b74f;
    --warn-soft: rgba(243, 183, 79, 0.12);
    --info: #79a8ff;
    --info-soft: rgba(121, 168, 255, 0.12);
    --danger: #ff7266;
    --danger-soft: rgba(255, 114, 102, 0.12);
    --shadow-sm: none;
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
  /* o quadrado grafite da logo some no fundo escuro: um contorno sutil devolve a forma */
  .brand img, .auth-brand img { border-radius: 26%; box-shadow: 0 0 0 1px var(--border-strong); }
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { letter-spacing: -0.02em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

.icon { display: inline-flex; width: 18px; height: 18px; flex: none; }
.icon svg { width: 100%; height: 100%; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 24px; height: 24px; }
.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.mono { font-family: var(--mono); }
.loading { display: flex; align-items: center; gap: 10px; padding: 24px 0; color: var(--text-3); font-size: 14px; }
.muted { color: var(--text-2); }

/* ------------------------------------------------------------------ topo */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand img { width: 32px; height: 32px; display: block; }
.brand .accent { font-weight: 400; }

.nav { display: flex; gap: 4px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); }
.nav a.active .icon { color: var(--brand); }

.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me-name { max-width: 190px; font-size: 14px; font-weight: 500; text-align: right; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-name small { overflow: hidden; text-overflow: ellipsis; }
.me-name small { display: block; color: var(--text-3); font-size: 12px; font-weight: 400; }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 700;
}

/* ------------------------------------------------------------------ página */

.page { max-width: 1080px; margin: 0 auto; padding: 36px 24px 72px; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.page-head h1 { margin: 0 0 4px; font-family: var(--font-display); font-size: 27px; font-weight: 600; }
.page-head p { margin: 0; color: var(--text-2); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ------------------------------------------------------------------ botões */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-icon.placeholder { visibility: hidden; }

/* ------------------------------------------------------------------ chips e status */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.brand { background: var(--brand-soft); color: var(--brand-ink); }
.chip.neutral { background: var(--surface-2); color: var(--text-2); font-weight: 500; }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.mono { font-family: var(--mono); font-weight: 500; }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status.on { color: var(--ok); font-weight: 600; }

/* ------------------------------------------------------------------ máquina selecionada */

.machine-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.machine-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.machine-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-2);
}
.machine-ico.on { background: var(--ok-soft); color: var(--ok); }
.machine-bar .title { font-weight: 600; font-size: 16px; line-height: 1.3; }
.machine-bar .meta { margin-left: auto; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.stat { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.stat strong { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------------ pastas */

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tab:hover { border-color: var(--border-strong); color: var(--text); }
.tab.active { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.tab small { font-family: var(--mono); font-size: 11px; opacity: 0.7; }

/* ------------------------------------------------------------------ envio */

.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background-color: var(--surface);
  background-image: radial-gradient(var(--surface-3) 1px, transparent 1px);
  background-size: 18px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background-color: var(--brand-soft); }
.drop.over { border-style: solid; }
.drop-ico {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 35%, transparent);
}
.drop-title { font-size: 16px; font-weight: 600; }
.drop-title u { text-decoration-color: var(--brand); text-underline-offset: 3px; }
.drop-sub { font-size: 13px; color: var(--text-3); }

.uploads { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.uploads:empty { display: none; }
.upload-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.upload-item .n { font-family: var(--mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .s { font-size: 12px; color: var(--text-3); text-align: right; }
.upload-item.done .s { color: var(--ok); font-weight: 600; }
.upload-item.fail .s { color: var(--danger); font-weight: 600; }
.progress { grid-column: 2 / 4; height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--brand); transition: width 0.2s; }
.upload-item.done .progress > span { background: var(--ok); }
.upload-item.fail .progress > span { background: var(--danger); }

/* ------------------------------------------------------------------ lista de arquivos */

.list-card { margin-top: 20px; overflow: hidden; }
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.list-head h2 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  width: 240px;
  max-width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text-3);
}
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--text); font-size: 14px; }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 140px 180px 116px;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row:not(.row-head):hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.row-head {
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface-2);
}
.cell-muted { font-size: 13px; color: var(--text-2); }
.name-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-ico {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-2);
}
.name-cell .txt, .person .txt { min-width: 0; }
.span-all { grid-column: 1 / -1; }
.name-cell .n { font-family: var(--mono); font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-cell .sub { font-size: 12px; color: var(--text-3); display: none; }
.actions { display: flex; justify-content: flex-end; gap: 2px; }

.empty { padding: 56px 20px; text-align: center; color: var(--text-2); }
.empty-ico {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-3);
}
.empty h3 { margin: 0 0 4px; font-size: 16px; color: var(--text); }
.empty p { margin: 0 auto; max-width: 380px; font-size: 14px; }
.empty .btn { margin-top: 18px; }

.hint {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
}
kbd {
  font-family: var(--mono);
  font-size: 12px;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

/* ------------------------------------------------------------------ máquinas */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.mcard { padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.mcard-head { display: flex; align-items: center; gap: 14px; }
.mcard-head h3 { margin: 0 0 2px; font-size: 16px; font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; text-align: right; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { height: 6px; margin-top: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--text-2); border-radius: 99px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mcard-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.mcard-foot .btn-icon { margin-left: auto; }
.section-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }

/* ------------------------------------------------------------------ usuários */

.user-row { grid-template-columns: minmax(0, 1fr) 130px 120px 150px 80px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .n { font-weight: 600; font-size: 14px; }
.person .e { font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ formulários */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; }
.help { font-size: 12px; color: var(--text-3); }
.input {
  height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.mono { font-family: var(--mono); font-size: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
.check:hover { background: var(--surface-2); }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.check small { margin-left: auto; color: var(--text-3); font-family: var(--mono); font-size: 12px; }
.form-error { margin: 0; color: var(--danger); font-size: 13px; font-weight: 500; }
.form-error:empty { display: none; }
.code {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--surface-2); color: var(--text-2); }

/* ------------------------------------------------------------------ diálogos */

dialog.modal {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog.modal.wide { width: min(600px, calc(100vw - 32px)); }
dialog.modal[open] { animation: pop 0.16s ease-out; }
dialog.modal::backdrop { background: rgba(10, 11, 13, 0.5); backdrop-filter: blur(3px); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 4px; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.modal-body { display: flex; flex-direction: column; gap: 16px; padding: 14px 24px 8px; }
.modal-body p { margin: 0; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px 22px; }

/* janela da Stripe: o formulário dela é sempre claro */
dialog.stripe-modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: #fff; color: #17181a; overflow: auto; }
dialog.stripe-modal .modal-head { position: sticky; top: 0; z-index: 1; padding: 16px 20px; background: #fff; border-bottom: 1px solid #ececea; }
dialog.stripe-modal .modal-head h3 { display: flex; align-items: center; gap: 6px; font-size: 16px; }
dialog.stripe-modal .btn-icon { color: #55585e; }
.stripe-mount { min-height: 420px; padding: 8px 4px 16px; }
.stripe-mount .loading { justify-content: center; padding: 120px 0; color: #85888e; }

/* ------------------------------------------------------------------ avisos */

#toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: #1c1d20;
  color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  animation: pop 0.18s ease-out;
}
.toast.ok .icon { color: #46d690; }
.toast.error .icon { color: #ff8a80; }
.toast.info .icon { color: #ff9a5c; }

/* ------------------------------------------------------------------ login */

.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background-color: var(--bg);
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px);
  background-size: 22px 22px;
}
.auth-card {
  width: min(400px, 100%);
  padding: 36px 32px 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.auth-brand img { width: 44px; height: 44px; display: block; }
.auth-brand .accent { font-weight: 400; }
.auth h1 { margin: 0 0 6px; font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.auth-alt { margin: 18px 0 0; text-align: center; font-size: 14px; color: var(--text-2); }
.auth-alt a { color: var(--brand-ink); font-weight: 600; }
.auth .lead { margin: 0 0 24px; color: var(--text-2); }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.auth form .btn { height: 46px; margin-top: 6px; font-size: 15px; }
.auth-foot { display: flex; align-items: center; gap: 8px; margin-top: 22px; color: var(--text-3); font-size: 12px; }

/* ------------------------------------------------------------------ gestão e assinatura */

.subnav {
  display: flex;
  gap: 2px;
  margin: -12px 0 28px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.subnav a:hover { color: var(--text); }
.subnav a.active { color: var(--text); border-bottom-color: var(--brand); }
.subnav a .count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { padding: 18px 20px; }
.stat-card .label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.stat-card .value { margin-top: 8px; font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.stat-card .foot { margin-top: 2px; font-size: 12.5px; color: var(--text-3); }
.stat-card .foot.warn { color: var(--danger); font-weight: 500; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel { overflow: hidden; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2, .panel-head h3 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.panel-body { padding: 18px 20px; }
.panel-body.cell-sub { white-space: normal; }
.panel-empty { padding: 28px 20px; text-align: center; color: var(--text-3); font-size: 14px; }

/* gráfico de colunas (receita por mês) */
.chart { position: relative; padding: 8px 20px 18px; }
.cols { display: grid; grid-template-columns: repeat(6, 1fr); align-items: end; gap: 2px; height: 170px; border-bottom: 1px solid var(--border); }
.col { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; cursor: default; }
.col .bar { width: min(24px, 60%); min-height: 2px; background: var(--chart); border-radius: 4px 4px 0 0; transition: opacity 0.15s; }
.col .cap { margin-bottom: 4px; font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cols:hover .col .bar { opacity: 0.45; }
.cols .col:hover .bar { opacity: 1; }
.col-labels { display: grid; grid-template-columns: repeat(6, 1fr); margin-top: 6px; font-size: 12px; color: var(--text-3); text-align: center; text-transform: capitalize; }

/* listas tabulares da gestão */
.list .row { cursor: default; }
.list a.row, .list .row.link { cursor: pointer; color: inherit; }
.cols-clients { grid-template-columns: minmax(0, 1.6fr) 196px 120px 100px 100px 24px; }
.cols-orders { grid-template-columns: 56px minmax(0, 1.4fr) 44px 110px 190px 92px 200px; }
.cols-invoices { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr) 96px 110px 116px 120px; }
.cols-devices { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) 170px 80px 84px; }
.cols-mini { grid-template-columns: minmax(0, 1fr) 110px 190px; }
.cols-mini > :nth-child(2), .cols-mini > :nth-child(3) { justify-self: end; }
.cols-mini .cell-strong { white-space: normal; }
.cell-strong { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; justify-content: flex-end; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { width: 280px; background: var(--surface); }
.toolbar .spacer { flex: 1; }

/* cabeçalho do cliente */
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--text-2); font-size: 14px; }
.back:hover { color: var(--text); }
.entity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.entity-head h1 { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 600; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.entity-head .meta { margin-top: 6px; display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-2); font-size: 14px; }
.entity-head .meta span { display: inline-flex; align-items: center; gap: 6px; }
.entity-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* pedido: etapas */
.order { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.order:last-child { border-bottom: none; }
.order-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.order-top .t { font-weight: 600; }
.steps { display: grid; grid-template-columns: repeat(5, 1fr); margin: 18px 0 14px; }
.step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 12px; color: var(--text-3); }
.step::before { content: ""; position: absolute; top: 7px; left: -50%; width: 100%; height: 2px; background: var(--surface-3); }
.step:first-child::before { display: none; }
.step .dot { position: relative; z-index: 1; width: 16px; height: 16px; background: var(--surface-3); box-shadow: 0 0 0 3px var(--surface); }
.step.done { color: var(--text-2); }
.step.done .dot, .step.done::before { background: var(--ok); }
.step.current { color: var(--text); font-weight: 600; }
.step.current .dot { background: var(--brand); box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--brand-soft); }
.step.current::before { background: var(--ok); }
.order-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-radius: 12px;
  font-size: 14px;
}
.banner .grow { flex: 1; min-width: 200px; }
.banner strong { display: block; margin-bottom: 2px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.danger { background: var(--danger-soft); color: var(--danger); }
.banner.info { background: var(--surface-2); color: var(--text-2); }
.banner .btn { flex: none; }

.pix-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
}
.pix-box code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; }
.big-amount { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }

textarea.input { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 32px; }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 14px; pointer-events: none; }
.input-prefix > .input { padding-left: 38px; }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-section + .form-section { margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-section h3 { margin: 0; font-size: 14px; font-weight: 600; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ------------------------------------------------------------------ celular */

.only-touch { display: none; }
@media (pointer: coarse) {
  .only-touch { display: inline; }
  .only-mouse { display: none; }
}

@media (max-width: 760px) {
  /* backdrop-filter prende elementos "fixed" dentro do topo; sem ele a navegação vai para o rodapé */
  .topbar { backdrop-filter: none; background: var(--surface); }
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
  }
  .nav a { flex-direction: column; gap: 2px; height: auto; padding: 6px 14px; font-size: 11px; }
  .nav a.active { background: transparent; color: var(--brand-ink); }
  .me-name { display: none; }
  .page { padding: 24px 16px 104px; }
  .page-head h1 { font-size: 24px; }
  .machine-bar .meta { margin-left: 0; width: 100%; gap: 14px; }
  .drop { padding: 30px 16px; }
  .row-head { display: none; }
  .row, .user-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 12px 16px; }
  .row .c-hide { display: none; }
  .row .c-status { grid-column: 1; padding-left: 48px; }
  .row .actions { grid-column: 2; grid-row: 1 / span 2; }
  .name-cell .sub { display: block; }
  .search, .toolbar .search { width: 100%; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .cols-clients, .cols-orders, .cols-invoices, .cols-devices, .cols-mini { grid-template-columns: minmax(0, 1fr) auto; }
  .me-name { display: none; }
  .subnav { margin-top: -4px; }
  .steps { font-size: 11px; }
  #toasts { left: 16px; right: 16px; bottom: 84px; align-items: stretch; }
}

.setup-steps { margin: 16px 0 6px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.5; font-size: 13.5px; }
.stack-gap > * + * { margin-top: 16px; }

/* Passo a passo de conexão do Hub (página Máquinas) */
.guide { position: relative; padding: 24px; }
.guide-close { position: absolute; top: 14px; right: 14px; }
.guide-head { display: flex; gap: 14px; align-items: flex-start; padding-right: 80px; margin-bottom: 20px; }
.guide-head h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 18px; }
.guide-head p { margin: 0; color: var(--text-2); font-size: 14px; max-width: 620px; }
.guide-ico { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); }
.guide-head.ok .guide-ico { background: var(--ok-soft); color: var(--ok); }
.gsteps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.gstep { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.gstep-num { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: 13px; }
.gstep.done .gstep-num { background: var(--ok); color: #fff; }
.gstep-body { flex: 1; min-width: 0; }
.gstep-body h4 { margin: 3px 0 8px; font-size: 15px; }
.gstep-body ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.gstep-body b { color: var(--text); font-weight: 600; }
.gstep-body .btn { margin-top: 12px; }
.gstep-state { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; }
.gstep-state.ok { background: var(--ok-soft); color: var(--ok); }
.gstep-state.warn { background: var(--warn-soft); color: var(--warn); }
.gstep-state.wait { background: var(--surface-2); color: var(--text-2); }
.copy-inline { display: inline-flex; align-items: center; gap: 5px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; vertical-align: baseline; }
.copy-inline code { font-family: var(--mono); font-size: 13px; }
.copy-inline .icon { color: var(--text-3); }
.copy-inline:hover { border-color: var(--border-strong); }
.guide-foot { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--text-2); }
.guide-foot a { color: var(--brand-ink); font-weight: 600; }
@media (max-width: 760px) {
  .guide { padding: 18px 16px; }
  .guide-head { padding-right: 0; flex-direction: column; }
  .guide-close { position: static; float: right; margin: -4px -6px 4px 0; }
}
