/* 
   Civic CRM - Premium Glassmorphism Design System 
   Typography: Inter 
   Color Palette: Slate / True Blue
*/

:root {
    /* Color Palette */
    --bg-dark: #0f172a;
    --bg-gradient: linear-gradient(145deg, #0b1120 0%, #1e293b 100%);

    /* Glassmorphism settings */
    --glass-bg: rgba(5, 7, 106, 0.45);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    /* Typography */
    --text-primary: #e2f991;
    --text-sec: #94a3b8;
    --text-muted: #64748b;

    /* Accents */
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --button-blue: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    --button-blue-hover: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
    --button-blue-border: #93c5fd;
    --ui-rest-shadow: 0 4px 12px rgba(2, 6, 23, 0.28);
    --ui-hover-shadow: 0 16px 34px rgba(2, 6, 23, 0.42);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

html {
    scrollbar-color: #60a5fa #0f2746;
    scrollbar-width: auto;
}

*::-webkit-scrollbar {
    width: 18px;
    height: 18px;
}

*::-webkit-scrollbar-track {
    background: #0f2746;
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    border-radius: 999px;
    border: 3px solid #0f2746;
}

*::-webkit-scrollbar-corner {
    background: #0f2746;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #ffffff;
    color: #111827;
}

.login-shell {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-stack {
    width: min(420px, 100%);
    display: grid;
    justify-items: center;
    gap: 18px;
}

.login-brand {
    display: grid;
    justify-items: center;
    gap: 10px;
}

.login-card {
    width: min(420px, 100%);
    padding: 28px 28px 24px;
    border-radius: 22px;
    text-align: center;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.12);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
}

.login-media-stage {
    position: relative;
    width: 150px;
    height: 150px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.login-media {
    position: absolute;
    inset: 0;
    width: 150px;
    height: 150px;
    object-fit: contain;
    display: none;
}

.login-media.is-visible {
    display: block;
}

.login-media-image {
    filter: drop-shadow(0 10px 22px rgba(15, 23, 42, 0.14));
}

.login-media-video {
    background: #ffffff;
}

.login-status-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid #111827;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
}

.login-status-bubble.is-success {
    background: #16a34a;
}

.login-status-bubble.is-error {
    background: #dc2626;
}

.login-brand-title {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.03em;
    text-align: center;
}

.login-subtitle {
    color: #475569;
    margin-bottom: 18px;
    font-size: 14px;
}

.login-form {
    display: grid;
    gap: 9px;
    text-align: left;
}

.login-label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.login-input {
    width: 100%;
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.16);
    background: #ffffff !important;
    color: #111827;
    font-size: 15px;
}

.login-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.login-submit {
    width: 100%;
    justify-content: center;
    margin-top: 10px;
}

.login-error {
    margin-bottom: 14px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(220, 38, 38, 0.24);
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
    font-size: 13px;
    font-weight: 600;
}

.login-helper-text {
    margin-top: 12px;
    color: #64748b;
    font-size: 12px;
    text-align: center;
}

.login-video-preload {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Base Glassmorphism Class */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    border-right: 1px solid var(--glass-border);
    border-radius: 0;
    /* Override generic glass radius for edge */
    z-index: 100;
    transition: width 0.18s ease, padding 0.18s ease;
    position: relative;
    min-width: 0;
}

.sidebar-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.sidebar-toggle {
    margin-top: 4px;
    flex: 0 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 20px 8px;
    position: relative;
}

.logo-mark {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex: 0 0 auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
    transform-origin: 50% 50%;
}

html.app-is-loading .logo-mark {
    animation: crm-logo-spin 0.85s linear infinite;
    filter: drop-shadow(0 6px 14px rgba(250, 204, 21, 0.35));
}

@keyframes crm-logo-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.logo-title {
    font-size: 24px;
    line-height: 1;
    font-weight: 800;
    color: #facc15;
    letter-spacing: -0.4px;
}

.logo-subtitle {
    margin-top: 4px;
    font-size: 15px;
    line-height: 1;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-sec);
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links li a i {
    font-size: 20px;
}

.nav-links li a:hover,
.nav-links li a.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.dashboard-comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.dashboard-comparison-card {
    padding: 14px 16px;
}

.dashboard-comparison-topline {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.dashboard-comparison-title {
    margin-bottom: 4px;
}

.dashboard-comparison-subtitle {
    color: var(--text-sec);
    font-size: 13px;
}

.dashboard-compare-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.dashboard-compare-header {
    margin-bottom: 8px;
}

.dashboard-compare-panel-heading {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #bfdbfe;
}

.dashboard-compare-panel {
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: grid;
    gap: 10px;
}

.dashboard-compare-statline {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    color: var(--text-sec);
    flex-wrap: wrap;
}

.dashboard-compare-statline strong {
    color: #f8fafc;
    font-size: 17px;
}

.dashboard-compare-baseline {
    color: var(--text-muted);
}

.dashboard-compare-diff {
    margin-left: auto;
    font-weight: 700;
}

.dashboard-compare-diff.is-up {
    color: var(--success);
}

.dashboard-compare-diff.is-down {
    color: var(--danger);
}

.dashboard-compare-bars {
    display: grid;
    gap: 8px;
}

.dashboard-mini-bar {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 44px;
    gap: 8px;
    align-items: center;
}

.dashboard-mini-bar-label,
.dashboard-mini-bar-value {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-sec);
}

.dashboard-mini-bar-value {
    text-align: right;
}

.dashboard-mini-bar-track {
    height: 9px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    overflow: hidden;
}

.dashboard-mini-bar-fill {
    height: 100%;
    border-radius: 999px;
}

.dashboard-mini-bar-fill.is-sold {
    background: linear-gradient(90deg, #38bdf8 0%, #2563eb 100%);
}

.dashboard-mini-bar-fill.is-paid {
    background: linear-gradient(90deg, #34d399 0%, #10b981 100%);
}

@media (max-width: 980px) {
    .dashboard-comparison-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .dashboard-compare-columns {
        grid-template-columns: 1fr;
    }
}

.nav-links li a.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    box-shadow: inset 3px 0 0 0 var(--accent);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
    width: 100%;
    background: transparent;
    border-left: none;
    border-right: none;
    border-bottom: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
    min-width: 0;
    position: relative;
}

.user-profile-stack {
    display: grid;
    gap: 6px;
    margin-top: auto;
}

.user-admin-indicator {
    justify-self: flex-start;
    padding: 2px 8px;
    border-radius: 999px;
    background: linear-gradient(180deg, #facc15 0%, #f59e0b 100%);
    color: #111827;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: 0 8px 18px rgba(250, 204, 21, 0.18);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-sec);
}

.user-profile-panel {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 76px;
    width: auto;
    max-width: calc(100vw - 48px);
    min-width: 320px;
    padding: 14px;
    border-radius: 18px;
    display: grid;
    gap: 12px;
    z-index: 130;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94));
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.52);
}

