/* ============================================
   Ultra Lite — Design System
   ============================================ */

:root {
    --color-bg-dark: #111318;
    --color-bg-sidebar: #161920;
    --color-bg-main: #f4f5f7;
    --color-bg-card: #ffffff;
    --color-bg-hover: rgba(255, 255, 255, 0.06);
    --color-text-primary: #1a1d23;
    --color-text-secondary: #5f6578;
    --color-text-muted: #8b90a0;
    --color-text-on-dark: #c8ccd8;
    --color-text-on-dark-bright: #eaedf5;
    --color-accent: #3b7ddd;
    --color-accent-hover: #2f6bc4;
    --color-accent-subtle: rgba(59, 125, 221, 0.08);
    --color-accent-light: rgba(59, 125, 221, 0.15);
    --color-border: #e2e4ea;
    --color-border-light: #eff0f3;
    --color-success: #2ea55a;
    --color-warning: #e5a00d;
    --color-danger: #d64545;
    --color-error: #d64545;
    --font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-family-heading: var(--font-family);
    --sidebar-width: 240px;
    --top-bar-height: 56px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.page-title, .detail-card-title, .settings-section-title, .form-section-title,
.hub-category-title, .dash-card-title, .page-context {
    font-family: var(--font-family-heading);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--color-text-primary);
    background: var(--color-bg-main);
    -webkit-font-smoothing: antialiased;
}

.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--color-bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    overflow-y: auto;
}
.sidebar-header {
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
    width: 32px; height: 32px;
    background: var(--color-accent);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 16px;
}
.logo-text {
    font-size: 16px; font-weight: 600;
    color: var(--color-text-on-dark-bright);
}
.sidebar-nav {
    padding: 12px 10px;
    display: flex; flex-direction: column; gap: 1px;
}
.nav-section-label {
    font-size: 14px; font-weight: 600;
    text-transform: none; letter-spacing: 0;
    color: inherit;
    padding: 0; opacity: 1;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 12px 7px 18px; border-radius: var(--radius-sm);
    color: var(--color-text-on-dark); text-decoration: none;
    font-size: 13px; transition: all 0.15s ease; cursor: pointer;
}
.nav-section .nav-item { padding-left: 18px; }
.nav-section .nav-item .nav-icon { width: 16px; height: 16px; }
.nav-section .nav-item .nav-icon svg { width: 16px; height: 16px; }
.nav-item:hover { background: var(--color-bg-hover); color: var(--color-text-on-dark-bright); }
.nav-item.active { background: var(--color-accent-light); color: white; font-weight: 500; }
.nav-icon {
    width: 18px; height: 18px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.nav-icon svg {
    width: 18px; height: 18px;
    stroke: currentColor; fill: none;
    stroke-width: 1.75;
    flex-shrink: 0;
}
.nav-label { white-space: nowrap; }

/* Collapsible Nav Sections (uses native <details>/<summary>) */
.sidebar-nav details { margin: 0; }
.sidebar-nav details > summary { list-style: none; }
.sidebar-nav details > summary::-webkit-details-marker { display: none; }
.sidebar-nav details > summary::marker { display: none; content: ''; }
.nav-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-top: 8px;
    cursor: default;
    user-select: none;
    border-radius: var(--radius-sm);
    color: #fff;
    text-decoration: none;
}
a.nav-section-header { cursor: pointer; }
.nav-section-header .nav-section-chevron {
    margin-left: auto;
}
.nav-section-header:hover { background: var(--color-bg-hover); }
.nav-section-header .nav-section-label {
    padding: 0;
    margin: 0;
}
.nav-section-chevron {
    font-size: 11px;
    color: var(--color-text-muted);
    opacity: 0.5;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.nav-section-chevron::after { content: '▸'; }
details[open] > summary .nav-section-chevron::after { content: '▾'; }
.nav-section-header:hover .nav-section-chevron { opacity: 0.8; }

/* Sub-group labels within collapsible sections */
.nav-subgroup-label {
    font-size: 9.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--color-text-muted);
    padding: 12px 12px 3px;
    opacity: 0.45;
}
.nav-subgroup-label:first-of-type { padding-top: 4px; }

