/* ============================================
   TemplateMo 3D Glassmorphism Dashboard
   https://templatemo.com
   CSS Stylesheet
============================================ */

/* ============================================
   CSS CUSTOM PROPERTIES
============================================ */
/* Every colour lives here, once per mode. Dark mode is navy; light mode is warm parchment.
   Text and controls are chosen to pass WCAG AA contrast (4.5:1 text, 3:1 field outlines). */
:root {
    /* Surfaces */
    --bg: #0b1220;
    /* Sidebar: frosted charcoal glass over the aurora */
    --sidebar-bg: rgba(27, 29, 34, 0.55);
    --sidebar-solid: rgba(27, 29, 34, 0.97);
    --sidebar-text: #f3f4f6;
    --sidebar-text-2: #d4d6db;
    --sidebar-muted: #a7acb6;
    --sidebar-line: rgba(255, 255, 255, 0.2);
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-link: #93c5fd;
    /* Aurora: indigo, violet and magenta glows sweeping across the page */
    --page-glow:
        radial-gradient(ellipse 60% 45% at 15% 25%, rgba(99, 102, 241, 0.18) 0, transparent 70%),
        radial-gradient(ellipse 55% 45% at 55% 55%, rgba(139, 92, 246, 0.2) 0, transparent 70%),
        radial-gradient(ellipse 50% 40% at 95% 85%, rgba(192, 38, 211, 0.16) 0, transparent 70%);
    --surface: #111a2e;
    --surface-raised: #162139;
    --surface-overlay: #18243e;
    --heading-bg: #263555;
    --heading-text: #ffffff;
    --heading-line: #3d5079;
    --hover: #17223a;
    --line: #24324f;
    /* Outlines and shadows for cards, the side panel and pop-ups */
    --card-border: #33466e;
    --panel-border: #4d6396;
    --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.35);
    /* The open call's window: charcoal grey with a deeper shadow, so it sits on top of the card */
    --panel-bg: #232529;
    --call-panel-border: #4a4e56;
    --panel-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
    --line-strong: #2a3a5c;
    --shadow: rgba(0, 0, 0, 0.4);
    --scrim: rgba(3, 7, 18, 0.65);

    /* Text */
    --text-primary: #eef2f8;
    --text-secondary: #b9c4d8;
    --text-muted: #8b97ae;

    /* Blue accent: fills (buttons), text (links) and a soft tint (selected things) */
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-text: #60a5fa;
    --accent-soft: rgba(96, 165, 250, 0.12);
    --on-accent: #ffffff;
    --focus: #60a5fa;

    /* Form fields */
    --input-bg: #18191c;
    --input-border: #6f747d;

    /* Messages and statuses */
    --danger-text: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --success-text: #4ade80;
    --open-text: #c4b5fd;
    --open-bg: rgba(167, 139, 250, 0.16);
    --hold-text: #fbbf24;
    --hold-bg: rgba(251, 191, 36, 0.16);
    --closed-text: #4ade80;
    --closed-bg: rgba(74, 222, 128, 0.16);

    /* Older names used around the stylesheet, mapped onto the scheme above */
    --emerald: var(--accent);
    --emerald-light: var(--accent-text);
    --gold: var(--accent-text);
    --gold-light: var(--accent-text);
    --amber: var(--accent);
    --coral: var(--danger-text);
    --glass-bg: var(--surface);
    --glass-border: var(--line);
    --glass-shadow: var(--shadow);
    --glass-hover: var(--hover);
    --bg-dark: var(--bg);
    --bg-gradient-1: var(--surface-overlay);
    --bg-gradient-2: var(--surface-overlay);
    --bg-gradient-3: var(--surface-overlay);
    --success: var(--success-text);
    --warning: var(--hold-text);
    --info: var(--accent-text);
    --danger: var(--danger-text);

    /* Spacing */
    --sidebar-width: 280px;
    --navbar-height: 70px;
    --border-radius: 20px;
    --card-padding: 24px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    color-scheme: dark;
}

/* Light mode: warm parchment, the same blue */
[data-theme="light"] {
    --bg: #f1ebdf;
    /* Sidebar: the same warm off-white as before, matching the page's own colours */
    --sidebar-bg: #f5f0e6;
    --sidebar-solid: #f5f0e6;
    --sidebar-text: #24211c;
    --sidebar-text-2: #4a443b;
    --sidebar-muted: #686054;
    --sidebar-line: #d3c5ab;
    --sidebar-hover: #f3ede2;
    --sidebar-link: #1d4ed8;
    --page-glow: none;
    --surface: #faf6ee;
    --surface-raised: #f5f0e6;
    --surface-overlay: #fffcf6;
    --heading-bg: #eee6d6;
    --heading-text: #24211c;
    --heading-line: #d8cdb8;
    --hover: #f3ede2;
    --line: #e0d5c1;
    --card-border: #cdbfa6;
    --panel-border: #c9b99b;
    --card-shadow: 0 1px 2px rgba(60, 45, 20, 0.08), 0 4px 14px rgba(60, 45, 20, 0.1);
    /* The open call's window: clean white with a deeper warm shadow */
    --panel-bg: #ffffff;
    --call-panel-border: #c9b99b;
    --panel-shadow: 0 10px 28px rgba(60, 45, 20, 0.18), 0 2px 6px rgba(60, 45, 20, 0.1);
    --line-strong: #d8cdb8;
    --shadow: rgba(60, 45, 20, 0.14);
    --scrim: rgba(36, 33, 28, 0.4);

    --text-primary: #24211c;
    --text-secondary: #4a443b;
    --text-muted: #686054;

    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-text: #1d4ed8;
    --accent-soft: #e6ecf7;
    --on-accent: #ffffff;
    --focus: #2563eb;

    --input-bg: #fffcf6;
    --input-border: #766d5e;

    --danger-text: #b91c1c;
    --danger-soft: #fbe9e7;
    --success-text: #166534;
    --open-text: #5b21b6;
    --open-bg: #ece6fb;
    --hold-text: #8a3c0c;
    --hold-bg: #fbefc9;
    --closed-text: #166534;
    --closed-bg: #dcf3df;

    color-scheme: light;
}

/* ============================================
   RESET & BASE STYLES
============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    font-size: 17px;  /* one size up from the browser's 16px, like every other text size */
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================
   ANIMATED BACKGROUND
============================================ */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
}

.background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: none;
}

/* ============================================
   LAYOUT STRUCTURE
============================================ */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    padding: 24px;
    z-index: 100;
    transition: all var(--transition-normal);
    overflow-y: auto;
}

/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--emerald-light);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 30px;
}

.logo {
    color: var(--on-accent);
    width: 45px;
    height: 45px;
    background: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 21px;
    box-shadow: 0 8px 32px color-mix(in srgb, var(--accent-text) 30%, transparent);
}

.logo-text {
    font-size: 23px;
    font-weight: 600;
    color: var(--text-primary);
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-section {
    margin-bottom: 25px;
    list-style: none;
}

.nav-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 15px;
}

