/* ===== Tokens (escuro é o padrão; claro pelo sistema ou pela escolha no menu) ===== */
:root {
  --bg: #0b0d12;
  --bg-2: #10131a;
  --panel: #141821;
  --panel-2: #1a1f2a;
  --panel-3: #222836;
  --border: #252b38;
  --border-2: #323a4b;
  --text: #eef0f5;
  --text-2: #c3c8d4;
  --muted: #8790a3;
  --accent: #e5262c;
  --accent-2: #ff4d4f;
  --accent-soft: rgb(229 38 44 / .14);
  --green: #22c55e;
  --green-text: #86efac;
  --yellow: #eab308;
  --yellow-text: #fde047;
  --red-text: #fca5a5;
  --blue: #3b82f6;
  --gray: #6b7280;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
  --shadow-lg: 0 24px 64px rgb(0 0 0 / .55);
  --glass: rgb(20 24 33 / .72);
  --radius: 14px;
  --radius-sm: 10px;
  --side-w: 256px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f5f8; --bg-2: #eceef3; --panel: #ffffff; --panel-2: #f6f7fa; --panel-3: #eceff4;
    --border: #e3e6ed; --border-2: #cfd4de; --text: #12151c; --text-2: #3a4152; --muted: #6a7386;
    --accent: #dc2626; --accent-2: #ef4444; --accent-soft: rgb(220 38 38 / .09);
    --green-text: #15803d; --yellow-text: #a16207; --red-text: #b91c1c;
    --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 6px 20px rgb(16 24 40 / .06);
    --shadow-lg: 0 24px 64px rgb(16 24 40 / .18); --glass: rgb(255 255 255 / .78);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f5f8; --bg-2: #eceef3; --panel: #ffffff; --panel-2: #f6f7fa; --panel-3: #eceff4;
  --border: #e3e6ed; --border-2: #cfd4de; --text: #12151c; --text-2: #3a4152; --muted: #6a7386;
  --accent: #dc2626; --accent-2: #ef4444; --accent-soft: rgb(220 38 38 / .09);
  --green-text: #15803d; --yellow-text: #a16207; --red-text: #b91c1c;
  --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 6px 20px rgb(16 24 40 / .06);
  --shadow-lg: 0 24px 64px rgb(16 24 40 / .18); --glass: rgb(255 255 255 / .78);
  color-scheme: light;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-2); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type=date] { min-height: 40px; }
