:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --text: #111827;
    --text-2: #4b5563;
    --text-3: #9ca3af;
    --primary: #1e3a5f;
    --primary-hover: #152944;
    --accent: #c9a961;
    --accent-hover: #b39247;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0284c7;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

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

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--surface);
}
.login-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #0d2440 100%);
    color: white;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.login-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 20% 30%, rgba(201,169,97,0.15), transparent 40%),
                      radial-gradient(circle at 80% 70%, rgba(201,169,97,0.1), transparent 40%);
}
.login-hero-content { position: relative; }
.login-hero h1 { font-size: 38px; font-weight: 600; margin-bottom: 16px; letter-spacing: -0.5px; }
.login-hero p { font-size: 15px; opacity: 0.85; max-width: 380px; line-height: 1.6; }
.login-features { position: relative; display: flex; flex-direction: column; gap: 12px; margin-top: 40px; }
.login-feature { display: flex; align-items: center; gap: 12px; opacity: 0.9; font-size: 14px; }
.login-feature::before { content: '✓'; color: var(--accent); font-weight: bold; }
.login-form-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.login-form { width: 100%; max-width: 380px; }
.login-form h2 { font-size: 26px; margin-bottom: 8px; font-weight: 600; }
.login-form .subtitle { color: var(--text-2); margin-bottom: 32px; }
.demo-creds {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-top: 24px;
    font-size: 12.5px;
    color: var(--text-2);
}
.demo-creds strong { color: var(--text); display: block; margin-bottom: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.demo-creds code { background: white; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); font-family: ui-monospace, monospace; font-size: 11.5px; }

@media (max-width: 900px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-hero { display: none; }
}

/* ---------- App layout ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 24px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.brand-logo {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--primary), #0d2440);
    color: var(--accent);
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 18px;
    font-family: Georgia, serif;
}
.brand-name { font-weight: 600; font-size: 14px; }
.brand-sub { font-size: 11px; color: var(--text-3); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--primary); color: white; }
.nav-link.active .nav-icon { filter: none; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: white; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-3); }
.logout-btn { display: block; text-align: center; padding: 8px; margin-top: 8px; font-size: 12px; color: var(--text-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.logout-btn:hover { background: var(--surface-2); }

.main { padding: 24px 32px 40px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.3px; }
.topbar-actions { display: flex; gap: 8px; }

.content { }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: white;
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    font-family: inherit;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-secondary { background: white; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(0.9); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 11px 18px; font-size: 14.5px; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.card-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.card-title-sub { font-size: 12px; color: var(--text-3); font-weight: normal; }

/* ---------- Stats grid ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    position: relative;
}
.stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -0.5px; color: var(--text); }
.stat-meta { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.stat-icon {
    position: absolute; top: 16px; right: 16px;
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    display: grid; place-items: center;
    font-size: 16px;
}

@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Tables ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    padding: 11px 16px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-3);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 500; text-transform: capitalize; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-default { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge-luxury { background: linear-gradient(135deg, #c9a961, #b39247); color: white; }

/* ---------- Quick actions ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px; }
.quick-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    display: flex; align-items: center; gap: 12px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow);
}
.quick-btn:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.quick-btn-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--surface-2); display: grid; place-items: center; font-size: 18px; }
.quick-btn-text { font-size: 13px; font-weight: 500; }

/* ---------- Two column layout ---------- */
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .two-col, .three-col { grid-template-columns: 1fr; } }

/* ---------- Tabs ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; gap: 4px; }
.tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center; justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
    background: white;
    border-radius: var(--radius);
    width: 100%; max-width: 500px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-lg { max-width: 700px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-3); line-height: 1; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Bars / charts ---------- */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 80px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-label { color: var(--text-2); }
.bar-track { background: var(--surface-2); border-radius: 4px; height: 8px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 4px; transition: width 0.4s; }
.bar-value { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- Misc ---------- */
.muted { color: var(--text-3); font-size: 12.5px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.text-right { text-align: right; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--text-3); }
.empty-state-icon { font-size: 36px; margin-bottom: 8px; }

/* Quotation print */
.invoice-box {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 800px;
    margin: 0 auto;
}
.invoice-header { display: flex; justify-content: space-between; padding-bottom: 20px; border-bottom: 2px solid var(--primary); margin-bottom: 20px; }
.invoice-totals { margin-top: 14px; display: flex; justify-content: flex-end; }
.invoice-totals table { min-width: 280px; }
.invoice-totals td { padding: 5px 12px; }
.invoice-totals .total-row td { font-weight: 600; font-size: 15px; border-top: 2px solid var(--primary); padding-top: 10px; }