/* Hub Page Cards */
.hub-category {
    margin-bottom: 24px;
}
.hub-category-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border-light);
}
.hub-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.hub-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text-primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.18s ease;
    cursor: pointer;
}
.hub-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent);
}
.hub-card-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    padding-top: 1px;
}
.hub-card-content {
    flex: 1;
    min-width: 0;
}
.hub-card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 3px;
}
.hub-card-desc {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.4;
}
.hub-card.integration {
    border-left: 3px solid var(--color-border);
}
.hub-card.integration.connected {
    border-left-color: var(--color-success);
}
.hub-card.integration.pending {
    border-left-color: var(--color-warning);
}
.hub-card-status {
    font-size: 11px;
    font-weight: 500;
    margin-top: 4px;
}
.hub-card-status.connected { color: var(--color-success); }
.hub-card-status.pending { color: var(--color-warning); }

/* Hub Card Stat Badge — large number above card title */
.hub-card-stat {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.5px;
    margin-bottom: 2px;
}
.hub-card-stat.danger { color: var(--color-danger); }
.hub-card-stat.warning { color: var(--color-warning); }
.hub-card-stat.success { color: var(--color-success); }
.hub-card-stat.muted { color: var(--color-text-muted); }

/* Main Area & Top Bar */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.top-bar {
    height: var(--top-bar-height);
    min-height: var(--top-bar-height);
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; box-shadow: var(--shadow-sm);
    position: relative; z-index: 10;
}
.top-bar-left { display: flex; align-items: center; flex: 1; }
.page-context { font-size: 14px; font-weight: 500; color: var(--color-text-secondary); }
.top-bar-right { display: flex; align-items: center; gap: 8px; }

/* Top Bar Search */
.top-bar-search {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    padding: 0 12px; height: 36px; max-width: 400px; width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background: var(--color-bg-main);
}
.top-bar-search:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-subtle);
    background: var(--color-bg-card);
}
.top-bar-search-icon {
    width: 16px; height: 16px; min-width: 16px; min-height: 16px;
    flex-shrink: 0; stroke: var(--color-text-muted);
    overflow: visible;
}
.top-bar-search:focus-within .top-bar-search-icon { stroke: var(--color-accent); }
.top-bar-search-input {
    border: none; outline: none; background: transparent;
    font-size: 13px; font-family: var(--font-family);
    color: var(--color-text-primary); width: 100%;
}
.top-bar-search-input::placeholder { color: var(--color-text-muted); }

/* Search Typeahead Dropdown */
.top-bar-search { position: relative; }
.search-typeahead {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: var(--color-bg-card); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    z-index: 1000; overflow: hidden; display: none; max-height: 420px; overflow-y: auto;
}
.search-typeahead.open { display: block; }
.search-ta-section {
    padding: 8px 14px 4px; font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--color-text-muted); background: var(--color-bg-main);
    border-top: 1px solid var(--color-border-light);
}
.search-ta-section:first-child { border-top: none; }
.search-ta-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 8px 14px; text-decoration: none;
    transition: background 0.1s ease;
}
.search-ta-item:hover { background: var(--color-accent-subtle); }
.search-ta-name {
    font-size: 13px; font-weight: 500; color: var(--color-text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0;
}
.search-ta-meta {
    font-size: 11.5px; color: var(--color-text-muted); white-space: nowrap; flex-shrink: 0;
}
.search-ta-empty {
    padding: 20px 14px; text-align: center; font-size: 13px; color: var(--color-text-muted);
}
.search-ta-viewall {
    display: block; padding: 10px 14px; text-align: center;
    font-size: 12.5px; font-weight: 500; color: var(--color-accent);
    text-decoration: none; border-top: 1px solid var(--color-border-light);
}
.search-ta-viewall:hover { background: var(--color-accent-subtle); }

/* Top Bar Icon Buttons */
.top-bar-icon-btn {
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--color-text-muted); text-decoration: none;
    transition: all 0.15s ease; flex-shrink: 0;
}
.top-bar-icon-btn:hover { background: var(--color-bg-main); color: var(--color-text-primary); }
.top-bar-icon-btn svg { width: 18px; height: 18px; }

