/* ===================================================
   Google Ads Analytics — ga.mailmkt.com.br
   =================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===================================================
   PALETA OFICIAL — DESIGN 3 "FUTURISTA" (dark / glass / neon)
   Mantém TODOS os nomes de variáveis originais (só muda os valores),
   então toda a plataforma re-skinna sem quebrar nenhuma referência.
   Camada de componentes glass/neon em assets/css/futuristic.css.
   =================================================== */
:root {
    /* Tema é dark: faz os controles nativos (time/date pickers, ícones de
       relógio/calendário, dropdown do select, spinners, scrollbars) renderizarem
       em modo escuro. Sem isso, inputs nativos voltam ao branco do browser. */
    color-scheme: dark;
    --sidebar-w: 260px;
    /* Accent primário ciano + secundário magenta */
    --primary: #22D3EE;
    --primary-hover: #0891B2;
    --primary-light: rgba(34,211,238,.14);   /* antes era bg claro p/ estados ativos */
    --primary-ring: rgba(34,211,238,.28);
    --accent-2: #A855F7;                      /* magenta — novo, p/ gradientes */
    --grad-neon: linear-gradient(90deg,#22D3EE,#A855F7);
    --sidebar-bg: #0A0F1E;
    --sidebar-text: #8794B3;
    --sidebar-hover: rgba(34,211,238,.10);
    --sidebar-active-bg: rgba(34,211,238,.16);
    --sidebar-active-text: #22D3EE;
    --sidebar-active-border: #22D3EE;
    --bg: #070B16;
    --card-bg: #0F1626;                       /* base sólida do card (glass aplicado via .card) */
    --surface-2: rgba(255,255,255,.04);       /* painéis aninhados / linhas hover */
    --text: #E6EBF7;
    --text-muted: #8794B3;
    --border: #1E2A44;
    --border-neon: rgba(34,211,238,.22);
    --success: #34D399;
    --success-bg: rgba(16,185,129,.16);
    --danger: #F87171;
    --danger-bg: rgba(239,68,68,.16);
    --warning: #FBBF24;
    --warning-bg: rgba(245,158,11,.16);
    --info: #38BDF8;
    --info-bg: rgba(56,189,248,.16);
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 8px 30px rgba(2,6,18,.45);
    --shadow-md: 0 14px 44px rgba(2,6,18,.6);
    --glow: 0 0 22px rgba(34,211,238,.10);
    --t: .18s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── LAYOUT ─────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    position: fixed; top: 0; left: 0;
    height: 100vh;
    overflow-y: auto; overflow-x: hidden;
    z-index: 200;
    display: flex; flex-direction: column;
    transition: transform var(--t);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.08) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 2px; }

.sidebar-logo {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex; align-items: center; gap: 11px;
    flex-shrink: 0;
}
.sidebar-logo-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 20px; height: 20px; fill: white; }
.sidebar-logo-text { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -.3px; line-height: 1.2; }
.sidebar-logo-sub { font-size: 11px; color: var(--sidebar-text); }

.sidebar-nav { flex: 1; padding: 10px 0; }
.sidebar-section {
    padding: 10px 20px 4px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: rgba(148,163,184,.45);
}
.sidebar-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 20px;
    color: var(--sidebar-text);
    font-size: 13.5px; font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--t);
    cursor: pointer;
}
.sidebar-item:hover { background: var(--sidebar-hover); color: #CBD5E1; }
.sidebar-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left-color: var(--sidebar-active-border);
}
.sidebar-item svg {
    width: 17px; height: 17px; flex-shrink: 0;
    stroke: currentColor; fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,.06);
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;
}
.sidebar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.sidebar-footer-info { flex: 1; overflow: hidden; }
.sidebar-footer-name { color: #CBD5E1; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer-role { font-size: 11px; color: var(--sidebar-text); }
.sidebar-logout { color: var(--sidebar-text); transition: color var(--t); }
.sidebar-logout:hover { color: var(--danger); }
.sidebar-logout svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── MAIN ───────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 28px; height: 64px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 100; gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.page-title { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: var(--radius-sm); cursor: default; }
.topbar-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg,#6366F1,#8B5CF6); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 700; }
.topbar-name { font-size: 14px; font-weight: 600; }

.hamburger { display: none; background: none; border: none; padding: 6px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); }
.hamburger:hover { background: var(--bg); }
.hamburger svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.content { padding: 28px; flex: 1; }

