/* =========================================================================
   NagariBilling — Design System
   ========================================================================= */

:root {
    --bg: #f1f5f9;
    --bg-soft: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --text: #0f172a;
    --text-soft: #334155;
    --muted: #64748b;
    --muted-2: #94a3b8;

    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-soft: #ccfbf1;
    --primary-50: #f0fdfa;

    --success: #059669;
    --success-soft: #d1fae5;
    --danger: #e11d48;
    --danger-soft: #ffe4e6;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --info: #2563eb;
    --info-soft: #dbeafe;
    --violet: #7c3aed;

    --sidebar: #0b1b2b;
    --sidebar-2: #0f2438;
    --sidebar-line: rgba(255, 255, 255, .07);
    --sidebar-text: #94a3b8;
    --sidebar-text-strong: #e2e8f0;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 8px 24px -12px rgba(15, 23, 42, .18);
    --shadow-lg: 0 24px 50px -24px rgba(15, 23, 42, .28);

    --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); }
img { max-width: 100%; }
h1, h2, h3, h4, h5 { margin: 0 0 .4em; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }

.icon { flex: none; vertical-align: middle; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-nowrap { white-space: nowrap; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.w-100 { width: 100%; }
.d-none { display: none !important; }

/* =========================================================================
   Shell
   ========================================================================= */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 264px;
    flex: none;
    background: var(--sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    background-image:
        radial-gradient(circle at 20% 0%, rgba(13, 148, 136, .22), transparent 34%),
        radial-gradient(circle at 100% 100%, rgba(37, 99, 235, .10), transparent 40%);
    transition: transform .25s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 22px 18px;
    color: #fff;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: linear-gradient(135deg, #14b8a6, #0d9488 55%, #0f766e);
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: 0 8px 20px -8px rgba(13, 148, 136, .9);
    flex: none;
}

.brand-text { line-height: 1.2; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.02em; color: #fff; }
.brand-name span { color: #5eead4; }
.brand-sub { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #7dd3c7; margin-top: 2px; font-weight: 600; }

.sidebar-section { padding: 10px 14px 0; }
.sidebar-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #5f7389;
    padding: 12px 10px 8px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 13.5px;
    transition: background .15s ease, color .15s ease, transform .15s ease;
    position: relative;
}

.sidebar-nav a .nav-icon { color: #7c8fa6; display: flex; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .055); color: #fff; }
.sidebar-nav a:hover .nav-icon { color: #5eead4; }
.sidebar-nav a.active {
    background: linear-gradient(90deg, rgba(13, 148, 136, .30), rgba(13, 148, 136, .12));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(94, 234, 212, .16);
}
.sidebar-nav a.active .nav-icon { color: #5eead4; }
.sidebar-nav a.active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #14b8a6;
}

.nav-badge {
    margin-left: auto;
    background: rgba(244, 63, 94, .18);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, .3);
    padding: 1px 7px;
    border-radius: 99px;
    font-size: 10.5px;
    font-weight: 700;
}

.sidebar-footer { margin-top: auto; padding: 16px 14px 18px; }
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--sidebar-line);
}
.sidebar-user .avatar { width: 36px; height: 36px; font-size: 12px; }
.sidebar-user-meta { min-width: 0; }
.sidebar-user-name { color: #f1f5f9; font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: #7c8fa6; font-size: 11px; }
.sidebar-footer-note { color: #4d6278; font-size: 10.5px; text-align: center; margin-top: 12px; }

.main {
    flex: 1;
    min-width: 0;
    margin-left: 264px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 30px;
    background: rgba(241, 245, 249, .84);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, .8);
}

.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 20px; margin: 0; letter-spacing: -.025em; }
.topbar-title .crumb { color: var(--muted); font-size: 12px; margin-bottom: 1px; }
.topbar-title .crumb span { color: var(--muted-2); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-date {
    display: flex; align-items: center; gap: 7px;
    color: var(--muted); font-size: 12.5px; font-weight: 500;
    background: #fff; border: 1px solid var(--line); border-radius: 99px;
    padding: 7px 13px; box-shadow: var(--shadow-sm);
}

.menu-toggle { display: none; }
.sidebar-overlay { display: none; }

.content { padding: 26px 30px 40px; width: 100%; max-width: 1440px; margin: 0 auto; flex: 1; }
.app-footer { padding: 0 30px 26px; color: var(--muted-2); font-size: 11.5px; display: flex; gap: 8px; justify-content: space-between; max-width: 1440px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0 0 3px; letter-spacing: -.03em; }
.page-head p { color: var(--muted); margin: 0; font-size: 13px; }
.page-head-actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #fff;
    color: var(--text-soft);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn .icon { width: 17px; height: 17px; }

.btn-primary { background: linear-gradient(135deg, #0d9488, #0f766e); color: #fff; box-shadow: 0 6px 16px -8px rgba(13, 148, 136, .8); }
.btn-primary:hover { color: #fff; filter: brightness(1.05); box-shadow: 0 8px 20px -8px rgba(13, 148, 136, .9); }
.btn-outline { border-color: var(--line-strong); background: #fff; color: var(--text-soft); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-50); }
.btn-soft { background: var(--primary-soft); color: var(--primary-dark); border-color: transparent; }
.btn-soft:hover { background: #99f6e4; color: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { color: #fff; filter: brightness(1.05); }
.btn-danger-soft { background: var(--danger-soft); color: #be123c; }
.btn-warning-soft { background: var(--warning-soft); color: #b45309; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { padding: 12px 22px; font-size: 14.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-icon { padding: 8px; width: 34px; height: 34px; border-radius: 9px; }
.btn-icon.btn-sm { width: 29px; height: 29px; padding: 0; }

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* =========================================================================
   Cards & layout blocks
   ========================================================================= */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.card-head h2, .card-head h3 { font-size: 15px; margin: 0; letter-spacing: -.01em; }
.card-head .sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.card-head-actions { margin-left: auto; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

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

/* Stat cards */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(218px, 1fr)); margin-bottom: 20px; }
.stat {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat::after {
    content: "";
    position: absolute; right: -40px; top: -40px; width: 110px; height: 110px;
    border-radius: 50%; background: var(--stat-soft, var(--primary-soft)); opacity: .55;
}
.stat-top { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.stat-icon {
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center;
    background: var(--stat-soft, var(--primary-soft));
    color: var(--stat-color, var(--primary-dark));
}
.stat-label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.stat-value { font-size: 23px; font-weight: 800; letter-spacing: -.03em; margin: 10px 0 2px; position: relative; z-index: 1; }
.stat-value.sm { font-size: 19px; }
.stat-foot { color: var(--muted); font-size: 11.5px; display: flex; align-items: center; gap: 5px; position: relative; z-index: 1; }
.stat-foot strong { color: var(--text-soft); }
.stat.accent { background: linear-gradient(135deg, #0b3b38, #0f766e); border-color: transparent; color: #fff; }
.stat.accent .stat-label, .stat.accent .stat-foot { color: #99f6e4; }
.stat.accent .stat-value { color: #fff; }
.stat.accent .stat-icon { background: rgba(255,255,255,.15); color: #ccfbf1; }
.stat.accent::after { background: rgba(255,255,255,.08); }

/* =========================================================================
   Forms
   ========================================================================= */

.form-grid { display: grid; gap: 15px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: 1 / -1; }
.field label, .label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 5px;
}
.label .req { color: var(--danger); }
.input, .select, .textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.45;
    transition: border .15s, box-shadow .15s;
    min-height: 38px;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, .12);
}
.textarea { min-height: 88px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.input-sm { padding: 6px 10px; font-size: 12.5px; min-height: 32px; border-radius: 8px; }
.hint { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.field-error { color: var(--danger); font-size: 11.5px; margin-top: 4px; }
.input-group { display: flex; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .btn { border-radius: 0 10px 10px 0; }
.input-addon {
    display: flex; align-items: center; padding: 0 11px;
    background: var(--surface-2); border: 1px solid var(--line-strong); border-right: 0;
    border-radius: 10px 0 0 10px; color: var(--muted); font-size: 12.5px; font-weight: 600;
}
.input-addon + .input { border-radius: 0 10px 10px 0; }

.search-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.search-form .field { min-width: 150px; }
.search-form .field.grow { flex: 1; min-width: 210px; }
.search-form .input, .search-form .select { min-height: 36px; }

.check {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: 13px; color: var(--text-soft); font-weight: 500;
}
.check input[type="checkbox"], .check input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

.form-actions { display: flex; gap: 9px; flex-wrap: wrap; padding-top: 6px; }

/* =========================================================================
   Tables
   ========================================================================= */

.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfd; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { vertical-align: middle; }
.table.compact td, .table.compact th { padding: 8px 12px; }
.table .row-title { font-weight: 600; color: var(--text); }
.table .row-sub { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.table .amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.table tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--line); }

.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
    width: 34px; height: 34px; border-radius: 10px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #ccfbf1, #99f6e4);
    color: var(--primary-dark);
    font-weight: 700; font-size: 11.5px; flex: none;
    border: 1px solid #b2f5ea;
}
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 18px; }
.avatar.blue { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.avatar.violet { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.avatar.rose { background: #ffe4e6; color: #be123c; border-color: #fecdd3; }

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 99px;
    font-size: 11px; font-weight: 700; line-height: 1.45;
    white-space: nowrap; border: 1px solid transparent;
}
.badge-success { background: var(--success-soft); color: #047857; border-color: #a7f3d0; }
.badge-danger { background: var(--danger-soft); color: #be123c; border-color: #fecdd3; }
.badge-warning { background: var(--warning-soft); color: #b45309; border-color: #fde68a; }
.badge-info { background: var(--info-soft); color: #1d4ed8; border-color: #bfdbfe; }
.badge-muted { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.badge-violet { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

.empty {
    padding: 48px 24px; text-align: center; color: var(--muted);
}
.empty .empty-icon {
    width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
    background: var(--surface-2); color: var(--muted-2); margin: 0 auto 12px; border: 1px dashed var(--line-strong);
}
.empty h3 { font-size: 15px; margin-bottom: 4px; color: var(--text-soft); }
.empty p { margin: 0; font-size: 12.5px; }

/* =========================================================================
   Alerts & toasts
   ========================================================================= */

.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 15px; border-radius: 12px; font-size: 13px;
    border: 1px solid transparent; margin-bottom: 16px;
}
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }
.alert-danger { background: var(--danger-soft); color: #9f1239; border-color: #fecdd3; }
.alert-warning { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--info-soft); color: #1e40af; border-color: #bfdbfe; }
.alert strong { font-weight: 700; }

.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 999; display: flex; flex-direction: column; gap: 9px; max-width: 360px; }
.toast {
    display: flex; align-items: flex-start; gap: 9px;
    background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--primary);
    border-radius: 11px; padding: 11px 14px; box-shadow: var(--shadow-lg);
    font-size: 12.5px; color: var(--text-soft);
    animation: toast-in .25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast .icon { color: var(--muted); }
.toast-close { margin-left: auto; background: none; border: 0; color: var(--muted-2); cursor: pointer; padding: 0 2px; font-size: 15px; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* =========================================================================
   Misc components
   ========================================================================= */

.pagination { display: flex; gap: 5px; align-items: center; }
.page-link {
    min-width: 32px; height: 32px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line-strong); border-radius: 8px;
    background: #fff; color: var(--text-soft); font-size: 12.5px; font-weight: 600;
}
.page-link:hover { border-color: var(--primary); color: var(--primary-dark); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link.disabled { opacity: .4; pointer-events: none; }

.tabs { display: flex; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); padding: 3px; border-radius: 10px; flex-wrap: wrap; }
.tabs a, .tabs button {
    padding: 6px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
    color: var(--muted); border: 0; background: none; cursor: pointer; font-family: inherit;
}
.tabs a.active, .tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

.progress { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #14b8a6, #0d9488); }
.progress.warn > span { background: linear-gradient(90deg, #fbbf24, #d97706); }
.progress.danger > span { background: linear-gradient(90deg, #fb7185, #e11d48); }

.kv { display: grid; grid-template-columns: 132px 1fr; gap: 9px 12px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; color: var(--text-soft); font-weight: 500; word-break: break-word; }

.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 0; }

.divider { height: 1px; background: var(--line); margin: 18px 0; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; font-size: 13px; }
.list-item .sub { color: var(--muted); font-size: 11.5px; }

/* Charts */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding: 8px 4px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart-bar {
    width: 100%; max-width: 46px; min-height: 4px;
    border-radius: 8px 8px 4px 4px;
    background: linear-gradient(180deg, #2dd4bf, #0d9488);
    position: relative; transition: filter .15s;
}
.chart-col:hover .chart-bar { filter: brightness(1.08); }
.chart-bar .chart-val {
    position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    font-size: 10px; font-weight: 700; color: var(--text-soft); white-space: nowrap; opacity: 0; transition: opacity .15s;
}
.chart-col:hover .chart-bar .chart-val { opacity: 1; }
.chart-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; font-weight: 600; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }

.donut {
    width: 132px; height: 132px; border-radius: 50%; position: relative; flex: none;
    background: conic-gradient(var(--success) 0 var(--p1), var(--info) var(--p1) var(--p2), var(--danger) var(--p2) 100%);
}
.donut::after { content: ""; position: absolute; inset: 18px; border-radius: 50%; background: #fff; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; text-align: center; }
.donut-center strong { display: block; font-size: 19px; line-height: 1.1; }
.donut-center span { font-size: 10px; color: var(--muted); }

/* Login */
.login-page {
    min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr;
    background: var(--bg);
}
.login-hero {
    position: relative; padding: 54px 60px;
    background: radial-gradient(circle at 15% 10%, #115e59, transparent 45%),
                radial-gradient(circle at 90% 90%, #1e3a8a, transparent 50%),
                linear-gradient(145deg, #071b2b, #0b3b38 70%, #0f172a);
    color: #e2e8f0; display: flex; flex-direction: column; overflow: hidden;
}
.login-hero::before {
    content: ""; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(94, 234, 212, .12) 1px, transparent 1px);
    background-size: 22px 22px; mask-image: linear-gradient(180deg, rgba(0,0,0,.9), transparent 85%);
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero .brand { padding: 0; }
.login-hero h2 { font-size: clamp(28px, 3vw, 42px); letter-spacing: -.04em; line-height: 1.12; margin: 60px 0 16px; color: #fff; max-width: 480px; }
.login-hero h2 span { color: #5eead4; }
.login-hero > p { color: #a7c0cc; max-width: 460px; line-height: 1.7; font-size: 14.5px; }
.login-features { display: grid; gap: 14px; margin-top: 36px; max-width: 460px; }
.login-feature { display: flex; gap: 13px; align-items: flex-start; }
.login-feature .fi {
    width: 38px; height: 38px; border-radius: 11px; flex: none;
    display: grid; place-items: center; background: rgba(94, 234, 212, .1);
    border: 1px solid rgba(94, 234, 212, .2); color: #5eead4;
}
.login-feature .ft { font-weight: 700; color: #e2e8f0; font-size: 13px; }
.login-feature .fd { color: #8aa4b3; font-size: 12px; margin-top: 1px; }
.login-hero .login-quote { margin-top: auto; padding-top: 40px; color: #6b8494; font-size: 11.5px; }
.login-side { display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { font-size: 26px; letter-spacing: -.035em; margin-bottom: 6px; }
.login-card .lead { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.login-form .field { margin-bottom: 15px; }
.login-form .input { padding: 11px 13px; font-size: 14px; }
.login-form .btn { margin-top: 6px; }
.login-demo {
    margin-top: 22px; padding: 13px 15px; border-radius: 12px;
    background: var(--surface); border: 1px dashed var(--line-strong);
    font-size: 11.5px; color: var(--muted);
}
.login-demo strong { color: var(--text-soft); }
.login-demo code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--text-soft); }
.login-footer { text-align: center; color: var(--muted-2); font-size: 11px; margin-top: 26px; }
.login-alert { margin-bottom: 16px; }

/* Invoice & billing document */
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.doc-head { display: flex; justify-content: space-between; gap: 24px; padding: 28px 30px; border-bottom: 2px solid var(--primary); flex-wrap: wrap; }
.doc-brand { display: flex; gap: 12px; align-items: flex-start; }
.doc-brand .brand-mark { width: 48px; height: 48px; border-radius: 14px; }
.doc-company h2 { font-size: 18px; margin: 0 0 2px; }
.doc-company p { color: var(--muted); font-size: 11.5px; margin: 0; line-height: 1.5; }
.doc-title { text-align: right; }
.doc-title h1 { font-size: 26px; letter-spacing: .06em; color: var(--primary-dark); margin: 0 0 5px; }
.doc-title .num { font-family: var(--mono); font-size: 12.5px; color: var(--text-soft); font-weight: 600; }
.doc-meta { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; padding: 22px 30px; border-bottom: 1px solid var(--line); }
.doc-meta .label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-bottom: 5px; }
.doc-meta .val { font-size: 13px; font-weight: 600; }
.doc-meta .val small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; margin-top: 1px; }
.doc-body { padding: 24px 30px; }
.doc-total-box { margin-left: auto; width: 300px; max-width: 100%; }
.doc-total-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; color: var(--text-soft); }
.doc-total-row.grand { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 12px; font-size: 16px; font-weight: 800; color: var(--text); }
.doc-note { margin-top: 26px; padding: 14px 16px; background: var(--surface-2); border-radius: 10px; font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); }
.doc-foot { padding: 18px 30px 26px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-end; }
.sign-box { text-align: center; min-width: 160px; }
.sign-box .line { border-top: 1px solid var(--line-strong); margin-top: 46px; padding-top: 6px; font-size: 11.5px; color: var(--muted); }

/* Receipt */
.receipt { width: 320px; margin: 20px auto; background: #fff; padding: 22px; font-family: var(--mono); font-size: 11.5px; color: #111; border: 1px solid #ddd; }
.receipt h3 { text-align: center; font-family: var(--font); font-size: 14px; margin: 0 0 2px; }
.receipt .center { text-align: center; }
.receipt .dash { border-top: 1px dashed #999; margin: 10px 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 2px 0; vertical-align: top; }
.receipt .right { text-align: right; }
.receipt .total { font-size: 14px; font-weight: 700; }

/* Login responsive */
@media (max-width: 900px) {
    .login-page { grid-template-columns: 1fr; }
    .login-hero { display: none; }
    .login-side { min-height: 100vh; background: radial-gradient(circle at 50% 0%, #ccfbf1, transparent 55%), var(--bg); }
}

/* Responsive */
@media (max-width: 1180px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main-side { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: 0 0 60px rgba(0,0,0,.35); }
    .sidebar.open { transform: none; }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 45; backdrop-filter: blur(2px); }
    .content, .topbar { padding-left: 20px; padding-right: 20px; }
    .app-footer { padding-left: 20px; padding-right: 20px; }
    .topbar-date { display: none; }
}

@media (max-width: 760px) {
    .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2, .form-grid .span-3 { grid-column: auto; }
    .page-head h1 { font-size: 21px; }
    .stat-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
    .stat { padding: 14px; }
    .stat-value { font-size: 19px; }
    .stat-value.sm { font-size: 16px; }
    .doc-head, .doc-meta, .doc-body, .doc-foot { padding: 18px; }
    .doc-meta { grid-template-columns: 1fr 1fr; }
    .content { padding: 18px 14px 30px; }
    .topbar { padding: 11px 14px; }
    .topbar-title h1 { font-size: 17px; }
    .hide-sm { display: none !important; }
    .table th, .table td { padding: 9px 10px; }
    .card-head { padding: 13px 15px; }
    .card-body { padding: 15px; }
    .page-head-actions { width: 100%; margin-left: 0; }
    .page-head-actions .btn { flex: 1; }
}

/* Print helpers */
@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .doc { border: 0; box-shadow: none; }
    .app-shell, .topbar, .sidebar, .app-footer, .toast-stack { display: none !important; }
    .content { padding: 0; max-width: none; }
}