/* User Avatar */
.user-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--color-accent); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; flex-shrink: 0;
    letter-spacing: 0.5px;
}
.user-avatar.lg { width: 40px; height: 40px; font-size: 14px; }

/* User Avatar Button */
.user-avatar-btn {
    display: flex; align-items: center; gap: 8px;
    background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 4px 10px 4px 4px; cursor: pointer;
    font-family: var(--font-family); transition: all 0.15s ease;
}
.user-avatar-btn:hover { background: var(--color-bg-main); border-color: var(--color-border); }
.user-avatar-name {
    font-size: 13px; font-weight: 500; color: var(--color-text-secondary);
    white-space: nowrap;
}

/* Top Bar Dropdown (shared toggle mechanism) */
.top-bar-dropdown-overlay {
    position: fixed; inset: 0; z-index: 999; cursor: default;
    display: none;
}
.top-bar-dropdown-overlay.open { display: block; }
.top-bar-dropdown {
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000; overflow: hidden;
    display: none;
}
.top-bar-dropdown.open { display: block; }

/* User Dropdown */
.user-dropdown { width: 240px; }
.user-dropdown-header {
    padding: 14px 16px 12px; font-size: 13.5px; font-weight: 600;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-light);
}
.user-dropdown-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 10px 16px;
    font-size: 13px; font-weight: 500; font-family: var(--font-family);
    color: var(--color-text-secondary); text-decoration: none;
    background: none; border: none; cursor: pointer;
    transition: background 0.12s ease;
}
.user-dropdown-item:hover:not(:disabled) { background: var(--color-bg-main); color: var(--color-text-primary); }
.user-dropdown-item:disabled { opacity: 0.45; cursor: not-allowed; }
.user-dropdown-item.sign-out { color: var(--color-danger); }
.user-dropdown-item.sign-out:hover { background: rgba(214, 69, 69, 0.06); }
.user-dropdown-item svg { flex-shrink: 0; }

/* Notification Bell & Dropdown */
.notif-bell-btn { position: relative; }
.notif-badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: var(--color-danger); color: white;
    font-size: 10px; font-weight: 700; line-height: 16px;
    border-radius: 8px; text-align: center;
    pointer-events: none;
}
.notif-dropdown { width: 340px; max-height: 480px; overflow-y: auto; }
.notif-dropdown-header {
    padding: 14px 16px 12px; font-size: 13.5px; font-weight: 600;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-light);
}
.notif-section-label {
    padding: 10px 16px 4px; font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--color-text-muted);
}
.notif-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 9px 16px; text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.12s ease;
}
.notif-item:hover { background: var(--color-bg-main); }
.notif-item.danger { border-left-color: var(--color-danger); }
.notif-item.warning { border-left-color: var(--color-warning); }
.notif-item.accent { border-left-color: var(--color-accent); }
.notif-item-text {
    font-size: 13px; font-weight: 500; color: var(--color-text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1;
}
.notif-item-meta {
    font-size: 11.5px; color: var(--color-text-muted); white-space: nowrap; flex-shrink: 0;
}
.notif-empty {
    padding: 32px 16px; text-align: center;
    font-size: 13px; color: var(--color-text-muted);
}

/* Content */
.content-area { flex: 1; overflow-y: auto; padding: 28px; }

/* Page Header */
.page-header { margin-bottom: 24px; }
.page-header-row {
    display: flex; align-items: flex-start;
    justify-content: space-between; gap: 16px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--color-text-primary); letter-spacing: -0.5px; }