.user-profile-panel[hidden] {
    display: none !important;
}

.user-profile-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.user-profile-panel-head strong {
    display: block;
    font-size: 15px;
    color: #f8fafc;
}

.user-profile-panel-head span {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: #93c5fd;
}

.user-profile-close {
    width: 32px;
    height: 32px;
    padding: 0;
}

.user-profile-form {
    display: grid;
    gap: 10px;
}

.user-profile-change-password-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-self: flex-start;
    padding: 0;
    background: transparent;
    border: none;
    color: #93c5fd;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.user-profile-change-password-link:hover {
    color: #dbeafe;
}

.user-profile-inline-field {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.user-profile-inline-field label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #bfdbfe;
}

.user-profile-admin-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-self: flex-start;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(147, 197, 253, 0.22);
    background: rgba(2, 6, 23, 0.46);
    color: #dbeafe;
    font-size: 12px;
    font-weight: 700;
}

.user-profile-admin-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #facc15;
}

.user-profile-admin-toggle input[type="checkbox"]:disabled + span,
.user-profile-admin-toggle input[type="checkbox"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.user-profile-inline-editable {
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(2, 6, 23, 0.58) !important;
    color: #f8fafc !important;
    font-size: 14px;
    line-height: 1.35;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.user-profile-inline-editable:empty::before {
    content: attr(data-placeholder);
    color: #64748b;
}

.user-profile-inline-editable:hover {
    border-color: rgba(147, 197, 253, 0.28);
    background: rgba(15, 23, 42, 0.72) !important;
}

.user-profile-inline-editable:focus {
    border-color: rgba(250, 204, 21, 0.85);
    box-shadow: inset 0 -1px 0 0 rgba(250, 204, 21, 0.9), 0 0 0 2px rgba(250, 204, 21, 0.08);
    background: rgba(15, 23, 42, 0.78) !important;
}

.user-profile-label {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.user-profile-label span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #bfdbfe;
}

.user-profile-status {
    min-height: 34px;
    padding: 8px 11px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.user-profile-status.is-success {
    background: rgba(22, 163, 74, 0.18);
    color: #dcfce7;
}

.user-profile-status.is-error {
    background: rgba(220, 38, 38, 0.18);
    color: #fee2e2;
}

.user-profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.btn-danger-lite {
    background: linear-gradient(180deg, #fca5a5 0%, #ef4444 100%) !important;
    color: #111827 !important;
    border: 1px solid rgba(248, 113, 113, 0.48) !important;
    text-decoration: none;
}

.btn-danger-lite:hover {
    background: linear-gradient(180deg, #fecaca 0%, #f87171 100%) !important;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
}

html.sidebar-collapsed .sidebar {
    width: 76px;
    padding: 16px 8px;
}

html.sidebar-collapsed .logo {
    padding: 0 0 16px 0;
    justify-content: center;
}

html.sidebar-collapsed .logo-text,
html.sidebar-collapsed .user-details {
    display: none;
}

html.sidebar-collapsed .sidebar-top {
    flex-direction: column;
    align-items: center;
}

html.sidebar-collapsed .nav-links li a {
    justify-content: center;
    padding: 10px 0;
    font-size: 0;
}

html.sidebar-collapsed .nav-links li a i {
    margin: 0;
    font-size: 22px;
}

html.sidebar-collapsed .user-profile {
    justify-content: center;
    padding: 10px 0 0;
}

html.sidebar-collapsed .user-profile-panel {
    left: calc(100% + 10px);
    right: auto;
    bottom: 8px;
    width: min(380px, calc(100vw - 112px));
    min-width: 340px;
}

/* Header */
.top-header {
    height: var(--header-height);
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
    border-radius: 0;
    z-index: 90;
    min-width: 0;
    max-width: 100%;
}

.active-call-bar {
    padding: 12px 18px;
    background: linear-gradient(180deg, rgba(8, 47, 73, 0.98), rgba(15, 23, 42, 0.96));
    border-bottom: 1px solid rgba(96, 165, 250, 0.22);
    box-shadow: 0 16px 32px rgba(2, 6, 23, 0.28);
    z-index: 80;
}

.active-call-bar[hidden] {
    display: none !important;
}

.active-call-bar-main {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    min-width: 0;
}

.active-call-bar-state {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
}

.active-call-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    box-shadow: 0 0 0 4px rgba(255,255,255,0.06), 0 0 16px currentColor;
    flex: 0 0 auto;
}

.active-call-state-copy {
    display: grid;
    gap: 2px;
}

.active-call-state-copy strong {
    color: #f8fafc;
    font-size: 15px;
}

.active-call-state-copy span {
    color: #cbd5e1;
    font-size: 12px;
    line-height: 1.25;
}

.active-call-bar-contact {
    flex: 1 1 280px;
    min-width: 0;
    display: grid;
    gap: 2px;
}

.active-call-contact-name {
    color: #fef3c7;
    font-size: 16px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.active-call-contact-detail {
    color: #e2e8f0;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.active-call-bar-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
    flex-wrap: wrap;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.6);
    padding: 8px 12px;
    border-radius: 8px;
    width: 400px;
    border: 1px solid var(--glass-border);
    transition: border-color 0.3s ease;
}

.search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.search-bar i {
    color: var(--text-sec);
    font-size: 18px;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 14px;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.lookup-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lookup-card {
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 620px;
    overflow: hidden;
}

.lookup-card.is-collapsed {
    min-height: 0;
}

.lookup-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.lookup-tab {
    border: none !important;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.22) !important;
    color: #bfdbfe !important;
    padding: 7px 11px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: none !important;
}

.lookup-tab.is-active {
    background: #facc15 !important;
    color: #111827 !important;
}

.lookup-tabs-updated {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #ecfdf5;
    background: #16a34a;
    box-shadow: 0 0 0 1px rgba(187, 247, 208, 0.3), 0 0 16px rgba(34, 197, 94, 0.28);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
    pointer-events: none;
}

.lookup-tabs-updated.is-visible {
    visibility: visible;
    animation: lookup-updated-flash 1.5s ease-in-out 2;
}

.lookup-panel {
    display: none;
}

.lookup-panel.is-active {
    display: block;
}

.lookup-table-products {
    font-size: 15px;
}

.lookup-table-products thead th {
    font-size: 13px;
}

.lookup-table-products tbody td {
    font-size: 15px;
    padding-top: 12px;
    padding-bottom: 12px;
}

.lookup-event-list {
    display: flex;
    flex-direction: column;
}

.lookup-event-head,
.lookup-event-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 128px;
    gap: 10px;
    align-items: center;
}

.lookup-event-head {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px 10px;
    background: rgba(37, 99, 235, 0.72);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-sec);
}

.lookup-event-row {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(59, 130, 246, 0.09);
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.lookup-event-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.lookup-event-name {
    display: block;
    width: 100%;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.lookup-event-code-wrap {
    display: flex;
    justify-content: flex-end;
    position: relative;
}

.lookup-event-code-picker {
    position: relative;
    width: 96px;
}

.lookup-event-code-button {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.24) !important;
    color: #dbeafe !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.2;
    border: 1px solid rgba(147, 197, 253, 0.25) !important;
    box-shadow: none !important;
    cursor: pointer;
}

.lookup-event-code-caret {
    font-size: 10px;
    opacity: 0.85;
}

.lookup-event-code-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 96px;
    padding: 6px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(147, 197, 253, 0.2);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
    display: none;
    z-index: 20;
}

.lookup-event-code-picker.is-open .lookup-event-code-menu {
    display: grid;
    gap: 4px;
}

.lookup-event-code-option {
    border: none !important;
    border-radius: 10px;
    background: transparent !important;
    color: #dbeafe !important;
    padding: 8px 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    box-shadow: none !important;
}

.lookup-event-code-option:hover,
.lookup-event-code-option.is-selected {
    background: rgba(59, 130, 246, 0.24) !important;
}

.lookup-event-code-button:focus {
    box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.9) !important;
}

.lookup-section-row td {
    padding: 0 !important;
    border-bottom: none;
    background: transparent;
}

.lookup-section-label {
    display: block;
    padding: 8px 10px 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #bfdbfe;
}

.lookup-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
}

