/* ─────────────────────────────────────────
   DATAXLIVE — MAIN STYLESHEET
   ───────────────────────────────────────── */

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

:root {
    --primary: #1F4E79;
    --primary-light: #2E75B6;
    --primary-dark: #152F47;
    --accent: #C00000;
    --success: #1A7A4A;
    --warning: #B8860B;
    --danger: #C00000;
    --bg: #F0F4F8;
    --bg-white: #FFFFFF;
    --text: #1A1A2E;
    --text-muted: #6B7280;
    --border: #D1D5DB;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 8px;
    --font: 'Segoe UI', Arial, sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── NAVBAR ── */
.navbar {
    background: var(--primary-dark);
    padding: 0 2rem 0 0.5rem;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.nav-brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    line-height: 1.1;
    gap: 0.5rem;
}

.brand-name {
    color: #FFFFFF;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.brand-sub {
    color: #FFFFFF;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    text-transform: none;
    opacity: 0.85;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    color: #B0C8E0;
    text-decoration: none;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-light);
    color: #FFFFFF;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    color: #90B8D8;
    font-size: 0.85rem;
}

/* ── BUTTONS ── */
.btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s;
    font-family: var(--font);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-outline-sm {
    background: transparent;
    border: 1px solid #90B8D8;
    color: #90B8D8;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-outline-sm:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

/* ── FLASH MESSAGES ── */
.flash {
    padding: 0.85rem 2rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.flash-success { background: #D1FAE5; color: #065F46; }
.flash-error   { background: #FEE2E2; color: #991B1B; }
.flash-warning { background: #FEF3C7; color: #92400E; }
.flash-info    { background: #DBEAFE; color: #1E40AF; }

/* ── MAIN CONTENT ── */
.main-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── PAGE HEADER ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ── CARDS ── */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bg);
}

/* ── STAT CARDS ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-card.accent { border-left-color: var(--accent); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ── TABLES ── */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

tbody tr:hover {
    background: #F5F8FF;
}

tbody td {
    padding: 0.75rem 1rem;
    color: var(--text);
}

/* ── STATUS BADGES ── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-draft    { background: #E5E7EB; color: #374151; }
.badge-submitted{ background: #DBEAFE; color: #1E40AF; }
.badge-approved { background: #D1FAE5; color: #065F46; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }
.badge-paid     { background: #D1FAE5; color: #065F46; }
.badge-cancelled{ background: #F3F4F6; color: #9CA3AF; }
.badge-unpaid   { background: #FEF3C7; color: #92400E; }

.badge-partially_paid {
    background: #FEF3C7;
    color: #92400E;
}

/* ── FORMS ── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

label .required {
    color: var(--danger);
    margin-left: 2px;
}

input, select, textarea {
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--text);
    background: white;
    transition: border-color 0.2s;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(46,117,182,0.1);
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ── AUTH PAGES ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.auth-card {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo .brand-name {
    color: var(--primary);
    font-size: 1.8rem;
    font-weight: 700;
}

.auth-logo .brand-sub {
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    display: block;
    margin-top: 0.2rem;
}

.auth-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
}

/* ── DASHBOARD ── */
.welcome-bar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.welcome-bar h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.welcome-bar p {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-top: 0.3rem;
}

/* ── INVOICE PREVIEW ── */
.invoice-preview {
    background: white;
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 0 auto;
}

.invoice-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid var(--primary);
}

.invoice-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.party-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.party-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.25rem;
}

.party-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── UTILITY ── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.fw-bold { font-weight: 700; }
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .main-content { padding: 1rem; }
    .navbar { padding: 0 1rem; }
    .nav-links { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .invoice-parties { grid-template-columns: 1fr; }
}