.page-subtitle { font-size: 13.5px; color: var(--color-text-secondary); margin-top: 4px; }
.header-actions { display: flex; gap: 8px; }
.inline-link { color: var(--color-accent); text-decoration: none; }
.inline-link:hover { text-decoration: underline; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; font-family: var(--font-family);
    cursor: pointer; transition: all 0.15s ease;
    text-decoration: none; border: 1px solid transparent; white-space: nowrap;
}
.btn-primary { background: var(--color-accent); color: white; border-color: var(--color-accent); }
.btn-primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--color-bg-card); color: var(--color-text-primary); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-bg-main); }
.btn-ghost { background: transparent; color: var(--color-text-secondary); border-color: transparent; }
.btn-ghost:hover { color: var(--color-text-primary); background: var(--color-bg-main); }
.btn-sm {
    padding: 5px 12px; font-size: 12px;
    background: var(--color-bg-card); border: 1px solid var(--color-border);
    color: var(--color-text-primary); border-radius: var(--radius-sm);
    cursor: pointer; font-family: var(--font-family); font-weight: 500;
    text-decoration: none; transition: all 0.15s ease;
}
.btn-sm:hover { background: var(--color-bg-main); }
.btn-ghost-sm {
    padding: 4px 8px; font-size: 12px; background: transparent;
    border: none; color: var(--color-text-muted); cursor: pointer;
    font-family: var(--font-family); transition: all 0.15s ease;
}
.btn-ghost-sm:hover { color: var(--color-text-primary); }
.btn-danger-sm {
    padding: 4px 10px; font-size: 12px; background: transparent;
    border: 1px solid var(--color-danger); color: var(--color-danger);
    cursor: pointer; font-family: var(--font-family);
    border-radius: var(--radius-sm); transition: all 0.15s ease;
}
.btn-danger-sm:hover { background: var(--color-danger); color: white; }

/* Data Tables */
.data-table-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); overflow: hidden;
}
.table-search { padding: 16px 20px; border-bottom: 1px solid var(--color-border-light); }
.search-input {
    width: 100%; max-width: 360px; padding: 8px 14px;
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    font-size: 13px; font-family: var(--font-family);
    color: var(--color-text-primary); outline: none; transition: border-color 0.15s ease;
}
.search-input:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-subtle); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    text-align: left; padding: 10px 20px;
    font-size: 11.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--color-text-muted); background: var(--color-bg-main);
    border-bottom: 1px solid var(--color-border);
}
.data-table tbody td {
    padding: 12px 20px; font-size: 13.5px;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-light);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--color-accent-subtle); }
.data-table.compact thead th { padding: 8px 16px; }
.data-table.compact tbody td { padding: 8px 16px; font-size: 13px; }
.table-link { color: var(--color-accent); text-decoration: none; font-weight: 500; }
.table-link:hover { text-decoration: underline; }
.mono { font-family: 'Courier New', monospace; font-size: 12.5px; }
.strong { font-weight: 600; }

/* Tags & Status */
.tag {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 11.5px; font-weight: 500;
    background: var(--color-bg-main); color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}
.tag.role-primary { background: rgba(59, 125, 221, 0.1); color: var(--color-accent); border-color: rgba(59, 125, 221, 0.2); }
.tag.role-billing { background: rgba(229, 160, 13, 0.1); color: var(--color-warning); border-color: rgba(229, 160, 13, 0.2); }
.tag.role-sitecontact { background: rgba(46, 165, 90, 0.1); color: var(--color-success); border-color: rgba(46, 165, 90, 0.2); }
.tag.role-general { background: var(--color-bg-main); color: var(--color-text-muted); }
.status-dot { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; }
.status-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-dot.active::before { background: var(--color-success); }
.status-dot.inactive::before { background: var(--color-text-muted); }
.status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 20px;
}
.status-badge.connected { background: rgba(46, 165, 90, 0.1); color: var(--color-success); }
.status-badge.pending { background: rgba(229, 160, 13, 0.1); color: var(--color-warning); }

