/* ===== Design tokens ===== */
:root {
  --brand-blue: #26BFFF;
  --brand-green: #00E175;
  --brand-ink: #0A121F;
  --brand-gradient: linear-gradient(90deg, var(--brand-blue), var(--brand-green)); /* reservado: banners/destaques de marca, nunca em botões */

  /* Cor de interação (botões, links ativos, marcadores): somente azul */
  --primary: var(--brand-blue);
  --primary-hover: #12AEEE;
  --primary-soft: rgba(38, 191, 255, .12);
  --link: #0B8FC7;

  --sidebar-bg: #1F2937;
  --sidebar-text: #D1D5DB;
  --sidebar-muted: #9CA3AF;
  --sidebar-hover: #374151;

  --bg: #FFFFFF;
  --bg-subtle: #F5F7FA;
  --text: #111827;
  --text-muted: #6B7280;
  --border: #E5E7EB;

  --success: #059669;
  --success-bg: #ECFDF5;
  --info: #0284C7;
  --info-bg: #E0F2FE;
  --error: #DC2626;
  --error-bg: #FEF2F2;
  --warning: #B45309;
  --warning-bg: #FFFBEB;
  --neutral-bg: #F3F4F6;
  --row-alt: #F6F7F9;     /* listas: linhas alternadas (zebra) */
  --row-hover: #ECEFF3;

  /* Densidade: telas com muita informação → espaçamentos compactos */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --control-h: 32px;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --sidebar-width: 220px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); font-size: 13px; line-height: 1.35; }