.nav-item {
    margin-bottom: 5px;
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-link:hover {
    background: var(--glass-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent-text);
    font-weight: 500;
}

.nav-icon {
    width: 22px;
    height: 22px;
    opacity: 0.8;
}

.nav-link.active .nav-icon,
.nav-link:hover .nav-icon {
    opacity: 1;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}

/* Sidebar User Profile */
.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-profile:hover {
    background: var(--glass-hover);
}

.user-avatar {
    color: var(--on-accent);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 17px;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 500;
    font-size: 15px;
}

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

/* ============================================
   MAIN CONTENT
============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
}

/* ============================================
   TOP NAVBAR
============================================ */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    gap: 20px;
}

.page-title {
    font-size: 29px;
    font-weight: 600;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-box {
    position: relative;
}

.search-input {
    width: 280px;
    padding: 12px 20px 12px 48px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: all var(--transition-fast);
}

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

.search-input:focus {
    outline: none;
    border-color: var(--emerald-light);
    box-shadow: 0 0 20px color-mix(in srgb, var(--accent-text) 20%, transparent);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.nav-btn {
    width: 45px;
    height: 45px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.nav-btn:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.notification-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: #dc2626;  /* the same red in both modes, so white numbers on it stay readable */
    border-radius: 50%;
}

/* ============================================
   GLASS CARD BASE
============================================ */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: var(--card-padding);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    transform-style: preserve-3d;
    perspective: 1000px;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: none;
}

.glass-card:hover {
    border-color: var(--line-strong);
}

/* 3D Tilt Effect */
.glass-card-3d {
    transition: transform 0.4s cubic-bezier(0.03, 0.98, 0.52, 0.99);
}

.glass-card-3d:hover {
    transform: rotateX(5deg) rotateY(-5deg) translateZ(10px);
}

/* ============================================
   STATS CARDS
============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    position: relative;
}

.stat-card-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.stat-info h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-family: 'Space Mono', monospace;
    font-size: 33px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
}

.stat-change.positive {
    color: var(--success);
    background: rgba(34, 197, 94, 0.15);
}

.stat-change.negative {
    color: var(--danger-text);
    background: color-mix(in srgb, var(--danger-text) 15%, transparent);
}

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Soft tinted squares, the icon drawn in the matching strong colour */
.stat-icon.cyan { background: var(--accent-soft); }
.stat-icon.magenta { background: var(--open-bg); }
.stat-icon.purple { background: var(--hold-bg); }
.stat-icon.success { background: var(--closed-bg); }
.stat-icon.cyan svg { stroke: var(--accent-text); }
.stat-icon.magenta svg { stroke: var(--open-text); }
.stat-icon.purple svg { stroke: var(--hold-text); }
.stat-icon.success svg { stroke: var(--closed-text); }

.stat-icon svg {
    width: 26px;
    height: 26px;
}

/* Sparkline in stat card */
.stat-sparkline {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    opacity: 0.3;
}

/* ============================================
   CONTENT GRID
============================================ */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 30px;
}

/* ============================================
   CHART CARD
============================================ */
.chart-card {
    min-height: 380px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.card-title {
    font-size: 19px;
    font-weight: 600;
}

.card-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.card-btn {
    padding: 8px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.card-btn:hover {
    background: var(--hover);
    border-color: var(--accent-text);
    color: var(--text-primary);
}

/* Main actions and switched-on buttons: solid blue */
.card-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}

.card-btn.active:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--on-accent);
}

/* Chart Container */
.chart-wrapper {
    overflow-x: auto;
    margin: 0 -10px;
    padding: 0 10px;
}

.chart-wrapper::-webkit-scrollbar {
    height: 8px;
}

.chart-wrapper::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.chart-wrapper::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 4px;
}

.chart-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.chart-container {
    height: 250px;
    position: relative;
    display: flex;
    min-width: 500px;
}

.chart-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 0;
    padding-right: 12px;
    text-align: right;
}

.y-value {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
}

.chart-placeholder {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    padding: 20px 0;
    border-left: 1px solid var(--glass-border);
    padding-left: 12px;
}

.chart-bar-group {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.chart-bar {
    width: 100%;
    max-width: 40px;
    border-radius: 8px 8px 0 0;
    background: var(--accent);
    transition: all var(--transition-normal);
    position: relative;
    min-height: 10px;
}

.chart-bar.bar-emerald {
    background: linear-gradient(180deg, #6db897, #3d8b6e);
}

.chart-bar.bar-gold {
    background: linear-gradient(180deg, #c9b896, #a89068);
}

.chart-bar.bar-coral {
    background: linear-gradient(180deg, #d4a090, #b87a68);
}

.chart-bar.bar-teal {
    background: linear-gradient(180deg, #7ac4b8, #4a9e92);
}

.chart-bar.bar-amber {
    background: linear-gradient(180deg, #d4b06a, #a88542);
}

.chart-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.2), transparent);
    border-radius: 8px 8px 0 0;
}

.chart-bar:hover {
    filter: brightness(1.15);
    transform: scaleY(1.02);
    transform-origin: bottom;
}

.chart-bar.bar-emerald:hover {
    box-shadow: 0 0 16px rgba(61, 139, 110, 0.4);
}

.chart-bar.bar-gold:hover {
    box-shadow: 0 0 16px rgba(168, 144, 104, 0.4);
}

.chart-bar.bar-coral:hover {
    box-shadow: 0 0 16px rgba(184, 122, 104, 0.4);
}

.chart-bar.bar-teal:hover {
    box-shadow: 0 0 16px rgba(74, 158, 146, 0.4);
}

.chart-bar.bar-amber:hover {
    box-shadow: 0 0 16px rgba(168, 133, 66, 0.4);
}

.chart-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================
   ACTIVITY FEED
============================================ */
.activity-card {
    max-height: 380px;
    display: flex;
    flex-direction: column;
}

.activity-list {
    flex: 1;
    overflow-y: auto;
    margin: 0 -10px;
    padding: 0 10px;
}

.activity-list::-webkit-scrollbar {
    width: 4px;
}

.activity-list::-webkit-scrollbar-track {
    background: transparent;
}

.activity-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 2px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--glass-border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.activity-text strong {
    color: var(--text-primary);
    font-weight: 500;
}

.activity-time {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   DATA TABLE
============================================ */
.table-card {
    grid-column: span 2;
}

.table-wrapper {
    overflow-x: auto;
    margin: 0 -10px;
    padding: 0 10px;
}

.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.data-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 16px;
    text-align: left;
}

.data-table th {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
}

.data-table tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--glass-hover);
}

.data-table td {
    font-size: 15px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--line);
}

.table-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.table-user-info {
    display: flex;
    flex-direction: column;
}

.table-user-name {
    color: var(--text-primary);
    font-weight: 500;
}