.lookup-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.lookup-collapse-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none !important;
    border-radius: 999px;
    background: rgba(250, 204, 21, 0.16) !important;
    color: #fde68a !important;
    cursor: pointer;
    flex: 0 0 auto;
    transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease;
    box-shadow: none !important;
}

.lookup-collapse-toggle:hover {
    background: rgba(250, 204, 21, 0.28) !important;
    color: #fef9c3 !important;
}

.lookup-card-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.lookup-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lookup-count {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #111827;
    background: #facc15;
    box-shadow: var(--ui-rest-shadow);
    transition: box-shadow 0.22s ease, filter 0.22s ease, background 0.22s ease;
}

.lookup-updated-indicator {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #ecfdf5;
    background: #16a34a;
    box-shadow: 0 0 0 1px rgba(187, 247, 208, 0.3), 0 0 16px rgba(34, 197, 94, 0.28);
    opacity: 0;
    transform: scale(0.88);
    pointer-events: none;
    visibility: hidden;
}

.lookup-updated-indicator.is-visible {
    visibility: visible;
    animation: lookup-updated-flash 1.5s ease-in-out 2;
}

@keyframes lookup-updated-flash {
    0%,
    100% {
        opacity: 0;
        transform: scale(0.88);
    }
    20%,
    60% {
        opacity: 1;
        transform: scale(1);
    }
    40%,
    80% {
        opacity: 0.28;
        transform: scale(0.94);
    }
}