/* Detail Cards */
.detail-grid { display: flex; flex-direction: column; gap: 20px; }
.detail-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}
.detail-card-title {
    font-size: 15px; font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light);
}
.detail-card-header {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light);
}
.detail-card-header .detail-card-title { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.detail-row {
    display: flex; align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border-light);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
    width: 180px; min-width: 180px;
    font-size: 13px; font-weight: 500;
    color: var(--color-text-muted);
}
.detail-value { font-size: 13px; color: var(--color-text-primary); }
.detail-value.notes { white-space: pre-wrap; }

/* Copyable / masked field UI */
.copyable-field { display: inline-flex; align-items: center; gap: 6px; }
.btn-field-action {
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 4px; padding: 1px 8px; font-size: 11px; color: var(--color-accent);
    cursor: pointer; white-space: nowrap; line-height: 1.6;
}
.btn-field-action:hover { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.btn-field-toggle {
    background: none; border: none; padding: 2px 0; font-size: 11px;
    color: var(--color-accent); cursor: pointer; margin-top: 2px;
}
.btn-field-toggle:hover { text-decoration: underline; }
.notes-text { font-size: 13.5px; color: var(--color-text-secondary); white-space: pre-wrap; line-height: 1.6; }

/* Forms */
.form-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}
.form-section { margin-bottom: 28px; }
.form-section:last-of-type { margin-bottom: 0; }
.form-section-title {
    font-size: 15px; font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 16px; padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border-light);
}
.form-row {
    display: flex; gap: 16px; margin-bottom: 14px;
}
.form-row:last-child { margin-bottom: 0; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.form-group.full { flex: 1 1 100%; }
.form-label {
    font-size: 12.5px; font-weight: 500;
    color: var(--color-text-secondary);
}
.form-input {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13.5px; font-family: var(--font-family);
    color: var(--color-text-primary);
    background: var(--color-bg-card);
    outline: none; transition: border-color 0.15s ease;
    width: 100%;
}
.form-input:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-subtle); }
.form-input:disabled { background: var(--color-bg-main); color: var(--color-text-muted); cursor: not-allowed; }
.form-input.textarea { resize: vertical; line-height: 1.5; }
.compact-input { padding: 5px 8px; font-size: 13px; }
.currency-wrap { display: flex; align-items: center; gap: 4px; }
.currency-wrap .currency-sign { font-size: 14px; font-weight: 500; color: var(--color-text-muted); }
select.form-input { cursor: pointer; }
.form-actions { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--color-border-light); }
.form-actions-inline { display: flex; gap: 8px; margin-top: 12px; }
.form-error {
    margin-top: 12px; padding: 10px 14px;
    background: rgba(214, 69, 69, 0.08);
    border: 1px solid rgba(214, 69, 69, 0.2);
    border-radius: var(--radius-sm);
    color: var(--color-danger); font-size: 13px;
}

/* Inline Form (for adding items in detail cards) */
.inline-form {
    display: flex; gap: 8px;
    margin-top: 16px; padding-top: 16px;
    border-top: 1px solid var(--color-border-light);
    align-items: flex-end;
}
.inline-form .form-input { flex: 1; }

/* Zone Form */
.zone-form {
    margin-top: 16px; padding-top: 16px;
    border-top: 1px solid var(--color-border-light);
}
.zone-form .form-row { margin-bottom: 10px; }

/* States */
.loading-state {
    padding: 48px; text-align: center;
    color: var(--color-text-muted); font-size: 14px;
}
.empty-state {
    padding: 48px; text-align: center;
    color: var(--color-text-muted); font-size: 14px;
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-sm {
    padding: 20px; text-align: center;
    color: var(--color-text-muted); font-size: 13px;
}

/* Placeholder cards */
.placeholder-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 48px; text-align: center;
    box-shadow: var(--shadow-sm);
}
.placeholder-icon { font-size: 40px; margin-bottom: 16px; opacity: 0.5; }
.placeholder-text { font-size: 14px; color: var(--color-text-muted); font-weight: 500; }

