/* ===========================================================
   AlôIA — dashboard estilo "Pinski": rail azul de ícones,
   fundo claro, KPIs, painéis com barras, tabela e callout.
   =========================================================== */
:root {
    --bg:#f4f5fb; --panel:#ffffff; --panel2:#f6f7fc; --line:#eceef5;
    --txt:#1e2340; --ink:#141a3a; --muted:#8a90a6; --slate:#525a73;
    --brand:#6d5cf5; --brand2:#8b6cff; --brand-d:#5a47e0; --brand-soft:#efecfe;
    --sidebar:#14182b; --sidebar2:#1b2039;
    --rail1:#6d5cf5; --rail2:#5a47e0;
    --amber:#f59e0b; --gray-bar:#cbd5e1;
    --green:#1fb573; --red:#ef4444; --teal:#14b8a6; --pink:#ec4899; --blue:#3b82f6;
    --radius:18px; --shadow:0 1px 3px rgba(20,26,58,.05); --shadow-lg:0 12px 32px rgba(20,26,58,.10);
}
* { box-sizing:border-box; }
html, body { height:100%; }
body {
    margin:0; background:var(--bg); color:var(--txt);
    font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
    -webkit-font-smoothing:antialiased;
}
a { color:var(--brand); text-decoration:none; }
a:hover { text-decoration:underline; }
h1 { font-size:26px; font-weight:800; letter-spacing:-.6px; color:var(--ink); }
h3 { letter-spacing:-.2px; color:var(--ink); }