.lookup-scroll {
    overflow: auto;
    max-height: 640px;
    scrollbar-color: #facc15 #1d4ed8;
    scrollbar-width: thin;
    transition: max-height 0.22s ease, opacity 0.18s ease, padding 0.18s ease;
}

.lookup-card.is-collapsed .lookup-scroll {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.lookup-scroll::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.lookup-scroll::-webkit-scrollbar-track {
    background: #1d4ed8;
    border-radius: 999px;
}

.lookup-scroll::-webkit-scrollbar-thumb {
    background: #facc15;
    border-radius: 999px;
    border: 2px solid #1d4ed8;
}

.lookup-scroll::-webkit-scrollbar-corner {
    background: #1d4ed8;
}

.lookup-table {
    width: 100%;
    border-collapse: collapse;
}

.lookup-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    padding: 8px 10px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-sec);
    background: rgba(37, 99, 235, 0.72);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lookup-table tbody td {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 13px;
    vertical-align: middle;
    background: rgba(59, 130, 246, 0.09);
}

.lookup-table tbody tr {
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.lookup-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.lookup-id {
    width: 70px;
    color: var(--text-sec);
    font-family: Consolas, "Andale Mono", "Lucida Console", "Courier New", monospace;
}

.lookup-inline {
    box-sizing: border-box;
    display: inline-block;
    width: calc(var(--field-chars, 10) * 0.72ch + 0.45rem);
    min-width: 2rem;
    max-width: 100%;
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    color: var(--text-primary) !important;
    padding: 2px 0;
    outline: none;
    font-size: 14px;
    line-height: 1.25;
    transition: border-color 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}

.lookup-editable {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    cursor: text;
}

.lookup-inline:hover {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

.lookup-inline:focus {
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: inset 0 -1px 0 0 rgba(250, 204, 21, 0.9) !important;
}

.lookup-inline-muted {
    color: #dbeafe;
}

.lookup-select {
    display: inline-block;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    min-width: 2rem;
    padding-right: 1rem;
}

.lookup-price-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 110px;
}

.lookup-currency {
    color: var(--warning);
    font-weight: 700;
}

.lookup-inline-price {
    text-align: right;
    font-family: Consolas, "Andale Mono", "Lucida Console", "Courier New", monospace;
    min-width: 5ch;
}

.lookup-editable::selection {
    background: rgba(250, 204, 21, 0.16);
    color: var(--text-primary);
}

.lookup-row-saving {
    background: rgba(59, 130, 246, 0.12);
}

.lookup-row-saved {
    background: rgba(16, 185, 129, 0.12);
}

.lookup-row-error {
    background: rgba(239, 68, 68, 0.12);
}

@media (max-width: 1500px) {
    .lookup-card {
        min-height: 420px;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 6px 10px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 2px solid var(--button-blue-border);
    background: var(--button-blue);
    color: #ffffff;
    box-shadow: var(--ui-rest-shadow);
    transition: box-shadow 0.22s ease, color 0.22s ease, border-color 0.22s ease, background 0.22s ease, filter 0.22s ease;
}

.btn-accent {
    background: var(--button-blue);
    color: #ffffff;
    box-shadow: var(--ui-rest-shadow);
}

.btn-accent:hover {
    background: var(--button-blue-hover);
    border-color: #bfdbfe;
}

.btn:hover {
    background: var(--button-blue-hover);
    border-color: #bfdbfe;
    color: #ffffff;
    box-shadow:
        var(--ui-hover-shadow),
        0 0 0 2px rgba(191, 219, 254, 0.10),
        0 0 16px rgba(147, 197, 253, 0.2);
}

/* Pulse Animation for important call-to-actions */
@keyframes pulse-ring {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.pulse {
    animation: pulse-ring 2s infinite;
}

.notification-wrapper {
    position: relative;
    cursor: pointer;
}

.restartcrm-button {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 999px;
    color: #f8fafc;
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(252, 165, 165, 0.22);
}

.restartcrm-button i {
    font-size: 22px;
}

.restartcrm-button:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(252, 165, 165, 0.36);
}

.restartcrm-button.is-busy {
    opacity: 0.72;
    cursor: wait;
    animation: restartcrm-spin 0.9s linear infinite;
}

@keyframes restartcrm-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.notification-button {
    position: relative;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 14px;
    color: #f8fafc;
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(191, 219, 254, 0.2);
    animation: notification-bell-pulse 2.15s ease-in-out infinite;
}

.notification-button i {
    font-size: 28px;
}

@keyframes notification-bell-pulse {
    0% {
        box-shadow:
            0 6px 12px rgba(15, 23, 42, 0.22),
            0 0 0 0 rgba(96, 165, 250, 0.52);
        filter: brightness(1);
    }
    55% {
        box-shadow:
            0 12px 24px rgba(15, 23, 42, 0.28),
            0 0 0 8px rgba(96, 165, 250, 0.0),
            0 0 22px rgba(147, 197, 253, 0.22);
        filter: brightness(1.08);
    }
    100% {
        box-shadow:
            0 6px 12px rgba(15, 23, 42, 0.22),
            0 0 0 0 rgba(96, 165, 250, 0.0);
        filter: brightness(1);
    }
}

.notification-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(380px, calc(100vw - 40px));
    max-height: min(72vh, 640px);
    overflow: auto;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.95));
    box-shadow: 0 28px 70px rgba(2, 6, 23, 0.52);
    z-index: 1200;
}