.table-user-email {
    font-size: 13px;
    color: var(--text-muted);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.completed {
    background: var(--closed-bg);
    color: var(--closed-text);
}

.status-badge.completed::before {
    background: var(--closed-text);
}

.status-badge.pending {
    background: var(--hold-bg);
    color: var(--hold-text);
}

.status-badge.pending::before {
    background: var(--hold-text);
}

.status-badge.processing {
    background: var(--open-bg);
    color: var(--open-text);
}

.status-badge.processing::before {
    background: var(--open-text);
}

.table-amount {
    font-family: 'Space Mono', monospace;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   PROGRESS BARS
============================================ */
.progress-card {
    padding: var(--card-padding);
}

.progress-item {
    margin-bottom: 24px;
}

.progress-item:last-child {
    margin-bottom: 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.progress-label {
    font-size: 15px;
    font-weight: 500;
}

.progress-value {
    font-family: 'Space Mono', monospace;
    font-size: 15px;
    color: var(--text-secondary);
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-out;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent);
}

.progress-fill.cyan {
    background: var(--accent);
    box-shadow: 0 0 20px color-mix(in srgb, var(--accent-text) 40%, transparent);
}

.progress-fill.magenta {
    background: var(--accent);
    box-shadow: 0 0 20px rgba(212, 165, 116, 0.4);
}

.progress-fill.purple {
    background: var(--accent);
    box-shadow: 0 0 20px rgba(224, 122, 95, 0.4);
}

/* ============================================
   BOTTOM GRID
============================================ */
.bottom-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ============================================
   CALENDAR WIDGET
============================================ */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.calendar-nav {
    display: flex;
    gap: 8px;
}

.calendar-nav-btn {
    width: 32px;
    height: 32px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.calendar-nav-btn:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
}

.calendar-nav-btn svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.calendar-day-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 0;
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.calendar-day:hover {
    background: var(--glass-hover);
}

.calendar-day.other-month {
    color: var(--text-muted);
}

.calendar-day.today {
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
    box-shadow: 0 4px 15px color-mix(in srgb, var(--accent-text) 30%, transparent);
}

.calendar-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    background: var(--gold);
    border-radius: 50%;
}

/* ============================================
   DONUT CHART
============================================ */
.donut-container {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-top: 20px;
}

.donut-chart {
    width: 140px;
    height: 140px;
    position: relative;
}

.donut-chart svg {
    transform: rotate(-90deg);
}

.donut-chart circle {
    fill: none;
    stroke-width: 20;
}

.donut-bg {
    stroke: rgba(255, 255, 255, 0.1);
}

.donut-segment {
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-value {
    font-family: 'Space Mono', monospace;
    font-size: 29px;
    font-weight: 700;
}

.donut-label {
    font-size: 13px;
    color: var(--text-muted);
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.legend-color.cyan { background: var(--emerald-light); }
.legend-color.magenta { background: var(--gold); }
.legend-color.purple { background: var(--coral); }

/* ============================================
   WEATHER WIDGET
============================================ */
.weather-main {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.weather-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent-text) 20%, transparent), rgba(212, 165, 116, 0.2));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.weather-icon svg {
    width: 45px;
    height: 45px;
    color: var(--emerald-light);
}

.weather-temp {
    font-family: 'Space Mono', monospace;
    font-size: 49px;
    font-weight: 700;
    line-height: 1;
}

.weather-desc {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.weather-detail {
    text-align: center;
    padding: 12px;
    background: var(--glass-bg);
    border-radius: 12px;
}

.weather-detail-value {
    font-family: 'Space Mono', monospace;
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 4px;
}

.weather-detail-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ============================================
   MOBILE MENU TOGGLE
============================================ */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--accent);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    z-index: 200;
    box-shadow: 0 8px 32px color-mix(in srgb, var(--accent-text) 30%, transparent);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
    color: var(--on-accent);
}

/* ============================================
   LOGIN PAGE STYLES
============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: none;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo {
    color: var(--on-accent);
    width: 70px;
    height: 70px;
    background: var(--accent);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 29px;
    margin: 0 auto 20px;
    box-shadow: 0 12px 40px color-mix(in srgb, var(--accent-text) 30%, transparent);
}

.login-title {
    font-size: 29px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 15px;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    transition: all var(--transition-fast);
}

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

.form-input:focus {
    outline: none;
    border-color: var(--emerald-light);
    box-shadow: 0 0 20px color-mix(in srgb, var(--accent-text) 20%, transparent);
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--emerald);
}

.forgot-link {
    font-size: 15px;
    color: var(--emerald-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.forgot-link:hover {
    color: var(--gold);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    width: 100%;
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--accent-text) 30%, transparent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px color-mix(in srgb, var(--accent-text) 40%, transparent);
}

.btn-secondary {
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
}

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 28px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.divider span {
    font-size: 14px;
    color: var(--text-muted);
}

.social-login {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
}

.social-btn {
    flex: 1;
    padding: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.social-btn:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
}

.social-btn svg {
    width: 22px;
    height: 22px;
}

.login-footer {
    text-align: center;
    font-size: 15px;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--emerald-light);
    text-decoration: none;
}

.login-footer a:hover {
    color: var(--gold);
}

/* ============================================
   PAGE HEADER (for inner pages)
============================================ */
.page-header {
    margin-bottom: 30px;
}

.page-header .page-title {
    margin-bottom: 8px;
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.page-breadcrumb a {
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.page-breadcrumb a:hover {
    color: var(--emerald-light);
}

.page-breadcrumb span {
    color: var(--text-muted);
}

/* ============================================
   FOOTER
============================================ */
.site-footer {
    text-align: center;
    padding: 20px;
    margin-left: var(--sidebar-width);
    color: var(--text-muted);
    font-size: 15px;
}

.site-footer a {
    color: var(--emerald-light);
    transition: color var(--transition-fast);
}

.site-footer a:hover {
    color: var(--gold);
}

/* Login/Register page footer */
.login-page .site-footer {
    margin-left: 0;
    position: relative;
    padding: 30px 20px;
    text-align: center;
    margin-top: 30px;
}

/* Floating Theme Toggle for Login/Register */
.theme-toggle-float {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 45px;
    height: 45px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all var(--transition-fast);
}

.theme-toggle-float:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
}

.theme-toggle-float svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

/* ============================================
   SETTINGS PAGE
============================================ */
.settings-grid {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 24px;
}

.settings-nav {
    list-style: none;
}

.settings-nav-item {
    margin-bottom: 8px;
}

.settings-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    color: var(--text-secondary);
    border-radius: 12px;
    transition: all var(--transition-fast);
}

.settings-nav-link:hover {
    background: var(--glass-hover);
    color: var(--text-primary);
}

.settings-nav-link.active {
    background: var(--glass-hover);
    color: var(--text-primary);
}

.settings-nav-link svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.settings-nav-link.active svg,
.settings-nav-link:hover svg {
    opacity: 1;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-label-title {
    font-weight: 500;
    color: var(--text-primary);
}

.settings-label-desc {
    font-size: 14px;
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 26px;
    transition: all var(--transition-fast);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--emerald);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
    background: white;
}

/* Settings Select Dropdown */
.settings-select {
    padding: 10px 16px;
    background-color: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
    min-width: 150px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2334d399' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.settings-select:focus {
    outline: none;
    border-color: var(--emerald-light);
    box-shadow: 0 0 15px color-mix(in srgb, var(--accent-text) 15%, transparent);
}

.settings-select option {
    background: var(--surface-overlay);
    color: var(--text-primary);
    padding: 10px;
}

/* Profile Header */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
}

