/* =====================================================================
   GTS Bill — Application Stylesheet
   Black + Gold theme matching GTS Payments brand
   ===================================================================== */

:root {
    --bg-base: #0a0a0a;
    --bg-elev-1: #141414;
    --bg-elev-2: #1a1a1a;
    --bg-elev-3: #242424;
    --bg-elev-4: #2a2a2a;

    --gold-500: #f5b800;
    --gold-400: #ffc929;
    --gold-600: #d4a000;
    --gold-700: #a87f00;
    --gold-gradient: linear-gradient(135deg, #d4a000 0%, #f5b800 50%, #ffc929 100%);

    --border-subtle: rgba(245, 184, 0, 0.08);
    --border-default: rgba(245, 184, 0, 0.15);
    --border-strong: rgba(245, 184, 0, 0.3);
    --border-card: rgba(255, 255, 255, 0.06);

    --text-primary: #f5f5f5;
    --text-secondary: #a3a3a3;
    --text-muted: #6b6b6b;
    --text-on-gold: #1a1a1a;

    --status-success: #22c55e;
    --status-info: #3b82f6;
    --status-warning: #f5b800;
    --status-danger: #ef4444;
    --status-neutral: #8b5cf6;

    --card-bg: linear-gradient(135deg, rgba(42, 42, 42, 0.5) 0%, rgba(26, 26, 26, 0.5) 100%);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.7);

    --font-display: 'Bebas Neue', sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;

    --sidebar-width: 240px;
    --topbar-height: 64px;
}

/* Light theme overrides */
[data-theme="light"] {
    --bg-base: #f5f5f5;
    --bg-elev-1: #ffffff;
    --bg-elev-2: #fafafa;
    --bg-elev-3: #f0f0f0;
    --bg-elev-4: #e8e8e8;

    --border-subtle: rgba(212, 160, 0, 0.12);
    --border-default: rgba(212, 160, 0, 0.25);
    --border-strong: rgba(212, 160, 0, 0.45);
    --border-card: rgba(0, 0, 0, 0.08);

    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #888888;

    --card-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 250, 250, 0.95) 100%);

    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Light-mode tweaks for elements that don't follow vars cleanly */
[data-theme="light"] body { background: var(--bg-base); }
[data-theme="light"] .sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
    border-right-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .nav-link.active {
    background: linear-gradient(90deg, rgba(212, 160, 0, 0.15), rgba(212, 160, 0, 0.04));
    color: var(--gold-600);
}
[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.85); }
[data-theme="light"] .modal {
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
}
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="tel"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="time"],
[data-theme="light"] input[type="datetime-local"],
[data-theme="light"] input[type="search"],
[data-theme="light"] select,
[data-theme="light"] textarea {
    background-color: #ffffff;
    color: var(--text-primary);
}
[data-theme="light"] thead { background: rgba(212, 160, 0, 0.06); }
[data-theme="light"] .table-wrap { background: var(--bg-elev-1); }
[data-theme="light"] tbody tr:hover { background: rgba(0, 0, 0, 0.02); }
[data-theme="light"] .toast {
    background: #ffffff;
    color: var(--text-primary);
}
[data-theme="light"] .totals-box { background: rgba(212, 160, 0, 0.06); }
[data-theme="light"] .btn-secondary {
    background: var(--bg-elev-3);
    color: var(--text-primary);
}
[data-theme="light"] .btn-secondary:hover { background: var(--bg-elev-4); }
[data-theme="light"] .login-bg { background: #f5f5f5; }
[data-theme="light"] .login-card {
    background: rgba(255, 255, 255, 0.98);
    border-color: var(--border-default);
}
[data-theme="light"] .login-title,
[data-theme="light"] .modal-header h2,
[data-theme="light"] .page-title { color: var(--text-primary); }
[data-theme="light"] .btn-icon { color: var(--text-secondary); }
[data-theme="light"] .btn-icon:hover { background: rgba(0, 0, 0, 0.06); color: var(--text-primary); }
[data-theme="light"] select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23555555' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
[data-theme="light"] .badge-muted {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    border-color: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .empty-state h3 { color: var(--text-primary); }
[data-theme="light"] .modal-overlay { background: rgba(40, 40, 40, 0.5); }

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

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

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea, button { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; display: block; }

/* =====================================================================
   LOGIN PAGE
   ===================================================================== */

.login-body {
    overflow: auto;
    min-height: 100vh;
}

.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: var(--bg-base);
    overflow: hidden;
}

.login-bg-mesh {
    position: absolute;
    inset: -50%;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(245, 184, 0, 0.15), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(212, 160, 0, 0.10), transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 201, 41, 0.05), transparent 60%);
    filter: blur(40px);
    animation: meshShift 20s ease-in-out infinite alternate;
}

