/* ==========================================================================
   Overview (/view) — “central de comando”.
   Carrega por último: theme.css → dashboard.css → overview.css.
   Refina por cima; sempre que possível usa os tokens do theme.css.
   ========================================================================== */

:root {
  /* tokens locais (somente /view) */
  --ov-focus: #9dc6ff;
  --ov-line-hover: #cbdff8;
  --ov-line-strong: #b9d4f4;
  --ov-on-accent: #ffffff;
  --ov-on-screen: #dbe7f5;
  --ov-on-screen-dim: rgba(219, 231, 245, .74);
  --ov-live-ink: #7ee787;
  --ov-live-dot: #3fb950;
  --ov-live-line: rgba(63, 185, 80, .52);
  --ov-violet-line: rgba(108, 92, 255, .26);
  --ov-violet-ink: #4b3fd6;
  --ov-accent-line: rgba(11, 107, 255, .20);
  --ov-ok-line: rgba(18, 183, 106, .34);
  --ov-err-line: rgba(217, 45, 32, .32);
  --ov-shadow-accent: 0 9px 22px rgba(11, 99, 230, .22);
  --ov-cmdk-veil: rgba(16, 32, 64, .34);
}

[hidden] { display: none !important; }
body.modal-open { overflow: hidden; }
body.cmdk-open { overflow: hidden; }

/* --------------------------------------------------------------- topbar */
.dash-top {
  min-height: var(--h-topbar);
  padding: 0 clamp(16px, 3vw, 36px);
  gap: 16px;
  background: var(--c-glass);
  border-bottom-color: var(--c-line);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  transition: box-shadow var(--d-med) var(--ease-out);
}
.dash-top.is-scrolled { box-shadow: 0 12px 30px rgba(16, 45, 95, .07); }

.logo { border-radius: var(--r-lg); box-shadow: var(--e-inset), 0 8px 20px rgba(11, 107, 255, .24); }
.brand-text strong { font-size: var(--t-lg); font-weight: 800; letter-spacing: -.01em; color: var(--c-ink); }
.brand-text small { font-size: var(--t-2xs); color: var(--c-muted); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 11px;
  border-radius: var(--r-pill); background: var(--c-accent-soft);
  border: 1px solid var(--ov-accent-line); color: var(--c-accent-2);
  font-size: var(--t-2xs); font-weight: 750; font-variant-numeric: tabular-nums;
}
.pill::before {
  content: ""; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%;
  background: var(--c-ok-2); box-shadow: 0 0 0 3px rgba(18, 183, 106, .16);
  transition: background var(--d-med), box-shadow var(--d-med);
}
.pill.is-off::before { background: var(--c-faint); box-shadow: 0 0 0 3px rgba(152, 162, 179, .16); }

.dash-actions { gap: 6px; }
.dash-actions .icon {
  width: 36px; height: 36px; border-radius: var(--r-md); color: var(--c-muted);
  transition: background var(--d-fast), border-color var(--d-fast), color var(--d-fast), transform var(--d-fast);
}
.dash-actions .icon svg { width: 17px; height: 17px; display: block; }
.dash-actions .icon:hover { background: var(--c-surface-3); border-color: var(--c-line-2); color: var(--c-ink); }
.dash-actions .icon:active { transform: translateY(1px); }
.dash-actions .icon.is-spinning svg { animation: ov-spin 700ms var(--ease-inout); }
@keyframes ov-spin { to { transform: rotate(360deg); } }

.dash-actions .btn-ghost {
  height: 36px; padding: 0 13px; border-radius: var(--r-md);
  font-size: var(--t-sm); font-weight: 700;
  transition: background var(--d-fast), border-color var(--d-fast), color var(--d-fast), transform var(--d-fast);
}
.dash-actions .btn-ghost svg { width: 14px; height: 14px; display: block; }
.dash-actions .btn-ghost:active { transform: translateY(1px); }
.setup-shortcut { border-color: var(--ov-accent-line); background: var(--c-accent-soft); color: var(--c-accent-2); }
.setup-shortcut:hover { background: var(--c-surface-3); border-color: var(--ov-line-strong); color: var(--c-accent-2); }
#logout-btn:hover { border-color: var(--ov-err-line); background: var(--c-err-soft); color: var(--c-err); }

.tb-sep { width: 1px; height: 22px; flex: 0 0 auto; margin: 0 3px; background: var(--c-line); }