.profile-avatar-large {
    color: var(--on-accent);
    width: 100px;
    height: 100px;
    border-radius: 20px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 37px;
    position: relative;
}

.profile-avatar-edit {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 32px;
    height: 32px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.profile-avatar-edit:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
}

.profile-avatar-edit svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.profile-info h2 {
    font-size: 25px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-info p {
    color: var(--text-muted);
    font-size: 15px;
}

/* Settings Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group-settings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-settings.full-width {
    grid-column: span 2;
}

.form-group-settings label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group-settings input,
.form-group-settings textarea {
    padding: 12px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: all var(--transition-fast);
}

.form-group-settings input:focus,
.form-group-settings textarea:focus {
    outline: none;
    border-color: var(--emerald-light);
    box-shadow: 0 0 20px color-mix(in srgb, var(--accent-text) 15%, transparent);
}

.form-group-settings textarea {
    resize: vertical;
    min-height: 100px;
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Settings Tab Content */
.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
    animation: settingsFadeIn 0.3s ease;
}

@keyframes settingsFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   RESPONSIVE DESIGN
============================================ */
@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bottom-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .table-card {
        grid-column: span 1;
    }
}

@media (max-width: 992px) {
    :root {
        --sidebar-width: 0px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .bottom-grid {
        grid-template-columns: 1fr;
    }

    .site-footer {
        margin-left: 0;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-nav-card {
        display: none;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        flex-wrap: wrap;
    }
    
    .search-box {
        order: 3;
        width: 100%;
    }
    
    .search-input {
        width: 100%;
    }
    
    .page-title {
        font-size: 23px;
    }
    
    .donut-container {
        flex-direction: column;
    }

    .login-card {
        padding: 36px 24px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group-settings.full-width {
        grid-column: span 1;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 20px 15px;
    }
    
    .glass-card {
        padding: 18px;
    }
    
    .stat-value {
        font-size: 27px;
    }
    
    .data-table {
        font-size: 14px;
    }
    
    .data-table th,
    .data-table td {
        padding: 12px 8px;
    }

    .social-login {
        flex-direction: column;
    }
}

/* ============================================
   ANIMATIONS
============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glass-card {
    animation: fadeInUp 0.6s ease-out backwards;
}

.stats-grid .glass-card:nth-child(1) { animation-delay: 0.1s; }
.stats-grid .glass-card:nth-child(2) { animation-delay: 0.2s; }
.stats-grid .glass-card:nth-child(3) { animation-delay: 0.3s; }
.stats-grid .glass-card:nth-child(4) { animation-delay: 0.4s; }

.content-grid .glass-card:nth-child(1) { animation-delay: 0.5s; }
.content-grid .glass-card:nth-child(2) { animation-delay: 0.6s; }
.content-grid .glass-card:nth-child(3) { animation-delay: 0.7s; }

.bottom-grid .glass-card:nth-child(1) { animation-delay: 0.8s; }
.bottom-grid .glass-card:nth-child(2) { animation-delay: 0.9s; }
.bottom-grid .glass-card:nth-child(3) { animation-delay: 1s; }

.login-card {
    animation: fadeInUp 0.6s ease-out;
}

/* ============================================
   CALL LOG
============================================ */
.call-form-card[hidden],
.customer-match[hidden] {
    display: none !important;
}

/* Log a Call: six narrow columns, so short fields share a row */
.call-form-card .call-form-head {
    margin-bottom: 14px;
}

.call-form-buttons {
    margin-top: 0;
}

.call-form-buttons .btn {
    width: auto;
    padding: 10px 20px;
    font-size: 15px;
}

.call-form-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px 14px;
    align-items: start;
}

.call-form-grid .cf-1 { grid-column: span 1; }
.call-form-grid .cf-2 { grid-column: span 2; }
.call-form-grid .cf-full { grid-column: 1 / -1; }

.call-form-grid .form-group-settings {
    gap: 5px;
}

.call-form-grid .form-group-settings input,
.call-form-grid .form-group-settings textarea,
.call-form-grid .settings-select {
    width: 100%;
    min-width: 0;
    padding: 9px 12px;
    font-size: 15px;
    border-radius: 10px;
}

.call-form-grid .settings-select {
    padding-right: 30px;
}

.call-form-grid .form-group-settings textarea {
    min-height: 70px;
}

.call-form-grid .form-message:empty {
    display: none;
}

/* Narrower screens: two fields per row; phones: one */
@media (max-width: 1100px) {
    .call-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .call-form-grid .cf-1,
    .call-form-grid .cf-2 {
        grid-column: span 1;
    }
}

@media (max-width: 600px) {
    .call-form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .call-form-card .call-form-head {
        flex-wrap: wrap;
        gap: 10px;
    }
}

.customer-match {
    font-size: 14px;
    color: var(--emerald-light);
}

/* Log a Call customer picker: a search box with a list of matches, or the chosen customer */
.call-form-grid .cf-4 { grid-column: span 4; }

/* Let the list of matches hang below the Log a Call card, above the call log */
.glass-card.call-form-card {
    overflow: visible;
    z-index: 5;
}

.call-form-grid [hidden] {
    display: none !important;
}

.customer-search-wrap {
    position: relative;
}

.customer-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--surface-overlay);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    box-shadow: var(--panel-shadow);
    max-height: 320px;
    overflow-y: auto;
}

.customer-option {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 9px 12px;
    cursor: pointer;
    font-size: 15px;
}

.customer-option:hover,
.customer-option.active {
    background: var(--hover);
}

.customer-option-name {
    color: var(--text-primary);
    font-weight: 600;
}

.customer-option-meta {
    color: var(--text-muted);
    font-size: 13px;
    text-align: right;
    overflow-wrap: anywhere;
}

.customer-option-empty {
    padding: 9px 12px;
    color: var(--text-muted);
    font-size: 14px;
}

.customer-option-new {
    border-top: 1px solid var(--line);
    color: var(--accent-text);
    font-weight: 600;
}

.customer-chosen {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 8px 7px 12px;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: 10px;
}

.customer-chosen > div {
    flex: 1;
    min-width: 0;
}

.customer-chosen-name {
    color: var(--accent-text);
    font-weight: 600;
    font-size: 15px;
}