.notification-panel[hidden] {
    display: none !important;
}

.notification-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.notification-panel-title {
    display: grid;
    gap: 3px;
}

.notification-panel-title strong {
    font-size: 13px;
    color: #f8fafc;
    letter-spacing: 0.02em;
}

.notification-panel-title span {
    font-size: 11px;
    color: #93c5fd;
}

.notification-mark-read {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(147, 197, 253, 0.26);
    background: rgba(59, 130, 246, 0.12);
    color: #dbeafe;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.notification-mark-read:hover {
    background: rgba(59, 130, 246, 0.18);
    color: #eff6ff;
}

.notification-list {
    display: grid;
    gap: 8px;
}

.notification-empty {
    padding: 16px 14px;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.34);
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
}

.notification-item {
    display: grid;
    gap: 6px;
    padding: 11px 12px;
    border-radius: 13px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(15, 23, 42, 0.52);
}

.notification-item.is-unread {
    background: linear-gradient(180deg, rgba(30, 64, 175, 0.18), rgba(15, 23, 42, 0.58));
    border-color: rgba(147, 197, 253, 0.24);
}

.notification-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.notification-item-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(250, 204, 21, 0.16);
    color: #fde68a;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.notification-item-time {
    font-size: 10px;
    color: #94a3b8;
    white-space: nowrap;
}