/* paleta de comandos: gatilho na topbar + texto de frescor */
.cmdk-trigger {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 8px 0 10px;
  border-radius: var(--r-md); border: 1px solid var(--c-line-2);
  background: var(--c-surface); color: var(--c-muted);
  font-size: var(--t-sm); font-weight: 700;
  transition: background var(--d-fast), border-color var(--d-fast), color var(--d-fast), transform var(--d-fast);
}
.cmdk-trigger svg { width: 15px; height: 15px; flex: 0 0 auto; display: block; }
.cmdk-trigger:hover { background: var(--c-surface-3); border-color: var(--ov-line-strong); color: var(--c-ink); }
.cmdk-trigger:active { transform: translateY(1px); }
.cmdk-trigger .cmdk-kbd { margin-left: 2px; }
.cmdk-kbd {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-xs); border: 1px solid var(--c-line-2);
  background: var(--c-surface-2); color: var(--c-muted);
  font-family: var(--f-mono); font-size: var(--t-2xs); font-weight: 700;
  line-height: 1; white-space: nowrap;
}

.fresh {
  height: 28px; padding: 0 9px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; color: var(--c-muted);
  font-family: var(--f-mono); font-size: var(--t-2xs); font-weight: 650;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap;
  transition: background var(--d-fast), border-color var(--d-fast), color var(--d-fast);
}
.fresh:hover { background: var(--c-surface-3); border-color: var(--c-line); color: var(--c-ink-2); }
.fresh:active { transform: translateY(1px); }

/* ---------------------------------------------------------------- layout */
.overview-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(20px, 2.8vw, 34px) clamp(16px, 3vw, 36px) 72px;
}

/* ------------------------------------------------------------------ hero */
.overview-hero {
  position: relative;
  text-align: center;
  padding: 6px 10px clamp(22px, 2.6vw, 30px);
  overflow: hidden;
}
.overview-hero::before,
.overview-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  filter: blur(12px);
  opacity: .62;
  pointer-events: none;
}
.overview-hero::before { top: -200px; left: 6%; background: radial-gradient(circle, rgba(179, 214, 255, .5), rgba(179, 214, 255, 0) 68%); }
.overview-hero::after { top: -240px; right: 5%; background: radial-gradient(circle, rgba(208, 196, 255, .4), rgba(208, 196, 255, 0) 68%); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 13px;
  border-radius: var(--r-pill); background: var(--c-glass-2); border: 1px solid var(--c-line);
  color: var(--c-accent-2); font-size: var(--t-2xs); font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  box-shadow: var(--e-1), var(--e-inset);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.overview-hero h1 {
  margin: 15px auto 11px;
  max-width: 900px;
  font-size: clamp(31px, 3.4vw, 46px);
  line-height: 1.04;
  letter-spacing: -.045em;
  font-weight: 800;
  color: var(--c-ink);
}
.hero-sub {
  max-width: 640px;
  margin: 0 auto;
  color: var(--c-muted);
  font-size: clamp(13.5px, 1.2vw, 15px);
  line-height: 1.58;
}
.hero-actions {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 10px; margin: 18px 0 14px;
}
.hero-actions .btn { height: 40px; padding: 0 18px; border-radius: var(--r-lg); font-size: var(--t-md); font-weight: 700; }
.hero-actions .btn svg { width: 15px; height: 15px; display: block; }
.hero-actions .primary { box-shadow: var(--ov-shadow-accent); }
.hero-actions .btn-ghost { background: var(--c-glass-2); border-color: var(--c-line-2); }
.hero-actions .btn:hover { transform: translateY(-1px); }
.hero-actions .primary:hover { box-shadow: 0 12px 26px rgba(11, 99, 230, .28); }
.hero-actions .btn-ghost:hover { background: var(--c-surface-3); border-color: var(--ov-line-strong); }
.hero-actions .btn:active,
.empty-actions .btn:active,
.grid-none .btn:active,
.settings-actions .btn:active { transform: translateY(1px); }

.hero-chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
  border-radius: var(--r-pill); background: var(--c-glass-2); border: 1px solid var(--c-line);
  color: var(--c-ink-2); font-size: var(--t-xs); font-weight: 650; box-shadow: var(--e-1);
}
.chip strong { color: var(--c-ink); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ kpis */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 1.2vw, 16px);
  margin: 4px 0 clamp(18px, 2.2vw, 26px);
}
.kpi {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 13px 15px;
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--r-xl); box-shadow: var(--e-1), var(--e-inset);
  transition: border-color var(--d-fast), box-shadow var(--d-fast), transform var(--d-fast) var(--ease-out);
}
.kpi:hover { border-color: var(--ov-line-hover); box-shadow: var(--e-2); transform: translateY(-1px); }
.kpi-ico {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--r-md); background: var(--c-accent-soft); color: var(--c-accent-2);
}
.kpi-ico.is-violet { background: var(--c-violet-soft); color: var(--c-violet); }
.kpi-ico svg { width: 18px; height: 18px; display: block; }
.kpi-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.22; }
.kpi-label {
  font-size: var(--t-2xs); font-weight: 750; letter-spacing: .07em;
  text-transform: uppercase; color: var(--c-muted); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-label-short { display: none; }
.kpi-value { font-size: var(--t-2xl); font-weight: 800; letter-spacing: -.02em; color: var(--c-ink); }
.kpi-value.is-on { color: var(--c-ok-strong); }
.kpi-sub { font-size: var(--t-2xs); color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------ grid tools */
.grid-tools {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin: 0 0 clamp(14px, 1.6vw, 18px);
}
.search { position: relative; flex: 1 1 240px; min-width: 0; max-width: 400px; display: block; }
.search-ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--c-muted); pointer-events: none;
  transition: color var(--d-fast);
}
.search:focus-within .search-ico { color: var(--c-accent-2); }
#thumb-search {
  width: 100%; height: 38px; padding: 0 66px 0 34px;
  border-radius: var(--r-md); border: 1px solid var(--c-line-2);
  background: var(--c-surface); color: var(--c-ink); font-size: var(--t-md);
  outline: none;
  transition: border-color var(--d-fast), box-shadow var(--d-fast), background var(--d-fast);
}
#thumb-search:hover { border-color: var(--ov-line-strong); }
#thumb-search::placeholder { color: var(--c-muted); opacity: 1; }
#thumb-search:focus { outline: none; border-color: var(--ov-focus); box-shadow: var(--e-focus); }
#thumb-search::-webkit-search-cancel-button,
#thumb-search::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