.customer-chosen-meta {
    color: var(--text-secondary);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.customer-chosen .btn,
.customer-match-use {
    width: auto;
    padding: 5px 12px;
    font-size: 14px;
    flex-shrink: 0;
}

.customer-match-use {
    margin-left: 6px;
}

@media (max-width: 1100px) {
    .call-form-grid .cf-4 { grid-column: 1 / -1; }
}

.form-message {
    min-height: 20px;
    font-size: 15px;
    margin: 0;
}

.form-message.success {
    color: var(--success);
}

.form-message.error {
    color: var(--danger-text);
}

.call-saved {
    margin: 0 0 12px;
}

.call-saved[hidden] {
    display: none;
}

.card-actions .settings-select {
    min-width: 140px;
}

.call-table {
    min-width: 640px;
}

.call-table td.nowrap,
.call-table th,
.call-table .th-button {
    white-space: nowrap;  /* headings like "Logged By" stay on one line */
}

.table-empty {
    text-align: center !important;
    color: var(--text-muted);
}

.status-select {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
}

.status-select option {
    background: var(--surface-overlay);
    color: var(--text-primary);
}

.login-card .form-message {
    margin-bottom: 16px;
}

/* ============================================
   USERS - EDIT DIALOG
============================================ */
.edit-dialog {
    margin: auto;  /* the global reset removes the default centring */
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 28px;
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    background: var(--surface-overlay);
    color: var(--text-primary);
    box-shadow: 0 24px 64px var(--glass-shadow);
}

.edit-dialog::backdrop {
    background: var(--scrim);
}

.edit-dialog .card-title {
    margin-bottom: 20px;
}

.edit-dialog .settings-select {
    width: 100%;
    padding-top: 12px;
    padding-bottom: 12px;
    border-radius: 10px;
}

.edit-dialog .settings-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.edit-dialog .form-message {
    margin-top: 16px;
}

.edit-dialog .btn-group {
    margin-top: 12px;
}

.edit-dialog .btn {
    width: auto;
}

.form-hint {
    grid-column: span 2;
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
}

.form-hint[hidden],
.actions-col[hidden],
.content-grid[hidden],
.card-btn[hidden],
#name-status-group[hidden],
#name-role-group[hidden] {
    display: none;
}

/* Row actions (Edit, Calls, Open, Restore, Invite): a clear blue outline, solid blue on hover */
.card-btn.edit-btn {
    padding: 6px 14px;
    background: var(--accent-soft);
    border-color: var(--accent-text);
    color: var(--accent-text);
    font-weight: 500;
}

.card-btn.edit-btn:hover,
.card-btn.edit-btn:focus-visible {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}

.call-table .edit-col,
.call-table td.edit-cell {
    width: 1%;
    padding-right: 0;
}

@media (max-width: 768px) {
    .edit-dialog .form-group-settings,
    .form-hint {
        grid-column: span 1;
    }
}

/* ============================================
   COLLAPSIBLE SIDEBAR
============================================ */
/* "Petrocourt Portal" sits on two lines when it doesn't fit beside the collapse button */
.sidebar-header .logo-text {
    min-width: 0;
    line-height: 1.1;
}

.sidebar-header:has(.sidebar-toggle) {
    gap: 10px;
}

.sidebar-toggle {
    margin-left: auto;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
    color: var(--text-primary);
    border-color: var(--emerald-light);
    outline: none;
}

.sidebar-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-normal);
}

.main-content,
.site-footer {
    transition: margin-left var(--transition-normal);
}

.sidebar-no-transition .sidebar,
.sidebar-no-transition .main-content,
.sidebar-no-transition .site-footer,
.sidebar-no-transition .sidebar-toggle svg {
    transition: none !important;
}

/* The phone layout already slides the sidebar in and out, so collapsing is desktop only */
@media (max-width: 992px) {
    .sidebar-toggle {
        display: none;
    }
}

@media (min-width: 993px) {
    html.sidebar-collapsed {
        --sidebar-width: 84px;
    }

    .sidebar-collapsed .sidebar {
        padding: 24px 14px;
        overflow-x: hidden;
    }

    .sidebar-collapsed .sidebar-header {
        flex-direction: column;
        gap: 14px;
    }

    .sidebar-collapsed .sidebar-toggle {
        margin-left: 0;
    }

    .sidebar-collapsed .sidebar-toggle svg {
        transform: rotate(180deg);
    }

    .sidebar-collapsed .logo-text,
    .sidebar-collapsed .nav-label,
    .sidebar-collapsed .nav-badge,
    .sidebar-collapsed .user-info,
    .sidebar-collapsed .user-profile > svg {
        display: none;
    }

    /* The header already has a line under the logo, so the first section needs no divider */
    .sidebar-collapsed .nav-section:first-child .nav-section-title {
        display: none;
    }

    .sidebar-collapsed .nav-section-title {
        display: block;
        font-size: 0;
        color: transparent;
        height: 1px;
        margin-bottom: 12px;
        padding: 0;
        background: var(--glass-border);
    }

    .sidebar-collapsed .nav-link {
        justify-content: center;
        gap: 0;
        padding: 14px 0;
    }

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

/* ============================================
   NOTIFICATIONS
============================================ */
.notification-wrapper {
    position: relative;
}

.notification-dot.notification-count {
    top: -6px;
    right: -6px;
    width: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
    color: var(--on-accent);
}

.notification-dot[hidden] {
    display: none;
}

.notification-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 200;
    width: min(360px, calc(100vw - 32px));
    max-height: 420px;
    overflow-y: auto;
    background: var(--surface-overlay);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 20px 48px var(--glass-shadow);
}

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

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
}

.notification-actions {
    display: flex;
    gap: 14px;
}

.notification-read-all,
.notification-clear-all {
    background: none;
    border: none;
    color: var(--emerald-light);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

.notification-clear-all {
    color: var(--coral);
}

.notification-read-all[hidden],
.notification-clear-all[hidden] {
    display: none;
}

.notification-list {
    list-style: none;
    margin: 0;
    padding: 6px;
}

.notification-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 10px 12px 10px 24px;
    background: none;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    position: relative;
}

.notification-item:hover,
.notification-item:focus-visible {
    background: var(--glass-hover);
    outline: none;
}

.notification-item.unread {
    color: var(--text-primary);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 17px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--coral);
}

.notification-time {
    font-size: 13px;
    color: var(--text-muted);
}

.notification-empty {
    padding: 20px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
}

/* ============================================
   INVITES & LOGIN PROTECTION
============================================ */
.status-badge.locked {
    background: var(--danger-soft);
    color: var(--danger-text);
}

.status-badge.locked::before {
    background: var(--danger-text);
}

.row-actions {
    white-space: nowrap;
}

.row-actions .edit-btn + .edit-btn {
    margin-left: 6px;
}

.invite-link-row {
    display: flex;
    gap: 10px;
    margin: 16px 0 8px;
}

.invite-link {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: 13px;
}

.invite-link-row .btn {
    width: auto;
}

#invite-dialog .form-hint {
    grid-column: auto;
}

.register-welcome,
.register-closed {
    margin: 0 0 20px;
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
}

.register-closed {
    padding: 16px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--glass-bg);
}

.register-welcome[hidden],
.register-closed[hidden],
#register-form[hidden],
#staff-choice[hidden] {
    display: none;
}

/* ============================================
   CALL LOG PAGER
============================================ */
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.pager[hidden] {
    display: none;
}

.pager-pages,
.pager-numbers {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pager .card-btn {
    padding: 6px 12px;
    min-width: 34px;
}

.pager .card-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.pager-gap {
    padding: 0 2px;
    color: var(--text-muted);
}

.pager-size {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pager-size .settings-select {
    min-width: 0;
    padding-top: 6px;
    padding-bottom: 6px;
}

/* ============================================
   DATE FILTER (Date column heading)
============================================ */
.th-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin: -4px -8px;
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
}

.th-button svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

.th-button:hover,
.th-button:focus-visible {
    color: var(--text-primary);
    border-color: var(--glass-border);
    outline: none;
}

.th-button.filtered {
    color: var(--emerald-light);
    border-color: var(--emerald-light);
}

.th-button.filtered svg {
    opacity: 1;
    fill: currentColor;
}

.date-filter {
    position: fixed;
    inset: auto;
    margin: 0;
    width: 320px;
    padding: 16px;
    background: var(--surface-overlay);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    box-shadow: 0 20px 48px var(--glass-shadow);
    color: var(--text-primary);
}

.date-presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.date-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 14px 0;
}