img { max-width: 100%; display: block; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.mono { font-variant-numeric: tabular-nums; }
.mr-auto { margin-right: auto; }

/* ===== Buttons / links ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-h); padding: 0 14px; border-radius: 6px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, box-shadow .15s;
}
.btn-primary { background: var(--primary); color: var(--brand-ink); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-subtle); }
.btn:focus-visible { outline: 3px solid rgba(38, 191, 255, .45); outline-offset: 1px; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }

.link { color: var(--link); font-weight: 500; text-decoration: none; }
.link:hover { text-decoration: underline; }

.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: 6px; border: 0; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgba(127, 127, 127, .15); }

.alert { padding: var(--space-2) var(--space-3); border-radius: 6px; margin-bottom: var(--space-3); }
.alert-error { background: var(--error-bg); color: var(--error); }
.alert-info, .alert-message { background: var(--info-bg); color: var(--info); }
.alert-success { background: var(--success-bg); color: var(--success); }

.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 1.5; vertical-align: middle; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--neutral-bg); color: #374151; }
.badge-muted { background: var(--neutral-bg); color: var(--text-muted); }
.badge + .badge { margin-left: 2px; }

.hint { color: var(--text-muted); font-size: 12px; margin-bottom: var(--space-2); }
.hint-inline { color: var(--text-muted); font-size: 12px; margin-left: var(--space-2); }
.field-hint { color: var(--text-muted); font-size: 12px; }
.hint-list { margin: 2px 0 4px; padding-left: 18px; }
.hint-list li { margin: 1px 0; }
.empty { text-align: center; color: var(--text-muted); padding: var(--space-5) !important; }

/* ===== Forms ===== */
.form { display: grid; gap: var(--space-3); }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2) var(--space-3); }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-1 { grid-column: span 1; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: 1 / -1; }
.field { display: grid; gap: 3px; align-content: start; margin: 0; padding: 0; border: 0; min-width: 0; }
.field-label { font-size: 12px; font-weight: 500; color: #374151; padding: 0; }
.req { color: var(--error); font-style: normal; }
.field-error { color: var(--error); font-size: 11px; }
.input {
  width: 100%; height: var(--control-h); padding: 0 10px; font: inherit; color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
select.input { padding-right: 6px; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(38, 191, 255, .2); }
textarea.input { height: auto; min-height: 120px; padding: 8px 10px; line-height: 1.5; resize: vertical; }
.input-prompt { min-height: calc(15 * 1.5em + 18px); /* at least 15 lines */ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
/* Version history (Admin > Prompts) */
.version-list { list-style: none; margin: 0; padding: 0; }
.version-list > li { border-top: 1px solid var(--border); }
.version-list > li:first-child { border-top: 0; }
.version > summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: 6px 0; cursor: pointer; }
.version > summary .hint-inline { margin-left: 0; }
.version-content { max-height: 320px; overflow: auto; margin: 0 0 var(--space-2); padding: 8px 10px; background: var(--bg-subtle);
  border: 1px solid var(--border); border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; }
.version-actions { margin-bottom: var(--space-2); }
/* Code (SQL) shown for copying (Admin > Prompts > Campos e view) */
.code-block { max-height: 480px; white-space: pre; overflow-wrap: normal; }
/* Data dictionary (Admin > Prompts > Campos e view) */
.fields-table td { vertical-align: top; }
.fields-description { min-width: 280px; width: 40%; }
.fields-compact { display: block; margin-left: 0; }
.fields-path { overflow-wrap: anywhere; }
@media (max-width: 640px) { .fields-description { min-width: 0; width: auto; } }
.input:disabled { background: var(--bg-subtle); color: var(--text-muted); cursor: not-allowed; }
.has-error .input { border-color: var(--error); }
.input-group { position: relative; display: block; }
.input-group .input { padding-right: 72px; }
.input-addon {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 12px; cursor: pointer; padding: 4px 6px;
}
.form-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.checkbox input { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; }
.checkbox input:disabled + * , .checkbox:has(input:disabled) { cursor: default; }
.checkbox-list { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); padding-top: 2px; }
.checkbox-list ul { list-style: none; margin: 0; padding: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.stack { display: grid; gap: var(--space-3); }
/* Cards side by side (e.g. Admin > LLM price boxes); one column on smaller screens */
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
@media (max-width: 1100px) { .card-grid { grid-template-columns: 1fr; } }
.stack > .alert { margin-bottom: 0; }
/* Bordered boxes side by side inside a card, each with a tinted header (e.g. Empresa > Tarifas:
   Lote diário | Consultas avulsas | Fee Tecnologia). Narrower last column for the small box. */
.panel-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(200px, .55fr); gap: var(--space-3); align-items: start; }
.panel { border: 1px solid var(--border); border-radius: 6px; background: #fff; min-width: 0; }
.panel-header { padding: 6px 10px; background: var(--bg-subtle); border-bottom: 1px solid var(--border); border-radius: 6px 6px 0 0; }
.panel-header h3 { font-size: 13px; font-weight: 600; }
.panel-body { display: grid; gap: var(--space-2); padding: var(--space-2) 10px; }
.panel-body .table-wrap { margin: 0 -10px; padding: 0 10px; }
@media (max-width: 1280px) {
  .panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid > .panel:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 960px) { .panel-grid { grid-template-columns: 1fr; } }
/* Fixed value shown in place of an input (e.g. Tarifas: "acima de 0") */
.input-static { display: flex; align-items: center; background: var(--bg-subtle); color: var(--text-muted); cursor: not-allowed; }

/* ===== Login (light background) ===== */
.page-login { background: var(--bg-subtle); font-size: 14px; }
.login {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px; position: relative; overflow: hidden;
}
.login::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--primary); }
.login-card {
  width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 24, 40, .06); padding: 32px 28px;
}
.login-logo { width: 170px; margin: 0 auto 20px; }
.login-title { font-size: 19px; font-weight: 700; text-align: center; }
.login-subtitle { margin: 4px 0 20px; color: var(--text-muted); text-align: center; font-size: 13px; }
.login .input { height: 38px; }
.login .btn { height: 38px; }
.login-footer { margin-top: 20px; color: var(--text-muted); font-size: 12px; }
@media (max-width: 480px) { .login-card { padding: 28px 18px; } }