.kbd {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 5px;
  border-radius: var(--r-xs); border: 1px solid var(--c-line-2); background: var(--c-surface-2);
  color: var(--c-muted); font-family: var(--f-mono); font-size: var(--t-2xs); font-weight: 700;
  pointer-events: none; transition: opacity var(--d-fast);
}
.search:focus-within .kbd { opacity: 0; }
.search-clear { min-width: 32px; min-height: 32px;
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; display: inline-grid; place-items: center;
  border: 0; border-radius: var(--r-sm); background: var(--c-surface-3); color: var(--c-muted);
  transition: background var(--d-fast), color var(--d-fast), transform var(--d-fast);
}
.search-clear:hover { background: var(--c-accent-soft); color: var(--c-accent-2); }
.search-clear:active { transform: translateY(-50%) scale(.94); }
.search-clear svg { width: 13px; height: 13px; display: block; }

.grid-count {
  margin-left: auto;
  display: inline-flex; align-items: center; height: 26px; padding: 0 11px;
  border-radius: var(--r-pill); border: 1px solid var(--c-line); background: var(--c-surface-2);
  color: var(--c-ink-2); font-size: var(--t-xs); font-weight: 700; white-space: nowrap;
}

.seg {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; flex: 0 0 auto;
  padding: 3px; border-radius: var(--r-lg);
  background: var(--c-surface-2); border: 1px solid var(--c-line);
  box-shadow: var(--e-inset);
}
.seg::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px;
  width: calc(50% - 3px); border-radius: 9px;
  background: linear-gradient(180deg, #0a63ee, #054bb2);
  box-shadow: 0 6px 14px rgba(11, 99, 230, .22);
  transition: transform var(--d-med) var(--ease-inout);
}
.seg[data-active="name"]::before { transform: translateX(100%); }
.seg-btn { min-height: 32px;
  position: relative; z-index: 1; height: 32px; padding: 0 14px;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--c-muted); font-size: var(--t-sm); font-weight: 700;
  transition: color var(--d-fast);
}
.seg-btn:hover { color: var(--c-ink-2); }
.seg-btn:focus-visible { outline-offset: -2px; }
.seg-btn.on { color: var(--ov-on-accent); }
.seg-btn.on:hover { color: var(--ov-on-accent); }