.date-range label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.date-range input {
    padding: 8px 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    color-scheme: dark;
}

[data-theme="light"] .date-range input {
    color-scheme: light;
}

.date-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.filter-chip {
    padding: 8px 12px;
    background: color-mix(in srgb, var(--accent-text) 12%, transparent);
    border: 1px solid var(--emerald-light);
    border-radius: 20px;
    color: var(--emerald-light);
    font-family: inherit;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
}

.filter-chip:hover {
    background: color-mix(in srgb, var(--accent-text) 20%, transparent);
}

.filter-chip[hidden] {
    display: none;
}

/* ============================================
   SORTABLE COLUMNS
============================================ */
.sort-button {
    white-space: nowrap;
}

.sort-arrow {
    font-size: 10px;
    min-width: 9px;
}

.th-button.sorted {
    color: var(--emerald-light);
}

.th-button.sorted-oldest::after {
    content: '\25B2';
    font-size: 10px;
}

.date-order {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

/* ============================================
   COLUMN FILTERS (Logged By, Logged to, Dept)
============================================ */
.column-filter {
    width: 280px;
}

.column-filter-title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
}

.column-filter-tools {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.link-button {
    background: none;
    border: none;
    padding: 0 0 0 10px;
    color: var(--emerald-light);
    font: inherit;
    cursor: pointer;
}

.column-filter-options {
    list-style: none;
    margin: 0 0 14px;
    padding: 4px;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
}

.column-filter-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.column-filter-options label:hover {
    background: var(--glass-hover);
}

.column-filter-options input {
    width: 16px;
    height: 16px;
    accent-color: var(--emerald);
}

.column-filter-empty {
    padding: 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chips:empty {
    display: none;
}

.column-filter-button svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

.column-filter-button.filtered {
    color: var(--emerald-light);
    border-color: var(--emerald-light);
}

.column-filter-button.filtered svg {
    opacity: 1;
    fill: currentColor;
}

/* ============================================
   DELETING CALLS
============================================ */
.btn-danger {
    margin-left: auto;
    width: auto;
    background: transparent;
    border: 1px solid var(--danger-text);
    color: var(--danger-text);
}

.btn-danger:hover {
    background: var(--danger-soft);
}

/* "Delete permanently" on the Deleted customers list */
.card-btn.edit-btn.danger-btn {
    background: var(--danger-soft);
    border-color: var(--danger-text);
    color: var(--danger-text);
}

.card-btn.edit-btn.danger-btn:hover,
.card-btn.edit-btn.danger-btn:focus-visible {
    background: color-mix(in srgb, var(--danger-text) 24%, transparent);
    border-color: var(--danger-text);
    color: var(--danger-text);
}

.btn-danger[hidden],
.deleted-banner[hidden],
#show-deleted[hidden] {
    display: none;
}

.deleted-banner {
    margin: 0 0 12px;
    padding: 10px 14px;
    border: 1px dashed color-mix(in srgb, var(--danger-text) 50%, transparent);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.deleted-by {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.call-saved .link-button {
    margin-left: 6px;
    font-weight: 600;
}

.card-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ============================================
   NOTES & HISTORY (call side panel)
============================================ */
.edit-dialog-wide {
    width: min(1000px, calc(100vw - 32px));
}

.history-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.history-title {
    margin: 0 0 14px;
    font-size: 17px;
    font-weight: 600;
}

.note-form textarea {
    width: 100%;
    min-height: 70px;
    padding: 10px 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    resize: vertical;
}

.note-form textarea:focus {
    outline: none;
    border-color: var(--emerald-light);
}

.note-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 8px 0 14px;
}

.note-actions .form-message {
    font-size: 13px;
}

.history-list {
    list-style: none;
    margin: 0;
    padding: 0 4px 0 0;
    max-height: 520px;
    overflow-y: auto;
}

.history-item {
    padding: 10px 0 10px 14px;
    border-left: 2px solid var(--glass-border);
    position: relative;
}

.history-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 15px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--glass-border);
}

.history-note::before { background: var(--emerald-light); }
.history-change::before { background: var(--info); }
.history-created::before { background: var(--gold); }
.history-deleted::before { background: var(--danger); }
.history-restored::before { background: var(--success); }

.history-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    font-size: 13px;
}

.history-kind {
    font-weight: 600;
    color: var(--text-primary);
}

.history-who {
    color: var(--text-secondary);
}

.history-when {
    margin-left: auto;
    color: var(--text-muted);
}

.history-text {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.history-note .history-text {
    color: var(--text-primary);
}

.history-empty {
    padding: 10px 0;
    font-size: 14px;
    color: var(--text-muted);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ============================================
   CUSTOMER CARD
============================================ */
.customer-link {
    padding: 0;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: text-decoration-color var(--transition-fast), color var(--transition-fast);
}

.customer-link:hover,
.customer-link:focus-visible {
    color: var(--emerald-light);
    text-decoration-color: currentColor;
    outline: none;
}

.customer-dialog {
    width: min(760px, calc(100vw - 32px));
}

.customer-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--glass-border);
}

.customer-head .card-title {
    margin-bottom: 6px;
}

.customer-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 0 0 6px;
    font-size: 15px;
}

.customer-contact a {
    color: var(--emerald-light);
    text-decoration: none;
}

.customer-contact a:hover {
    text-decoration: underline;
}

.customer-summary {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
}

.customer-actions {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.customer-calls {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 60vh;
    overflow-y: auto;
}

.customer-call {
    padding: 14px 0;
    border-bottom: 1px solid var(--glass-border);
}

.customer-call:last-child {
    border-bottom: none;
}

.customer-call-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    font-size: 14px;
}

.customer-call-when {
    font-weight: 600;
    color: var(--text-primary);
}

.customer-call-meta {
    color: var(--text-secondary);
}

.customer-call-head .edit-btn {
    margin-left: auto;
}

.customer-call-text {
    margin: 6px 0 0;
    font-size: 15px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ============================================
   CUSTOMERS PAGE
============================================ */
.customer-none {
    color: var(--text-muted);
}

.customer-table td,
.customer-table th {
    white-space: nowrap;
}

/* ============================================
   QUICK TABS (above the call log)
============================================ */
.quick-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -8px 0 16px;
}

.quick-tabs[hidden] {
    display: none;
}

.quick-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: var(--glass-bg);
    color: var(--text-secondary);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-tab:hover,
.quick-tab:focus-visible {
    border-color: var(--emerald-light);
    color: var(--text-primary);
    outline: none;
}

.quick-tab.active {
    background: var(--accent-soft);
    border-color: var(--emerald-light);
    color: var(--text-primary);
    font-weight: 500;
}

.tab-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--glass-hover);
    font-size: 12px;
    text-align: center;
}