/* ===== App shell: sidebar + content ===== */
.app { display: flex; min-height: 100%; }
.sidebar {
  width: var(--sidebar-width); background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 30;
  transition: transform .2s ease;
}
.sidebar-brand { padding: 16px 18px 14px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.sidebar-brand img { width: 118px; margin: 0 auto; }
.sidebar-nav { flex: 1; padding: 10px 8px; display: grid; gap: 2px; align-content: start; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px;
  color: var(--sidebar-text); text-decoration: none; font-weight: 500; position: relative;
}
.nav-item svg { color: var(--sidebar-muted); }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.is-active { background: var(--primary-soft); color: #fff; }
.nav-item.is-active svg { color: var(--primary); }
.nav-item.is-active::before {
  content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-item.is-disabled { opacity: .5; cursor: default; }
.nav-item.is-disabled:hover { background: none; color: var(--sidebar-text); }
.sidebar-user { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar-user form { margin: 0 0 0 auto; }
.sidebar-user .icon-btn { color: var(--sidebar-muted); }
.sidebar-user .icon-btn:hover { color: #fff; background: var(--sidebar-hover); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--primary); color: var(--brand-ink); font-weight: 700; font-size: 12px;
}
.sidebar-user-info { display: grid; min-width: 0; font-size: 12px; }
.sidebar-user-info strong { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-info a { color: var(--sidebar-muted); text-decoration: none; }
.sidebar-user-info a:hover { color: #fff; text-decoration: underline; }
.sidebar-backdrop { display: none; }

.main { flex: 1; margin-left: var(--sidebar-width); min-width: 0; background: var(--bg); display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: var(--space-2); padding: 10px 20px; min-height: 52px;
  border-bottom: 1px solid var(--border); background: #fff; position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 17px; font-weight: 700; }
.topbar-actions { margin-left: auto; display: flex; gap: var(--space-2); }
.menu-toggle { display: none; }
.content { padding: var(--space-4) 20px 32px; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); align-content: start; }
.content > .alert { margin-bottom: 0; }
.lead { color: var(--text-muted); }
.breadcrumb { color: var(--text-muted); font-size: 12px; }
.breadcrumb a { color: var(--link); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ===== Cards ===== */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-3) var(--space-4); }
.card-narrow { max-width: 440px; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); min-height: 26px; }
.card-header h2, .section-title { font-size: 14px; font-weight: 600; }
.card-header form { margin: 0; }
.section-title { margin-bottom: var(--space-2); }
.section-title + .hint { margin-top: -4px; }

/* Definition list (read-only data) */
.dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2) var(--space-4); margin: 0; }
.dl > div { min-width: 0; }
.dl dt { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.dl dd { margin: 1px 0 0; overflow-wrap: anywhere; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-3); }
.stat { display: grid; gap: 2px; }
.stat-label { color: var(--text-muted); font-size: 12px; }
.stat-value { font-size: 20px; font-weight: 700; }
.stat-delta { font-size: 11px; color: var(--success); }

/* Toolbar / filters */
.toolbar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-2); }
.input-search { max-width: 320px; }
.toolbar-info { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.pills { display: flex; gap: 2px; background: var(--neutral-bg); border-radius: 6px; padding: 2px; }
.pill { padding: 3px 10px; border-radius: 4px; font-size: 12px; font-weight: 500; color: var(--text-muted); text-decoration: none; }
.pill:hover { color: var(--text); }
.pill.is-active { background: #fff; color: var(--text); box-shadow: var(--shadow); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--space-4)); padding: 0 var(--space-4); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--text-muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.table th, .table td { padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
/* Edge cells keep a small padding so the zebra background does not touch the text */
.table th:first-child, .table td:first-child { padding-left: 8px; }
.table th:last-child, .table td:last-child { padding-right: 8px; }
.table td a { text-decoration: none; }
.table td a:hover { text-decoration: underline; }
.table .num { text-align: right; }
.table .center { text-align: center; }
.table tbody tr:last-child td { border-bottom: 0; }
/* Zebra: alternate rows white / light gray in every list */
.table tbody tr:nth-child(even) { background: var(--row-alt); }
.table tbody tr:hover { background: var(--row-hover); }
.row-link { cursor: pointer; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .form-grid, .dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3 { grid-column: 1 / -1; }
}
.sidebar-close, .menu-toggle-close { display: none; }
.sidebar-brand { position: relative; }

@media (max-width: 960px) {
  /* Menu becomes a drawer opened by the hamburger in the top bar */
  .sidebar { width: min(280px, 85vw); transform: translateX(-100%); box-shadow: none; visibility: hidden;
             transition: transform .2s ease, visibility 0s linear .2s; }
  .app.sidebar-open .sidebar { transform: none; visibility: visible; box-shadow: 4px 0 24px rgba(0, 0, 0, .3);
             transition: transform .2s ease; }
  .app.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 20; }
  .sidebar-close { display: inline-grid; position: absolute; top: 10px; right: 8px; color: var(--sidebar-muted); }
  .sidebar-close:hover { color: #fff; background: var(--sidebar-hover); }
  .nav-item { padding: 10px 10px; }            /* bigger touch targets */
  .nav-child { padding-left: 38px; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-grid; flex-shrink: 0; }
  .app.sidebar-open .menu-toggle-open { display: none; }
  .app.sidebar-open .menu-toggle-close { display: inline; }
  .topbar { padding: 8px 12px; }
  .content { padding: var(--space-3) 12px 24px; }
}
body.no-scroll { overflow: hidden; }

@media (max-width: 640px) {
  .form-grid, .form-grid.cols-3, .dl { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: 1 / -1; }
  .page-title { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions .btn { height: 30px; padding: 0 10px; font-size: 12px; }
  .card { padding: var(--space-3); }
  .toolbar .input-search { max-width: none; flex: 1 1 100%; }
  .toolbar .input-auto { max-width: none; flex: 1; }
  .toolbar-info { margin-left: 0; }
  .form-actions { flex-wrap: wrap; }
  .card-header { flex-wrap: wrap; }

  /* Tables → stacked cards (labels come from the header via JS data-label) */
  .table-wrap { margin: 0; padding: 0; overflow: visible; }
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { position: relative; padding: 8px; border-bottom: 1px solid var(--border); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack tbody tr:hover { background: none; }
  .table-stack tbody tr:nth-child(even) { background: var(--row-alt); }
  .table-stack td { display: flex; gap: 8px; padding: 2px 0 !important; border: 0; white-space: normal; text-align: left !important; overflow-wrap: anywhere; }
  .table-stack td::before { content: attr(data-label); flex: 0 0 92px; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; padding-top: 1px; }
  .table-stack td:first-child { padding-right: 64px !important; font-size: 14px; flex-wrap: wrap; }
  .table-stack td:first-child::before, .table-stack td.actions::before, .table-stack td.empty::before, .table-stack td:not([data-label])::before { display: none; }
  .table-stack td.actions { position: absolute; top: 6px; right: 8px; width: auto; padding: 0 !important; }
  .table-stack td.wrap { min-width: 0; }
  .table-stack .empty { justify-content: center; }
  /* column filters (.th-filter) stay visible on phones: a row of filters above the cards */
  .table-stack thead.has-filters { display: block; }
  .table-stack thead.has-filters tr { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) 0; }
  .table-stack thead.has-filters th { display: none; }
  .table-stack thead.has-filters th.th-filter { display: block; padding: 0; border: 0; }
}

/* ===== Sidebar groups (parent → children) ===== */
.nav-group-toggle { width: 100%; border: 0; background: none; font: inherit; cursor: pointer; text-align: left; }
.nav-group-toggle span { flex: 1; }
.nav-chevron { width: 14px; height: 14px; transition: transform .15s; }
.nav-group:not(.is-open) .nav-chevron { transform: rotate(-90deg); }
.nav-group:not(.is-open) .nav-children { display: none; }
.nav-group.has-active > .nav-group-toggle { color: #fff; }
.nav-group.has-active > .nav-group-toggle svg:first-child { color: var(--primary); }
.nav-children { display: grid; gap: 2px; margin: 2px 0 4px; }
.nav-child { padding-left: 38px; font-weight: 400; }
.nav-child svg { width: 15px; height: 15px; }

/* ===== Extra components ===== */
.input-auto { width: auto; max-width: 220px; }
.input-readonly { display: flex; align-items: center; background: var(--bg-subtle); color: var(--text-muted); }
.btn-danger { background: #fff; color: var(--error); border-color: #FCA5A5; }
.btn-danger:hover { background: var(--error-bg); }
.card-medium { max-width: 640px; }
.table td.wrap { white-space: normal; min-width: 240px; }

/* Sortable (Admin > Menu) */
.sortable { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: grid; gap: 4px; }
.sortable-children { margin: 4px 0 2px 28px; }
.sortable-row {
  display: flex; align-items: center; gap: var(--space-2); padding: 4px 6px 4px 8px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
.sortable-item.is-dragging > .sortable-row { opacity: .5; border-style: dashed; border-color: var(--primary); }
.sortable-grip { color: var(--text-muted); cursor: grab; display: inline-grid; }
.sortable-label { flex: 1; }
.sortable-actions { display: flex; gap: 2px; }
.sortable-actions .icon-btn { width: 26px; height: 26px; color: var(--text-muted); }

/* ===== Company context (sidebar) ===== */
.company-switch { padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, .06); display: grid; gap: 3px; }
.company-switch-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--sidebar-muted); }
.company-name { color: #fff; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-switch-select {
  width: 100%; height: 28px; padding: 0 6px; border-radius: 6px; font: inherit; font-size: 12px;
  background: var(--sidebar-hover); color: #fff; border: 1px solid rgba(255, 255, 255, .12); cursor: pointer;
}
.company-switch-select:focus { outline: none; border-color: var(--primary); }
.simulation-bar {
  padding: 6px var(--space-3); border-radius: 6px; font-size: 12px;
  background: var(--primary-soft); color: #075985; border: 1px solid rgba(38, 191, 255, .35);
}
.badge-super { background: var(--brand-ink); color: #fff; }

/* Row actions (edit / delete icons in tables) */
/* Filter in a column header: <th class="th-filter" data-label="Tipo"><label>Tipo <select class="th-select" form=...> */
.th-filter label { display: inline-flex; align-items: center; gap: var(--space-1); cursor: pointer; }
.th-select {
  height: 22px; max-width: 150px; padding: 0 2px; font: inherit; font-size: 11px; text-transform: none; letter-spacing: 0;
  color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; cursor: pointer;
}
.th-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.th-select.is-filtered { border-color: var(--primary); background: var(--primary-soft); }
.table th.actions, .table td.actions { width: 1%; text-align: right; white-space: nowrap; }
.table td.actions form { display: inline; margin: 0; }
.icon-btn-sm { width: 26px; height: 26px; color: var(--text-muted); vertical-align: middle; }
.icon-btn-sm svg { width: 16px; height: 16px; }
.icon-btn-sm:hover { color: var(--text); background: var(--neutral-bg); }
.icon-btn-danger:hover { color: var(--error); background: var(--error-bg); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; background: none; }
/* Personal data toggle ("eye", demos/screen sharing): masked by default; html.pii-visible shows the full values.
   Only visual — both values are in the HTML. Markup: <span class="pii-full">…</span><span class="pii-mask">…</span> */
.pii-full, .pii-icon-on { display: none; }
html.pii-visible .pii-full, html.pii-visible .pii-icon-on { display: inline; }
html.pii-visible .pii-mask, html.pii-visible .pii-icon-off { display: none; }
html.pii-visible .pii-toggle { color: var(--primary); background: var(--primary-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FCD34D; }

/* Login: verification code step */
.input-code { height: 48px !important; text-align: center; font-size: 24px; font-weight: 700; letter-spacing: 10px;
              font-variant-numeric: tabular-nums; padding-left: 20px; }
.verify-actions { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); font-size: 13px; }
.verify-actions form { margin: 0; }
.verify-hint { text-align: center; margin: var(--space-3) 0 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--link); font-weight: 500; cursor: pointer; }
.link-btn:hover:not(:disabled) { text-decoration: underline; }
.link-btn:disabled { color: var(--text-muted); cursor: default; }

/* Access log */
.badge-danger { background: var(--error-bg); color: var(--error); }
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }
.date-filter { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12px; }
.table-log td { vertical-align: top; }
.log-user { white-space: normal !important; min-width: 180px; }
.log-user small { display: block; font-size: 11px; }
.log-desc { margin-top: 2px; font-size: 12px; color: var(--text); }
.log-req { max-width: 280px; }
.log-path { display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-3); }
.pagination .hint { margin: 0 var(--space-1); }
.pagination .btn-sm { min-width: 28px; padding: 0 8px; }
.pagination.pagination-top { margin: 0 0 var(--space-2); }
.input-call-id { max-width: 150px; }

/* Role permissions: menu tree with checkboxes */
.perm-tree, .perm-tree ul { list-style: none; margin: 0; padding: 0; }
.perm-tree { display: grid; gap: 6px; max-width: 520px; }
.perm-tree > li { border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; }
.perm-tree ul { display: grid; gap: 6px; margin: 8px 0 2px 24px; }
.perm-tree .checkbox { color: var(--text); }
.perm-tree .checkbox.is-locked { color: var(--text-muted); cursor: not-allowed; }
.perm-group .badge { margin-left: 4px; }

/* Date range picker (one field, a calendar: first click = start, second = end). Markup: reports/calls.html; JS: main.js */
.daterange { position: relative; }
.daterange-input { display: inline-flex; align-items: center; gap: 6px; width: auto; min-width: 210px; cursor: pointer; text-align: left; }
.daterange-input svg { width: 16px; height: 16px; color: var(--text-muted); }
.daterange-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; width: 260px; padding: var(--space-2);
                 background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
                 box-shadow: 0 8px 24px rgba(16, 24, 40, .12); }