.notification-item-title {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.25;
}

.notification-item-message {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.35;
}

.btn-icon {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 10px;
    color: var(--text-sec);
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--ui-rest-shadow);
    transition: box-shadow 0.22s ease, color 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.btn-icon:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
    border-color: rgba(191, 219, 254, 0.22);
    box-shadow:
        var(--ui-hover-shadow),
        0 0 0 2px rgba(191, 219, 254, 0.08),
        0 0 14px rgba(147, 197, 253, 0.18);
}

.badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: bold;
    height: 16px;
    min-width: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-dark);
    box-shadow: var(--ui-rest-shadow);
    transition: box-shadow 0.22s ease, filter 0.22s ease;
}

.notification-wrapper:hover .badge,
.notification-wrapper:hover .btn-icon,
.badge:hover,
.btn-icon:hover,
.lookup-count:hover,
.lookup-tabs-updated:hover,
.lookup-updated-indicator:hover,
.lookup-count,
.lookup-tabs-updated,
.lookup-updated-indicator {
    box-shadow:
        var(--ui-hover-shadow),
        0 0 0 2px rgba(191, 219, 254, 0.10),
        0 0 20px rgba(147, 197, 253, 0.24);
}

/* Page Content Area */
.page-content {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    max-width: 100%;
}

/* Cards & Widgets */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 14px;
    min-width: 0;
    max-width: 100%;
}

.glass,
section,
article,
header,
footer,
div,
form {
    min-width: 0;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

table {
    max-width: 100%;
}

th,
td {
    overflow-wrap: anywhere;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* Shared form controls */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea,
label:has(> input[type="checkbox"]) {
    background: #000 !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--glass-border) !important;
}

button.btn,
a.btn,
.btn-secondary {
    background: var(--button-blue) !important;
    color: #ffffff !important;
    border: 2px solid var(--button-blue-border) !important;
}

label:has(> input[type="checkbox"]) {
    background: #000 !important;
    color: var(--text-primary) !important;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"])::placeholder,
textarea::placeholder {
    color: var(--text-sec) !important;
}

select option,
select optgroup {
    background: #000;
    color: var(--text-primary);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Maintenance inline fields intentionally override the global dark form skin. */
.lookup-table input.lookup-inline,
.lookup-table select.lookup-inline {
    background: transparent !important;
    background-color: transparent !important;
    color: var(--text-primary) !important;
    border: none !important;
    box-shadow: none !important;
}

.lookup-table input.lookup-inline:hover,
.lookup-table select.lookup-inline:hover {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

.lookup-table input.lookup-inline:focus,
.lookup-table select.lookup-inline:focus {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: inset 0 -1px 0 0 rgba(250, 204, 21, 0.9) !important;
}