/* ------------------------------------------------------------ thumb grid */
.thumb-grid {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(12px, 1.6vw, 20px);
  align-items: flex-start;
  justify-content: center;
}
.thumb-card {
  position: relative;
  display: block;
  flex: 0 0 var(--w-thumb);
  width: var(--w-thumb);
  max-width: 100%;
  min-width: 0;
  padding: 7px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-2xl);
  box-shadow: var(--e-1), var(--e-inset);
  color: var(--c-ink);
  text-decoration: none;
  transition: transform var(--d-med) var(--ease-out), border-color var(--d-fast), box-shadow var(--d-med) var(--ease-out);
}
.thumb-card:hover {
  transform: translateY(-3px);
  border-color: var(--ov-line-strong);
  box-shadow: var(--e-3);
}
.thumb-card:active { transform: translateY(-1px); box-shadow: var(--e-2); }
.thumb-card:focus-visible {
  outline: 2px solid var(--c-accent); outline-offset: 2px;
  border-color: var(--ov-line-strong);
  box-shadow: var(--e-3);
}
.thumb-card.thumb-enter { animation: thumb-enter var(--d-slow) var(--ease-out) both; }
@keyframes thumb-enter {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.thumb-screen {
  position: relative;
  width: 100%;
  aspect-ratio: var(--thumb-ratio, 0.45);
  background: var(--c-screen);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .07),
    inset 0 1px 0 rgba(255, 255, 255, .09),
    0 14px 28px -22px rgba(16, 45, 95, .55);
  transition: box-shadow var(--d-med) var(--ease-out);
}
.thumb-card:hover .thumb-screen,
.thumb-card:focus-visible .thumb-screen {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .07),
    inset 0 1px 0 rgba(255, 255, 255, .09),
    0 18px 34px -22px rgba(16, 45, 95, .62);
}
.thumb-screen canvas,
.thumb-screen video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; z-index: 2; background: var(--c-screen);
}

/* conectando = skeleton shimmer (sem layout shift) */
.thumb-overlay {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 12px; text-align: center; overflow: hidden;
  background: linear-gradient(180deg, rgba(5, 9, 16, .93), rgba(5, 9, 16, .85));
  color: var(--ov-on-screen);
}
.thumb-overlay::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg,
    transparent 25%,
    rgba(255, 255, 255, .05) 42%,
    rgba(255, 255, 255, .12) 50%,
    rgba(255, 255, 255, .05) 58%,
    transparent 75%);
  transform: translateX(-100%);
  animation: ov-sweep 1.4s var(--ease-inout) infinite;
}
@keyframes ov-sweep { to { transform: translateX(100%); } }
.thumb-overlay .spinner {
  position: relative; z-index: 1;
  width: 20px; height: 20px; border-width: 2px;
  border-color: rgba(255, 255, 255, .14);
  border-top-color: var(--c-accent-3);
}
.thumb-overlay p {
  position: relative; z-index: 1; margin: 0;
  font-size: var(--t-2xs); font-weight: 650; color: var(--ov-on-screen-dim);
}