.daterange-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-1); font-weight: 600; }
.daterange-head .icon-btn-sm svg { width: 16px; height: 16px; }
.daterange-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; }
.daterange-dow { text-align: center; font-size: 11px; color: var(--text-muted); padding: 2px 0; }
.daterange-day { height: 30px; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; border-radius: 0; }
.daterange-day:hover { background: var(--row-hover); }
.daterange-day.is-other { color: var(--text-muted); }
.daterange-day.is-today { font-weight: 700; }
.daterange-day.in-range { background: var(--primary-soft); }
.daterange-day.is-start, .daterange-day.is-end { background: var(--primary); color: var(--brand-ink); font-weight: 600; }
.daterange-day.is-start { border-radius: 6px 0 0 6px; }
.daterange-day.is-end { border-radius: 0 6px 6px 0; }
.daterange-day.is-start.is-end { border-radius: 6px; }
.daterange-day:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.daterange-hint { margin: var(--space-2) 0 0; font-size: 12px; color: var(--text-muted); }
@media (max-width: 640px) {
  .daterange { flex: 1 1 100%; }
  .daterange-input { width: 100%; }
  .daterange-pop { width: min(300px, calc(100vw - 24px)); }
}

/* Table with column lines and a highlighted header row (e.g. Relatórios > Ligações): <table class="table table-grid">.
   Desktop only — on phones .table-stack turns the rows into cards, which keep their own look. */
