:root {
    --bg-deep: #03152f;
    --bg-deeper: #020b1b;
    --panel: rgba(6, 28, 61, .76);
    --panel-strong: rgba(7, 33, 70, .92);
    --panel-soft: rgba(12, 46, 91, .55);
    --line: rgba(107, 190, 255, .18);
    --line-strong: rgba(84, 197, 255, .34);
    --text: #f6fbff;
    --muted: #9eb6ce;
    --cyan: #08c6f4;
    --cyan-2: #52e1ff;
    --blue: #1878e8;
    --blue-2: #2d9dff;
    --navy: #0750a8;
    --green: #43e6a6;
    --yellow: #ffd166;
    --red: #ff6d86;
    --purple: #9b8cff;
    --shadow: 0 26px 70px rgba(0, 8, 26, .35);
    --radius: 24px;
    --radius-sm: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-deeper);
    overflow-x: hidden;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app-bg {
    position: fixed;
    inset: 0;
    z-index: -3;
    background: url('../img/background_buszone.png') center / cover no-repeat;
    transform: scale(1.02);
}
.app-overlay {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(circle at 22% 15%, rgba(0, 181, 255, .17), transparent 29%),
        radial-gradient(circle at 78% 54%, rgba(0, 115, 255, .14), transparent 31%),
        linear-gradient(180deg, rgba(1, 13, 35, .72), rgba(2, 12, 28, .94) 58%, rgba(1, 7, 18, .98));
    backdrop-filter: blur(2px);
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: .22;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(70, 176, 255, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(70, 176, 255, .05) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 75%, transparent);
}