@keyframes meshShift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-5%, 5%) scale(1.1); }
}

.login-bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(245, 184, 0, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(245, 184, 0, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at center, black, transparent 70%);
}

.login-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-modal);
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}
.login-logo img {
    height: 56px;
    filter: drop-shadow(0 0 20px rgba(245, 184, 0, 0.3));
}

.login-title {
    text-align: center;
    font-family: var(--font-display);
    font-size: 28px;
    letter-spacing: 0.12em;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
}

.login-footer {
    margin-top: 28px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.05em;
}

/* =====================================================================
   FORMS
   ===================================================================== */

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

.form-row {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Modal forms: uniform vertical rhythm between every section. */
.modal-body form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.modal-body form > * { margin: 0; }
.modal-body form fieldset { margin: 0; padding: 18px 20px; }
.modal-body form fieldset > * + * { margin-top: 14px; }

label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], input[type="date"],
input[type="time"], input[type="search"],
select, textarea {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gold-500);
    box-shadow: 0 0 0 3px rgba(245, 184, 0, 0.12);
}

textarea { resize: vertical; min-height: 80px; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23a3a3a3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

input[type="checkbox"], input[type="radio"] {
    accent-color: var(--gold-500);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.checkbox-row label {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}

/* =====================================================================
   BUTTONS
   ===================================================================== */

.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 18px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.02em;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gold-gradient);
    color: var(--text-on-gold);
    box-shadow: 0 4px 12px rgba(245, 184, 0, 0.3);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(245, 184, 0, 0.45);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-elev-3);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}
.btn-secondary:hover { background: var(--bg-elev-4); border-color: var(--border-strong); }

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.04); color: var(--text-primary); }

.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); }

/* =====================================================================
   APP SHELL
   ===================================================================== */

.app-body { overflow: hidden; }

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    background: linear-gradient(180deg, #0f0f0f 0%, #050505 100%);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-logo {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-subtle);
}
.sidebar-logo img { height: 36px; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    position: relative;
}
.nav-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}
.nav-link.active {
    background: linear-gradient(90deg, rgba(245, 184, 0, 0.12), rgba(245, 184, 0, 0.04));
    color: var(--gold-500);
}
.nav-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--gold-gradient);
    border-radius: 0 3px 3px 0;
}
.nav-link i { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 12px 8px;
}

.sidebar-user {
    padding: 12px;
    margin: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold-gradient);
    color: var(--text-on-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* TOPBAR */
.main-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    flex-shrink: 0;
}