/* ── OVERLAY ────────────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 190; }

/* ── METRICS GRID ───────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.metric-card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 20px; border: 1px solid rgba(226,232,240,.8);
    box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.metric-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.metric-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mi-blue   { background: var(--info-bg);    color: var(--info);    }
.mi-green  { background: var(--success-bg); color: var(--success); }
.mi-purple { background: var(--primary-light); color: var(--primary); }
.mi-orange { background: var(--warning-bg); color: var(--warning); }
.mi-red    { background: var(--danger-bg);  color: var(--danger);  }
.mi-teal   { background: #CCFBF1; color: #0D9488; }
.mi-pink   { background: #FCE7F3; color: #DB2777; }
.mi-indigo { background: #E0E7FF; color: #4338CA; }
.mi-slate  { background: #F1F5F9; color: #475569; }

.metric-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); }
.metric-value { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -1px; line-height: 1.1; }

/* ── PERIOD FILTER ──────────────────────────── */
.period-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.period-btn {
    padding: 7px 14px; border-radius: 20px;
    border: 1px solid var(--border); background: var(--card-bg);
    color: var(--text-muted); font-size: 12.5px; font-weight: 500;
    cursor: pointer; transition: all var(--t);
}
.period-btn:hover { border-color: var(--primary); color: var(--primary); }
.period-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.period-custom { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.period-custom input[type="date"] {
    padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 12.5px; color: var(--text); background: var(--card-bg);
    outline: none; transition: border-color var(--t);
}
.period-custom input[type="date"]:focus { border-color: var(--primary); }

/* ── CHARTS ─────────────────────────────────── */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 20px; border: 1px solid rgba(226,232,240,.8); box-shadow: var(--shadow);
}
.chart-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); margin-bottom: 14px; }
.chart-container { position: relative; height: 190px; }

/* ── CARDS ──────────────────────────────────── */
.card {
    background: var(--card-bg); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 24px;
    border: 1px solid rgba(226,232,240,.8);
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }

/* ── TABLE ──────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(226,232,240,.8); }
.table { width: 100%; border-collapse: collapse; background: var(--card-bg); font-size: 13px; }
.table th {
    background: #F8FAFC; padding: 11px 16px;
    text-align: left; font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .6px;
    color: var(--text-muted); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid #F1F5F9; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background:rgba(34,211,238,.10); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }
.table-empty { text-align: center; padding: 52px 16px; color: var(--text-muted); }
.table-empty-icon { font-size: 40px; margin-bottom: 10px; }
.table-empty p { font-size: 14px; }

/* ── BUTTONS ────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer;
    transition: all var(--t); white-space: nowrap; text-decoration: none;
}
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: 0 4px 12px rgba(99,102,241,.35); transform: translateY(-1px); }
.btn-secondary { background: var(--card-bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ── FORMS ──────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 10px 13px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; color: var(--text); background: var(--card-bg);
    outline: none; transition: border-color var(--t), box-shadow var(--t);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

/* ── UPLOAD AREA ────────────────────────────── */
.upload-area {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 44px 24px; text-align: center; background: #FAFBFC;
    cursor: pointer; transition: all var(--t); position: relative;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-icon {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--primary-light); display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
}
.upload-icon svg { width: 28px; height: 28px; stroke: var(--primary); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.upload-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.upload-sub { font-size: 13px; color: var(--text-muted); }
.upload-sub span { color: var(--primary); font-weight: 600; }
#fileNameDisplay { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--primary); display: none; }

/* ── ALERTS ─────────────────────────────────── */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
    display: flex; align-items: flex-start; gap: 10px;
    margin-bottom: 16px;
}
.alert svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-bg); color: #065F46; }
.alert-danger   { background: var(--danger-bg);  color: #991B1B; }
.alert-warning  { background: var(--warning-bg); color: #92400E; }
.alert-info     { background: var(--info-bg);    color: #1E40AF; }

/* ── BADGES ─────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ── SECTION HEADER ─────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-title { font-size: 15px; font-weight: 700; }

/* ── LOGIN PAGE ─────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 60%, #0F172A 100%);
    padding: 24px; position: relative; overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at 25% 25%, rgba(99,102,241,.18) 0%, transparent 50%),
                radial-gradient(circle at 75% 75%, rgba(139,92,246,.12) 0%, transparent 50%);
    pointer-events: none;
}
.login-card {
    background: rgba(255,255,255,.04);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 20px; padding: 44px 40px;
    width: 100%; max-width: 420px;
    position: relative; z-index: 1;
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; justify-content: center; }
.login-logo-icon { width: 50px; height: 50px; background: linear-gradient(135deg,#6366F1,#8B5CF6); border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.login-logo-icon svg { width: 26px; height: 26px; fill: #fff; }
.login-logo-text { color: #fff; font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.login-heading { text-align: center; color: #fff; font-size: 22px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 6px; }
.login-sub { text-align: center; color: rgba(148,163,184,.85); font-size: 14px; margin-bottom: 28px; }
.login-card .form-label { color: #CBD5E1; }
.login-card .form-control { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); color: #fff; }
.login-card .form-control::placeholder { color: rgba(148,163,184,.55); }
.login-card .form-control:focus { border-color: var(--primary); background: rgba(255,255,255,.1); }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 12px; font-size: 15px; border-radius: 10px; margin-top: 4px; }
.login-error { background: rgba(239,68,68,.14); border: 1px solid rgba(239,68,68,.3); border-radius: var(--radius-sm); color: #FCA5A5; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }

/* ── TABS ───────────────────────────────────── */
.tab-container { }
.tab-list { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
    background: none; border: none; padding: 10px 18px; font-size: 13px; font-weight: 600;
    color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── STATS GRID ─────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.stat-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .6px; color: var(--text-muted); margin-bottom: 6px;
}
.stat-value { font-size: 22px; font-weight: 700; }

/* ── UTILS ──────────────────────────────────── */
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-primary { color: var(--primary); }
.mt-8  { margin-top: 8px;  }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.flex-1 { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── ACCOUNT PILLS ──────────────────────────── */
.account-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.account-pill {
    padding: 6px 13px; border-radius: 20px;
    border: 1px solid var(--border); background: var(--card-bg);
    color: var(--text-muted); font-size: 12.5px; font-weight: 500;
    cursor: pointer; transition: all var(--t); white-space: nowrap; text-decoration: none;
    display: inline-flex; align-items: center; gap: 4px;
}
.account-pill:hover { border-color: var(--primary); color: var(--primary); }
.account-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── ACCOUNT CARDS ───────────────────────────── */
.accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 8px; }
.account-card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 22px; border: 1px solid rgba(226,232,240,.8);
    box-shadow: var(--shadow); display: flex; flex-direction: column;
    gap: 14px; transition: box-shadow var(--t), transform var(--t);
    cursor: pointer;
}
.account-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.account-card-header { display: flex; align-items: flex-start; gap: 12px; }
.account-card-icon {
    width: 42px; height: 42px; border-radius: 10px;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px; font-weight: 800; flex-shrink: 0;
}
.account-card-name { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.3; }
.account-card-metrics { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 8px; }
.account-metric-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 2px; }
.account-metric-value { font-size: 15px; font-weight: 700; color: var(--text); }
.account-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 4px; border-top: 1px solid var(--border); }

/* ── RESPONSIVE ─────────────────────────────── */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block !important; }
    .main-content { margin-left: 0; }
    .hamburger { display: flex; }
    .content { padding: 16px; }
    .metrics-grid { grid-template-columns: 1fr 1fr; }
    .topbar { padding: 0 16px; }
    .topbar-name { display: none; }
    .filter-sticky { margin-left: -16px !important; margin-right: -16px !important; padding-left: 16px !important; padding-right: 16px !important; }
}
@media (max-width: 480px) {
    .metrics-grid { grid-template-columns: 1fr; }
    .login-card { padding: 28px 20px; }
}

/* ── OTIMIZAÇÃO ─────────────────────────────── */
.otim-filter-bar {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.otim-filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 16px;
    align-items: end;
}
@media(max-width:900px){ .otim-filter-grid { grid-template-columns: 1fr 1fr; } }
@media(max-width:560px){ .otim-filter-grid { grid-template-columns: 1fr; } }

.otim-empty {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}
.otim-empty-icon { font-size: 48px; margin-bottom: 16px; }
.otim-empty h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; }