.tab-count:empty {
    display: none;
}

.quick-tab.active .tab-count {
    background: var(--accent);
    color: var(--on-accent);
}

/* ============================================
   CALL LIST (compact rows; click one to open it)
============================================ */
.call-browser {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.call-browser.panel-open {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
}

/* An open call gets most of the width, so its details and history sit side by side */
.call-browser.panel-open.detail-mode {
    grid-template-columns: minmax(340px, 1fr) minmax(0, 1.9fr);
}

.call-table th,
.call-table td {
    padding: 12px 10px;
    vertical-align: top;
}

.call-table th.col-who .th-button {
    margin: -4px -2px;
}

.th-sep {
    margin: 0 4px;
    color: var(--text-muted);
}

.call-table .call-row {
    cursor: pointer;
}

.call-table .call-row:focus {
    outline: none;
}

.call-table .call-row:focus-visible td {
    background: var(--glass-hover);
}

.call-table .call-row:focus-visible td:first-child,
.call-table .call-row.row-open td:first-child {
    box-shadow: inset 3px 0 0 var(--emerald-light);
}

.call-table .call-row.row-open td {
    background: var(--accent-soft);
}

.call-table .call-row.row-selected td {
    background: color-mix(in srgb, var(--accent-text) 7%, transparent);
}

.showing-deleted .call-table .call-row {
    cursor: default;
}

.cell-main {
    display: block;
}

.customer-cell .cell-main {
    color: var(--text-primary);
    font-weight: 500;
}

.cell-sub {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.call-table td.col-desc {
    min-width: 200px;
}

.desc-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.dept-tag {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: var(--glass-hover);
    font-size: 12px;
    color: var(--text-secondary);
}

.call-table td.col-dept,
.call-table td.col-who,
.call-table td.status-cell {
    white-space: nowrap;
}

.who-arrow {
    color: var(--text-muted);
}

/* The person it's assigned to stands out */
.who-to {
    color: var(--text-primary);
    font-weight: 500;
}

.status-cell .edit-btn {
    margin-left: 8px;
}

.call-table .select-col,
.call-table td.select-cell {
    width: 1%;
    padding-right: 0;
}

.select-col input,
.select-cell input {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--emerald);
    cursor: pointer;
}

/* With a call open beside it, the list keeps just the date, customer and status */
.panel-open .call-table {
    min-width: 0;
}

.panel-open .call-table th,
.panel-open .call-table td {
    padding-left: 8px;
    padding-right: 8px;
}

.panel-open .call-table .customer-cell,
.panel-open .call-table .customer-cell .cell-sub {
    white-space: normal;
    overflow-wrap: anywhere;
}

.panel-open .call-table .col-desc,
.panel-open .call-table .col-dept,
.panel-open .call-table .col-who {
    display: none;
}

.call-list-hint {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.call-list-hint kbd {
    padding: 1px 5px;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    background: var(--glass-bg);
    font-family: inherit;
    font-size: 12px;
}

.showing-deleted .call-list-hint {
    display: none;
}

/* ============================================
   SIDE PANEL (one call, or the ticked calls)
============================================ */
.call-panel {
    container-type: inline-size;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 18px 20px;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: var(--glass-bg);
}

.call-panel[hidden],
.call-panel section[hidden] {
    display: none;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-heading {
    flex: 1;
    min-width: 0;
}

#bulk-panel .panel-title {
    flex: 1;
}

.panel-title {
    margin: 0;
    font-size: 19px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.panel-sub {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-muted);
}

.panel-customer {
    padding: 0;
    font-size: 13px;
}

.panel-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
}

.panel-close:hover,
.panel-close:focus-visible {
    border-color: var(--emerald-light);
    color: var(--text-primary);
    outline: none;
}

.panel-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.panel-status .status-select {
    padding: 7px 14px;
    font-size: 14px;
}

.detail-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 24px;
}

/* Compact form: six narrow columns, so short fields share a row */
.panel-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px 12px;
}

.panel-grid .span-2 { grid-column: span 2; }
.panel-grid .span-3 { grid-column: span 3; }
.panel-grid .span-6 { grid-column: 1 / -1; }

.panel-form .form-group-settings {
    gap: 4px;
}

.panel-form .form-group-settings label {
    font-size: 13px;
}

.panel-form input,
.panel-form select,
.panel-form textarea {
    width: 100%;
    min-width: 0;
}

.panel-form .form-group-settings input,
.panel-form .form-group-settings textarea,
.panel-form .settings-select {
    padding: 8px 12px;
    font-size: 14px;
}

.panel-form .settings-select {
    padding-right: 28px;
    background-position: right 10px center;
}

.panel-form .form-group-settings textarea {
    min-height: 100px;
}

.panel-form .form-hint {
    margin-top: -4px;
    font-size: 12px;
}

.panel-form .form-message:empty {
    display: none;
}

.panel-form .btn-group {
    flex-wrap: wrap;
    margin-top: 12px;
}

.panel-form .btn {
    width: auto;
    padding: 10px 18px;
    font-size: 15px;
}

.panel-form .btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.btn-secondary[hidden] {
    display: none;
}

/* Notes & history beside the details; only the history list scrolls */
.call-panel .history-panel {
    padding-left: 24px;
    border-left: 1px solid var(--glass-border);
}

.call-panel .history-title {
    margin-bottom: 10px;
    font-size: 15px;
}

.call-panel .note-form textarea {
    min-height: 56px;
    padding: 8px 12px;
    font-size: 14px;
}

.call-panel .note-actions {
    margin: 6px 0 10px;
}

.call-panel .history-list {
    max-height: calc(100vh - 290px);
    min-height: 120px;
}

/* A narrow panel (small window or collapsed sidebar off): history goes under the details */
@container (max-width: 500px) {
    .detail-columns {
        grid-template-columns: minmax(0, 1fr);
    }

    .call-panel .history-panel {
        padding: 16px 0 0;
        border-left: none;
        border-top: 1px solid var(--glass-border);
    }

    .call-panel .history-list {
        max-height: none;
    }
}

/* Not quite room for three dropdowns in a row: Dept goes on its own line */
@container (max-width: 640px) {
    .panel-grid .span-2 {
        grid-column: span 3;
    }

    .panel-grid .span-2:last-child {
        grid-column: 1 / -1;
    }
}

@container (max-width: 420px) {
    .panel-grid .span-2,
    .panel-grid .span-3 {
        grid-column: 1 / -1;
    }
}

/* Several calls ticked */
.bulk-names {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 120px;
    margin: 0 0 16px;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.bulk-name {
    padding: 3px 10px;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: var(--glass-hover);
    font-size: 13px;
}

#bulk-panel .form-group-settings {
    margin-bottom: 12px;
}

#bulk-panel .settings-select {
    width: 100%;
}

#bulk-panel .btn {
    width: 100%;
    margin: 8px 0 0;
    padding: 11px 18px;
    font-size: 15px;
}

#bulk-panel .btn[hidden] {
    display: none;
}

/* Small screens: an open call takes the list's place (close it to go back);
   ticked calls are changed from the panel below the list */