.thumb-live {
  position: absolute; left: 8px; top: 8px; z-index: 5;
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 8px; border-radius: var(--r-pill);
  background: rgba(6, 18, 12, .74);
  border: 1px solid var(--ov-live-line);
  color: var(--ov-live-ink);
  font-size: 9.5px; font-weight: 800; letter-spacing: .07em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.thumb-live .live-dot { width: 5px; height: 5px; background: var(--ov-live-dot); }
.thumb-live .live-dot::after { inset: -3px; border-color: var(--ov-live-line); }

.thumb-ai {
  position: absolute; right: 8px; top: 8px; z-index: 5;
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 8px; border-radius: var(--r-pill);
  background: var(--c-violet-soft);
  border: 1px solid var(--ov-violet-line);
  color: var(--ov-violet-ink);
  font-size: 9.5px; font-weight: 800;
  box-shadow: var(--e-1);
}

.thumb-info {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 5px 5px 6px;
}
.thumb-title { min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.thumb-title strong {
  font-size: var(--t-sm); font-weight: 750; letter-spacing: -.01em; color: var(--c-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thumb-title span {
  color: var(--c-muted); font-size: var(--t-2xs);
  font-family: var(--f-mono); font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thumb-open {
  display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto;
  height: 26px; padding: 0 9px; border-radius: var(--r-pill);
  border: 1px solid var(--c-line-2); background: var(--c-surface-2);
  color: var(--c-accent-2); font-size: var(--t-xs); font-weight: 750; white-space: nowrap;
  transition: background var(--d-fast), border-color var(--d-fast), color var(--d-fast);
}
.thumb-card:hover .thumb-open,
.thumb-card:focus-visible .thumb-open { background: var(--c-accent-soft); border-color: var(--ov-accent-line); }
.thumb-open svg { width: 12px; height: 12px; display: block; transition: transform var(--d-fast) var(--ease-out); }
.thumb-card:hover .thumb-open svg,
.thumb-card:focus-visible .thumb-open svg { transform: translate(1px, -1px); }

.grid-none {
  max-width: 420px; margin: 26px auto 8px; padding: 26px 22px;
  text-align: center;
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--r-2xl); box-shadow: var(--e-1), var(--e-inset);
}
.none-ico {
  width: 44px; height: 44px; margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 50%; background: var(--c-surface-3); color: var(--c-accent-2);
}
.none-ico svg { width: 20px; height: 20px; display: block; }
.grid-none p { margin: 0 0 14px; color: var(--c-muted); font-size: var(--t-md); }
.grid-none .btn { height: 36px; padding: 0 15px; border-radius: var(--r-md); }

/* -------------------------------------------------------------- pin/empty */
.pin-card,
.empty-state {
  border-radius: var(--r-3xl);
  border-color: var(--c-line);
  box-shadow: var(--e-4);
}
.pin-card { padding: clamp(26px, 3vw, 38px); }
.pin-card .logo,
.empty-state .logo { width: 56px; height: 56px; border-radius: var(--r-xl); font-size: var(--t-lg); }
.pin-card h1,
.empty-state h1 { margin: 6px 0; font-size: var(--t-3xl); letter-spacing: -.03em; }

.pin-card form {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px; margin-top: 20px;
}
.pin-card input {
  height: 52px; padding: 0 16px;
  border-radius: var(--r-lg); border: 1px solid var(--c-line-2);
  background: var(--c-surface-2); color: var(--c-ink);
  font-size: var(--t-2xl); font-weight: 750; letter-spacing: .35em; text-indent: .35em;
  outline: none;
  transition: border-color var(--d-fast), box-shadow var(--d-fast), background var(--d-fast);
}
.pin-card input:hover { border-color: var(--ov-line-strong); }
.pin-card input:focus { outline: none; border-color: var(--ov-focus); box-shadow: var(--e-focus); background: var(--c-surface); }
.pin-card input[aria-invalid="true"] { border-color: var(--ov-err-line); background: var(--c-err-soft); }
.pin-card input[aria-invalid="true"]:focus { border-color: var(--c-err); box-shadow: 0 0 0 4px rgba(217, 45, 32, .12); }
#pin-btn {
  height: 52px; padding: 0 22px;
  border-radius: var(--r-lg); font-size: var(--t-md); font-weight: 750;
  box-shadow: var(--ov-shadow-accent);
  transition: filter var(--d-fast), transform var(--d-fast) var(--ease-out), box-shadow var(--d-fast);
}
#pin-btn:hover { filter: brightness(1.04); }
#pin-btn:active { transform: translateY(1px); box-shadow: 0 4px 12px rgba(11, 99, 230, .2); }
.pin-error { min-height: 20px; margin-top: 10px; color: var(--c-err); font-size: var(--t-sm); font-weight: 650; }
.pin-card .tiny a { color: var(--c-accent-2); font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }
.pin-card .tiny a:hover { color: var(--c-accent-2); }
.pin-card.pin-shake { animation: pin-shake 500ms var(--ease-inout); }
@keyframes pin-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

.empty-actions { margin: 22px 0 12px; }
.empty-actions .btn { height: 38px; padding: 0 16px; border-radius: var(--r-lg); }

/* --------------------------------------------------------------- modal */
@keyframes ov-modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ov-modal-rise { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
#settings-panel { animation: ov-modal-fade var(--d-med) var(--ease-out) both; }
#settings-panel .modal-card {
  border-radius: var(--r-3xl);
  border-color: var(--c-line);
  box-shadow: var(--e-4);
  padding: clamp(20px, 2.6vw, 28px);
  animation: ov-modal-rise var(--d-slow) var(--ease-out) both;
}
.modal-title { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.modal-head h2 { font-size: var(--t-2xl); letter-spacing: -.02em; margin: 0; }
.modal-head p { margin: 3px 0 0; }
.modal-close { width: 34px; height: 34px; flex: 0 0 auto; border-color: var(--c-line); background: var(--c-surface-2); color: var(--c-muted); transition: background var(--d-fast), border-color var(--d-fast), color var(--d-fast), transform var(--d-fast); }
.modal-close:hover { background: var(--c-err-soft); border-color: var(--ov-err-line); color: var(--c-err); }
.modal-close:active { transform: translateY(1px); }
.modal-close svg { width: 15px; height: 15px; display: block; }

.set-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 8px; }
.set-head h3 { margin: 0; font-size: var(--t-lg); letter-spacing: -.01em; font-weight: 800; }
.set-ico {
  width: 32px; height: 32px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--r-md); background: var(--c-accent-soft); color: var(--c-accent-2);
  box-shadow: var(--e-inset);
}
.set-ico.is-lg { width: 42px; height: 42px; border-radius: var(--r-lg); }
.set-ico.is-lg svg { width: 19px; height: 19px; }
.set-ico svg { width: 16px; height: 16px; display: block; }

.settings-section { margin: 20px 0 0; padding-top: 18px; border-top-color: var(--c-line); }
.settings-section > p { color: var(--c-muted); font-size: var(--t-sm); line-height: 1.5; }
.field-label {
  display: block; margin: 12px 0 2px;
  color: var(--c-muted); font-size: var(--t-2xs); font-weight: 750;
  letter-spacing: .07em; text-transform: uppercase;
}
.settings-section .btn svg { width: 14px; height: 14px; display: block; }
#copy-setup svg { width: 13px; height: 13px; display: block; }

.url-box code {
  border-radius: var(--r-md); border-color: var(--c-line-2);
  background: var(--c-surface-2); color: var(--c-info);
  font-family: var(--f-mono); font-size: var(--t-sm);
}

.device-manager-row {
  border-radius: var(--r-lg); border-color: var(--c-line); background: var(--c-surface-2); padding: 12px;
  transition: border-color var(--d-fast), background var(--d-fast);
}
.device-manager-row:hover { border-color: var(--ov-line-hover); background: var(--c-surface); }
.device-manager-row input { border-radius: var(--r-sm); height: 34px; background: var(--c-surface); }
.device-manager-row input:hover { border-color: var(--ov-line-strong); }
.device-manager-row input:focus { outline: none; border-color: var(--ov-focus); box-shadow: var(--e-focus); }
.device-manager-row .name .seen {
  display: block; margin-top: 3px;
  color: var(--c-muted); font-size: var(--t-xs); font-family: var(--f-mono);
}
.device-manager-row .state {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: var(--t-2xs); font-weight: 800; letter-spacing: .04em;
}
.device-manager-row .state.online { background: var(--c-ok-soft); color: var(--c-ok); }
.device-manager-row .state.offline { background: var(--c-surface-3); color: var(--c-muted); }

.diag-grid { display: grid; gap: 8px; margin: 12px 0 6px; }
.diag-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface-2);
}
.diag-row > span { color: var(--c-muted); font-size: var(--t-sm); font-weight: 650; }
.diag-row strong {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--t-sm); font-weight: 750; color: var(--c-ink);
}