/* Settings */
.settings-section {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px; margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.settings-section-title {
    font-size: 15px; font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light);
}
.settings-row {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-light);
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 13px; font-weight: 500; color: var(--color-text-secondary); }
.settings-value {
    font-size: 13px; color: var(--color-text-primary);
    font-family: 'Courier New', monospace;
    background: var(--color-bg-main);
    padding: 4px 10px; border-radius: var(--radius-sm);
    max-width: 400px; overflow: hidden; text-overflow: ellipsis;
}
.settings-value.masked { letter-spacing: 2px; }

/* Toggle Switch */
.toggle-switch {
    position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: 13px; color: var(--color-text-secondary); user-select: none;
}
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
    width: 36px; height: 20px; background: #ccc; border-radius: 10px;
    transition: background 0.2s; position: relative; flex-shrink: 0;
}
.toggle-track::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; background: white; border-radius: 50%;
    transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-track { background: var(--color-accent); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle-label { font-weight: 500; }

/* Wizard Steps */
.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 16px 24px;
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}
.wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: all 0.2s;
}
.wizard-step.active {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
}
.wizard-step.completed {
    color: var(--color-success);
}
.wizard-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid currentColor;
}
.wizard-step.active .wizard-step-num {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}
.wizard-step.completed .wizard-step-num {
    background: var(--color-success);
    color: white;
    border-color: var(--color-success);
}
.wizard-divider {
    width: 32px;
    height: 2px;
    background: var(--color-border);
}
.wizard-added-list {
    margin-bottom: 16px;
}
.wizard-added-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--color-accent-subtle);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 13px;
}
.wizard-added-item .item-name { font-weight: 500; }
.wizard-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* Lookups Grid */
.lookups-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
/* Custom Fields */
.multi-select-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 0;
}

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

    .checkbox-label input[type="checkbox"] {
        width: 16px;
        height: 16px;
        cursor: pointer;
    }

