@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg: #f4f5fb;
    --surface: #ffffff;
    --surface-soft: #fafafe;
    --border: #ebedf7;
    --text: #1f2433;
    --text-muted: #8086a3;
    --primary: #7367f0;
    --primary-hover: #6558f5;
    --success-bg: #e8f9ef;
    --success-text: #1f9d5a;
    --warning-bg: #fff6e6;
    --warning-text: #c77817;
    --danger-bg: #ffecec;
    --danger-text: #db3c55;
    --info-bg: #eaf3ff;
    --info-text: #2f74d0;
    --shadow-sm: 0 6px 20px rgba(15, 23, 42, 0.05);
    --radius: 14px;
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

.ajax-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, #7367f0, #43c2f2);
    z-index: 1400;
    box-shadow: 0 2px 10px rgba(115, 103, 240, 0.4);
    opacity: 0;
    transition: width 0.2s ease, opacity 0.2s ease;
}

body.ajax-busy .ajax-progress {
    opacity: 1;
    width: 72%;
}

body.app-ready .page-loader {
    opacity: 0;
    visibility: hidden;
}

h1, h2, h3, h4 {
    margin: 0 0 10px;
    color: #171b2d;
    font-weight: 600;
}
h1 { font-size: 28px; }
h2 { font-size: 23px; }
h3 { font-size: 18px; }
h4 { font-size: 15px; }
p { margin: 0 0 10px; }
.muted { color: var(--text-muted); }
label,
.auto-field-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #5f6788;
    line-height: 1.25;
}

.card h3::before {
    content: "◉";
    display: inline-block;
    margin-right: 8px;
    color: #8c83f4;
    font-size: 12px;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 272px;
    height: 100vh;
    background: #fdfdff;
    border-right: 1px solid var(--border);
    padding: 18px 14px;
    overflow-y: auto;
    z-index: 1010;
}

.menu:not(.app-sidebar) {
    position: fixed;
    top: 0;
    left: 0;
    width: 252px;
    height: 100vh;
    padding: 18px 12px;
    border-right: 1px solid var(--border);
    background: #fff;
    overflow-y: auto;
    z-index: 1000;
}

.menu:not(.app-sidebar) h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.menu:not(.app-sidebar) a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #555d7b;
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 6px;
}

.menu:not(.app-sidebar) a:hover {
    background: #f2f4ff;
}

.menu:not(.app-sidebar) a.active {
    background: #ecebff;
    border-color: #ddd9ff;
    color: #4d43d2;
    font-weight: 600;
}

.menu-brand { padding: 8px 10px 12px; }
.brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 10px;
    display: block;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #eceff8;
    padding: 4px;
}
.menu-brand h3 {
    margin: 0;
    color: #292c4f;
    font-size: 20px;
    letter-spacing: 0.2px;
}
.menu-brand p {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.menu-group {
    margin: 6px 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}
.menu-group summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 12px;
    font-weight: 600;
    color: #454b66;
    border-bottom: 1px solid transparent;
}
.menu-group[open] summary { border-bottom-color: var(--border); }
.menu-group summary::-webkit-details-marker { display: none; }
.menu-group a {
    display: flex;
    align-items: center;
    margin: 6px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 8px 10px;
    text-decoration: none;
    color: #515673;
    font-size: 13px;
}
.menu-group a:hover { background: #f2f4ff; }
.menu-group a.active {
    background: #ecebff;
    border-color: #ddd9ff;
    color: #4d43d2;
    font-weight: 600;
}

.menu-section-icon,
.menu-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    text-align: center;
    color: #8e94b2;
    font-size: 11px;
    vertical-align: middle;
}

.menu-icon-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.menu-icon-svg svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.menu-logout {
    display: flex;
    align-items: center;
    margin: 10px 6px 0;
    padding: 9px 10px;
    border-radius: 10px;
    background: var(--danger-bg);
    border: 1px solid #ffd3d9;
    text-decoration: none;
    color: var(--danger-text);
    font-weight: 600;
}

.app-topbar {
    position: fixed;
    top: 0;
    left: 272px;
    right: 0;
    height: 72px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    z-index: 1005;
}
.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #2d3251;
}
.topbar-brand strong {
    font-size: 13px;
    max-width: 132px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 8px;
}
.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 300px;
}
.topbar-search input {
    margin: 0;
    width: 340px;
    border: 1px solid #ebeef8;
    border-radius: 12px;
    background: #f8f9fe;
    padding: 10px 12px;
}
.topbar-search button {
    width: auto;
    margin: 0;
    border-radius: 10px;
    padding: 9px 12px;
    background: var(--primary);
    border: 1px solid var(--primary);
    color: #fff;
}

