/* DrinksBox Invoicing — Stylesheet */
/* Follows the DrinksBox design system */

:root {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --border: #dee2e6;
    --text: #212529;
    --text-muted: #6c757d;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

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

/* ===== NAV ===== */
.nav {
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}
.nav-inner {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}
.nav-links a {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--primary); }
.nav-user {
    font-size: 13px;
    color: var(--text-muted);
    padding-left: 16px;
    border-left: 1px solid var(--border);
}
.nav-logout {
    font-size: 12px;
    color: var(--text-muted) !important;
}

.nav-divider {
    color: #334155;
    opacity: 0.3;
    margin: 0 2px;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}
.page-header-actions { display: flex; gap: 10px; }

/* ===== BREADCRUMB ===== */
.breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 6px; }

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-body { padding: 20px; }
.card-section-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ===== STATS ROW ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
}
.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.stat-value { font-size: 24px; font-weight: 700; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
}
.btn:hover { background: #f1f5f9; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: white; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-small { padding: 4px 10px; font-size: 12px; }

/* ===== TABLES ===== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
    text-align: left;
    padding: 10px 14px;
    background: #f1f5f9;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
tr:hover td { background: #f8fafc; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-mono { font-family: "SF Mono", "Menlo", monospace; font-size: 12px; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-draft { background: #e5e7eb; color: #4b5563; }
.badge-generated { background: #dbeafe; color: #1d4ed8; }
.badge-sent { background: #dcfce7; color: #15803d; }
.badge-open { background: #fef3c7; color: #b45309; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #e5e7eb; color: #4b5563; }
.badge-complete { background: #dcfce7; color: #15803d; }
.badge-in_progress { background: #fef3c7; color: #b45309; }
.badge-admin { background: #dbeafe; color: #1d4ed8; }
.badge-editor { background: #fef3c7; color: #b45309; }
.badge-viewer { background: #e5e7eb; color: #4b5563; }
.badge-synced { background: #dbeafe; color: #1d4ed8; }
.badge-documents_generated { background: #dcfce7; color: #15803d; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.form-section-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }

/* ===== FLASH MESSAGES ===== */
.flash-messages { margin-bottom: 16px; }
.flash {
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* ===== FILTERS BAR ===== */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.filter-select {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
}
.search-input {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    width: 240px;
}
.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 36px; margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-state-text { font-size: 13px; margin-bottom: 16px; }

/* ===== DOCUMENT TRIO ===== */
.doc-trio {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.doc-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
}
.doc-card-icon { font-size: 28px; margin-bottom: 8px; }
.doc-card-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.doc-card-amount { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.doc-card-amount.credit { color: var(--success); }
.doc-card-amount.debit { color: var(--danger); }
.doc-card-sub { font-size: 11px; color: var(--text-muted); margin-bottom: 12px; }
.doc-card-actions { display: flex; gap: 6px; justify-content: center; }

/* ===== DETAIL LAYOUT ===== */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
}
.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}
.detail-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.detail-subtitle { font-size: 13px; color: var(--text-muted); }

/* ===== SUMMARY GRID ===== */
.summary-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px 16px;
    font-size: 13px;
}
.summary-label { color: var(--text-muted); font-weight: 500; }
.summary-value { color: var(--text); }
.summary-divider {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

/* ===== TIMELINE ===== */
.timeline-item {
    display: flex;
    gap: 12px;
    padding-bottom: 16px;
    position: relative;
}
.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 11px;
    top: 26px;
    bottom: 0;
    width: 1px;
    background: var(--border);
}
.timeline-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #dbeafe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}
.timeline-dot.green { background: #dcfce7; }
.timeline-content { font-size: 13px; }
.timeline-date { font-size: 11px; color: var(--text-muted); }

/* ===== TWO COL ===== */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ===== UPLOAD AREA ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.upload-area:hover { border-color: var(--primary); background: #eff6ff; }
.upload-icon { font-size: 28px; margin-bottom: 8px; }
.upload-text { font-size: 14px; font-weight: 500; }
.upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== DOCUMENT PREVIEW (invoice view) ===== */
.doc-preview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
    max-width: 800px;
}
.doc-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
}
.doc-title { font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.doc-subtitle { font-size: 14px; color: var(--text-muted); }
.doc-company { font-size: 18px; font-weight: 700; text-align: right; }
.doc-company-detail { font-size: 12px; color: var(--text-muted); line-height: 1.6; text-align: right; }
.doc-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
    padding: 16px;
    background: #f8fafc;
    border-radius: var(--radius);
}
.doc-meta-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.doc-meta-grid {
    display: grid;
    grid-template-columns: auto auto;
    gap: 4px 16px;
    justify-content: end;
    font-size: 13px;
    text-align: right;
}
.doc-totals {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}
.doc-totals-inner { width: 280px; }
.doc-total-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}
.doc-total-row .label { color: var(--text-muted); }
.doc-total-final {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 16px;
    font-weight: 700;
    border-top: 2px solid var(--text);
    margin-top: 6px;
}
.doc-notice {
    margin-top: 28px;
    padding: 16px;
    background: #fefce8;
    border: 1px solid #fef08a;
    border-radius: var(--radius);
    font-size: 12px;
    color: #854d0e;
    line-height: 1.6;
}
.doc-note {
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===== STATEMENT SUMMARY BOXES ===== */
.stmt-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}
.stmt-box {
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
}
.stmt-box.green { background: #f0fdf4; border: 1px solid #bbf7d0; }
.stmt-box.blue { background: #eff6ff; border: 1px solid #bfdbfe; }
.stmt-box-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}
.stmt-box-value { font-size: 18px; font-weight: 700; }

/* ===== ACTION LINKS ===== */
a.action-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
}
a.action-link:hover { text-decoration: underline; }

/* ===== NET COLOURS ===== */
.net-positive { color: var(--success); font-weight: 600; }
.net-negative { color: var(--danger); font-weight: 600; }

/* ===== LOGIN PAGE ===== */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 48px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}
.login-card h1 { font-size: 22px; margin-bottom: 8px; }
.login-card p { color: var(--text-muted); margin-bottom: 32px; }

/* ===== LINE ITEMS TABLE ===== */
.line-items th { font-size: 10px; padding: 6px 10px; }
.line-items td { font-size: 12px; padding: 6px 10px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .detail-layout { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .doc-trio { grid-template-columns: 1fr; }
    .two-col { grid-template-columns: 1fr; }
    .stmt-summary { grid-template-columns: repeat(2, 1fr); }
}
