@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap');

:root {
    --primary: #5865f2;
    --secondary: #14b8a6;
    --accent: #f59e0b;
    --ink: #1d2638;
    --muted: #6c7588;
    --canvas: #e9edf4;
    --surface: #f9fbfe;
    --surface-high: #ffffff;
    --surface-low: #e2e7f0;
    --line: #d3dae6;
    --line-strong: #c1cad8;
    --danger: #d84b5f;
    --warning: #e99c22;
    --success: #0c9a73;
    --info: #2f7fe5;
    --sidebar: #172034;
    --sidebar-2: #222e48;
    --shadow-sm: 0 2px 4px rgba(23, 32, 52, .08), 0 1px 1px rgba(23, 32, 52, .06);
    --shadow-md: 0 10px 25px rgba(23, 32, 52, .10), 0 2px 6px rgba(23, 32, 52, .08);
    --shadow-lg: 0 24px 60px rgba(23, 32, 52, .14), 0 3px 10px rgba(23, 32, 52, .08);
    --inset: inset 0 1px 2px rgba(23, 32, 52, .10), inset 0 -1px rgba(255, 255, 255, .75);
    --radius-sm: 11px;
    --radius: 16px;
    --radius-lg: 22px;
    --sidebar-width: 266px;
    --topbar-height: 82px;
}