@media (max-width: 900px) {
    .call-browser.panel-open {
        grid-template-columns: minmax(0, 1fr);
    }

    .panel-open:not(.bulk-mode) .call-list {
        display: none;
    }

    .panel-open .call-table {
        min-width: 640px;
    }

    .panel-open .call-table .col-desc,
    .panel-open .call-table .col-who {
        display: table-cell;
    }

    .call-panel {
        position: static;
        max-height: none;
    }

    .call-browser.panel-open.detail-mode {
        grid-template-columns: minmax(0, 1fr);
    }

    .panel-open .call-table .col-dept {
        display: table-cell;
    }

    .panel-head {
        flex-wrap: wrap;
    }
}

/* ============================================
   COLOUR SCHEME: FORM FIELDS & FOCUS
============================================ */
body {
    background: var(--bg);
}

.search-input,
.form-input,
.settings-select,
.form-group-settings input,
.form-group-settings textarea,
.note-form textarea,
.date-range input,
.call-panel select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
}

.search-input::placeholder,
.form-input::placeholder,
.form-group-settings input::placeholder,
.form-group-settings textarea::placeholder,
.note-form textarea::placeholder {
    color: var(--text-muted);
}

.search-input:focus,
.form-input:focus,
.settings-select:focus,
.form-group-settings input:focus,
.form-group-settings textarea:focus,
.note-form textarea:focus,
.date-range input:focus {
    border-color: var(--focus);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* A clear ring for anyone using the keyboard */
:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.call-table .call-row:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: -2px;
}

::selection {
    background: var(--accent);
    color: var(--on-accent);
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
}

.status-select.status-badge {
    border: 1px solid transparent;
}

.status-select option {
    background: var(--surface-overlay);
    color: var(--text-primary);
}

.form-message.error {
    color: var(--danger-text);
}

.form-message.success {
    color: var(--success-text);
}

.edit-dialog,
.date-filter,
.notification-panel {
    box-shadow: 0 20px 48px var(--shadow);
}

/* ============================================
   TABLE HEADINGS & TOOLBAR (high contrast, neutral)
============================================ */
/* Column headings on every table: strong text on their own strip */
.data-table thead th {
    background: var(--heading-bg);
    color: var(--heading-text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--heading-line);
}

.data-table .th-button svg {
    opacity: 1;
    color: var(--heading-text);
}

.data-table .th-sep {
    color: var(--heading-text);
}

.data-table .th-button:hover,
.data-table .th-button:focus-visible {
    background: var(--hover);
    border-color: var(--input-border);
    color: var(--text-primary);
}

/* A heading that's sorting or filtering the list: outlined, with a filled funnel (not blue) */
.data-table .th-button.sorted,
.data-table .th-button.filtered,
.data-table .th-button.sorted-oldest {
    color: var(--heading-text);
    border-color: var(--heading-text);
}

.data-table .th-button.filtered svg {
    color: var(--heading-text);
    fill: currentColor;
}

/* Buttons and tabs: solid outline, full-strength text */
.card-btn,
.quick-tab {
    background: var(--surface-raised);
    border-color: var(--input-border);
    color: var(--text-primary);
    font-weight: 500;
}

.quick-tab:not(.active):hover,
.quick-tab:not(.active):focus-visible {
    background: var(--hover);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.tab-count {
    background: var(--line-strong);
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================================
   SIDEBAR: frosted glass, its own colour in each mode
============================================ */
/* Dark mode: a purple aurora across the whole page (light mode has none) */
body {
    background-color: var(--bg);
    background-image: var(--page-glow);
    background-attachment: fixed;
}

.sidebar {
    /* Colours used inside the sidebar */
    --text-primary: var(--sidebar-text);
    --text-secondary: var(--sidebar-text-2);
    --text-muted: var(--sidebar-muted);
    --glass-bg: var(--sidebar-hover);
    --glass-border: var(--sidebar-line);
    --glass-hover: var(--sidebar-hover);
    --accent-text: var(--sidebar-link);
    --focus: var(--sidebar-link);
    background: var(--sidebar-bg);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    color: var(--text-primary);
    border-right: 1px solid var(--sidebar-line);
}

/* Light mode: solid, no glass, and the current page in soft blue as before */
[data-theme="light"] .sidebar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

[data-theme="light"] .sidebar .nav-link.active,
[data-theme="light"] .sidebar .nav-link.active:hover {
    background: var(--accent-soft);
    color: var(--accent-text);
    font-weight: 500;
}

/* On small screens the sidebar slides over the page, so it's nearly solid there */
@media (max-width: 992px) {
    .sidebar {
        background: var(--sidebar-solid);
    }
}

.sidebar .nav-icon {
    opacity: 1;
}

/* The page you're on: solid blue with white text */
.sidebar .nav-link.active {
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
}

.sidebar .nav-link.active:hover {
    background: var(--accent-hover);
    color: var(--on-accent);
}

.sidebar .logo {
    box-shadow: none;
}

/* ============================================
   OUTLINES & SHADOWS: clearer edges, cards lifted slightly off the page
============================================ */
.glass-card,
.glass-card:hover,
.login-card {
    border-color: var(--card-border);
    box-shadow: var(--card-shadow);
}

/* The open call's window and the Log a Call card share the same look */
.call-panel,
.glass-card.call-form-card {
    background: var(--panel-bg);
    border-color: var(--call-panel-border);
    box-shadow: var(--panel-shadow);
}

/* Dark mode: everything inside the charcoal window uses matching greys, not navy */
html:not([data-theme="light"]) .call-panel,
html:not([data-theme="light"]) .call-form-card {
    --text-primary: #f3f4f6;
    --text-secondary: #d4d6db;
    --text-muted: #a9adb5;
    --input-bg: #18191c;
    --input-border: #6f747d;
    --surface-raised: #2c2e33;
    --hover: #2c2e33;
    --line: #3a3d44;
    --glass-bg: #2c2e33;
    --glass-border: #3a3d44;
    --glass-hover: #2c2e33;
}

/* ...and the open row in the list gets a matching neutral highlight */
html:not([data-theme="light"]) .call-table .call-row.row-open td {
    background: rgba(255, 255, 255, 0.07);
}

html:not([data-theme="light"]) .call-table .call-row.row-open td:first-child {
    box-shadow: inset 3px 0 0 #d4d6db;
}

.edit-dialog,
.date-filter,
.notification-panel {
    border-color: var(--panel-border);
}

/* Small buttons in the top bar and sidebar, and secondary buttons like Cancel,
   get the same outline as other buttons */
.nav-btn,
.sidebar-toggle,
.btn-secondary {
    border-color: var(--input-border);
}

/* Dark mode: secondary buttons like Cancel are darker, the same charcoal as the fields */
html:not([data-theme="light"]) .btn-secondary {
    background: #18191c;
}

html:not([data-theme="light"]) .btn-secondary:hover {
    background: #222327;
}

/* Phones: a card's search box gets its own full-width row, and its buttons wrap underneath */
@media (max-width: 768px) {
    .glass-card > .card-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .glass-card > .card-header .search-box {
        order: 0;
        flex: 1 1 100%;
    }

    .glass-card > .card-header .card-actions {
        flex-wrap: wrap;
    }
}