.otim-loading {
    text-align: center; padding: 64px 24px;
}
.otim-spinner {
    width: 44px; height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Score badge */
.score-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 84px; height: 84px;
    border-radius: 50%;
    border: 4px solid currentColor;
    flex-shrink: 0;
}
.score-badge .score-num  { font-size: 22px; font-weight: 900; line-height: 1; }
.score-badge .score-lbl  { font-size: 9px;  font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.score-excellent { color: var(--success); }
.score-good      { color: #0EA5E9; }
.score-warning   { color: var(--warning); }
.score-critical  { color: var(--danger); }

/* Summary banner */
.otim-banner {
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left-width: 5px;
    border-left-color: #94A3B8;
    box-shadow: var(--shadow);
}
.otim-banner.status-good    { border-left-color: var(--success); }
.otim-banner.status-warning { border-left-color: var(--warning); }
.otim-banner.status-bad     { border-left-color: var(--danger);  }
.otim-banner.status-no_av   { border-left-color: #94A3B8; }
.otim-banner.status-no_data { border-left-color: #94A3B8; }

/* Diagnostic cards */
.diag-list { display: flex; flex-direction: column; gap: 10px; }
.diag-card {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 16px; border-radius: var(--radius-sm);
    border: 1px solid transparent;
}
.diag-card.sev-critical { background: #FEF2F2; border-color: #FECACA; }
.diag-card.sev-warning  { background: #FFFBEB; border-color: #FDE68A; }
.diag-card.sev-info     { background: #EFF6FF; border-color: #BFDBFE; }
.diag-card.sev-success  { background: #F0FDF4; border-color: #BBF7D0; }
.diag-icon {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0; font-weight: 700;
}
.sev-critical .diag-icon { background: #FEE2E2; color: var(--danger); }
.sev-warning  .diag-icon { background: #FEF3C7; color: var(--warning); }
.sev-info     .diag-icon { background: #DBEAFE; color: var(--info); }
.sev-success  .diag-icon { background: #D1FAE5; color: var(--success); }
.diag-title   { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.diag-msg     { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.diag-meta    { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Recommendation cards */
.rec-list { display: flex; flex-direction: column; gap: 10px; }
.rec-card {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 16px; border-radius: var(--radius-sm);
    background: var(--card-bg); border: 1px solid var(--border);
}
.rec-priority {
    font-size: 10px; font-weight: 800; text-transform: uppercase;
    letter-spacing: .6px; padding: 2px 7px; border-radius: 20px; flex-shrink: 0; white-space: nowrap;
}
.prio-high   { background: #FEE2E2; color: var(--danger); }
.prio-medium { background: #FEF3C7; color: #92400E; }
.prio-low    { background: #EFF6FF; color: #1D4ED8; }
.rec-title   { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.rec-msg     { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.rec-reason  { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-style: italic; }

/* Summary metrics grid */
.otim-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.otim-metric {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px 16px;
}
.otim-metric .lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 4px; }
.otim-metric .val { font-size: 18px; font-weight: 800; line-height: 1.1; }
.otim-metric .prev { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.otim-metric .delta { font-size: 11px; font-weight: 600; }
.delta-up   { color: var(--success); }
.delta-down { color: var(--danger); }
.delta-neutral { color: var(--text-muted); }

/* Section accordion */
.otim-section {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 16px;
    box-shadow: var(--shadow); overflow: hidden;
}
.otim-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; cursor: pointer; user-select: none;
    gap: 12px;
}
.otim-section-header:hover { background: var(--bg); }
.otim-section-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.otim-section-body {
    display: none;
    padding: 16px 20px 20px;
    border-top: 1px solid var(--border);
}
.otim-section.open .otim-section-body { display: block; }
.otim-chevron { width: 16px; height: 16px; stroke: var(--text-muted); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; flex-shrink: 0; }
.otim-section.open .otim-chevron { transform: rotate(180deg); }

/* Comparison table */
.cmp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cmp-table th { padding: 8px 12px; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--bg); }
.cmp-table td { padding: 10px 12px; border-bottom: 1px solid #F1F5F9; }
.cmp-table tr:last-child td { border-bottom: none; }
.cmp-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cmp-table th.num { text-align: right; }