/* ---------- Rail (barra lateral de ícones) ---------- */
.layout { min-height:100vh; }
.rail {
    position:fixed; top:0; left:0; bottom:0; width:74px; z-index:50;
    background:linear-gradient(180deg,var(--rail1),var(--rail2));
    display:flex; flex-direction:column; align-items:center; gap:6px; padding:16px 0;
}
.rail-toggle {
    width:44px; height:40px; border:none; background:transparent; color:rgba(255,255,255,.8);
    border-radius:11px; cursor:pointer; display:grid; place-items:center; margin-bottom:2px;
}
.rail-toggle:hover { background:rgba(255,255,255,.14); color:#fff; }
.rail-toggle svg { width:20px; height:20px; stroke:currentColor; fill:none; stroke-width:2; }

.rail-logo { display:flex; align-items:center; gap:11px; margin-bottom:14px; background:transparent; border:none; padding:0; cursor:pointer; font:inherit; }
.rail-logo:hover { text-decoration:none; }
.rail-logo-ic { width:42px; height:42px; border-radius:12px; background:#fff; display:grid; place-items:center; color:var(--brand); font-weight:800; font-size:18px; flex-shrink:0; }
.rail-logo-name { font-size:16px; font-weight:800; color:#fff; }
.rail-logo-name b { opacity:.82; }

.rail-nav { display:flex; flex-direction:column; gap:4px; width:100%; align-items:center; }
.rail-item {
    width:44px; height:44px; border-radius:13px; display:flex; align-items:center; justify-content:center;
    color:rgba(255,255,255,.72); transition:background .14s,color .14s;
}
.rail-item:hover { background:rgba(255,255,255,.14); color:#fff; text-decoration:none; }
.rail-item.on { background:#fff; color:var(--brand); }
.rail-item svg { width:21px; height:21px; stroke:currentColor; fill:none; stroke-width:1.9; flex-shrink:0; }
.rail-label { display:none; white-space:nowrap; font-size:14px; font-weight:600; }
.rail-spacer { flex:1; }

.main { margin-left:74px; padding:26px 34px 48px; transition:margin-left .18s ease; }

/* Estado expandido (desktop): mostra ícone + texto */
@media (min-width:861px) {
    html[data-rail="expanded"] .rail { width:218px; align-items:stretch; padding:16px 12px; }
    html[data-rail="expanded"] .rail-toggle { align-self:flex-start; }
    html[data-rail="expanded"] .rail-logo { padding:0 6px; }
    html[data-rail="expanded"] .rail-nav { align-items:stretch; }
    html[data-rail="expanded"] .rail-item { width:100%; justify-content:flex-start; gap:13px; padding:0 13px; }
    html[data-rail="expanded"] .rail-label { display:inline; }
    html[data-rail="expanded"] .main { margin-left:218px; }
}
.container { max-width:1280px; margin:0 auto; }

/* ---------- Cabeçalho da página ---------- */
.pagehead { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; flex-wrap:wrap; margin-bottom:22px; padding-right:60px; }
.eyebrow { font-size:11.5px; font-weight:700; letter-spacing:.8px; color:var(--brand); text-transform:uppercase; }
.pagehead h1 { margin:4px 0 6px; }
.subtitle { color:var(--muted); font-size:13.5px; margin:0; }
.subtitle b { color:var(--slate); }

.filters { display:flex; gap:8px; flex-wrap:wrap; }
.chip {
    padding:8px 14px; border-radius:10px; font-size:13px; font-weight:600;
    background:var(--panel); border:1px solid var(--line); color:var(--slate);
}
.chip.on { background:var(--brand-soft); color:var(--brand-d); border-color:transparent; }

/* ---------- KPIs ---------- */
.kpis { display:grid; gap:14px; grid-template-columns:repeat(6,1fr); margin-bottom:18px; }
.kpi { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:16px 18px; box-shadow:var(--shadow); }
.kpi .klabel { font-size:11px; font-weight:700; letter-spacing:.5px; text-transform:uppercase; color:var(--muted); display:flex; align-items:center; justify-content:space-between; }
.kpi .kval { font-size:27px; font-weight:800; letter-spacing:-.8px; color:var(--ink); margin:8px 0 4px; }
.kpi .ksub { font-size:12px; color:var(--muted); }
.kpi.hi { background:linear-gradient(135deg,var(--brand),var(--brand2)); border-color:transparent; color:#fff; box-shadow:var(--shadow-lg); }
.kpi.hi .klabel { color:rgba(255,255,255,.82); }
.kpi.hi .kval { color:#fff; }
.kpi.hi .ksub { color:rgba(255,255,255,.85); }
.up { color:var(--green); font-weight:700; } .down { color:var(--red); font-weight:700; }

/* ---------- Painéis ---------- */
.panels { display:grid; gap:16px; grid-template-columns:2fr 1fr; margin-bottom:16px; }
.panel { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:20px 22px; box-shadow:var(--shadow); }
.panel h3 { margin:0 0 3px; font-size:16px; font-weight:700; }
.panel .psub { color:var(--muted); font-size:12.5px; margin:0 0 16px; }

.legend { display:flex; gap:16px; margin-bottom:14px; font-size:12px; color:var(--muted); }
.legend span { display:inline-flex; align-items:center; gap:6px; }
.legend i { width:10px; height:10px; border-radius:3px; display:inline-block; }

/* Barras horizontais */
.hbars { display:flex; flex-direction:column; gap:12px; }
.hbar { display:grid; grid-template-columns:96px 1fr 46px; align-items:center; gap:12px; }
.hbar .hlabel { font-size:13px; color:var(--slate); text-align:right; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hbar .htrack { background:var(--panel2); border-radius:7px; height:16px; overflow:hidden; }
.hbar .hfill { height:100%; border-radius:7px; background:var(--brand); }
.hbar .hfill.amber { background:var(--amber); } .hbar .hfill.gray { background:var(--gray-bar); }
.hbar .hval { font-size:14px; font-weight:700; color:var(--ink); text-align:right; }

/* ---------- Callout ---------- */
.callout {
    display:flex; gap:16px; align-items:center; background:var(--brand-soft);
    border-left:4px solid var(--brand); border-radius:12px; padding:16px 20px; margin-bottom:16px;
}
.callout .ctag { font-size:11px; font-weight:800; letter-spacing:.6px; text-transform:uppercase; color:var(--brand-d); white-space:nowrap; }
.callout .ctext { font-size:14px; color:var(--slate); }

.foot-note { font-size:12px; color:var(--muted); margin-top:4px; }

/* ---------- Cards / grid genéricos ---------- */
.card { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:22px; box-shadow:var(--shadow); }
.card + .card, .mt { margin-top:16px; }
.grid { display:grid; gap:16px; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); }
.grid .card h3 { margin:0 0 4px; font-size:26px; }
.grid .card p { margin:0; color:var(--muted); font-size:14px; }
.dash-head { display:flex; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; gap:12px; margin-bottom:22px; padding-right:60px; }

/* ---------- Formulários ---------- */
label { display:block; font-size:13px; font-weight:600; color:var(--slate); margin:16px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], textarea, select {
    width:100%; padding:11px 13px; font-size:15px; font-family:inherit;
    background:#fff; border:1px solid var(--line); border-radius:10px; color:var(--txt);
}
textarea { resize:vertical; }
input:focus, textarea:focus, select:focus { outline:2px solid var(--brand); border-color:transparent; }
select { cursor:pointer; }
.row { display:grid; gap:12px; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); }
.btn {
    display:inline-flex; align-items:center; justify-content:center; gap:7px;
    padding:11px 22px; border:none; border-radius:10px; cursor:pointer;
    background:linear-gradient(135deg,var(--brand),var(--brand2)); color:#fff; font-size:14px; font-weight:600;
}
.btn:hover { opacity:.92; text-decoration:none; }

/* ---------- Badges / alerts / código ---------- */
.badge { display:inline-block; padding:3px 10px; border-radius:999px; background:var(--panel2); border:1px solid var(--line); font-size:12.5px; font-weight:600; color:var(--slate); }
.alert { margin-top:12px; padding:12px 14px; border-radius:10px; font-size:14px; background:#fef2f2; border:1px solid #fecaca; color:#b91c1c; }
.alert.ok { background:#f0fdf4; border-color:#bbf7d0; color:#15803d; }
code { background:var(--panel2); border:1px solid var(--line); padding:2px 6px; border-radius:6px; font-size:13px; color:var(--brand-d); }

/* ---------- Tabelas ---------- */
.tbl { width:100%; border-collapse:collapse; font-size:14px; }
.tbl th, .tbl td { text-align:left; padding:12px 14px; border-bottom:1px solid var(--line); }
.tbl th { color:var(--muted); font-weight:700; font-size:11px; text-transform:uppercase; letter-spacing:.4px; }
.tbl tr:last-child td { border-bottom:0; }
.tbl tr:target td { background:var(--brand-soft); animation:targetFade 2.5s ease; }
@keyframes targetFade { 0%{background:#c7d2fe;} 100%{background:var(--brand-soft);} }
.bell-item.has-link .bell-title::after { content:' ›'; color:var(--brand); }
.tbl td select { padding:6px 8px; width:auto; }
.tbl-click tbody tr { cursor:pointer; transition:background .12s; }
.tbl-click tbody tr:hover td { background:var(--panel2); }

.pill { display:inline-block; padding:3px 11px; border-radius:999px; font-size:12.5px; font-weight:700; text-transform:capitalize; }

.kv { width:100%; border-collapse:collapse; font-size:14px; }
.kv td { padding:9px 0; border-bottom:1px solid var(--line); vertical-align:top; }
.kv td:first-child { color:var(--muted); width:42%; }
.kv tr:last-child td { border-bottom:none; }

.status-actions { display:flex; gap:8px; flex-wrap:wrap; }
.btn-status { padding:9px 16px; border:1.5px solid; background:#fff; border-radius:10px; cursor:pointer; font-weight:600; font-size:14px; }
.btn-status:hover { filter:brightness(.97); }

/* ---------- Serviços / horário (Negócio) ---------- */
.svc-head { display:grid; grid-template-columns:1fr 130px 110px 40px; gap:10px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.4px; color:var(--muted); margin-bottom:6px; }
.svc-row { display:grid; grid-template-columns:1fr 130px 110px 40px; gap:10px; margin-bottom:8px; }
.svc-row input { margin:0; }
.svc-row .rm { width:40px; height:42px; border:1px solid var(--line); background:#fff; color:var(--muted); border-radius:10px; cursor:pointer; }
.svc-row .rm:hover { border-color:var(--red); color:var(--red); background:#fef2f2; }
.hour-row { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.hour-day { display:flex; align-items:center; gap:8px; width:150px; margin:0; font-weight:600; color:var(--txt); }
.hour-day input { width:auto; }
.hour-row input[type=time] { width:auto; margin:0; }
@media (max-width:640px) { .svc-head { display:none; } .svc-row { grid-template-columns:1fr 1fr; } .svc-row .rm { grid-column:2; justify-self:end; } }

/* ---------- Abas de idioma ---------- */
.tabs { display:flex; gap:6px; margin-bottom:18px; flex-wrap:wrap; }
.tab { display:inline-flex; align-items:center; gap:7px; padding:9px 16px; border-radius:10px; font-size:14px; font-weight:600; color:var(--slate); background:var(--panel); border:1px solid var(--line); }
.tab:hover { text-decoration:none; border-color:var(--brand); }
.tab.on { background:var(--brand-soft); color:var(--brand-d); border-color:transparent; }
.tab .dot { width:7px; height:7px; border-radius:50%; background:var(--green); display:inline-block; }
.tab .pub { color:var(--brand); font-size:9px; }
.toggle { display:flex; align-items:center; gap:8px; font-weight:600; color:var(--txt); margin:4px 0 6px; cursor:pointer; }
.toggle input { width:auto; }

/* ---------- Campos dinâmicos (Negócio) ---------- */
.field-row { display:grid; grid-template-columns:230px 1fr 40px; gap:10px; align-items:start; margin-bottom:10px; }
.field-row input, .field-row textarea { margin:0; }
.field-row .rm { width:40px; height:42px; border:1px solid var(--line); background:#fff; color:var(--muted); border-radius:10px; cursor:pointer; font-size:15px; }
.field-row .rm:hover { border-color:var(--red); color:var(--red); background:#fef2f2; }
.btn-add { margin-top:6px; padding:10px 16px; border:1px dashed var(--brand); background:var(--brand-soft); color:var(--brand-d); border-radius:10px; cursor:pointer; font-size:14px; font-weight:600; }
.btn-add:hover { background:#dbe3fb; }

/* ---------- Sino de notificações ---------- */
.bell-wrap { position:fixed; top:16px; right:22px; z-index:60; }
.bell-btn { position:relative; width:42px; height:42px; border-radius:12px; border:1px solid var(--line); background:#fff; color:var(--slate); cursor:pointer; display:grid; place-items:center; box-shadow:var(--shadow); }
.bell-btn:hover { color:var(--brand-d); border-color:var(--brand); }
.bell-badge { position:absolute; top:-6px; right:-6px; min-width:18px; height:18px; padding:0 4px; border-radius:999px; background:var(--red); color:#fff; font-size:11px; font-weight:700; display:grid; place-items:center; }
.bell-panel { position:absolute; top:52px; right:0; width:340px; max-width:88vw; background:#fff; border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow-lg); overflow:hidden; }
.bell-head { display:flex; align-items:center; justify-content:space-between; padding:13px 16px; border-bottom:1px solid var(--line); }
.bell-markall { border:none; background:none; color:var(--brand-d); font-size:12px; font-weight:600; cursor:pointer; }
.bell-markall:hover { text-decoration:underline; }
.bell-list { max-height:380px; overflow-y:auto; }
.bell-item { padding:12px 16px; border-bottom:1px solid var(--line); cursor:pointer; }
.bell-item:last-child { border-bottom:none; }
.bell-item:hover { background:var(--panel2); }
.bell-item.unread { background:var(--brand-soft); }
.bell-item.unread:hover { background:#dbe3fb; }
.bell-title { font-size:14px; font-weight:600; color:var(--ink); }
.bell-body { font-size:13px; color:var(--muted); margin-top:2px; }
.bell-time { font-size:11px; color:var(--muted); margin-top:4px; }
.bell-empty { padding:24px 16px; text-align:center; color:var(--muted); font-size:14px; }
@media (max-width:860px) { .bell-wrap { top:9px; right:12px; } .bell-btn { width:38px; height:38px; } }

/* ---------- Chamadas ao vivo ---------- */
.live-wrap { background:#fff; border:1px solid var(--line); border-left:4px solid var(--green); border-radius:12px; padding:14px 18px; margin-bottom:18px; box-shadow:var(--shadow); }
.live-head { display:flex; align-items:center; gap:9px; font-weight:700; color:var(--ink); margin-bottom:10px; }
.live-dot { width:10px; height:10px; border-radius:50%; background:var(--green); box-shadow:0 0 0 0 rgba(22,163,74,.6); animation:livePulse 1.4s infinite; }
@keyframes livePulse { 0%{box-shadow:0 0 0 0 rgba(22,163,74,.5);} 70%{box-shadow:0 0 0 8px rgba(22,163,74,0);} 100%{box-shadow:0 0 0 0 rgba(22,163,74,0);} }
.live-card { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; padding:10px 0; border-top:1px solid var(--line); }
.live-info { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.live-time { font-variant-numeric:tabular-nums; font-weight:700; color:var(--brand-d); background:var(--brand-soft); padding:2px 9px; border-radius:999px; font-size:13px; }
.live-actions { display:flex; align-items:center; gap:8px; }
.live-actions .btn { padding:8px 16px; }
.live-end { padding:8px 14px; border:1px solid var(--line); background:#fff; color:var(--red); border-radius:10px; cursor:pointer; font-weight:600; font-size:14px; }
.live-end:hover { background:#fef2f2; border-color:var(--red); }

/* ---------- Agenda do dia ---------- */
.agenda-list { display:flex; flex-direction:column; }
.agenda-item { display:flex; align-items:center; gap:14px; padding:12px 6px; border-bottom:1px solid var(--line); text-decoration:none; color:var(--txt); }
.agenda-item:last-child { border-bottom:none; }
.agenda-item:hover { background:var(--panel2); text-decoration:none; }
.agenda-item.blocked { background:repeating-linear-gradient(45deg,#f8fafc,#f8fafc 8px,#f1f4f9 8px,#f1f4f9 16px); border-radius:8px; }
.agenda-time { font-weight:700; color:var(--brand-d); min-width:84px; font-variant-numeric:tabular-nums; }
.agenda-main { flex:1; font-size:14px; }
.linkbtn { border:none; background:none; color:var(--red); cursor:pointer; font-size:13px; }
.linkbtn:hover { text-decoration:underline; }

/* ---------- Calendário ---------- */
.cal-nav { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; gap:12px; }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.cal-dow { text-align:center; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.4px; color:var(--muted); padding-bottom:4px; }
.cal-cell { min-height:92px; background:var(--panel2); border:1px solid var(--line); border-radius:10px; padding:6px; overflow:hidden; }
.cal-cell.empty { background:transparent; border:none; }
.cal-cell.today { border-color:var(--brand); box-shadow:inset 0 0 0 1px var(--brand); }
.cal-day { font-size:12px; font-weight:700; color:var(--slate); margin-bottom:4px; }
.cal-cell.today .cal-day { color:var(--brand); }
.cal-ev {
    display:block; font-size:11.5px; color:var(--txt); background:#fff; border-left:3px solid var(--brand);
    border-radius:5px; padding:3px 6px; margin-bottom:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    text-decoration:none;
}
.cal-ev:hover { background:var(--brand-soft); text-decoration:none; }
.cal-ev b { color:var(--ink); }
@media (max-width:860px) {
    .cal-cell { min-height:64px; }
    .cal-ev { font-size:10px; }
}

/* ---------- Utilidades ---------- */
.muted { color:var(--muted); }
.center { text-align:center; }
pre { white-space:pre-wrap; margin:0; font-family:inherit; }

/* ---------- Auth / landing ---------- */
.topbar { display:flex; align-items:center; justify-content:space-between; max-width:1040px; margin:0 auto; padding:18px 16px; }
.brand { font-weight:800; font-size:20px; letter-spacing:-.3px; color:var(--ink); }
.brand span { color:var(--brand); }
.auth-wrap { max-width:420px; margin:7vh auto; padding:0 16px; }
.auth-wrap .card { box-shadow:var(--shadow-lg); }
.hero { text-align:center; padding:9vh 16px 5vh; max-width:720px; margin:0 auto; }
.hero h1 { font-size:42px; margin:0 0 14px; }
.hero p { color:var(--muted); font-size:18px; margin:0 auto 26px; max-width:560px; }

/* ---------- Responsivo: rail vira topo ---------- */
@media (max-width:860px) {
    .kpis { grid-template-columns:repeat(2,1fr); }
    .panels { grid-template-columns:1fr; }
    /* Menu inferior fixo (estilo app) */
    .rail {
        position:fixed; top:auto; bottom:0; left:0; right:0; width:100%; height:auto;
        flex-direction:row; align-items:center; gap:2px;
        padding:6px 6px; border-right:none; border-top:1px solid rgba(255,255,255,.14);
        overflow-x:auto; z-index:50;
    }
    .rail-logo, .rail-toggle, .rail-spacer { display:none; }
    .rail-nav { flex:1 1 auto; flex-direction:row; width:auto; justify-content:space-around; gap:2px; }
    .rail-item { flex:0 0 auto; width:42px; height:42px; }
    .rail-label { display:none; }
    .main { margin-left:0; padding:18px 16px 88px; }
    .pagehead, .dash-head { padding-right:46px; }
    .field-row { grid-template-columns:1fr 40px; }
    .field-row textarea { grid-column:1 / -1; }
}