.page-title {
    font-family: var(--font-display);
    font-size: 22px;
    letter-spacing: 0.08em;
    color: var(--text-primary);
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.mobile-menu-btn { display: none; }

/* CONTENT */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(245, 184, 0, 0.2);
    border-top-color: var(--gold-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   CARDS, GRIDS, TABLES
   ===================================================================== */

.card {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 16px;
    letter-spacing: 0.08em;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.grid {
    display: grid;
    gap: 16px;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* KPI cards */
.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gold-gradient);
    opacity: 0.6;
}
.kpi-card .kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.kpi-card .kpi-value {
    font-family: var(--font-display);
    font-size: 32px;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}
.kpi-card .kpi-value.gold {
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.kpi-card .kpi-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-card);
    background: var(--bg-elev-1);
}
table {
    width: 100%;
    border-collapse: collapse;
}
thead { background: rgba(245, 184, 0, 0.04); }
th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
}
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
tbody tr.clickable { cursor: pointer; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-mono { font-family: ui-monospace, 'SF Mono', monospace; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-gold {
    background: var(--gold-gradient);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.text-success { color: var(--status-success); }
.text-danger { color: var(--status-danger); }

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid;
}
.badge-success { background: rgba(34, 197, 94, 0.12); color: #86efac; border-color: rgba(34, 197, 94, 0.3); }
.badge-info    { background: rgba(59, 130, 246, 0.12); color: #93c5fd; border-color: rgba(59, 130, 246, 0.3); }
.badge-warning { background: rgba(245, 184, 0, 0.12); color: var(--gold-400); border-color: rgba(245, 184, 0, 0.3); }
.badge-danger  { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }
.badge-neutral { background: rgba(139, 92, 246, 0.12); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.3); }
.badge-muted   { background: rgba(255, 255, 255, 0.04); color: var(--text-secondary); border-color: var(--border-card); }

.badge-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* =====================================================================
   PAGE LAYOUTS
   ===================================================================== */

.page-section { margin-bottom: 24px; }

.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}
.toolbar .search-input {
    flex: 1;
    min-width: 220px;
    max-width: 360px;
}
.toolbar select { width: auto; min-width: 140px; }
.toolbar-spacer { flex: 1; }

.empty-state {
    padding: 60px 24px;
    text-align: center;
    color: var(--text-secondary);
}
.empty-state h3 {
    font-family: var(--font-display);
    font-size: 22px;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* =====================================================================
   MODAL
   ===================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.15s;
}
.modal-overlay[hidden] {
    display: none !important;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: linear-gradient(135deg, #1c1c1c, #141414);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scaleIn 0.18s ease-out;
}
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 960px; }

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.modal-header h2 {
    font-family: var(--font-display);
    font-size: 22px;
    letter-spacing: 0.06em;
}
.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

/* =====================================================================
   TOASTS
   ===================================================================== */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 200;
}
.toast {
    background: linear-gradient(135deg, #1c1c1c, #141414);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: var(--shadow-card);
    color: var(--text-primary);
    font-size: 13px;
    min-width: 240px;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.2s;
}
.toast.toast-success { border-color: rgba(34, 197, 94, 0.4); }
.toast.toast-success::before { content: '✓'; color: var(--status-success); font-weight: 700; }
.toast.toast-error { border-color: rgba(239, 68, 68, 0.4); }
.toast.toast-error::before { content: '✕'; color: var(--status-danger); font-weight: 700; }
.toast.toast-info::before { content: 'ℹ'; color: var(--status-info); font-weight: 700; }
@keyframes slideInRight { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* =====================================================================
   ICONS - using inline SVG via mask
   ===================================================================== */
.i-grid, .i-truck, .i-users, .i-document, .i-clock, .i-tag,
.i-car, .i-check, .i-trophy, .i-shield, .i-plus, .i-gear {
    display: inline-block;
    width: 18px;
    height: 18px;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}
.i-grid     { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7'/%3E%3Crect x='14' y='3' width='7' height='7'/%3E%3Crect x='14' y='14' width='7' height='7'/%3E%3Crect x='3' y='14' width='7' height='7'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7'/%3E%3Crect x='14' y='3' width='7' height='7'/%3E%3Crect x='14' y='14' width='7' height='7'/%3E%3Crect x='3' y='14' width='7' height='7'/%3E%3C/svg%3E"); }
.i-truck    { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='1' y='3' width='15' height='13'/%3E%3Cpolygon points='16 8 20 8 23 11 23 16 16 16 16 8'/%3E%3Ccircle cx='5.5' cy='18.5' r='2.5'/%3E%3Ccircle cx='18.5' cy='18.5' r='2.5'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='1' y='3' width='15' height='13'/%3E%3Cpolygon points='16 8 20 8 23 11 23 16 16 16 16 8'/%3E%3Ccircle cx='5.5' cy='18.5' r='2.5'/%3E%3Ccircle cx='18.5' cy='18.5' r='2.5'/%3E%3C/svg%3E"); }
.i-users    { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); }
.i-document { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3C/svg%3E"); }
.i-clock    { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E"); }
.i-tag      { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z'/%3E%3Cline x1='7' y1='7' x2='7.01' y2='7'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z'/%3E%3Cline x1='7' y1='7' x2='7.01' y2='7'/%3E%3C/svg%3E"); }
.i-car      { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 17H3v-6l2-5h14l2 5v6h-2'/%3E%3Ccircle cx='7' cy='17' r='2'/%3E%3Ccircle cx='17' cy='17' r='2'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 17H3v-6l2-5h14l2 5v6h-2'/%3E%3Ccircle cx='7' cy='17' r='2'/%3E%3Ccircle cx='17' cy='17' r='2'/%3E%3C/svg%3E"); }
.i-check    { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E"); }
.i-trophy   { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9H4.5a2.5 2.5 0 0 1 0-5H6'/%3E%3Cpath d='M18 9h1.5a2.5 2.5 0 0 0 0-5H18'/%3E%3Cpath d='M4 22h16'/%3E%3Cpath d='M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22'/%3E%3Cpath d='M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22'/%3E%3Cpath d='M18 2H6v7a6 6 0 0 0 12 0V2Z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9H4.5a2.5 2.5 0 0 1 0-5H6'/%3E%3Cpath d='M18 9h1.5a2.5 2.5 0 0 0 0-5H18'/%3E%3Cpath d='M4 22h16'/%3E%3Cpath d='M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22'/%3E%3Cpath d='M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22'/%3E%3Cpath d='M18 2H6v7a6 6 0 0 0 12 0V2Z'/%3E%3C/svg%3E"); }
.i-shield   { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E"); }
.i-plus     { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E"); }
.i-gear     { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E"); }

/* =====================================================================
   PRINT (for invoices)
   ===================================================================== */
@media print {
    .sidebar, .topbar, .toolbar, .modal-footer, .no-print { display: none !important; }
    .app-shell { display: block; }
    .content { padding: 0; overflow: visible; }
    body { background: white; color: black; }
    .invoice-print {
        background: white !important;
        color: black !important;
        padding: 40px;
    }
    .invoice-print * {
        color: black !important;
        background: transparent !important;
        border-color: #ccc !important;
    }
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--sidebar-width);
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.2s;
    }
    .sidebar.open { transform: translateX(0); }
    .mobile-menu-btn { display: inline-flex; }
    .content { padding: 16px; }
}

/* Job/invoice details */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px 24px;
    margin-bottom: 20px;
}
.detail-item .detail-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.detail-item .detail-value {
    font-size: 14px;
    color: var(--text-primary);
}

/* Line items editor */
.line-items {
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 12px;
}
.line-items table { font-size: 13px; }
.line-items td { padding: 8px; vertical-align: top; }
.line-items input, .line-items select {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-card);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
}
[data-theme="light"] .line-items input,
[data-theme="light"] .line-items select {
    background-color: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
}
.line-items input:focus, .line-items select:focus {
    background: var(--bg-elev-3);
    border-color: var(--gold-500);
}
.line-items select[data-product] {
    color: var(--gold-400);
    font-weight: 500;
}
[data-theme="light"] .line-items select[data-product] {
    color: var(--gold-600);
}

/* Auto-save status indicator (Jobs modal) */
.autosave-status {
    position: sticky;
    top: -24px;
    margin-bottom: 12px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    transition: opacity 0.25s, background-color 0.2s;
    letter-spacing: 0.04em;
}
.autosave-status[data-state="pending"] {
    background: rgba(245, 184, 0, 0.12);
    color: var(--gold-400);
    border: 1px solid rgba(245, 184, 0, 0.3);
}
.autosave-status[data-state="saving"] {
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}
.autosave-status[data-state="saved"] {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.autosave-status[data-state="error"] {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
[data-theme="light"] .autosave-status[data-state="pending"] { color: var(--gold-700); }
[data-theme="light"] .autosave-status[data-state="saving"] { color: #1e40af; }
[data-theme="light"] .autosave-status[data-state="saved"] { color: #166534; }
[data-theme="light"] .autosave-status[data-state="error"] { color: #991b1b; }

.totals-box {
    background: rgba(245, 184, 0, 0.04);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.totals-box .row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}
.totals-box .row.grand {
    border-top: 1px solid var(--border-default);
    padding-top: 8px;
    margin-top: 4px;
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--gold-500);
    letter-spacing: 0.04em;
}

/* Aging report */
.aging-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}
.aging-current  { background: rgba(34, 197, 94, 0.12); color: #86efac; }
.aging-30       { background: rgba(245, 184, 0, 0.12); color: var(--gold-400); }
.aging-60       { background: rgba(249, 115, 22, 0.12); color: #fdba74; }
.aging-90       { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }
.aging-90-plus  { background: rgba(220, 38, 38, 0.18); color: #f87171; }

/* Leaderboard */
.leaderboard-row {
    display: grid;
    grid-template-columns: 50px 1fr auto auto;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    align-items: center;
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-rank {
    font-family: var(--font-display);
    font-size: 24px;
    text-align: center;
    color: var(--text-muted);
}
.leaderboard-rank.gold   { color: #fbbf24; }
.leaderboard-rank.silver { color: #d1d5db; }
.leaderboard-rank.bronze { color: #b45309; }

/* Form sections */
fieldset {
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}
legend {
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--gold-500);
    padding: 0 8px;
}