.topbar-icon-btn {
    border: 1px solid #ebeef8;
    background: #fff;
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #666d8d;
    text-decoration: none;
    cursor: pointer;
    margin: 0;
}

.topbar-icon-svg svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}
.topbar-chip {
    text-decoration: none;
    border-radius: 10px;
    border: 1px solid #ddd9ff;
    background: #f0efff;
    color: #4d43d2;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
}

.topbar-profile {
    display: flex;
    align-items: center;
    gap: 8px;
}
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #edeaff;
    color: #4d43d2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.profile-meta small {
    color: var(--text-muted);
    display: block;
    line-height: 1.2;
}

.container {
    margin-left: 272px;
    max-width: calc(100% - 272px);
    padding: 18px 22px;
}
.app-content { padding-top: 90px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    animation: cardIn 260ms ease both;
}
.card-soft { background: var(--surface-soft); }
.card-success { border-left: 4px solid var(--success-text); }
.card-error { border-left: 4px solid var(--danger-text); }
.onboarding-hero {
    border: 1px solid #e7e8f7;
    background: linear-gradient(180deg, #ffffff 0%, #fafaff 100%);
}

.page-intro {
    position: relative;
    overflow: hidden;
    padding: 22px;
}

.page-intro::after {
    content: "";
    position: absolute;
    right: -40px;
    top: -40px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(115, 103, 240, 0.13) 0%, rgba(115, 103, 240, 0) 70%);
    pointer-events: none;
}

.page-intro h2 {
    margin-bottom: 8px;
}

.page-intro p {
    max-width: 760px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.grid-two,
.two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi-label {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 5px;
}
.kpi-big,
.kpi-card strong,
.card-soft strong { font-size: 26px; font-weight: 700; }
.label-inline {
    display: inline-block;
    margin-bottom: 6px;
    color: #677090;
    font-size: 12px;
}

.actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.actions-compact a,
.actions-compact button {
    padding: 7px 10px;
    font-size: 12px;
}
.actions a,
.actions button,
a.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin: 0;
    padding: 9px 12px;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid #e2e5f2;
    background: #fff;
    color: #4a4f67;
    font-size: 13px;
    cursor: pointer;
}
.actions a:hover,
.actions button:hover,
a.btn:hover,
button.btn:hover {
    border-color: #cfd4ec;
    background: #f8f9ff;
}

.btn-primary,
.actions .btn-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}
.btn-primary:hover {
    background: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
}
.btn-danger,
.actions .btn-danger,
.actions a.danger {
    background: var(--danger-bg) !important;
    border-color: #ffd7dd !important;
    color: var(--danger-text) !important;
}

input, select, textarea, button {
    width: 100%;
    border: 1px solid #e1e5f2;
    border-radius: 12px;
    background: #fff;
    padding: 11px 12px;
    margin-bottom: 10px;
    font: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.16s ease, background-color 0.18s ease;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #b8b2ff;
    box-shadow: 0 0 0 4px rgba(115, 103, 240, 0.14);
    transform: translateY(-1px);
}

input:hover, select:hover, textarea:hover {
    border-color: #ccd2ea;
}

input:not(:placeholder-shown),
textarea:not(:placeholder-shown) {
    background: #fff;
}
button {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    cursor: pointer;
}
button:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.field-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field-stack > input,
.field-stack > select,
.field-stack > textarea {
    margin-bottom: 0;
}

.field-stack.is-smart-select {
    position: relative;
}