.form-hint {
    font-size: 11.5px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* Invoice Status Tags */
.tag-grey { background: var(--color-bg-main); color: var(--color-text-muted); border-color: var(--color-border); }
.tag-blue { background: rgba(59, 125, 221, 0.1); color: var(--color-accent); border-color: rgba(59, 125, 221, 0.2); }
.tag-green { background: rgba(46, 165, 90, 0.1); color: var(--color-success); border-color: rgba(46, 165, 90, 0.2); }
.tag-orange { background: rgba(229, 160, 13, 0.1); color: var(--color-warning); border-color: rgba(229, 160, 13, 0.2); }
.tag-red { background: rgba(221, 59, 59, 0.1); color: var(--color-error); border-color: rgba(221, 59, 59, 0.2); }

/* Filter Tabs */
.filter-tabs { display: flex; gap: 4px; padding: 8px 16px; border-bottom: 1px solid var(--color-border); }
.filter-tab {
    padding: 6px 14px; border-radius: 6px; border: 1px solid var(--color-border);
    background: var(--color-bg-main); color: var(--color-text-secondary);
    font-size: 12.5px; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.filter-tab:hover { border-color: var(--color-accent); color: var(--color-accent); }
.filter-tab.active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

/* Text Colors */
.text-danger { color: var(--color-error); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }

/* Discount text */
.discount-text { font-size: 12px; color: var(--color-text-secondary); display: flex; align-items: center; gap: 4px; }

/* Line Group Header */
.line-group-header {
    font-size: 13px; font-weight: 600; color: var(--color-text-primary);
    padding: 10px 0 4px 0; margin-top: 8px; border-bottom: 1px solid var(--color-border);
}

/* Void invoice row */
.row-void td { opacity: 0.5; text-decoration: line-through; }
.row-void td:last-child { text-decoration: none; }

/* Sent indicator */
.sent-indicator { font-size: 12px; color: var(--color-success); font-weight: 500; }

/* Recurring icon */
.recurring-icon { font-size: 13px; color: var(--color-accent); margin-left: 4px; font-weight: 600; }

/* Warning background for edit mode */
:root { --color-warning-bg: #fff8e1; }

/* Bulk Action Bar — floating at bottom of content area */
.bulk-action-bar {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    background: var(--color-bg-dark);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 28px;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    animation: slideUp 0.25s ease forwards;
}
@keyframes slideUp {
    to { transform: translateY(0); }
}
.bulk-action-bar .bulk-count {
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
}
.bulk-action-bar .bulk-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bulk-action-bar .btn-bulk {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.bulk-action-bar .btn-bulk:hover { background: rgba(255, 255, 255, 0.2); }
.bulk-action-bar .btn-bulk:disabled { opacity: 0.4; cursor: not-allowed; }
.bulk-action-bar .btn-bulk.primary {
    background: var(--color-accent);
    border-color: var(--color-accent);
}
.bulk-action-bar .btn-bulk.primary:hover { background: var(--color-accent-hover); }
.bulk-action-bar .btn-bulk.danger {
    border-color: rgba(214, 69, 69, 0.5);
    color: #ff8a8a;
}
.bulk-action-bar .btn-bulk.danger:hover { background: rgba(214, 69, 69, 0.3); }
.bulk-action-bar .btn-bulk-clear {
    padding: 6px 10px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 12.5px;
    font-family: var(--font-family);
    transition: color 0.15s ease;
}
.bulk-action-bar .btn-bulk-clear:hover { color: #fff; }

/* Bulk result message overlay */
.bulk-result-banner {
    padding: 10px 20px;
    margin: 0 0 1px 0;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid var(--color-border-light);
}
.bulk-result-banner.success { background: rgba(46, 165, 90, 0.08); color: var(--color-success); }
.bulk-result-banner.error { background: rgba(214, 69, 69, 0.08); color: var(--color-danger); }

/* Confirm dialog card for bulk actions */
.bulk-confirm-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
}
.bulk-confirm-card.danger { border-color: var(--color-danger); }
.bulk-confirm-card .confirm-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}
.bulk-confirm-card .confirm-title.text-danger { color: var(--color-danger); }
.bulk-confirm-card p { font-size: 13.5px; color: var(--color-text-secondary); margin-bottom: 12px; }
.bulk-confirm-card .confirm-actions { display: flex; gap: 8px; }

/* Checkbox in tables */
.data-table thead th.col-check,
.data-table tbody td.col-check { width: 36px; padding-left: 16px; padding-right: 4px; }
.data-table thead th.col-check input[type="checkbox"],
.data-table tbody td.col-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* ============================================
   Dashboard
   ============================================ */

/* Last updated text */
.dash-updated {
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
    padding-top: 6px;
}

/* Metric cards row */
.dash-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.dash-metric-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--color-border);
}
.dash-metric-card.accent-blue { border-left-color: var(--color-accent); }
.dash-metric-card.accent-green { border-left-color: var(--color-success); }
.dash-metric-card.accent-accent { border-left-color: #7c5cbf; }
.dash-metric-card.accent-red { border-left-color: var(--color-danger); }
.dash-metric-card.accent-grey { border-left-color: var(--color-text-muted); }

.dash-metric-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}
.dash-metric-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-top: 4px;
}
.dash-metric-sub {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* Charts row */
.dash-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Tables row */
.dash-tables {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Shared card style */
.dash-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.dash-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border-light);
}

/* Bar chart */
.dash-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 160px;
    padding-top: 10px;
}
.dash-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    position: relative;
}
.dash-bar {
    width: 100%;
    max-width: 36px;
    background: var(--color-accent);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height 0.3s ease;
}
.dash-bar-col:hover .dash-bar { background: var(--color-accent-hover); }
.dash-bar-label {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-top: 6px;
    white-space: nowrap;
}
.dash-bar-tooltip {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
    opacity: 0;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.dash-bar-col:hover .dash-bar-tooltip { opacity: 1; }

/* Horizontal stacked bar (status breakdown) */
.dash-status-chart { display: flex; flex-direction: column; gap: 16px; }
.dash-hbar {
    display: flex;
    height: 28px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    gap: 2px;
}
.dash-hbar-seg {
    min-width: 4px;
    transition: width 0.3s ease;
    cursor: default;
}
.dash-status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}
.dash-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
.dash-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dash-legend-label { color: var(--color-text-secondary); }
.dash-legend-count { font-weight: 600; color: var(--color-text-primary); }

