:root {
    --primary: #1e5f8a;
    --primary-dark: #164a6c;
    --accent: #2e8b57;
    --danger: #c0392b;
    --bg: #f4f6f8;
    --card-bg: #ffffff;
    --border: #dde3e8;
    --text: #2b2f33;
    --text-light: #6b7480;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.topbar {
    background: var(--primary-dark);
    color: #fff;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.topbar .brand { font-size: 18px; font-weight: 700; color: #fff; }
.topbar nav a {
    color: #dce8f0;
    margin-left: 18px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.topbar nav a svg { opacity: 0.85; }
.topbar nav a:hover { color: #fff; }

.container {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.card h2, .card h3 { margin-top: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 800px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text-light); }
input[type=text], input[type=number], input[type=date], input[type=email],
input[type=password], input[type=tel], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 14px;
    margin-bottom: 12px;
    background: #fff;
}
textarea { min-height: 80px; }
.form-row { margin-bottom: 0; }
input[type=checkbox] { width: auto; margin-right: 6px; }
.check-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 5px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #7a8592; }
.btn-secondary:hover { background: #5f6a76; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #96261a; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-accent { background: var(--accent); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th, table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
table th { background: #eef2f5; font-size: 12px; text-transform: uppercase; color: var(--text-light); }
table tr:hover { background: #f9fbfc; }

/* ---------- Item builder table ---------- */
#itemsTable input, #itemsTable select { margin-bottom: 0; }
#itemsTable td { padding: 4px; }
.remove-row { color: var(--danger); cursor: pointer; font-weight: 700; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-gst { background: #dff3e6; color: var(--accent); }
.badge-nongst { background: #f1eddc; color: #8a6d1a; }
.badge-quotation { background: #e6eefb; color: var(--primary); }
.badge-invoice { background: #fbe9e6; color: var(--danger); }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #dff3e6; color: #1c6b3d; }
.alert-error { background: #fbe6e6; color: #a12b23; }

/* ---------- Auth pages ---------- */
.auth-wrap {
    max-width: 380px;
    margin: 60px auto;
    background: #fff;
    padding: 32px;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.auth-wrap h1 { font-size: 20px; text-align: center; margin-bottom: 20px; }
.captcha-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eef2f5;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 1px;
}

/* ---------- Dashboard stats ---------- */
.stat-box { text-align: center; }
.stat-box .num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-box .lbl { font-size: 13px; color: var(--text-light); }

.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.small { font-size: 12px; color: var(--text-light); }

/* ---------- Business type radio cards ---------- */
.type-choice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    background: #fff;
}
.type-choice input[type=radio] { margin-top: 3px; width: auto; }
.type-choice:has(input:checked) { border-color: var(--primary); background: #f0f7fb; }

/* ==================================================================
   AUTH PAGES (Login / Register) - split screen, gradient + SVG blobs
   ================================================================== */
.auth-screen {
    min-height: 100vh;
    display: flex;
}
.auth-visual {
    flex: 1.1;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #164a6c 0%, #1e5f8a 45%, #2e8b57 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    color: #fff;
}
.auth-visual::before, .auth-visual::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}
.auth-visual::before { width: 420px; height: 420px; top: -140px; right: -120px; }
.auth-visual::after { width: 280px; height: 280px; bottom: -100px; left: -80px; background: rgba(255,255,255,0.06); }
.auth-visual .blob3 {
    position: absolute; width: 180px; height: 180px; border-radius: 50%;
    background: rgba(255,255,255,0.05); top: 60%; right: 10%;
}
.auth-visual-content { position: relative; z-index: 2; max-width: 420px; }
.auth-visual .brandmark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 14px;
    background: rgba(255,255,255,0.15); margin-bottom: 24px;
    font-size: 24px; font-weight: 800;
}
.auth-visual h1 { font-size: 30px; margin: 0 0 12px; line-height: 1.25; }
.auth-visual p { font-size: 15px; opacity: 0.9; line-height: 1.6; }
.auth-visual .feature-list { margin-top: 32px; list-style: none; padding: 0; }
.auth-visual .feature-list li {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px; font-size: 14px; opacity: 0.95;
}
.auth-visual .feature-list svg { flex-shrink: 0; opacity: 0.9; }

.auth-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 40px 20px;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 36px 32px;
    box-shadow: 0 10px 30px rgba(20,40,60,0.06);
}
.auth-card .auth-icon {
    width: 46px; height: 46px; border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; display: flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
}
.auth-card h1 { font-size: 21px; margin: 0 0 4px; }
.auth-card .auth-sub { color: var(--text-light); font-size: 13px; margin-bottom: 22px; }
.auth-card .btn { width: 100%; padding: 11px; font-size: 15px; }

@media (max-width: 860px) {
    .auth-visual { display: none; }
    .auth-form-side { min-height: 100vh; }
}

/* ==================================================================
   DASHBOARD HERO
   ================================================================== */
.hero-banner {
    background: linear-gradient(120deg, #164a6c, #1e5f8a 60%, #2e8b57);
    border-radius: 14px;
    padding: 30px 32px;
    color: #fff;
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
}
.hero-banner::after {
    content: "";
    position: absolute; width: 300px; height: 300px; border-radius: 50%;
    background: rgba(255,255,255,0.07); top: -120px; right: -60px;
}
.hero-banner h2 { margin: 0 0 4px; font-size: 24px; position: relative; z-index: 1; }
.hero-banner .hero-sub { opacity: 0.9; font-size: 14px; position: relative; z-index: 1; }

.stat-card-v2 {
    display: flex; align-items: center; gap: 14px;
    background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px;
}
.stat-card-v2 .icon-circle {
    width: 46px; height: 46px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-card-v2 .num { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-card-v2 .lbl { font-size: 12.5px; color: var(--text-light); }
.ic-blue { background: #e6eefb; color: var(--primary); }
.ic-green { background: #dff3e6; color: var(--accent); }
.ic-amber { background: #f9edd6; color: #a6740f; }
.ic-pink { background: #fbe9e6; color: var(--danger); }

.action-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-radius: 10px; border: 1px solid var(--border);
    background: #fff; color: var(--text);
}
.action-card:hover { border-color: var(--primary); text-decoration: none; }
.action-card .icon-circle { width: 38px; height: 38px; border-radius: 10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