@media (min-width: 641px) {
  .table-grid { border: 1px solid var(--border); }
  .table-grid th, .table-grid td { border-right: 1px solid var(--border); }
  .table-grid th:last-child, .table-grid td:last-child { border-right: 0; }
  .table-grid thead th { background: var(--neutral-bg); color: var(--text); font-weight: 600;
                         border-bottom: 2px solid var(--border); }
}
/* Fixed column widths, set in a <colgroup> (percent): long text ends with "…" instead of widening the column.
   Desktop only — on phones .table-stack shows cards. */
@media (min-width: 641px) {
  .table-fixed { table-layout: fixed; }
  .table-fixed td { overflow: hidden; text-overflow: ellipsis; }
  .table-fixed th.th-filter label { max-width: 100%; }
  .table-fixed .th-select { min-width: 0; flex: 1 1 auto; }
}

/* Column filter with checkboxes (several options at once): <details class="multi-filter"> in a .th-filter header.
   The panel is position: fixed (placed by main.js [data-multi-filter]) so the scrolling .table-wrap does not clip it. */
.multi-filter { display: inline-block; max-width: 100%; vertical-align: middle; }
.multi-filter > summary { list-style: none; display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
                          padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.multi-filter > summary::-webkit-details-marker { display: none; }
.multi-filter > summary::after { content: "▾"; color: var(--text-muted); margin-left: auto; padding-left: 2px; }
.multi-filter[open] > summary { border-color: var(--primary); }
.multi-filter-panel { position: fixed; z-index: 40; width: 260px; display: flex; flex-direction: column; gap: var(--space-2);
                      padding: var(--space-2); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
                      box-shadow: 0 8px 24px rgba(16, 24, 40, .12); text-align: left; text-transform: none; letter-spacing: 0;
                      font-size: 12px; font-weight: 400; color: var(--text); white-space: normal; }
.multi-filter-search { height: 28px; }
.multi-filter-options { display: grid; gap: 1px; overflow-y: auto; min-height: 0; }
.multi-filter-options .checkbox { padding: 3px 4px; border-radius: 4px; }
.multi-filter-options .checkbox:hover { background: var(--row-hover); }
.multi-filter-options .checkbox[hidden] { display: none; }
.multi-filter-actions { display: flex; justify-content: space-between; align-items: center;
                        border-top: 1px solid var(--border); padding-top: var(--space-2); }