.topbar {
    width: min(1480px, calc(100% - 48px));
    margin: 0 auto;
    padding: 22px 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.brand-wrap { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand-logo-shell {
    width: 118px;
    height: 74px;
    border-radius: 18px;
    padding: 8px 10px;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(255,255,255,.7);
    box-shadow: 0 12px 30px rgba(0, 89, 180, .23);
    overflow: hidden;
    flex: 0 0 auto;
}
.brand-logo { width: 100%; height: 100%; object-fit: contain; }
.brand-copy h1 { margin: 1px 0 2px; font-size: clamp(1.2rem, 2.1vw, 1.8rem); letter-spacing: -.03em; }
.brand-copy h1 strong { color: var(--cyan-2); font-weight: 750; }
.brand-copy p { margin: 0; color: var(--muted); font-size: .92rem; }
.eyebrow, .section-step, .chart-kicker, .hero-kicker {
    letter-spacing: .16em;
    font-size: .69rem;
    font-weight: 800;
    color: var(--cyan-2);
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.live-pill {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 10px 14px; border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(5, 29, 63, .67);
    color: #d9efff; font-size: .83rem;
    backdrop-filter: blur(16px);
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(67,230,166,.1), 0 0 18px rgba(67,230,166,.7); }
.icon-btn {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
    background: rgba(5, 29, 63, .67); color: var(--text); font-weight: 800;
}
.icon-btn:hover { border-color: var(--cyan); box-shadow: 0 0 24px rgba(0, 198, 244, .15); }

.main-shell { width: min(1480px, calc(100% - 48px)); margin: 16px auto 76px; }
.glass-card {
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(8, 35, 73, .8), rgba(2, 18, 43, .78));
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.025);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
}

.hero {
    min-height: 310px;
    padding: 42px 46px;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(290px, .75fr);
    gap: 30px;
    overflow: hidden;
    position: relative;
}
.hero::before {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(circle at 86% 55%, rgba(12, 171, 255, .15), transparent 34%);
    pointer-events: none;
}
.hero-content { position: relative; z-index: 2; align-self: center; }
.hero h2 { max-width: 830px; font-size: clamp(2rem, 4vw, 3.65rem); line-height: 1.02; letter-spacing: -.055em; margin: 13px 0 18px; }
.hero p { max-width: 800px; color: #b7cce0; font-size: 1.04rem; line-height: 1.72; margin: 0; }
.hero-features { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero-features span { padding: 8px 12px; border-radius: 999px; background: rgba(12, 102, 176, .17); border: 1px solid rgba(72, 190, 255, .16); color: #d7efff; font-size: .8rem; }
.hero-orbit { position: relative; min-height: 230px; align-self: stretch; }
.orbit { position: absolute; border: 1px solid rgba(73, 206, 255, .23); border-radius: 50%; transform: rotate(-17deg); }
.orbit-a { width: 320px; height: 140px; right: 0; top: 48px; animation: orbitPulse 5s ease-in-out infinite; }
.orbit-b { width: 260px; height: 106px; right: 28px; top: 64px; animation: orbitPulse 5s ease-in-out infinite reverse; }
.metric-bubble {
    position: absolute; width: 92px; height: 92px; border-radius: 50%;
    display: grid; place-items: center; align-content: center;
    background: radial-gradient(circle at 35% 25%, rgba(57, 217, 255, .35), rgba(5, 46, 100, .84) 48%, rgba(2, 17, 40, .95));
    border: 1px solid rgba(83, 216, 255, .34);
    box-shadow: 0 16px 44px rgba(0, 119, 255, .24), inset 0 0 28px rgba(20, 190, 255, .08);
    animation: float 4.6s ease-in-out infinite;
}
.metric-bubble strong { font-size: 1.3rem; color: #e9fbff; }
.metric-bubble span { color: var(--muted); font-size: .7rem; }
.metric-bubble.b1 { right: 195px; top: 21px; }
.metric-bubble.b2 { right: 50px; top: 111px; animation-delay: -1.4s; }
.metric-bubble.b3 { right: 232px; top: 149px; width: 76px; height: 76px; animation-delay: -2.3s; }
@keyframes float { 50% { transform: translateY(-10px); } }
@keyframes orbitPulse { 50% { opacity: .4; transform: rotate(-17deg) scale(1.04); } }

.workflow-grid { display: grid; grid-template-columns: .88fr 1.42fr; gap: 20px; margin-top: 20px; align-items: start; }
.upload-card, .compare-card { padding: 28px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.section-heading h3, .chart-head h3, .table-heading h3, .standard-card h3 { margin: 5px 0 5px; font-size: 1.35rem; letter-spacing: -.025em; }
.section-heading p, .table-heading p, .standard-card p { margin: 0; color: var(--muted); font-size: .88rem; }
.section-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; font-size: 1.4rem; color: var(--cyan-2); background: rgba(18, 124, 205, .12); border: 1px solid rgba(62, 185, 255, .17); }

.dropzone {
    min-height: 265px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 8px;
    border: 1.5px dashed rgba(80, 198, 255, .32);
    border-radius: 20px;
    background: radial-gradient(circle at center, rgba(0, 173, 255, .08), rgba(4, 27, 60, .2));
    padding: 28px;
    transition: .25s ease;
    outline: none;
}
.dropzone:hover, .dropzone.dragover, .dropzone:focus-visible { border-color: var(--cyan); background: rgba(5, 92, 153, .14); transform: translateY(-2px); box-shadow: inset 0 0 45px rgba(0, 183, 255, .07); }
.drop-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: linear-gradient(145deg, rgba(22, 173, 255, .2), rgba(18, 101, 220, .17)); border: 1px solid rgba(86, 210, 255, .2); color: var(--cyan-2); font-size: 1.75rem; margin-bottom: 4px; }
.dropzone h4 { margin: 0; font-size: 1.03rem; }
.dropzone p { margin: 0; color: var(--muted); font-size: .84rem; }
.dropzone small { color: #7895b4; font-size: .72rem; margin-top: 6px; }

.btn { border: 0; border-radius: 13px; color: var(--text); padding: 11px 15px; transition: .2s ease; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--blue-2), #0ab9dc); box-shadow: 0 10px 30px rgba(0, 146, 255, .22); font-weight: 750; }
.btn-primary:hover { box-shadow: 0 14px 38px rgba(0, 165, 255, .28); }
.btn-ghost { background: rgba(14, 58, 105, .28); border: 1px solid rgba(93, 178, 239, .18); color: #dcefff; }
.btn-ghost:hover { border-color: rgba(79, 211, 255, .5); background: rgba(14, 82, 138, .34); }
.btn-sm { padding: 8px 11px; font-size: .78rem; border-radius: 10px; }

.file-summary { margin-top: 14px; display: flex; align-items: center; gap: 12px; border-radius: 15px; padding: 13px; background: rgba(9, 46, 89, .55); border: 1px solid var(--line); }
.file-icon { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 12px; background: rgba(67, 230, 166, .12); color: var(--green); font-size: .72rem; font-weight: 900; border: 1px solid rgba(67, 230, 166, .17); }
.file-info { min-width: 0; flex: 1; }
.file-info strong, .file-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info strong { font-size: .88rem; }
.file-info span { color: var(--muted); font-size: .72rem; margin-top: 3px; }
.column-check { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.column-check-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .78rem; }
.column-check-head strong { color: var(--green); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: .68rem; padding: 6px 8px; border-radius: 999px; border: 1px solid var(--line); color: #b8cee2; background: rgba(5, 31, 66, .48); }
.chip.ok { border-color: rgba(67, 230, 166, .2); color: #aef2d4; background: rgba(67, 230, 166, .06); }
.chip.missing { border-color: rgba(255, 109, 134, .18); color: #ffb9c4; background: rgba(255, 109, 134, .06); }
.data-range { margin-top: 10px; color: #83a6c5; font-size: .72rem; line-height: 1.5; }

.disabled-card { opacity: .55; pointer-events: none; filter: saturate(.65); }
.common-options { display: grid; grid-template-columns: minmax(200px, .9fr) minmax(270px, 1.1fr); gap: 14px; margin-bottom: 14px; }
.field-group { display: grid; gap: 7px; color: #c9dbea; font-size: .78rem; }
.field-group > span { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.field-group em { color: #6f8dab; font-style: normal; font-size: .66rem; font-weight: 500; }
.field-group small { color: #7290ad; font-size: .66rem; }
input, select {
    width: 100%; min-height: 43px;
    color: var(--text);
    background: rgba(2, 20, 46, .72);
    border: 1px solid rgba(93, 168, 230, .2);
    border-radius: 11px;
    padding: 9px 11px;
    outline: none;
    transition: .2s ease;
}
input:focus, select:focus { border-color: rgba(48, 204, 255, .65); box-shadow: 0 0 0 3px rgba(14, 193, 255, .08); }
input::placeholder { color: #567491; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.7); cursor: pointer; }
select option { background: #071f42; color: #f6fbff; }
.compact-field { align-content: start; }
.toggle-field { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(3, 24, 52, .42); cursor: pointer; }
.toggle-field input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-ui { width: 42px; height: 23px; border-radius: 999px; background: #173b62; position: relative; flex: 0 0 auto; transition: .2s; border: 1px solid rgba(255,255,255,.08); }
.toggle-ui::after { content: ""; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px; border-radius: 50%; background: #c9e6f8; transition: .22s; }
.toggle-field input:checked + .toggle-ui { background: linear-gradient(90deg, #0e7ee5, #05c7e7); }
.toggle-field input:checked + .toggle-ui::after { transform: translateX(19px); background: white; }
.toggle-copy strong, .toggle-copy small { display: block; }
.toggle-copy strong { font-size: .76rem; }
.toggle-copy small { color: var(--muted); font-size: .65rem; margin-top: 2px; }

.period-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.period-panel { border-radius: 17px; padding: 16px; border: 1px solid var(--line); background: rgba(6, 31, 65, .5); position: relative; overflow: hidden; }
.period-panel::after { content: ""; position: absolute; inset: auto -45px -58px auto; width: 125px; height: 125px; border-radius: 50%; filter: blur(10px); opacity: .12; }
.primary-period::after { background: var(--cyan); }
.comparison-period::after { background: var(--purple); }
.period-title { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.period-title div { min-width: 0; }
.period-title strong, .period-title small { display: block; }
.period-title strong { font-size: .85rem; }
.period-title small { margin-top: 2px; color: var(--muted); font-size: .65rem; }
.period-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px rgba(8, 198, 244, .6); }
.comparison-period .period-dot { background: var(--purple); box-shadow: 0 0 12px rgba(155,140,255,.6); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 10px; }
.btn-analyze { width: 100%; margin-top: 15px; justify-content: flex-start; padding: 12px 16px; background: linear-gradient(100deg, rgba(19, 113, 219, .98), rgba(7, 189, 221, .98)); box-shadow: 0 12px 35px rgba(0, 140, 255, .2); }
.btn-analyze .btn-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.12); }
.btn-analyze > span:nth-child(2) { display: grid; text-align: left; }
.btn-analyze strong { font-size: .86rem; }
.btn-analyze small { font-size: .67rem; opacity: .72; margin-top: 1px; }
.btn-arrow { margin-left: auto; font-size: 1.25rem; }
.btn-analyze:disabled { opacity: .55; cursor: wait; transform: none; }

.process-card { margin-top: 20px; padding: 28px; position: relative; overflow: hidden; }
.process-card::before { content: ""; position: absolute; width: 330px; height: 330px; left: 50%; top: 50%; transform: translate(-50%,-50%); border-radius: 50%; background: rgba(0, 175, 255, .08); filter: blur(60px); }
.process-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; position: relative; z-index: 2; }
.process-top h3 { margin: 5px 0 0; font-size: 1.35rem; }
.process-percent { font-size: 1.65rem; color: var(--cyan-2); font-variant-numeric: tabular-nums; }
.progress-track { height: 11px; margin-top: 22px; border-radius: 999px; background: rgba(0,0,0,.27); border: 1px solid rgba(102, 194, 255, .12); position: relative; overflow: visible; }
.progress-fill { position: absolute; left: 0; top: -1px; height: 11px; width: 0; border-radius: 999px; background: linear-gradient(90deg, #126ce8, #00cdf3, #72f5ff); transition: width .35s ease; box-shadow: 0 0 22px rgba(0, 198, 244, .35); }
.progress-glow { position: absolute; top: 50%; left: 0; width: 18px; height: 18px; border-radius: 50%; transform: translate(-50%,-50%); background: #a7f6ff; box-shadow: 0 0 22px #22ddff; transition: left .35s ease; }
.process-status-row { display: flex; align-items: center; gap: 10px; margin-top: 15px; color: #b8d1e7; font-size: .84rem; position: relative; z-index: 2; }
.pulse-loader { display: inline-flex; gap: 3px; align-items: center; }
.pulse-loader i { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan-2); animation: dots 1s infinite ease-in-out; }
.pulse-loader i:nth-child(2) { animation-delay: .16s; }
.pulse-loader i:nth-child(3) { animation-delay: .32s; }
@keyframes dots { 0%,100% { transform: translateY(0); opacity: .45; } 50% { transform: translateY(-4px); opacity: 1; } }
.floating-messages { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float-message { position: absolute; right: 7%; padding: 7px 10px; border-radius: 999px; background: rgba(8, 68, 120, .6); border: 1px solid rgba(69, 208, 255, .18); color: #bfeeff; font-size: .67rem; animation: riseMessage 5.5s ease-out forwards; }
@keyframes riseMessage { from { transform: translateY(50px) scale(.94); opacity: 0; } 15% { opacity: .9; } to { transform: translateY(-85px) translateX(-25px) scale(1.05); opacity: 0; } }

.results-shell { margin-top: 20px; }
.results-header { padding: 25px 28px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.results-header h2 { margin: 6px 0 5px; font-size: 1.5rem; letter-spacing: -.025em; }
.results-header p { margin: 0; color: var(--muted); font-size: .82rem; }
.success-step { color: var(--green); }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tabs { margin-top: 14px; padding: 7px; display: flex; gap: 5px; position: sticky; top: 8px; z-index: 20; width: max-content; max-width: 100%; }
.tab { border: 0; background: transparent; color: #91abc4; padding: 10px 14px; border-radius: 11px; font-weight: 700; font-size: .82rem; }
.tab.active { color: white; background: linear-gradient(135deg, rgba(24, 120, 232, .76), rgba(8, 181, 228, .57)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.tab-panel { display: none; margin-top: 14px; }
.tab-panel.active { display: block; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi-card { min-height: 145px; padding: 20px; border-radius: 20px; border: 1px solid var(--line); display: flex; align-items: flex-start; gap: 14px; background: linear-gradient(145deg, rgba(7, 36, 74, .86), rgba(4, 23, 51, .84)); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi-card::after { content: ""; position: absolute; width: 120px; height: 120px; right: -40px; bottom: -55px; border-radius: 50%; filter: blur(7px); opacity: .1; background: currentColor; }
.kpi-icon { width: 43px; height: 43px; border-radius: 13px; display: grid; place-items: center; flex: 0 0 auto; background: rgba(255,255,255,.06); border: 1px solid currentColor; font-size: 1.2rem; }
.kpi-card > div:last-child { display: grid; gap: 4px; }
.kpi-card span { color: #aac1d5; font-size: .74rem; font-weight: 650; }
.kpi-card strong { font-size: 2.2rem; line-height: 1.05; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.kpi-card small { color: #7795b1; font-size: .67rem; }
.kpi-new { color: var(--cyan-2); }
.kpi-retained { color: var(--green); }
.kpi-lost { color: var(--red); }
.kpi-total { color: var(--yellow); }
.secondary-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 10px; }
.secondary-kpis article { padding: 13px 14px; border-radius: 13px; background: rgba(5, 31, 65, .64); border: 1px solid rgba(90, 173, 235, .12); }
.secondary-kpis span, .secondary-kpis strong { display: block; }
.secondary-kpis span { color: #7797b4; font-size: .65rem; }
.secondary-kpis strong { margin-top: 5px; font-size: 1.06rem; }
.insight-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.insight { padding: 13px 14px; border: 1px solid rgba(85, 185, 242, .12); border-radius: 13px; background: rgba(3, 25, 55, .6); display: flex; gap: 10px; align-items: flex-start; }
.insight .insight-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: rgba(8,198,244,.1); color: var(--cyan-2); flex: 0 0 auto; }
.insight strong, .insight span { display: block; }
.insight strong { font-size: .77rem; }
.insight span { color: var(--muted); font-size: .68rem; line-height: 1.45; margin-top: 2px; }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.chart-card { min-width: 0; padding: 20px; }
.wide-chart { grid-column: span 2; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.chart-head h3 { font-size: 1rem; }
.chart-legend { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; color: #86a3be; font-size: .66rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.sw-primary { background: #08c6f4; }
.sw-comparison { background: #9b8cff; }
.chart-wrap { position: relative; width: 100%; min-height: 270px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.donut-wrap { min-height: 290px; display: grid; place-items: center; }
.donut-center { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%,-50%); display: grid; place-items: center; pointer-events: none; }
.donut-center strong { font-size: 2rem; letter-spacing: -.05em; }
.donut-center span { color: var(--muted); font-size: .64rem; max-width: 85px; text-align: center; }
.routes-chart-wrap { min-height: 340px; }

.table-card { padding: 20px; }
.table-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.table-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.search-box { position: relative; min-width: min(390px, 100%); }
.search-box span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #5d88ac; }
.search-box input { padding-left: 33px; }
.table-filters select { width: auto; min-width: 145px; }
.table-scroll { overflow-x: auto; border: 1px solid rgba(92, 177, 241, .13); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 1180px; }
thead { position: sticky; top: 0; z-index: 2; background: rgba(5, 31, 65, .97); }
th, td { padding: 12px 11px; border-bottom: 1px solid rgba(87, 164, 222, .1); text-align: left; vertical-align: middle; }
th { color: #89a6c0; font-size: .68rem; font-weight: 800; white-space: nowrap; user-select: none; }
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--cyan-2); }
td { color: #d7e7f4; font-size: .74rem; }
tbody tr { transition: .15s; }
tbody tr:hover { background: rgba(11, 76, 125, .16); }
.client-name { max-width: 240px; }
.client-name strong, .client-name small { display: block; }
.client-name small { margin-top: 3px; color: #6385a3; font-size: .62rem; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; font-size: .65rem; font-weight: 800; border: 1px solid transparent; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-Novo { color: var(--cyan-2); background: rgba(8,198,244,.08); border-color: rgba(8,198,244,.13); }
.status-Retido { color: var(--green); background: rgba(67,230,166,.08); border-color: rgba(67,230,166,.13); }
.status-Perdido { color: #ff8da0; background: rgba(255,109,134,.08); border-color: rgba(255,109,134,.13); }
.delta-positive { color: var(--green); font-weight: 800; }
.delta-negative { color: var(--red); font-weight: 800; }
.delta-neutral { color: #91a9c0; }
.table-empty { text-align: center; padding: 50px 20px; color: #7695b2; }
.table-empty > span { font-size: 2rem; color: #4a779b; }
.table-empty strong { display: block; color: #c8dbe9; margin-top: 8px; }
.table-empty p { margin: 4px 0; font-size: .78rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; color: #8ba6bf; font-size: .75rem; }

.method-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.method-card { padding: 22px; min-height: 220px; }
.method-number { font-size: 2rem; font-weight: 900; color: rgba(74, 209, 255, .25); letter-spacing: -.05em; }
.method-card h3 { margin: 18px 0 9px; font-size: 1rem; }
.method-card p { color: var(--muted); font-size: .77rem; line-height: 1.65; margin: 0; }
.method-card p strong { color: #dff4ff; }
.standard-card { margin-top: 14px; padding: 22px; display: grid; grid-template-columns: .75fr 1.25fr; gap: 24px; align-items: center; }
.standard-fields { display: flex; flex-wrap: wrap; gap: 7px; }
.standard-fields span { padding: 7px 9px; border-radius: 9px; background: rgba(7, 81, 139, .18); border: 1px solid rgba(63, 182, 244, .14); color: #c0d8ea; font-size: .7rem; }

.toast-stack { position: fixed; right: 20px; top: 20px; z-index: 150; display: grid; gap: 8px; width: min(380px, calc(100vw - 40px)); }
.toast { padding: 13px 14px; border-radius: 14px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid rgba(96, 190, 255, .2); background: rgba(5, 30, 63, .96); box-shadow: 0 18px 55px rgba(0,0,0,.35); animation: toastIn .25s ease; }
.toast.success { border-color: rgba(67,230,166,.25); }
.toast.error { border-color: rgba(255,109,134,.3); }
.toast strong { display: block; font-size: .78rem; }
.toast span { color: var(--muted); font-size: .7rem; line-height: 1.45; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }
.chart-tooltip { position: fixed; z-index: 160; pointer-events: none; display: none; padding: 8px 10px; border-radius: 9px; color: white; background: rgba(1, 15, 34, .94); border: 1px solid rgba(89, 189, 246, .2); box-shadow: 0 10px 30px rgba(0,0,0,.3); font-size: .7rem; max-width: 230px; }

.client-drawer { position: fixed; inset: 0; z-index: 200; pointer-events: none; opacity: 0; transition: .24s ease; }
.client-drawer.open { opacity: 1; pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 7, 18, .68); backdrop-filter: blur(4px); }
.drawer-panel { position: absolute; top: 0; right: 0; width: min(490px, 94vw); height: 100%; padding: 34px 28px; background: linear-gradient(180deg, #071f43, #031326); border-left: 1px solid rgba(95, 187, 244, .18); box-shadow: -30px 0 80px rgba(0,0,0,.38); transform: translateX(100%); transition: .3s cubic-bezier(.2,.8,.2,1); overflow-y: auto; }
.client-drawer.open .drawer-panel { transform: translateX(0); }
.drawer-close { position: absolute; top: 18px; right: 18px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: rgba(5, 45, 84, .6); color: white; font-size: 1.35rem; }
.drawer-panel h2 { margin: 8px 45px 8px 0; font-size: 1.5rem; }
.drawer-status { margin: 10px 0 20px; }
.drawer-contact { display: grid; gap: 8px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(2, 20, 44, .55); }
.drawer-contact div { display: grid; grid-template-columns: 95px 1fr; gap: 8px; font-size: .76rem; }
.drawer-contact span { color: #7495b1; }
.drawer-periods { display: grid; gap: 10px; margin-top: 14px; }
.drawer-periods article { padding: 16px; border-radius: 15px; border: 1px solid var(--line); background: rgba(4, 31, 64, .58); }
.drawer-periods article > span, .drawer-periods strong, .drawer-periods small, .drawer-periods p { display: block; }
.drawer-periods article > span { color: #7d9cb8; font-size: .68rem; }
.drawer-periods strong { margin-top: 6px; font-size: 1.2rem; }
.drawer-periods small { margin-top: 4px; color: #819fba; }
.drawer-periods p { margin: 11px 0 0; color: #c9deed; font-size: .76rem; line-height: 1.5; }

@media (max-width: 1180px) {
    .workflow-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .secondary-kpis { grid-template-columns: repeat(3, 1fr); }
    .method-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 850px) {
    .topbar, .main-shell { width: min(100% - 24px, 1480px); }
    .topbar { align-items: flex-start; }
    .brand-logo-shell { width: 86px; height: 60px; }
    .brand-copy p { display: none; }
    .live-pill { display: none; }
    .hero { grid-template-columns: 1fr; padding: 30px 24px; }
    .hero-orbit { display: none; }
    .period-grid, .common-options { grid-template-columns: 1fr; }
    .chart-grid { grid-template-columns: 1fr; }
    .wide-chart { grid-column: auto; }
    .insight-strip { grid-template-columns: 1fr; }
    .results-header, .table-toolbar { align-items: flex-start; flex-direction: column; }
    .table-filters { justify-content: flex-start; width: 100%; }
    .search-box { min-width: 100%; width: 100%; }
    .standard-card { grid-template-columns: 1fr; }
}
@media (max-width: 610px) {
    .brand-copy .eyebrow { display: none; }
    .brand-copy h1 { font-size: 1rem; }
    .top-actions .icon-btn { width: 36px; height: 36px; }
    .hero h2 { font-size: 2rem; }
    .upload-card, .compare-card, .process-card { padding: 20px; }
    .field-grid { grid-template-columns: 1fr; }
    .kpi-grid, .secondary-kpis, .method-grid { grid-template-columns: 1fr; }
    .tabs { width: 100%; overflow-x: auto; position: static; }
    .tab { white-space: nowrap; }
    .chart-head { flex-direction: column; }
    .chart-legend { justify-content: flex-start; }
    .result-actions { justify-content: flex-start; }
}

/* ===== Autenticação, usuários e comunicação por e-mail ===== */
.top-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.top-actions form { margin:0; }
.user-chip { display:flex; align-items:center; gap:9px; min-height:42px; padding:6px 11px 6px 7px; border:1px solid var(--line); background:rgba(5,27,59,.66); border-radius:999px; }
.user-avatar { width:31px; height:31px; display:grid; place-items:center; border-radius:50%; background:linear-gradient(135deg,var(--cyan),var(--blue)); color:#fff; font-weight:900; box-shadow:0 7px 18px rgba(4,158,255,.22); }
.user-chip div { display:flex; flex-direction:column; line-height:1.08; }
.user-chip strong { font-size:.78rem; }
.user-chip small { color:var(--muted); font-size:.65rem; margin-top:3px; }

.login-page { overflow:auto; }
.login-bg { position:fixed; inset:0; z-index:-3; background:url('../img/background_buszone.png') center/cover no-repeat; transform:scale(1.03); }
.login-overlay { position:fixed; inset:0; z-index:-2; background:linear-gradient(100deg,rgba(1,8,24,.96) 0%,rgba(2,18,43,.88) 48%,rgba(1,15,37,.72) 100%),radial-gradient(circle at 74% 50%,rgba(0,181,255,.16),transparent 34%); backdrop-filter:blur(3px); }
.login-shell { min-height:100vh; display:grid; place-items:center; padding:32px; }
.login-card { width:min(1080px,100%); display:grid; grid-template-columns:1.08fr .92fr; overflow:hidden; padding:0; min-height:620px; }
.login-brand { position:relative; padding:55px; display:flex; flex-direction:column; justify-content:center; background:linear-gradient(145deg,rgba(5,46,96,.82),rgba(4,22,51,.38)); border-right:1px solid var(--line); overflow:hidden; }
.login-brand::after { content:""; position:absolute; width:380px; height:380px; border:1px solid rgba(58,202,255,.18); border-radius:50%; right:-190px; top:-120px; box-shadow:0 0 0 45px rgba(39,170,255,.04),0 0 0 95px rgba(39,170,255,.025); }
.login-brand img { width:min(310px,82%); max-height:165px; object-fit:contain; background:#fff; border-radius:22px; padding:13px 18px; margin-bottom:28px; box-shadow:0 18px 38px rgba(0,0,0,.22); }
.login-brand > span { color:var(--cyan-2); font-size:.69rem; font-weight:800; letter-spacing:.18em; }
.login-brand h1 { margin:9px 0 12px; font-size:clamp(2rem,4vw,3.35rem); line-height:.98; letter-spacing:-.045em; }
.login-brand h1 strong { display:block; color:var(--cyan-2); }
.login-brand p { max-width:540px; color:#b9cce0; line-height:1.65; font-size:1.02rem; }
.login-form { padding:55px 48px; display:flex; flex-direction:column; justify-content:center; gap:19px; background:rgba(2,15,37,.7); }
.login-title h2 { margin:8px 0 6px; font-size:2rem; }
.login-title p { margin:0; color:var(--muted); line-height:1.5; }
.login-error { padding:12px 14px; border:1px solid rgba(255,109,134,.34); background:rgba(255,109,134,.11); border-radius:12px; color:#ffd7df; font-size:.9rem; }
.password-field { position:relative; }
.password-field input { width:100%; padding-right:50px !important; }
.password-toggle { position:absolute; right:7px; top:50%; transform:translateY(-50%); width:36px; height:36px; border:0; border-radius:10px; background:transparent; color:var(--cyan-2); font-size:1.1rem; }
.password-toggle:hover { background:rgba(59,192,255,.08); }
.login-submit { margin-top:5px; width:100%; }
.login-security-note { display:flex; gap:10px; align-items:flex-start; padding:12px 14px; border-radius:13px; background:rgba(31,105,164,.11); border:1px solid rgba(84,197,255,.13); }
.login-security-note p { margin:0; color:var(--muted); font-size:.78rem; line-height:1.45; }

.email-selection-bar { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:13px 15px; margin-bottom:15px; border-radius:16px; border:1px solid rgba(69,201,255,.19); background:linear-gradient(90deg,rgba(7,82,152,.18),rgba(7,36,78,.28)); }
.email-selection-copy,.email-selection-actions { display:flex; align-items:center; gap:11px; }
.email-selection-copy div { display:flex; flex-direction:column; gap:3px; }
.email-selection-copy strong { font-size:.88rem; }
.email-selection-copy small { color:var(--muted); font-size:.74rem; }
.mail-orb { width:36px; height:36px; display:grid; place-items:center; border-radius:12px; color:var(--cyan-2); background:rgba(8,198,244,.11); border:1px solid rgba(82,225,255,.2); }
.select-col { width:42px; text-align:center !important; }
.select-col input,.client-select { width:17px; height:17px; accent-color:#08c6f4; cursor:pointer; }
.client-select:disabled { cursor:not-allowed; opacity:.3; }
.send-state-cell { text-align:center; }
.sent-check,.mail-ready,.mail-blocked { display:inline-grid; place-items:center; width:28px; height:28px; border-radius:50%; font-weight:900; }
.sent-check { background:rgba(67,230,166,.13); border:1px solid rgba(67,230,166,.35); color:var(--green); }
.mail-ready { background:rgba(8,198,244,.10); border:1px solid rgba(8,198,244,.24); color:var(--cyan-2); }
.mail-blocked { color:#667f98; border:1px solid rgba(120,154,185,.14); }

.modal-open { overflow:hidden; }
.modal-shell { position:fixed; inset:0; z-index:90; display:grid; place-items:center; padding:24px; }
.modal-backdrop { position:absolute; inset:0; background:rgba(0,7,20,.78); backdrop-filter:blur(7px); }
.modal-card { position:relative; z-index:1; width:min(1320px,calc(100vw - 44px)); max-height:calc(100vh - 44px); overflow:auto; padding:26px; box-shadow:0 35px 100px rgba(0,0,0,.55); }
.modal-close { position:absolute; top:17px; right:17px; width:38px; height:38px; border-radius:12px; border:1px solid var(--line); background:rgba(4,24,53,.92); color:#fff; font-size:1.4rem; z-index:3; }
.email-modal-head { display:flex; justify-content:space-between; gap:24px; align-items:flex-start; padding-right:48px; margin-bottom:22px; }
.email-modal-head h2 { margin:6px 0 5px; font-size:1.7rem; }
.email-modal-head p { margin:0; color:var(--muted); }
.recipient-badge { min-width:120px; padding:13px 16px; text-align:center; border-radius:16px; background:rgba(7,93,171,.22); border:1px solid rgba(67,195,255,.2); }
.recipient-badge strong { display:block; color:var(--cyan-2); font-size:1.55rem; }
.recipient-badge span { color:var(--muted); font-size:.72rem; }
.email-compose-grid { display:grid; grid-template-columns:minmax(0,.9fr) minmax(420px,1.1fr); gap:20px; }
.email-editor,.email-preview-shell { min-width:0; }
.field-group textarea { width:100%; resize:vertical; min-height:190px; padding:13px 14px; color:var(--text); background:rgba(2,20,46,.72); border:1px solid var(--line); border-radius:12px; outline:none; font:inherit; line-height:1.55; }
.field-group textarea:focus { border-color:rgba(50,202,255,.58); box-shadow:0 0 0 3px rgba(7,195,255,.08); }
.image-upload-box { display:flex; align-items:center; gap:10px; margin-top:13px; padding:13px; border:1px dashed rgba(82,225,255,.26); border-radius:14px; background:rgba(5,36,74,.28); }
.image-upload-box > div { flex:1; display:flex; flex-direction:column; gap:3px; }
.image-upload-box small { color:var(--muted); }
.email-modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:18px; }
.preview-toolbar { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:9px; color:var(--muted); font-size:.76rem; }
.preview-toolbar span { color:var(--cyan-2); text-transform:uppercase; letter-spacing:.13em; font-weight:800; }
.mock-mail-client { overflow:hidden; border-radius:18px; background:#eef3f8; color:#18334d; border:1px solid rgba(189,220,244,.28); min-height:475px; box-shadow:inset 0 0 0 1px rgba(255,255,255,.6); }
.mock-mail-header { display:flex; justify-content:space-between; align-items:flex-start; gap:20px; padding:21px 22px; background:#fff; border-bottom:1px solid #dfe8f0; }
.mock-mail-header div { display:flex; flex-direction:column; gap:4px; }
.mock-mail-header strong { font-size:1rem; color:#13324c; }
.mock-mail-header span { font-size:.74rem; color:#71879a; }
.mock-mail-pill { padding:5px 8px; border-radius:999px; background:#edf8ff; color:#1682c8 !important; }
.mock-mail-content { width:min(640px,calc(100% - 34px)); margin:22px auto; padding:28px; background:#fff; border-radius:16px; box-shadow:0 8px 25px rgba(22,57,87,.08); }
.mock-mail-content::before { content:"BUSZONE • COMUNICAÇÃO"; display:block; margin:-28px -28px 24px; padding:20px 25px; border-radius:16px 16px 0 0; background:linear-gradient(135deg,#052d64,#0579c7); color:white; font-size:.68rem; letter-spacing:.15em; font-weight:800; }
.mock-mail-content p { white-space:pre-wrap; line-height:1.65; margin:0; }
.mock-mail-content img { width:100%; height:auto; display:block; margin-top:22px; border-radius:12px; }
.email-send-progress { margin-top:16px; padding:14px; border-radius:14px; border:1px solid rgba(61,196,255,.18); background:rgba(5,40,82,.32); }
.email-send-progress-head { display:flex; justify-content:space-between; gap:12px; margin-bottom:9px; }
.email-send-progress small { display:block; margin-top:8px; color:var(--muted); }

.admin-shell { padding-top:10px; padding-bottom:50px; }
.admin-hero { margin-bottom:22px; }
.admin-grid { display:grid; grid-template-columns:minmax(320px,.72fr) minmax(0,1.28fr); gap:20px; }
.admin-create-card,.admin-users-card { padding:22px; }
.admin-user-form { display:grid; gap:15px; margin-top:20px; }
.admin-users-list { display:grid; gap:10px; margin-top:18px; }
.admin-user-row { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:12px; padding:13px; border:1px solid var(--line); border-radius:15px; background:rgba(3,24,53,.46); transition:.2s ease; }
.admin-user-row.is-disabled { opacity:.58; }
.admin-user-avatar { width:40px; height:40px; display:grid; place-items:center; border-radius:12px; background:linear-gradient(135deg,#0bb8e8,#176dd8); color:white; font-weight:900; }
.admin-user-main { min-width:0; }
.admin-user-title { display:flex; gap:7px; align-items:center; flex-wrap:wrap; }
.admin-user-main small { display:block; color:var(--muted); margin-top:5px; }
.role-badge,.active-badge,.inactive-badge { padding:3px 7px; border-radius:999px; font-size:.62rem; font-weight:800; }
.role-badge.admin { background:rgba(155,140,255,.14); color:#c2b8ff; }
.role-badge.user { background:rgba(8,198,244,.12); color:var(--cyan-2); }
.active-badge { background:rgba(67,230,166,.12); color:var(--green); }
.inactive-badge { background:rgba(255,109,134,.12); color:#ff9daf; }
.admin-user-actions { display:flex; gap:7px; flex-wrap:wrap; justify-content:flex-end; }
.compact-modal { width:min(470px,calc(100vw - 36px)); }
.compact-modal h2 { margin:7px 0 18px; }
.compact-modal .btn { margin-top:14px; width:100%; }

@media (max-width: 1000px) {
    .login-card { grid-template-columns:1fr; }
    .login-brand { min-height:330px; border-right:0; border-bottom:1px solid var(--line); padding:35px; }
    .login-form { padding:38px 34px; }
    .email-compose-grid { grid-template-columns:1fr; }
    .email-preview-shell { order:2; }
    .admin-grid { grid-template-columns:1fr; }
}
@media (max-width: 720px) {
    .top-actions .live-pill,.user-chip small { display:none; }
    .user-chip { padding-right:7px; }
    .email-selection-bar,.email-selection-copy,.email-selection-actions,.email-modal-head,.image-upload-box { align-items:stretch; flex-direction:column; }
    .email-selection-actions .btn { width:100%; }
    .recipient-badge { width:100%; }
    .modal-shell { padding:8px; }
    .modal-card { width:calc(100vw - 16px); max-height:calc(100vh - 16px); padding:18px; }
    .email-modal-head { padding-right:34px; }
    .mock-mail-content { width:calc(100% - 16px); margin:8px; padding:20px; }
    .mock-mail-content::before { margin:-20px -20px 18px; }
    .admin-user-row { grid-template-columns:auto 1fr; }
    .admin-user-actions { grid-column:1/-1; justify-content:stretch; }
    .admin-user-actions .btn { flex:1; }
    .login-shell { padding:12px; }
    .login-brand,.login-form { padding:28px 22px; }
}