html[data-theme="dark"] {
    --ink: #edf2fb;
    --muted: #9aa7ba;
    --canvas: #101725;
    --surface: #182235;
    --surface-high: #1d2940;
    --surface-low: #111a2b;
    --line: #2b3951;
    --line-strong: #3a4962;
    --sidebar: #0a101c;
    --sidebar-2: #131d30;
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, .24);
    --shadow-md: 0 12px 28px rgba(0, 0, 0, .26);
    --shadow-lg: 0 26px 60px rgba(0, 0, 0, .32);
    --inset: inset 0 2px 3px rgba(0, 0, 0, .24), inset 0 -1px rgba(255, 255, 255, .03);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; }

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    z-index: 100;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    color: #eaf0fb;
    background:
        radial-gradient(circle at 15% 0, color-mix(in srgb, var(--primary) 28%, transparent), transparent 26%),
        linear-gradient(155deg, var(--sidebar), var(--sidebar-2));
    border-right: 1px solid rgba(255,255,255,.08);
    box-shadow: 7px 0 24px rgba(14,20,35,.12), inset -1px 0 rgba(0,0,0,.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar::after {
    content: "";
    position: absolute;
    z-index: -1;
    width: 190px;
    height: 190px;
    right: -100px;
    bottom: 12%;
    border-radius: 50%;
    border: 40px solid rgba(255,255,255,.025);
}
.app-brand {
    min-height: 82px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 1px rgba(0,0,0,.2);
}
.brand-emblem {
    flex: 0 0 auto;
    width: 43px;
    height: 43px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font: 800 20px "Outfit", sans-serif;
    color: white;
    background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 74%, white), color-mix(in srgb, var(--primary) 84%, #111));
    border: 1px solid rgba(255,255,255,.28);
    box-shadow: inset 0 1px rgba(255,255,255,.5), inset 0 -2px rgba(0,0,0,.15), 0 9px 20px rgba(0,0,0,.25);
}
.brand-emblem img { width: 100%; height: 100%; padding: 5px; object-fit: contain; border-radius: inherit; }
.app-brand strong, .app-brand small { display: block; }
.app-brand strong {
    max-width: 163px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font: 700 16px "Outfit", sans-serif;
}
.app-brand small { color: #aeb8cc; font-size: 10px; margin-top: 2px; letter-spacing: .035em; text-transform: uppercase; }
.side-nav { padding: 14px 12px 25px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.nav-section + .nav-section { margin-top: 14px; }
.nav-caption {
    display: block;
    padding: 7px 12px;
    color: #73819b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.nav-item {
    min-height: 42px;
    padding: 8px 11px;
    margin: 3px 0;
    display: flex;
    align-items: center;
    gap: 11px;
    border-radius: 12px;
    color: #b9c4d8;
    text-decoration: none;
    font-weight: 600;
    position: relative;
    transition: .18s ease;
}
.nav-item i { width: 20px; font-size: 16px; text-align: center; color: #8e9bb2; transition: inherit; }
.nav-item em { margin-left: auto; border-radius: 99px; padding: 2px 7px; background: rgba(255,255,255,.08); font-style: normal; font-size: 10px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item:hover i { color: #fff; }
.nav-item.active {
    color: #fff;
    background: linear-gradient(100deg, color-mix(in srgb, var(--primary) 72%, transparent), color-mix(in srgb, var(--primary) 35%, transparent));
    border: 1px solid rgba(255,255,255,.13);
    box-shadow: inset 0 1px rgba(255,255,255,.17), inset 0 -1px rgba(0,0,0,.18), 0 7px 16px rgba(0,0,0,.16);
}
.nav-item.active::before { content: ""; position: absolute; left: -13px; width: 4px; height: 24px; border-radius: 0 4px 4px 0; background: #fff; box-shadow: 0 0 13px color-mix(in srgb, var(--primary) 50%, white); }
.nav-item.active i { color: white; filter: drop-shadow(0 2px 3px rgba(0,0,0,.2)); }
.sidebar-foot {
    margin-top: auto;
    padding: 16px 20px;
    display: flex;
    gap: 11px;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,.07);
    background: rgba(0,0,0,.08);
}
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { font-size: 11px; color: #cbd5e7; }
.sidebar-foot small { color: #6f7d95; font-size: 10px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #22c99a; box-shadow: 0 0 0 4px rgba(34,201,154,.12), 0 0 10px #22c99a; }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar {
    height: var(--topbar-height);
    position: sticky;
    z-index: 90;
    top: 0;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 3px 15px rgba(23,32,52,.06), inset 0 -1px var(--surface-high);
    backdrop-filter: blur(18px);
}
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 12px; }
.page-heading h1 { margin: 0; font: 700 22px/1.15 "Outfit", sans-serif; letter-spacing: -.02em; }
.page-heading p { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.icon-button {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 13px;
    border: 1px solid var(--line-strong);
    color: var(--ink);
    background: linear-gradient(180deg, var(--surface-high), var(--surface-low));
    box-shadow: var(--shadow-sm), inset 0 1px rgba(255,255,255,.65);
    display: inline-grid;
    place-items: center;
    text-decoration: none;
    cursor: pointer;
    transition: .15s ease;
}
.icon-button:hover { color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-md), inset 0 1px rgba(255,255,255,.65); }
.icon-button:active { transform: translateY(1px); box-shadow: var(--inset); }
.icon-button.small { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
.icon-button.danger { color: var(--danger); }
.mobile-menu { display: none; }
.notification-button { position: relative; }
.notification-button span { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; color: #fff; background: var(--danger); border: 2px solid var(--surface); border-radius: 99px; font-size: 9px; font-weight: 800; }
.user-menu {
    height: 48px;
    padding: 5px 8px 5px 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: linear-gradient(180deg, var(--surface-high), var(--surface));
    box-shadow: var(--shadow-sm), inset 0 1px rgba(255,255,255,.7);
}
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), color-mix(in srgb, var(--primary) 65%, #182033));
    border: 1px solid color-mix(in srgb, var(--primary) 60%, #fff);
    box-shadow: inset 0 1px rgba(255,255,255,.45), 0 4px 10px color-mix(in srgb, var(--primary) 24%, transparent);
    font-size: 11px;
    font-weight: 800;
}
.user-copy strong, .user-copy small { display: block; max-width: 135px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-copy strong { font-size: 11px; }
.user-copy small { color: var(--muted); font-size: 9px; margin-top: 1px; }
.logout-link { padding: 7px; color: var(--muted); }

.content-area { width: 100%; max-width: 1640px; margin: 0 auto; padding: 26px 28px 42px; }
.app-alert {
    min-height: 48px;
    margin-bottom: 18px;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-high);
    box-shadow: var(--shadow-sm);
}
.app-alert button { margin-left: auto; border: 0; color: inherit; background: none; font-size: 20px; }
.app-alert.success { color: var(--success); border-color: color-mix(in srgb, var(--success) 28%, var(--line)); background: color-mix(in srgb, var(--success) 7%, var(--surface-high)); }
.app-alert.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 28%, var(--line)); background: color-mix(in srgb, var(--danger) 7%, var(--surface-high)); }
.app-alert.warning { color: #b47713; border-color: color-mix(in srgb, var(--warning) 30%, var(--line)); background: color-mix(in srgb, var(--warning) 8%, var(--surface-high)); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px; }
.metric-card {
    min-height: 132px;
    padding: 19px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(145deg, rgba(255,255,255,.8), transparent 34%),
        linear-gradient(180deg, var(--surface-high), var(--surface));
    box-shadow: var(--shadow-md), inset 0 1px rgba(255,255,255,.75), inset 0 -1px var(--line);
}
html[data-theme="dark"] .metric-card { background: linear-gradient(145deg, rgba(255,255,255,.035), transparent 34%), linear-gradient(180deg, var(--surface-high), var(--surface)); }
.metric-card::after { content: ""; position: absolute; width: 82px; height: 82px; border-radius: 50%; right: -35px; bottom: -40px; background: color-mix(in srgb, var(--metric-color, var(--primary)) 11%, transparent); border: 13px solid color-mix(in srgb, var(--metric-color, var(--primary)) 7%, transparent); }
.metric-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.metric-icon {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    color: var(--metric-color, var(--primary));
    border: 1px solid color-mix(in srgb, var(--metric-color, var(--primary)) 25%, var(--line));
    border-radius: 13px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--metric-color, var(--primary)) 10%, var(--surface-high)), var(--surface));
    box-shadow: inset 0 1px rgba(255,255,255,.8), 0 5px 12px color-mix(in srgb, var(--metric-color, var(--primary)) 12%, transparent);
    font-size: 18px;
}
.metric-trend { padding: 3px 7px; color: var(--success); background: color-mix(in srgb, var(--success) 9%, transparent); border-radius: 99px; font-size: 9px; font-weight: 800; }
.metric-card strong { display: block; font: 700 27px "Outfit", sans-serif; letter-spacing: -.03em; }
.metric-card small { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; }
.surface {
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, var(--surface-high), var(--surface));
    box-shadow: var(--shadow-md), inset 0 1px rgba(255,255,255,.75);
    overflow: hidden;
}
.surface-head { min-height: 76px; padding: 18px 21px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); box-shadow: inset 0 -1px var(--surface-high); }
.surface-head h2 { margin: 1px 0 0; font: 700 17px "Outfit", sans-serif; letter-spacing: -.01em; }
.surface-head p { max-width: 700px; margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.section-kicker { color: var(--primary); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.surface-body { padding: 21px; }
.chart-box { min-height: 310px; padding: 18px 20px 16px; }
.chart-box canvas { max-height: 278px; }
.activity-list { padding: 6px 20px 14px; }
.activity-item { padding: 13px 0; display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border: 0; }
.activity-symbol { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; color: var(--primary); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.activity-copy { min-width: 0; }
.activity-copy strong { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-copy small { color: var(--muted); font-size: 9px; }
.activity-value { margin-left: auto; font: 700 12px "Outfit", sans-serif; }

.page-actions { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.search-box { width: min(410px, 100%); height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 10px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface-low); box-shadow: var(--inset); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search-box input::placeholder { color: var(--muted); }
.btn-app {
    min-height: 42px;
    padding: 10px 15px;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 800;
    font-size: 11px;
    background: linear-gradient(180deg, var(--surface-high), var(--surface-low));
    box-shadow: var(--shadow-sm), inset 0 1px rgba(255,255,255,.75);
    cursor: pointer;
    transition: .15s ease;
}
.btn-app:hover { color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow-md), inset 0 1px rgba(255,255,255,.75); }
.btn-app:active { transform: translateY(1px); box-shadow: var(--inset); }
.btn-app.primary { color: #fff; border-color: color-mix(in srgb, var(--primary) 76%, #000); background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 80%, #fff), var(--primary)); box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 25%, transparent), inset 0 1px rgba(255,255,255,.42), inset 0 -1px rgba(0,0,0,.14); }
.btn-app.success { color: #fff; border-color: #07805f; background: linear-gradient(#18b88d,#0c966f); }
.btn-app.danger { color: #fff; border-color: #b73547; background: linear-gradient(#eb6375,#ce3f53); }
.btn-app.ghost { background: transparent; box-shadow: none; }

.form-surface { overflow: visible; }
.crud-form { padding: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 20px; }
.field-full { grid-column: 1 / -1; }
.field > label { display: block; margin: 0 0 7px; font-size: 11px; font-weight: 800; }
.field input:not([type="checkbox"]), .field select, .field textarea, .app-input {
    width: 100%;
    min-height: 43px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    outline: none;
    color: var(--ink);
    background: linear-gradient(180deg, var(--surface-low), var(--surface));
    box-shadow: var(--inset);
    transition: .15s ease;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .app-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent), var(--inset); }
.field small { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; }
.form-actions { margin-top: 22px; padding-top: 17px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }
.switch-control { min-height: 43px; display: flex !important; align-items: center; gap: 9px; cursor: pointer; }
.switch-control input { position: absolute; opacity: 0; }
.switch-control span { width: 43px; height: 24px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface-low); box-shadow: var(--inset); transition: .2s; }
.switch-control span::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(#fff,#dbe1eb); border: 1px solid #c3cbd8; box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: .2s; }
.switch-control input:checked + span { background: var(--primary); }
.switch-control input:checked + span::after { transform: translateX(19px); }
.switch-control em { font-style: normal; font-size: 11px; color: var(--muted); }

.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 11px 18px; color: var(--muted); background: var(--surface-low); border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 800; letter-spacing: .07em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 11px; vertical-align: middle; }
.data-table tbody tr { transition: .15s ease; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--primary) 3.5%, var(--surface-high)); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.actions-column { width: 100px; text-align: right !important; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-actions form { margin: 0; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 99px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.status-active,.status-connected,.status-paid,.status-sent,.status-completed,.status-published { color: var(--success); background: color-mix(in srgb,var(--success) 7%,transparent); border-color: color-mix(in srgb,var(--success) 22%,var(--line)); }
.status-trial,.status-pending,.status-waiting,.status-scheduled,.status-in_progress,.status-draft { color: #b47713; background: color-mix(in srgb,var(--warning) 8%,transparent); border-color: color-mix(in srgb,var(--warning) 22%,var(--line)); }
.status-blocked,.status-cancelled,.status-failed,.status-error { color: var(--danger); background: color-mix(in srgb,var(--danger) 7%,transparent); border-color: color-mix(in srgb,var(--danger) 22%,var(--line)); }
.status-inactive,.status-disconnected,.status-suspended { color: var(--muted); background: var(--surface-low); }
.empty-state { padding: 55px 25px; text-align: center; }
.empty-state > span { width: 66px; height: 66px; margin: 0 auto 15px; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); border-radius: 21px; background: linear-gradient(var(--surface-high),var(--surface-low)); box-shadow: var(--shadow-md), inset 0 1px rgba(255,255,255,.7); font-size: 25px; }
.empty-state h3 { margin: 0; font: 700 16px "Outfit", sans-serif; }
.empty-state p { margin: 6px 0 17px; color: var(--muted); font-size: 11px; }

/* Central de atendimento */
.attendance-shell {
    height: calc(100vh - var(--topbar-height) - 53px);
    min-height: 620px;
    display: grid;
    grid-template-columns: 300px minmax(420px, 1fr) 300px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg), inset 0 1px rgba(255,255,255,.75);
    overflow: hidden;
}
.conversation-list { min-width: 0; border-right: 1px solid var(--line); background: linear-gradient(90deg,var(--surface),var(--surface-low)); }
.panel-title { min-height: 68px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface-high); box-shadow: 0 2px 8px rgba(23,32,52,.04); }
.panel-title h2 { margin: 0; font: 700 16px "Outfit",sans-serif; }
.panel-title p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.conversation-search { margin: 12px; }
.conversation-filters { padding: 0 12px 10px; display: flex; gap: 6px; overflow-x: auto; }
.filter-chip { padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface-high); font-size: 9px; font-weight: 800; white-space: nowrap; }
.filter-chip.active { color: #fff; border-color: var(--primary); background: var(--primary); box-shadow: inset 0 1px rgba(255,255,255,.35), 0 4px 9px color-mix(in srgb,var(--primary) 20%,transparent); }
.conversation-scroll { height: calc(100% - 132px); overflow-y: auto; }
.conversation-row { width: 100%; padding: 13px 14px; display: flex; gap: 10px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); transition: .15s; }
.conversation-row:hover { color: inherit; background: var(--surface-high); }
.conversation-row.active { background: color-mix(in srgb,var(--primary) 8%,var(--surface-high)); box-shadow: inset 4px 0 var(--primary); }
.contact-avatar { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; border-radius: 14px; background: linear-gradient(145deg,var(--secondary),color-mix(in srgb,var(--secondary) 55%,#17354a)); border: 1px solid color-mix(in srgb,var(--secondary) 65%,#fff); box-shadow: inset 0 1px rgba(255,255,255,.45), 0 5px 11px color-mix(in srgb,var(--secondary) 20%,transparent); font-weight: 800; font-size: 10px; }
.conversation-copy { min-width: 0; flex: 1; }
.conversation-meta { display: flex; gap: 7px; align-items: center; justify-content: space-between; }
.conversation-meta strong { max-width: 150px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; }
.conversation-meta time { color: var(--muted); font-size: 8px; white-space: nowrap; }
.conversation-preview { margin: 3px 0 6px; color: var(--muted); font-size: 9px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mini-badge { display: inline-flex; padding: 2px 6px; border-radius: 6px; color: var(--primary); background: color-mix(in srgb,var(--primary) 9%,transparent); font-size: 8px; font-weight: 800; }
.conversation-pane { min-width: 0; display: flex; flex-direction: column; background: var(--surface-high); }
.chat-head { min-height: 68px; padding: 10px 16px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid var(--line); box-shadow: 0 2px 8px rgba(23,32,52,.05); }
.chat-head .contact-avatar { width: 40px; height: 40px; }
.chat-contact { min-width: 0; }
.chat-contact strong, .chat-contact small { display: block; }
.chat-contact strong { font-size: 12px; }
.chat-contact small { color: var(--success); font-size: 9px; }
.chat-tools { margin-left: auto; display: flex; gap: 6px; }
.messages {
    flex: 1;
    padding: 22px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 20% 20%, color-mix(in srgb,var(--primary) 3.5%,transparent) 0 2px, transparent 3px) 0 0/26px 26px,
        var(--canvas);
}
.date-separator { width: max-content; margin: 0 auto 18px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface); box-shadow: var(--shadow-sm); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.message-line { margin: 8px 0; display: flex; }
.message-line.outbound { justify-content: flex-end; }
.message-line.system { justify-content: center; }
.message-bubble { max-width: min(74%,620px); padding: 10px 12px 7px; border: 1px solid var(--line); border-radius: 5px 16px 16px 16px; background: linear-gradient(145deg,var(--surface-high),var(--surface)); box-shadow: var(--shadow-sm), inset 0 1px rgba(255,255,255,.65); }
.message-line.outbound .message-bubble { color: #fff; border-color: color-mix(in srgb,var(--primary) 75%,#000); border-radius: 16px 5px 16px 16px; background: linear-gradient(145deg,color-mix(in srgb,var(--primary) 80%,#fff),var(--primary)); box-shadow: 0 6px 15px color-mix(in srgb,var(--primary) 20%,transparent), inset 0 1px rgba(255,255,255,.3); }
.message-line.system .message-bubble { padding: 5px 10px; color: var(--muted); border-radius: 99px; background: var(--surface-low); font-size: 8px; }
.message-author { margin-bottom: 3px; color: var(--secondary); font-size: 8px; font-weight: 800; }
.message-bubble p { margin: 0; white-space: pre-wrap; font-size: 11px; }
.message-foot { margin-top: 4px; display: flex; justify-content: flex-end; gap: 4px; color: var(--muted); font-size: 7px; }
.message-line.outbound .message-foot { color: rgba(255,255,255,.7); }
.composer { padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 -3px 12px rgba(23,32,52,.04); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; min-height: 42px; max-height: 120px; padding: 11px 13px; resize: none; border: 1px solid var(--line-strong); border-radius: 14px; color: var(--ink); background: var(--surface-low); box-shadow: var(--inset); outline: 0; }
.composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb,var(--primary) 11%,transparent),var(--inset); }
.send-button { width: 44px; height: 44px; border: 1px solid color-mix(in srgb,var(--primary) 75%,#000); border-radius: 14px; color: #fff; background: linear-gradient(145deg,color-mix(in srgb,var(--primary) 80%,#fff),var(--primary)); box-shadow: 0 7px 15px color-mix(in srgb,var(--primary) 25%,transparent),inset 0 1px rgba(255,255,255,.4); }
.composer-hints { margin-top: 6px; display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; }
.contact-panel { border-left: 1px solid var(--line); background: linear-gradient(-90deg,var(--surface),var(--surface-low)); overflow-y: auto; }
.contact-hero { padding: 22px 18px 17px; text-align: center; border-bottom: 1px solid var(--line); background: var(--surface-high); }
.contact-hero .contact-avatar { width: 62px; height: 62px; margin: 0 auto 10px; border-radius: 20px; font-size: 15px; }
.contact-hero h3 { margin: 0; font: 700 15px "Outfit",sans-serif; }
.contact-hero p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.detail-section { padding: 15px 17px; border-bottom: 1px solid var(--line); }
.detail-section h4 { margin: 0 0 10px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.detail-row { margin: 8px 0; display: flex; align-items: flex-start; gap: 8px; }
.detail-row i { width: 16px; color: var(--primary); text-align: center; }
.detail-row span { font-size: 9px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { padding: 4px 7px; border: 1px solid color-mix(in srgb,var(--tag-color,var(--primary)) 30%,var(--line)); border-radius: 7px; color: var(--tag-color,var(--primary)); background: color-mix(in srgb,var(--tag-color,var(--primary)) 8%,transparent); font-size: 8px; font-weight: 800; }
.conversation-empty { height: 100%; display: grid; place-items: center; text-align: center; padding: 30px; color: var(--muted); }
.conversation-empty i { display: block; margin-bottom: 13px; font-size: 50px; color: var(--line-strong); }

/* CRM */
.pipeline-toolbar { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pipeline-select { min-width: 220px; }
.kanban-board { padding-bottom: 18px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; }
.kanban-column { min-height: 530px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface-low); box-shadow: var(--inset); }
.kanban-head { padding: 13px 14px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.kanban-color { width: 9px; height: 9px; border-radius: 50%; background: var(--stage-color); box-shadow: 0 0 7px var(--stage-color); }
.kanban-head strong { font-size: 11px; }
.kanban-head span { margin-left: auto; color: var(--muted); font-size: 9px; }
.kanban-cards { padding: 10px; display: grid; gap: 9px; }
.deal-card { padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg,var(--surface-high),var(--surface)); box-shadow: var(--shadow-sm),inset 0 1px rgba(255,255,255,.65); cursor: grab; }
.deal-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.deal-card h4 { margin: 0 0 7px; font-size: 11px; }
.deal-contact { color: var(--muted); font-size: 9px; }
.deal-foot { margin-top: 12px; padding-top: 9px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.deal-value { color: var(--success); font: 700 11px "Outfit",sans-serif; }

/* Login */
.auth-page { min-height: 100vh; padding: 28px; display: grid; place-items: center; background: radial-gradient(circle at 12% 10%,color-mix(in srgb,var(--primary) 22%,transparent),transparent 30%),radial-gradient(circle at 88% 90%,color-mix(in srgb,var(--secondary) 18%,transparent),transparent 26%),var(--canvas); }
.auth-shell { width: min(1050px,100%); min-height: 650px; display: grid; grid-template-columns: 1.08fr .92fr; border: 1px solid rgba(255,255,255,.7); border-radius: 28px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-lg); }
.auth-visual { padding: 52px; position: relative; overflow: hidden; color: #fff; background: radial-gradient(circle at 80% 20%,color-mix(in srgb,var(--primary) 40%,transparent),transparent 32%),linear-gradient(145deg,#141d31,#283753); }
.auth-visual::after { content:""; position:absolute; width:310px; height:310px; left:-100px; bottom:-130px; border:60px solid rgba(255,255,255,.035); border-radius:50%; }
.auth-brand { display:flex; align-items:center; gap:12px; font:700 19px "Outfit",sans-serif; }
.auth-visual-copy { max-width: 430px; margin-top: 110px; position: relative; z-index: 1; }
.auth-visual-copy .eyebrow { color: #8edfd2; }
.auth-visual-copy h1 { margin: 10px 0 16px; font: 700 clamp(32px,4vw,49px)/1.03 "Outfit",sans-serif; letter-spacing: -.04em; }
.auth-visual-copy p { color: #bac5d9; line-height: 1.7; }
.auth-points { margin-top: 28px; display: grid; gap: 12px; }
.auth-point { display:flex; align-items:center; gap:10px; color:#d8e0ef; font-size:11px; }
.auth-point i { width:29px; height:29px; display:grid; place-items:center; color:#8edfd2; border:1px solid rgba(255,255,255,.12); border-radius:9px; background:rgba(255,255,255,.06); }
.auth-form-area { padding: 52px; display:grid; place-items:center; background:linear-gradient(150deg,var(--surface-high),var(--surface)); }
.auth-form { width:100%; max-width:360px; }
.auth-form .eyebrow { color:var(--primary); }
.auth-form h2 { margin:8px 0; font:700 29px "Outfit",sans-serif; letter-spacing:-.03em; }
.auth-form > p { margin:0 0 26px; color:var(--muted); font-size:11px; }
.auth-form .field { margin-bottom:16px; }
.password-field { position:relative; }
.password-field input { padding-right:45px !important; }
.password-field button { position:absolute; right:7px; top:5px; width:33px; height:33px; border:0; color:var(--muted); background:transparent; }
.auth-submit { width:100%; margin-top:7px; }
.auth-switch { margin-top:20px; padding-top:18px; border-top:1px solid var(--line); text-align:center; color:var(--muted); font-size:10px; }
.auth-switch a { color:var(--primary); font-weight:800; text-decoration:none; }

.sidebar-backdrop { display: none; }

@media (max-width: 1250px) {
    .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .attendance-shell { grid-template-columns: 280px minmax(420px,1fr); }
    .contact-panel { display: none; }
}
@media (max-width: 1020px) {
    :root { --sidebar-width: 250px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .user-copy { display: none; }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-105%); transition: transform .25s ease; box-shadow: 20px 0 50px rgba(0,0,0,.28); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop { position:fixed; z-index:99; inset:0; background:rgba(5,10,20,.52); backdrop-filter:blur(2px); }
    body.sidebar-open .sidebar-backdrop { display:block; }
    .workspace { margin-left:0; }
    .mobile-menu { display:inline-grid; }
    .attendance-shell { grid-template-columns: 265px minmax(380px,1fr); }
    .auth-shell { grid-template-columns:1fr; min-height:auto; }
    .auth-visual { display:none; }
    .auth-form-area { min-height:620px; }
}
@media (max-width: 650px) {
    :root { --topbar-height: 70px; }
    .topbar { padding: 0 15px; }
    .topbar-actions { gap:6px; }
    .topbar-actions > .icon-button:first-child { display:none; }
    .user-menu { padding:5px; }
    .user-menu .logout-link { display:none; }
    .page-heading h1 { font-size:18px; }
    .page-heading p { display:none; }
    .content-area { padding:16px 13px 28px; }
    .metrics-grid { grid-template-columns:1fr 1fr; gap:11px; }
    .metric-card { min-height:118px; padding:14px; }
    .metric-card strong { font-size:23px; }
    .metric-icon { width:38px; height:38px; }
    .page-actions { align-items:stretch; flex-direction:column; }
    .search-box { width:100%; }
    .form-grid { grid-template-columns:1fr; }
    .field-full { grid-column:auto; }
    .surface { border-radius:17px; }
    .surface-head { padding:15px; }
    .crud-form { padding:16px; }
    .data-table thead { display:none; }
    .data-table,.data-table tbody,.data-table tr,.data-table td { display:block; width:100%; }
    .data-table tr { padding:12px 14px; border-bottom:1px solid var(--line); }
    .data-table td { padding:6px 0; border:0; display:flex; justify-content:space-between; gap:15px; text-align:right; }
    .data-table td::before { content:attr(data-label); color:var(--muted); font-size:8px; font-weight:800; text-transform:uppercase; }
    .data-table .row-actions { padding-top:10px; justify-content:flex-end; }
    .data-table .row-actions::before { display:none; }
    .attendance-shell { height:calc(100vh - var(--topbar-height) - 32px); min-height:520px; display:block; border-radius:17px; }
    .conversation-list { height:100%; border:0; }
    .conversation-pane { display:none; height:100%; }
    .attendance-shell.chat-active .conversation-list { display:none; }
    .attendance-shell.chat-active .conversation-pane { display:flex; }
    .chat-back { display:inline-grid !important; }
    .messages { padding:15px 11px; }
    .message-bubble { max-width:86%; }
    .auth-page { padding:0; }
    .auth-shell { min-height:100vh; border:0; border-radius:0; }
    .auth-form-area { padding:32px 23px; }
}
@media (max-width: 420px) {
    .metrics-grid { grid-template-columns:1fr; }
    .topbar .notification-button { display:none; }
    .page-heading h1 { max-width:190px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
}