/* Interest/late fee summary in status card */
.dash-interest-summary {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dash-interest-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

/* Clickable table rows */
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--color-accent-subtle) !important; }

/* Quick actions bar */
.dash-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.dash-confirm {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    color: var(--color-text-primary);
    font-weight: 500;
    flex-wrap: wrap;
}

/* Skeleton loading */
.dash-metric-card.skeleton,
.dash-card.skeleton {
    background: var(--color-bg-card);
}
.skeleton-line {
    height: 14px;
    background: var(--color-border-light);
    border-radius: 4px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-line.lg { width: 60%; height: 28px; margin-bottom: 10px; }
.skeleton-line.sm { width: 40%; }
.skeleton-block {
    height: 120px;
    background: var(--color-border-light);
    border-radius: var(--radius-sm);
    margin-top: 12px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-block.tall { height: 200px; }
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   Reports
   ============================================ */

/* Report metrics grid — responsive summary cards */
.report-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

/* Date range filter row */
.report-date-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--color-border);
}
.report-date-filters label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--color-text-secondary);
}
.report-date-filters input[type="date"] {
    padding: 5px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-family);
    color: var(--color-text-primary);
    background: var(--color-bg-card);
}
.report-date-filters input[type="date"]:focus {
    border-color: var(--color-accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

/* Purple accent tag (In Progress, etc.) */
.tag-accent { background: rgba(124, 92, 191, 0.1); color: #7c5cbf; border-color: rgba(124, 92, 191, 0.2); }

/* Report action buttons */
.report-actions { display: flex; gap: 8px; }

/* Print styles */
@media print {
    .sidebar, .top-bar, .filter-tabs, .table-search, .report-actions,
    .report-date-filters, .page-subtitle, .report-metrics,
    .bulk-action-bar, .tab-bar { display: none !important; }
    .app-layout { display: block; }
    .main-area { width: 100%; }
    .content-area { overflow: visible; padding-top: 0; }
    .data-table-card { border: none; box-shadow: none; }
}

/* Responsive */
@media (max-width: 900px) {
    .dash-metrics { grid-template-columns: repeat(2, 1fr); }
    .report-metrics { grid-template-columns: repeat(2, 1fr); }
    .dash-charts,
    .dash-tables { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .dash-metrics { grid-template-columns: 1fr; }
    .report-metrics { grid-template-columns: 1fr; }
    .dash-actions { flex-wrap: wrap; }
    .report-date-filters { flex-wrap: wrap; }
}

/* ============================================
   Filter Bar (inline filter controls row)
   ============================================ */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 12px 0;
    flex-wrap: wrap;
}

/* ============================================
   Form Select (styled dropdown)
   ============================================ */
.form-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13.5px; font-family: var(--font-family);
    color: var(--color-text-primary);
    background: var(--color-bg-card) 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='%235f6578' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
    background-size: 12px;
    outline: none; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    transition: border-color 0.15s ease;
    width: 100%;
}
.form-select:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-subtle); }
.form-select:disabled { background-color: var(--color-bg-main); color: var(--color-text-muted); cursor: not-allowed; }

/* ============================================
   Tab Bar (underline-style tabs)
   ============================================ */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 20px;
}
.tab {
    padding: 10px 18px;
    font-size: 13px; font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s ease;
    background: none; border-top: none; border-left: none; border-right: none;
    font-family: var(--font-family);
}
.tab:hover { color: var(--color-text-primary); }
.tab.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    font-weight: 600;
}

/* ============================================
   Purple tag variant
   ============================================ */
.tag-purple { background: rgba(124, 92, 191, 0.1); color: #7c5cbf; border-color: rgba(124, 92, 191, 0.2); }

/* ============================================
   Blazor Error UI (moved from MainLayout.razor.css)
   ============================================ */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