.smart-select-search {
    margin: 0;
    border: 1px solid #e6e8f6;
    background: #f8f9ff;
    color: #556089;
    padding: 8px 10px;
    border-radius: 10px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.smart-select-search:focus {
    background: #fff;
    border-color: #b8b2ff;
    box-shadow: 0 0 0 4px rgba(115, 103, 240, 0.14);
    outline: none;
}

.field-stack.is-smart-select.is-loading .smart-select-search {
    background-image: linear-gradient(90deg, #f8f9ff 0%, #eef1ff 50%, #f8f9ff 100%);
    background-size: 260% 100%;
    animation: selectPulse 0.9s linear infinite;
}

.filters {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: end;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #edf0fa;
    border-radius: 12px;
    background: #fbfcff;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.filters:focus-within {
    border-color: #dadfff;
    box-shadow: 0 12px 24px rgba(115, 103, 240, 0.08);
    transform: translateY(-1px);
}

.filters .field-stack {
    align-self: stretch;
}

.filters-compact-mode .filter-extra {
    display: none;
}

.filters-compact-mode.filters-expanded .filter-extra {
    display: flex;
}

.filter-more-toggle {
    width: auto;
    margin: 0;
    justify-self: start;
    border: 1px solid #dfe3f6;
    background: #fff;
    color: #5a6286;
    padding: 8px 10px;
}

.guided-form {
    position: relative;
}

.guided-form-shell {
    border: 1px solid #e5e8fb;
    border-radius: 12px;
    background: linear-gradient(180deg, #f9faff 0%, #f2f4ff 100%);
    padding: 10px 12px;
    margin-bottom: 12px;
}

.guided-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.guided-form-title {
    color: #40486c;
    font-size: 12px;
    font-weight: 700;
}

.guided-form-meta {
    color: #6f7699;
    font-size: 11px;
    font-weight: 600;
}

.guided-progress {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(115, 103, 240, 0.14);
    overflow: hidden;
}

.guided-progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7367f0, #43c2f2);
    transition: width 0.22s ease;
}

.guided-step-dots {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.guided-step-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    border: 0;
    padding: 0;
    margin: 0;
    background: #c8ceeb;
    cursor: pointer;
}

.guided-step-dot.done {
    background: #8f86fa;
}

.guided-step-dot.active {
    width: 22px;
    background: #7367f0;
}

.guided-field {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.guided-hidden {
    display: none !important;
    opacity: 0;
    transform: translateY(5px);
}

.guided-visible {
    animation: guidedIn 0.2s ease both;
}

.guided-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.guided-prev,
.guided-next {
    width: auto;
    margin: 0;
    padding: 8px 12px;
}

.guided-prev {
    background: #fff;
    border-color: #dfe4f6;
    color: #596286;
}

.guided-next {
    background: #7367f0;
    border-color: #7367f0;
    color: #fff;
}

.guided-submit-hidden {
    display: none !important;
}

.inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.inline-form input,
.inline-form select,
.inline-form button { width: auto; margin: 0; }
.inline-form input { min-width: 220px; }

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #eceff8;
    border-radius: 12px;
    overflow: hidden;
}

.table-shell {
    border: 1px solid #edf0fa;
    border-radius: 14px;
    padding: 10px;
    background: #fcfcff;
    overflow-x: auto;
}
th {
    background: #f8f9ff;
    color: #545a78;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

th.sortable-th {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 22px;
}

th.sortable-th::after {
    content: "↕";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #a0a7c4;
}

th.sortable-th.sort-asc::after {
    content: "↑";
    color: #7367f0;
}

th.sortable-th.sort-desc::after {
    content: "↓";
    color: #7367f0;
}
th, td {
    padding: 11px 12px;
    border-bottom: 1px solid #f0f2fb;
    text-align: left;
    vertical-align: middle;
}
tbody tr:hover { background: #fafbff; }

.pagination {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.section-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.section-split h3 {
    margin-bottom: 0;
}
.pagination a {
    text-decoration: none;
    border: 1px solid #e2e5f2;
    border-radius: 9px;
    padding: 7px 10px;
    color: #4d536f;
    background: #fff;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
}
.badge.online, .badge.active, .badge.paid, .badge.running, .badge.completed, .badge.sent, .badge.read, .badge.won {
    background: var(--success-bg);
    color: var(--success-text);
}
.badge.pending, .badge.paused, .badge.draft, .badge.scheduled {
    background: var(--warning-bg);
    color: var(--warning-text);
}
.badge.open, .badge.in_progress, .badge.waiting_human, .badge.new, .badge.qualified, .badge.proposal, .badge.negotiation, .badge.normal, .badge.inbound, .badge.outbound {
    background: var(--info-bg);
    color: var(--info-text);
}
.badge.blocked, .badge.cancelled, .badge.failed, .badge.error, .badge.overdue, .badge.lost, .badge.high, .badge.urgent, .badge.critical, .badge.inactive {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.progress-track {
    width: 100%;
    height: 10px;
    background: #eceeff;
    border-radius: 999px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #4fc5ff 100%);
}

.step-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #dfdcff;
    background: #f3f1ff;
    color: #5a4ed4;
    font-size: 12px;
}
.chip-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid #eceff8;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #fff;
}
.checklist li.done {
    border-color: #d4f2e2;
    background: #f5fff9;
}

.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #eef1f8;
}
.activity-list li:last-child { border-bottom: none; }

.empty-state {
    border: 1px dashed #d7dcf0;
    background: #fafbff;
    color: #667099;
    border-radius: 12px;
    padding: 12px;
}

.advanced-box {
    margin: 10px 0;
    border: 1px dashed #d5dbf0;
    border-radius: 12px;
    background: #fbfcff;
    padding: 8px 10px;
}
.advanced-box summary {
    cursor: pointer;
    font-weight: 600;
    color: #4f5676;
}
.advanced-content { margin-top: 10px; }

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.choice-grid-3 { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.choice-card {
    border: 1px solid #e0e4f4;
    border-radius: 12px;
    background: #fff;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.choice-card input { width: auto; margin: 0; }

.status-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.conversation-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
}

.conversation-list {
    display: grid;
    gap: 8px;
}

.conversation-item {
    border: 1px solid #eceffa;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
    display: grid;
    gap: 8px;
}

.conversation-item:hover {
    border-color: #d8dcf6;
    background: #fafbff;
}

.conversation-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.conversation-head strong {
    display: block;
}

.conversation-meta {
    color: #7c84a6;
    font-size: 12px;
}

.conversation-snippet {
    color: #505774;
    margin: 0;
}
.chat-timeline {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 4px;
}
.chat-row { display: flex; margin-bottom: 10px; }
.chat-row.inbound { justify-content: flex-start; }
.chat-row.outbound { justify-content: flex-end; }
.chat-row.system { justify-content: center; }
.chat-bubble {
    max-width: 78%;
    border-radius: 12px;
    border: 1px solid #e5e8f4;
    background: #fff;
    padding: 10px 12px;
}

.chat-bubble .meta strong {
    text-transform: capitalize;
}

.summary-grid {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.summary-grid .summary-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid #edf0fa;
    background: #fcfcff;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
}

.deferred-async {
    position: relative;
}

.deferred-async.is-loading {
    opacity: 0.75;
}

.deferred-async.is-loading::after {
    content: attr(data-loading-text);
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #7a83a8;
}
.chat-row.outbound .chat-bubble {
    background: #f2f0ff;
    border-color: #ddd9ff;
}
.chat-row.system .chat-bubble {
    background: #fff8e9;
    border-color: #ffe7b7;
}
.chat-bubble .meta {
    color: #7d84a5;
    font-size: 12px;
    margin-bottom: 4px;
}
.chat-bubble .content {
    white-space: normal;
    word-break: break-word;
}
.conversation-sidebar .summary-text { white-space: pre-wrap; }

.qr-preview {
    max-width: 320px;
    width: 100%;
    border-radius: 12px;
    border: 1px solid #eceff9;
    padding: 8px;
    background: #fff;
}

.qr-live-status {
    margin-bottom: 8px;
}

.notification-list { list-style: none; margin: 0; padding: 0; }
.notification-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    border: 1px solid #eceff8;
    border-radius: 12px;
    padding: 10px;
    background: #fff;
    margin-bottom: 10px;
}
.notification-icon {
    border: 1px solid #dce1f2;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
    color: #636c8f;
    height: fit-content;
}
.notification-head {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.notification-critical { border-left: 4px solid #e2526f; }
.notification-high { border-left: 4px solid #e2a036; }
.notification-medium { border-left: 4px solid #4f8ce3; }
.notification-low { border-left: 4px solid #a2abc6; }

.auth-page { background: linear-gradient(135deg, #eef0ff 0%, #f7f8ff 100%); }
.auth-page .container { margin-left: auto; max-width: 100%; }
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}
.auth-brand {
    padding: 60px;
    background: linear-gradient(145deg, #7b6eff 0%, #5e7cf7 55%, #43c2f2 100%);
    color: #fff;
}
.auth-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 6px;
    margin-bottom: 14px;
}
.auth-brand h1 { color: #fff; font-size: 36px; margin-bottom: 14px; }
.auth-brand p {
    color: rgba(255, 255, 255, 0.9);
    max-width: 520px;
}
.auth-box-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 22px;
}
.auth-box {
    width: 100%;
    max-width: 420px;
}
.auth-box .card { padding: 24px; }

.floating-alerts {
    position: fixed;
    top: 84px;
    right: 16px;
    z-index: 1200;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100% - 24px));
}

.mobile-tabbar {
    display: none;
}

.floating-alert {
    border: 1px solid #e7eaf8;
    background: #fff;
    color: #394060;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    padding: 10px 12px;
    font-size: 13px;
    animation: toastIn 220ms ease both;
}

.floating-alert.success {
    border-left: 4px solid var(--success-text);
}

.floating-alert.error {
    border-left: 4px solid var(--danger-text);
}

.floating-alert.hide {
    animation: toastOut 220ms ease forwards;
}

.page-loader {
    position: fixed;
    inset: 0;
    background: rgba(244, 245, 251, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1300;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.page-loader .spinner {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid #dadff6;
    border-top-color: var(--primary);
    animation: spin 0.85s linear infinite;
}

button.is-loading {
    opacity: 0.85;
    pointer-events: none;
}

button.is-loading::after {
    content: " ...";
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes selectPulse {
    0% { background-position: 0 0; }
    100% { background-position: 120% 0; }
}

@keyframes cardIn {
    from { transform: translateY(8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes guidedIn {
    from { transform: translateY(5px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes toastIn {
    from { transform: translateY(-6px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-8px); opacity: 0; }
}

@keyframes tabbarIn {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 1200px) {
    .topbar-search input { width: 240px; }
}

@media (max-width: 980px) {
    .app-sidebar,
    .menu:not(.app-sidebar) {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 268px;
        background: #fff;
        border-right: 1px solid var(--border);
        padding: 14px 12px;
        z-index: 1110;
        transform: translateX(-106%);
        transition: transform 0.28s ease;
        overflow-y: auto;
    }
    body.sidebar-open .app-sidebar,
    body.sidebar-open .menu:not(.app-sidebar) { transform: translateX(0); }
    .app-topbar {
        left: 0;
        padding: 10px 14px;
    }
    .topbar-search { min-width: 0; }
    .topbar-search input { width: 150px; }
    .topbar-search button,
    .topbar-chip,
    .profile-meta { display: none; }
    .topbar-brand strong { display: none; }
    .container {
        margin-left: 0;
        max-width: 100%;
        padding: 14px;
        padding-bottom: calc(94px + env(safe-area-inset-bottom));
    }
    .app-content { padding-top: 84px; }
    .two-col,
    .grid-two,
    .status-row,
    .conversation-layout,
    .auth-shell { grid-template-columns: 1fr; }

    .section-split {
        flex-direction: column;
        align-items: flex-start;
    }
    .auth-brand { padding: 26px 20px; }
    .chat-bubble { max-width: 96%; }
    table {
        min-width: 680px;
    }
    .floating-alerts {
        left: 12px;
        right: 12px;
        width: auto;
        top: 74px;
    }
    label,
    .auto-field-label {
        font-size: 11px;
        line-height: 1.2;
    }
    .smart-select-search {
        padding: 9px 10px;
    }
    .mobile-tabbar {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        z-index: 1190;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px;
        padding: 8px;
        border-radius: 18px;
        border: 1px solid #e7eafd;
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: blur(10px);
        box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
        animation: tabbarIn 0.25s ease both;
    }
    .mobile-tab-item {
        border: 0;
        background: transparent;
        color: #6b7394;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        border-radius: 12px;
        gap: 3px;
        margin: 0;
        padding: 7px 4px;
        min-height: 52px;
        transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-tab-item:active {
        transform: scale(0.96);
    }
    .mobile-tab-item.active {
        background: #efeeff;
        color: #4d43d2;
    }
    .mobile-tab-item.active .mobile-tab-icon {
        transform: translateY(-1px);
    }
    .mobile-tab-icon {
        width: 19px;
        height: 19px;
        display: inline-flex;
        transition: transform 0.18s ease;
    }
    .mobile-tab-icon svg {
        width: 19px;
        height: 19px;
        fill: currentColor;
    }
    .mobile-tab-label {
        font-size: 10px;
        font-weight: 600;
        line-height: 1.1;
        white-space: nowrap;
    }
    .mobile-tab-button {
        width: 100%;
    }
    .menu-brand {
        margin-bottom: 8px;
    }
    .guided-form-shell {
        padding: 9px 10px;
    }
    .guided-form-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }
    .guided-nav {
        position: sticky;
        bottom: 80px;
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid #eceffd;
        border-radius: 12px;
        padding: 7px;
        backdrop-filter: blur(8px);
    }
    .guided-prev,
    .guided-next {
        flex: 1;
        justify-content: center;
    }
}