/* ---------------------------------------------------- paleta de comandos */
.cmdk {
  position: fixed; inset: 0; z-index: 95;
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(52px, 14dvh, 150px) 16px 24px;
  background: var(--ov-cmdk-veil);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: ov-modal-fade var(--d-med) var(--ease-out) both;
}
.cmdk-card {
  display: flex; flex-direction: column;
  width: min(640px, 100%); max-height: min(64dvh, 560px); min-height: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-3xl);
  box-shadow: var(--e-4);
  overflow: hidden;
  animation: ov-modal-rise var(--d-slow) var(--ease-out) both;
}
.cmdk-search {
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 16px; flex: 0 0 auto;
  border-bottom: 1px solid var(--c-line);
}
.cmdk-search-ico { width: 17px; height: 17px; flex: 0 0 auto; color: var(--c-muted); }
#cmdk-input {
  flex: 1 1 auto; min-width: 0; height: 100%;
  border: 0; outline: none; background: transparent;
  color: var(--c-ink); font-size: var(--t-lg); font-weight: 600; letter-spacing: -.01em;
}
#cmdk-input::placeholder { color: var(--c-muted); opacity: 1; }
.cmdk-search .cmdk-kbd { flex: 0 0 auto; }

.cmdk-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 8px 10px; }
.cmdk-group {
  padding: 10px 10px 5px;
  font-size: var(--t-2xs); font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--c-muted);
}
.cmdk-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; min-height: 44px; padding: 6px 10px;
  border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--c-ink); text-align: left;
  cursor: pointer;
  transition: background var(--d-fast), color var(--d-fast);
}
.cmdk-item + .cmdk-item { margin-top: 2px; }
.cmdk-item .cmdk-ico {
  width: 30px; height: 30px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--r-sm); background: var(--c-surface-3); color: var(--c-ink-2);
  transition: background var(--d-fast), color var(--d-fast), box-shadow var(--d-fast);
}
.cmdk-item .cmdk-ico svg { width: 16px; height: 16px; display: block; }
.cmdk-item .cmdk-main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 1px; }
.cmdk-item .cmdk-name {
  font-size: var(--t-md); font-weight: 700; color: var(--c-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmdk-item .cmdk-meta {
  font-size: var(--t-2xs); font-family: var(--f-mono); color: var(--c-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmdk-item.is-active { background: var(--c-accent-soft); }
.cmdk-item.is-active .cmdk-ico { background: var(--c-surface); color: var(--c-accent-2); box-shadow: var(--e-inset); }

.cmdk-badge {
  margin-left: auto; flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: var(--t-2xs); font-weight: 800; letter-spacing: .02em;
}
.cmdk-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.cmdk-badge.online { background: var(--c-ok-soft); border: 1px solid var(--ov-ok-line); color: var(--c-ok-strong); }
.cmdk-badge.offline { background: var(--c-surface-3); border: 1px solid var(--c-line); color: var(--c-muted); }

.cmdk-empty {
  margin: 0; padding: 26px 16px 30px; text-align: center;
  color: var(--c-muted); font-size: var(--t-sm); font-weight: 600;
}
.cmdk-foot {
  display: flex; align-items: center; gap: 13px; flex: 0 0 auto;
  padding: 8px 14px;
  border-top: 1px solid var(--c-line);
  background: var(--c-surface-2);
  color: var(--c-muted); font-size: var(--t-2xs); font-weight: 650;
}
.cmdk-hint { display: inline-flex; align-items: center; gap: 4px; }
.cmdk-hint .cmdk-kbd { height: 18px; min-width: 18px; padding: 0 5px; }
.cmdk-hint-end { margin-left: auto; }

/* --------------------------------------------------------------- toasts */
#toasts { right: 18px; bottom: 18px; gap: 10px; align-items: flex-end; }
.toast {
  --toast-life: 4200ms;
  position: relative; display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 15px 13px;
  border-radius: var(--r-lg);
  border: 1px solid var(--c-line-2);
  border-left: 3px solid var(--c-accent);
  background: var(--c-glass-2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--c-ink); font-size: var(--t-sm); font-weight: 650;
  box-shadow: var(--e-3);
  overflow: hidden;
  animation: toast-in var(--d-slow) var(--ease-out) both;
}
.toast.ok { background: var(--c-ok-soft); border-color: var(--ov-ok-line); border-left-color: var(--c-ok); }
.toast.error { background: var(--c-err-soft); border-color: var(--ov-err-line); border-left-color: var(--c-err); --toast-life: 6500ms; }
.toast.out { animation: toast-out var(--d-med) var(--ease-inout) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes toast-in-top { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out-top { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-6px) scale(.98); } }

.toast-ico { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; color: var(--c-accent-2); }
.toast.ok .toast-ico { color: var(--c-ok); }
.toast.error .toast-ico { color: var(--c-err); }
.toast-ico svg { display: block; width: 18px; height: 18px; }
.toast-text { min-width: 0; }
.toast-bar {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 2px;
  transform-origin: left; background: var(--c-accent); opacity: .5;
  animation: toast-bar var(--toast-life) linear forwards;
}
.toast.ok .toast-bar { background: var(--c-ok); }
.toast.error .toast-bar { background: var(--c-err); }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ------------------------------------------------------------ responsivo */
@media (max-width: 900px) {
  .cmdk-trigger-label { display: none; }
}
@media (max-width: 620px) {
  .cmdk-trigger { width: 34px; height: 34px; padding: 0; justify-content: center; gap: 0; }
  .cmdk-trigger .cmdk-kbd { display: none; }
}
@media (max-width: 1080px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .dash-top { padding: 0 12px; gap: 10px; }
  #freshness { display: none; }
  .overview-main { padding: 16px 12px 60px; }
  .overview-hero { padding: 4px 0 20px; }
  .overview-hero h1 { letter-spacing: -.04em; }
  .hero-actions .btn { height: 38px; padding: 0 14px; }
  .thumb-grid { gap: 10px; }
  .thumb-card {
    flex: 0 1 calc(50% - 5px); width: calc(50% - 5px);
    max-width: var(--w-thumb); padding: 6px;
    border-radius: var(--r-xl);
  }
  .thumb-screen { border-radius: 12px; }
  .pin-card { margin-top: 5vh; }
  #settings-panel .modal-card { padding: 18px; }
  #settings-panel { padding: 12px; }
}
@media (max-width: 560px) {
  .tb-sep { display: none; }
  #refresh-btn { display: inline-grid; }

  /* paleta: caber na tela pequena sem cortar a lista */
  .cmdk { padding: 9dvh 10px 16px; }
  .cmdk-card { max-height: min(74dvh, 560px); border-radius: var(--r-2xl); }
  #cmdk-input { font-size: var(--t-md); }
  .cmdk-search { height: 52px; padding: 0 13px; }
  .cmdk-foot { gap: 9px; padding: 8px 12px; }
  .cmdk-hint-end { margin-left: 0; }
  .cmdk-item { padding: 6px 8px; gap: 9px; }
  .dash-actions .icon { width: 34px; height: 34px; }
  .dash-actions .btn-ghost { width: 34px; height: 34px; padding: 0; }
  .dash-actions .btn-ghost .btn-label { display: none; }
  .grid-tools { row-gap: 8px; }
  .grid-tools .search { flex: 1 1 100%; max-width: none; }
  .grid-tools .seg { margin-left: auto; }

  /* kpis: rótulo curto em 1 linha, sem “…” no rodapé */
  .kpi { padding: 12px; gap: 10px; align-items: flex-start; }
  .kpi-ico { width: 32px; height: 32px; }
  .kpi-ico svg { width: 16px; height: 16px; }
  .kpi-label-full { display: none; }
  .kpi-label-short { display: inline; }
  .kpi-label { font-size: 9.5px; letter-spacing: .05em; }
  .kpi-body { gap: 2px; }
  .kpi-value { font-size: var(--t-xl); line-height: 1.05; }
  .kpi-sub { white-space: normal; overflow: visible; overflow-wrap: anywhere; text-overflow: clip; line-height: 1.35; }

  /* busca: alvo maior, atalho “/” só em ponteiro fino */
  #thumb-search { height: 42px; padding-right: 44px; font-size: var(--t-md); }
  .search-ico { left: 13px; }
  .search-clear { width: 30px; height: 30px; right: 6px; }
  .search:focus-within .kbd, .kbd { display: none; }
  .grid-count { margin-left: 0; }

  .pin-card form { grid-template-columns: 1fr; }
  #pin-btn { width: 100%; }
  .url-box { flex-wrap: wrap; }
  .url-box code { flex: 1 1 100%; }

  /* toasts no topo: nunca cobrem as miniaturas */
  #toasts {
    top: calc(var(--h-topbar) + 10px); bottom: auto; left: 12px; right: 12px;
    align-items: stretch; max-width: none;
  }
  .toast { animation-name: toast-in-top; }
  .toast.out { animation: toast-out-top var(--d-med) var(--ease-inout) both; }
  body.modal-open #toasts { top: auto; bottom: 14px; }

  .device-manager-row .state { justify-self: start; }
}
@media (max-width: 520px) {
  .dash-brand .pill { display: inline-flex; }
}
@media (max-width: 430px) {
  .brand-text { display: none; }
  .overview-hero { padding: 2px 0 16px; }
  .overview-hero h1 { font-size: 28px; margin: 12px auto 9px; }
  .overview-hero h1 br { display: none; }
  .hero-sub { font-size: var(--t-md); line-height: 1.5; }
  .hero-actions { margin: 15px 0 12px; }
  .chip { height: 28px; padding: 0 11px; font-size: var(--t-2xs); }
  .thumb-info { padding: 8px 3px 3px; gap: 6px; }
  .thumb-title strong { font-size: var(--t-xs); }
  .thumb-open { font-size: var(--t-2xs); padding: 0 8px; height: 24px; }
}
@media (pointer: coarse) {
  .kbd { display: none; }
  #thumb-search { padding-right: 44px; }
}