input[type=checkbox] { accent-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
label > input, label > select, label > textarea, label > .input-row { margin-top: 6px; color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
::selection { background: rgb(229 38 44 / .35); }

.muted { color: var(--muted); }
.mono { font-family: "JetBrains Mono", Consolas, "Cascadia Mono", monospace; font-size: .95em; }
.spacer { flex: 1; }

/* Barras de rolagem discretas */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

/* ===== Botões ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  min-height: 40px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--border-2); background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 1px 0 rgb(255 255 255 / .18) inset, 0 6px 18px rgb(229 38 44 / .28);
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--red-text); border-color: rgb(229 38 44 / .35); background: transparent; }
.btn.danger:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 11px; min-height: 32px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn.lg { min-height: 46px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.link { background: none; border: 0; color: var(--accent-2); cursor: pointer; padding: 0; font-weight: 500; }
.link:hover { text-decoration: underline; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  background: none; border: 0; border-radius: var(--radius-sm); color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn svg { width: 20px; height: 20px; }

/* ===== Login ===== */
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); }
.login-hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; padding: 56px;
  background: radial-gradient(120% 90% at 0% 100%, #3a0b0e 0%, #12080a 45%, #07080b 100%);
  color: #f4f5f8;
}
.hero-glow {
  position: absolute; inset: -20%; z-index: -1;
  background:
    radial-gradient(40% 35% at 70% 30%, rgb(229 38 44 / .35), transparent 70%),
    radial-gradient(30% 30% at 20% 80%, rgb(255 77 79 / .22), transparent 70%);
  filter: blur(20px);
  animation: drift 14s ease-in-out infinite alternate;
}
.hero-rings { position: absolute; right: -120px; top: 50%; translate: 0 -50%; z-index: -1; }
.hero-rings span {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  border: 1px solid rgb(255 255 255 / .08); border-radius: 50%;
  animation: ring 6s ease-out infinite;
}
.hero-rings span:nth-child(1) { width: 260px; height: 260px; }
.hero-rings span:nth-child(2) { width: 460px; height: 460px; animation-delay: 2s; }
.hero-rings span:nth-child(3) { width: 660px; height: 660px; animation-delay: 4s; }
.hero-content { max-width: 480px; }
.hero-logo { height: 44px; width: auto; display: block; margin-bottom: 28px; }
.login-hero h2 { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 14px; font-weight: 800; }
.login-hero h2 em { font-style: normal; background: linear-gradient(90deg, #ff6b6d, #e5262c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero p { color: rgb(244 245 248 / .7); font-size: 16px; margin: 0 0 28px; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.hero-points li { display: flex; align-items: center; gap: 12px; color: rgb(244 245 248 / .85); }
.hero-points svg { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgb(255 255 255 / .06); border: 1px solid rgb(255 255 255 / .1); color: #ff6b6d; }

.login-side { display: grid; place-items: center; padding: 32px 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 18px; animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.login-brand img { height: 28px; width: auto; }
.login-brand small, .side-brand small { color: var(--accent-2); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; margin-left: 2px; }
.login-head h1 { margin: 6px 0 4px; font-size: 26px; letter-spacing: -.02em; }
.login-head p { margin: 0; }
.field > span:first-child { display: block; margin-bottom: 6px; color: var(--text-2); }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > svg { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 42px; min-height: 46px; margin: 0; }
.input-icon input[type=password], .input-icon input#login-password { padding-right: 46px; }
.pw-toggle { position: absolute; right: 4px; width: 38px; height: 38px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: 8px; }
.pw-toggle:hover, .pw-toggle.on { color: var(--text); }
.caps { display: block; margin-top: 6px; color: var(--yellow-text); font-size: 12px; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 4px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.login-foot svg { width: 14px; height: 14px; color: var(--green); }
.form-error { color: var(--red-text); background: var(--accent-soft); border: 1px solid rgb(229 38 44 / .35); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin: 0; }
.login-card.shake { animation: shake .4s; }

/* ===== Estrutura ===== */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; width: var(--side-w); flex: none;
  display: flex; flex-direction: column;
  background: var(--bg-2); border-right: 1px solid var(--border);
  z-index: 40;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 14px; font-weight: 700; font-size: 16px; }
.side-brand .logo { height: 26px; width: auto; }
.side-close { display: none; margin-left: auto; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { margin: 16px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); opacity: .8; }
.tab {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-2); font-weight: 500; text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.tab svg { color: var(--muted); transition: color .15s; }
.tab:hover { background: var(--panel-2); color: var(--text); }
.tab.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.tab.active svg { color: var(--accent-2); }
.tab.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.tab .pulse { margin-left: auto; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgb(229 38 44 / .6); animation: pulse 1.8s infinite; }

.side-foot { display: flex; align-items: center; gap: 4px; padding: 12px; border-top: 1px solid var(--border); }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer; text-align: left; }
.me:hover { background: var(--panel-2); }
.avatar {
  width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff; letter-spacing: .02em;
  background: linear-gradient(135deg, var(--accent-2), #8b1418);
}
.me-text { min-width: 0; display: grid; }
.me-text b, .me-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text b { font-size: 13px; font-weight: 600; }
.me-text small { color: var(--muted); font-size: 12px; }
.side-actions { display: flex; }
.icon-btn .sun { display: none; }
:root[data-theme="light"] .icon-btn .sun { display: block; }
:root[data-theme="light"] .icon-btn .moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-btn .sun { display: block; }
  :root:not([data-theme="dark"]) .icon-btn .moon { display: none; }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 22px 32px 18px;
  background: var(--glass); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.page-title { min-width: 0; }
.page-title h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; line-height: 1.2; }
.page-title p { margin: 2px 0 0; font-size: 13px; }
.menu-btn, .head-logo { display: none; }
.content { width: 100%; max-width: 1360px; padding: 24px 32px 48px; animation: fade .25s ease both; }
.backdrop { position: fixed; inset: 0; z-index: 35; background: rgb(0 0 0 / .5); backdrop-filter: blur(2px); animation: fade .2s; }

/* ===== Cartões de resumo ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-2); }
.stat::after { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--tone, var(--accent)); opacity: .9; }
.stat::before { content: ""; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%; background: var(--tone, var(--accent)); opacity: .08; }
.stat:nth-child(5n+2) { --tone: var(--green); }
.stat:nth-child(5n+3) { --tone: var(--yellow); }
.stat:nth-child(5n+4) { --tone: var(--blue); }
.stat:nth-child(5n+5) { --tone: #a855f7; }
.stat b { display: block; font-size: 30px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 500; }

/* ===== Barra de busca e filtros ===== */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 260px; display: flex; align-items: center; min-width: 0; }
.search > svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; width: 17px; height: 17px; }
.search input { padding-left: 38px; min-height: 40px; }
.toolbar select { width: auto; min-width: 140px; min-height: 40px; }
.filters .search { flex: 0 1 260px; }
label.inline { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
label.inline input { margin-top: 0; width: auto; }
.summary { margin: 0 0 12px; font-size: 13px; }

/* ===== Tabelas ===== */
.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.table th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.table tbody tr { transition: background .12s; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--panel-2); }
.table tbody tr.clickable { cursor: pointer; }
.table td.wrap { white-space: normal; max-width: 340px; }
.table td.actions { text-align: right; }
.table td.alert { color: var(--yellow-text); font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; margin: 0; }
.empty::before { content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 12px; background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238790a3' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center / 20px no-repeat; }

.ext-number { font-weight: 700; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gray); margin-right: 8px; vertical-align: 1px; flex: none; }
.dot.on, .dot.online { background: var(--green); box-shadow: 0 0 0 3px rgb(34 197 94 / .18); }
.dot.busy { background: var(--accent); box-shadow: 0 0 0 3px rgb(229 38 44 / .2); animation: pulse 1.8s infinite; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ACTIVE { background: rgb(34 197 94 / .13); color: var(--green-text); }
.badge.SUSPENDED { background: rgb(234 179 8 / .14); color: var(--yellow-text); }
.badge.DISABLED { background: rgb(107 114 128 / .18); color: var(--muted); }
.badge.busy { background: var(--accent-soft); color: var(--red-text); }
.badge.ringing { background: rgb(234 179 8 / .14); color: var(--yellow-text); }
.badge.owner { margin-left: 8px; }
.result { font-weight: 600; }
.result.ok { color: var(--green-text); }
.result.bad { color: var(--red-text); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--border); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.on { border-color: var(--green); color: var(--green-text); background: rgb(34 197 94 / .1); }
.chip.off { opacity: .55; text-decoration: line-through; }
.chip.none { color: var(--muted); }

/* ===== Versões do app (tela Usuários) ===== */
.versions {
  display: grid; grid-template-columns: minmax(220px, auto) auto minmax(260px, 1fr); gap: 18px 28px; align-items: center;
  margin-bottom: 18px; padding: 18px 20px; position: relative; overflow: hidden;
}
.versions::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(var(--accent), var(--blue)); }
.v-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.v-head b { display: block; font-size: 15px; }
.v-head small { display: block; font-size: 12px; }
.v-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-2); }
.v-icon svg { width: 20px; height: 20px; }
.v-tags { display: flex; gap: 10px; }
.v-tag { min-width: 112px; max-width: 220px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--border); }
.v-tag small { display: block; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.v-tag b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.v-tag span { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-tag.new { border-color: rgb(34 197 94 / .45); background: rgb(34 197 94 / .08); }
.v-tag.new b { color: var(--green-text); }
.v-progress { display: grid; gap: 8px; min-width: 0; }
.v-count { color: var(--text-2); font-size: 13.5px; }
.v-count b { font-size: 20px; color: var(--text); margin-right: 2px; font-variant-numeric: tabular-nums; }
.v-count em { float: right; font-style: normal; font-weight: 700; color: var(--green-text); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #4ade80); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.v-outdated, .v-done { grid-column: 1 / -1; margin: 0; padding-top: 12px; border-top: 1px solid var(--border); }
.v-outdated summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--yellow-text); }
.v-outdated ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 18px; }
.v-outdated li { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.v-outdated li .link { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-outdated li .muted { font-size: 12px; white-space: nowrap; }
.v-done { display: flex; align-items: center; gap: 8px; color: var(--green-text); font-size: 13px; font-weight: 600; }
.v-done svg { width: 16px; height: 16px; }
.v-minimum { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.v-min-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: rgb(234 179 8 / .12); color: var(--yellow-text); }
.v-min-icon svg { width: 16px; height: 16px; }
.v-min-text { flex: 1; min-width: 0; }
.v-min-text b { display: block; font-size: 13.5px; }
.v-min-text small { display: block; font-size: 12px; }
.v-minimum select { width: auto; min-width: 200px; min-height: 38px; }
@media (max-width: 760px) {
  .v-minimum { flex-wrap: wrap; }
  .v-minimum select { width: 100%; }
}
@media (max-width: 1180px) {
  .versions { grid-template-columns: minmax(0, 1fr) auto; }
  .v-progress { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .versions { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 14px; }
  .v-tags .v-tag { flex: 1; min-width: 0; }
}

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 60; background: rgb(5 6 10 / .6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; overflow-y: auto; animation: fade .15s; }
.modal-card {
  width: 100%; max-width: 580px; background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  padding: 22px 24px 24px; box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.2, .8, .2, 1);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; overflow-wrap: anywhere; }
#modal-body > p { color: var(--text-2); }

.form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; font-size: 11.5px; font-weight: 700; color: var(--accent-2); text-transform: uppercase; letter-spacing: .08em; }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.hint { font-size: 12px; color: var(--muted); margin: 5px 0 0; font-weight: 400; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

.detail-grid { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0 0 18px; padding: 16px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.detail-grid dt { color: var(--muted); font-size: 13px; }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.devices { margin: 0 0 16px; padding: 0; list-style: none; display: grid; gap: 6px; }
.devices li { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.devices li .grow { flex: 1; min-width: 0; }
.pick-list { max-height: 240px; overflow-y: auto; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; margin-top: 6px; }
.pick-list label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); cursor: pointer; font-size: 14px; font-weight: 400; }
.pick-list label:hover { background: var(--panel); }
.pick-list input { width: auto; margin: 0; box-shadow: none; }
.pick-list .muted { margin-left: auto; font-size: 12px; }
.full > input[type=search] { margin: 6px 0 0; }
/* Caixinha de ligar/desligar uma permissão, dentro de um campo do formulário. */
.check-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; font-weight: 400; cursor: pointer; }
.check-row:hover { border-color: var(--accent); }
.check-row input { width: auto; margin: 0; box-shadow: none; }
.secret-box { background: var(--accent-soft); border: 1px dashed var(--accent); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; }

/* ===== PABX ===== */
.section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.section-title .muted { font-weight: 400; font-size: 12px; }
.table-wrap + .section-title { margin-top: 26px; }
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
/* Coluna estreita ao lado da lista de ramais: cabeçalho pode quebrar linha e as células ficam mais justas. */
.live-grid .table th { white-space: normal; }
.live-grid .table th, .live-grid .table td { padding: 11px 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card .toolbar { margin-bottom: 10px; }
.presence { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; max-height: 620px; overflow-y: auto; }
.presence li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); }
.presence li:hover { background: var(--panel-2); }
.presence .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.presence-label { color: var(--muted); font-weight: 600; }
.presence-label.online { color: var(--green-text); }
.presence-label.busy { color: var(--red-text); }
.player {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(90deg, var(--accent-soft), var(--panel) 60%);
  border: 1px solid rgb(229 38 44 / .4); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
#player-title { font-weight: 600; }
.player audio { flex: 1; min-width: 220px; height: 38px; }

/* ===== Aviso ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; translate: -50% 0; z-index: 80;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 18px 12px 14px; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px);
  animation: toast .25s cubic-bezier(.2, .8, .2, 1); cursor: pointer;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--green); box-shadow: 0 0 0 4px rgb(34 197 94 / .18); }
.toast.error::before { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ===== Animações ===== */
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toast { from { opacity: 0; translate: -50% 12px; } }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgb(229 38 44 / 0); } 100% { box-shadow: 0 0 0 0 rgb(229 38 44 / 0); } }
@keyframes ring { 0% { opacity: 0; scale: .7; } 30% { opacity: 1; } 100% { opacity: 0; scale: 1.15; } }
@keyframes drift { to { transform: translate(4%, -3%) scale(1.06); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes slide { from { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===== Telas médias ===== */
@media (max-width: 1180px) {
  .live-grid { grid-template-columns: 1fr; }
  .presence { max-height: 420px; }
}

/* ===== Tablet e celular: menu vira gaveta ===== */
@media (max-width: 960px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-side {
    background:
      radial-gradient(80% 50% at 50% 0%, rgb(229 38 44 / .16), transparent 70%),
      var(--bg);
  }

  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: auto;
    width: min(84vw, 300px);
    transform: translateX(-100%); visibility: hidden;
    transition: transform .25s cubic-bezier(.2, .8, .2, 1), visibility .25s;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  body.nav-open { overflow: hidden; }
  .side-close { display: inline-grid; }
  .menu-btn { display: inline-grid; margin-left: -8px; }
  .head-logo { display: block; height: 22px; width: auto; margin-left: auto; opacity: .9; }
  .page-head { padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
  .page-title h1 { font-size: 18px; }
  .page-title p { display: none; }
  .content { padding: 16px 16px 40px; }
}

/* ===== Celular: tabelas viram cartões ===== */
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 24px; }
  .stat span { font-size: 12px; }

  .toolbar { gap: 8px; }
  .search, .filters .search { flex: 1 1 100%; }
  .toolbar select, .toolbar .btn { flex: 1 1 auto; }
  .toolbar .spacer { display: none; }
  .filters label.inline { flex: 1 1 calc(50% - 4px); flex-direction: column; align-items: stretch; gap: 4px; font-size: 12px; }
  .filters label.inline input { width: 100%; }

  .table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  .table, .table tbody { display: block; }
  .table thead { display: none; }
  .table tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 14px;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
  }
  .table tbody tr:hover { background: var(--panel); }
  .table tbody tr.clickable:active { border-color: var(--accent); }
  .table td { display: block; padding: 0; border: 0; white-space: normal; min-width: 0; overflow-wrap: anywhere; }
  .table td::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
  .table td:first-child { grid-column: 1 / -1; font-size: 15px; font-weight: 600; }
  .table td:first-child::before { display: none; }
  .table td.actions { grid-column: 1 / -1; text-align: left; }
  .table td.actions:empty, .table td.actions::before, .table td[data-label=""]::before { display: none; }
  .table td.actions .btn { width: 100%; }
  .table tr.clickable td.actions { display: none; }
  .table td.wrap { max-width: none; }
  .empty { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }

  .modal { place-items: end center; padding: 0; }
  .modal-card {
    max-width: none; border-radius: 20px 20px 0 0; max-height: 92dvh; overflow-y: auto;
    padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
    animation: sheet .25s cubic-bezier(.2, .8, .2, 1);
  }
  .modal-card::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--border-2); margin: -6px auto 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; gap: 2px; padding: 14px; }
  .detail-grid dd { margin-bottom: 10px; }
  .detail-actions .btn { flex: 1 1 calc(50% - 4px); }
  .detail-actions .spacer { display: none; }
  .form-actions .btn { flex: 1; }
  .player audio { min-width: 100%; order: 3; }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@keyframes sheet { from { transform: translateY(100%); } }

@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat b { font-size: 21px; }
}
