/* ============================================================ */
/* RESET & ROOT                                                 */
/* ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #1a3d6d;
    --primary-light: #2f5a94;
    --accent: #4f8cff;
    --slate: #566799;
    --text: #0f172a;
    --muted: #475569;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 16px;
    --border: #e5e7eb;
    --btn-text: #475569;
    --btn-text-hover: #0f172a;
    --btn-border: #e5e7eb;
    --btn-border-hover: #0f172a;
}

html, body { min-height: 100%; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, Tahoma, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 15%, rgba(86, 103, 153, 0.18) 0%, transparent 45%),
        radial-gradient(circle at 88% 12%, rgba(26, 61, 109, 0.14) 0%, transparent 42%),
        radial-gradient(circle at 78% 88%, rgba(79, 140, 255, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 15% 92%, rgba(47, 90, 148, 0.14) 0%, transparent 42%),
        linear-gradient(135deg, #f4f6fb 0%, #eef2f8 50%, #f6f8fc 100%);
    background-attachment: fixed;
    padding: 0 20px 40px;
    min-height: 100vh;
}

body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    z-index: -1;
    animation: float 12s ease-in-out infinite;
}
body::before { width: 400px; height: 400px; background: #4f8cff; top: -100px; left: -100px; opacity: 0.35; }
body::after  { width: 500px; height: 500px; background: #566799; bottom: -150px; right: -100px; animation-delay: -6s; opacity: 0.32; }
@keyframes float {
    0%,100% { transform: translate(0,0) scale(1); }
    50%     { transform: translate(30px,-30px) scale(1.05); }
}

/* ============================================================ */
/* SITE HEADER — clean modern nav                               */
/* ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 500;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    margin: 0 -20px 32px;
}
.site-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* ---------- LEFT: Brand + Company ---------- */
.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}
.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}
.brand-logo {
    height: 36px;
    width: auto;
    display: block;
}

.company-switch select {
    height: 36px;
    padding: 0 34px 0 14px;
    font-size: 13px;
    font-weight: 500;
    color: #0f172a;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background-color: #fafbfc;
    cursor: pointer;
    min-width: 180px;
    outline: none;
    transition: border-color .15s, background-color .15s;

    /* custom caret */
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.company-switch select:hover { border-color: #cbd5e1; background-color: #f4f6fa; }
.company-switch select:focus { border-color: #1a3d6d; background-color: #fff; }

.company-label {
    height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    background: #fafbfc;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    white-space: nowrap;
}

/* ---------- CENTER: Main nav ---------- */
.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color .15s, color .15s;
    white-space: nowrap;
    position: relative;
    cursor: pointer;
    user-select: none;
}
.nav-link:hover {
    background: #f4f6fa;
    color: #0f172a;
}
.nav-link.active {
    color: #0f172a;
    font-weight: 600;
    background: #eef2f8;
}

/* ---------- Dropdowns ---------- */
.nav-drop {
    position: relative;
    display: inline-block;
}
.nav-drop-toggle .chev {
    font-size: 9px;
    opacity: 0.55;
    transition: transform .15s ease;
    display: inline-block;
    margin-left: 2px;
}
.nav-drop:hover .nav-drop-toggle .chev {
    transform: rotate(180deg);
    opacity: 0.9;
}
.nav-drop:hover .nav-drop-toggle {
    background: #f4f6fa;
    color: #0f172a;
}

.nav-drop-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 600;
}
/* Hover bridge — small invisible area so menu doesn't close when moving mouse */
.nav-drop-menu::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
}
.nav-drop:hover .nav-drop-menu {
    display: flex;
}
.nav-drop-menu a {
    display: block;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    text-decoration: none;
    border-radius: 6px;
    transition: background .12s, color .12s;
    white-space: nowrap;
}
.nav-drop-menu a:hover {
    background: #f4f6fa;
    color: #0f172a;
}
.nav-drop-menu a.active {
    background: #1a3d6d;
    color: #ffffff;
    font-weight: 600;
}

/* ---------- RIGHT: User menu ---------- */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}
.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.25;
}
.user-name { font-size: 13px; font-weight: 600; color: #0f172a; }
.user-role { font-size: 10.5px; color: #64748b; text-transform: uppercase; letter-spacing: 0.8px; }

.logout-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: all .15s ease;
}
.logout-link:hover {
    color: #0f172a;
    border-color: #0f172a;
    background: #fafbfc;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .site-header-inner { padding: 0 20px; gap: 14px; }
    .main-nav { gap: 2px; }
    .nav-link { padding: 8px 10px; font-size: 12.5px; }
    .company-switch select, .company-label { min-width: 140px; font-size: 12px; }
    .user-info { display: none; }
}

@media (max-width: 800px) {
    .site-header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 10px;
    }
    .header-left { width: 100%; justify-content: space-between; }
    .main-nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        gap: 4px;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .header-right { gap: 10px; }
    .logout-link { padding: 6px 12px; font-size: 11px; }

    /* Mobile: flatten dropdowns */
    .nav-drop { display: contents; }
    .nav-drop-toggle { display: none; }
    .nav-drop-menu {
        position: static;
        transform: none;
        box-shadow: none;
        border: none;
        padding: 0;
        display: contents;
        min-width: 0;
        background: transparent;
    }
    .nav-drop-menu::before { display: none; }
    .nav-drop-menu a { padding: 8px 10px; font-size: 12.5px; }
}

@media print {
    .site-header { display: none !important; }
}
/* ============================================================ */
/* CONTAINER                                                    */
/* ============================================================ */
.container {
    max-width: 820px;
    margin: 0 auto 40px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(31, 38, 135, 0.10);
    padding: 40px 48px;
    position: relative;
}
.container.container-wide {
    max-width: 1400px;
    width: 100%;
    padding: 36px 44px;
}
@media (min-width: 1600px) {
    .container.container-wide { max-width: 1560px; }
}

.container-wide .filter-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: 14px;
    align-items: end;
}
.container-wide .filter-grid.cols-5 {
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
}
@media (max-width: 1100px) {
    .container-wide .filter-grid,
    .container-wide .filter-grid.cols-5 { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 700px) {
    .container-wide .filter-grid,
    .container-wide .filter-grid.cols-5 { grid-template-columns: 1fr; }
}

/* ============================================================ */
/* UNIFIED CONTENT THEME                                        */
/* ============================================================ */
h1.page-title {
    font-size: 32px;
    font-weight: 300;
    letter-spacing: 1px;
    color: #0f172a;
    background: none;
    -webkit-text-fill-color: currentColor;
    margin-bottom: 8px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e5e7eb;
}
h1.page-title::first-letter { font-weight: 700; }

.section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: #475569;
    margin: 32px 0 14px;
}

table.list, table.items, table.editable {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
    background: #ffffff;
    border: none;
    border-top: 2px solid #1a3d6d;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
}
table.list th, table.items th, table.editable th {
    background: #ffffff;
    color: #475569;
    text-align: left;
    padding: 14px;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}
table.list td, table.items td, table.editable td {
    padding: 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
    vertical-align: middle;
}
table.list tbody tr:last-child td, table.items tbody tr:last-child td,
table.editable tbody tr:last-child td { border-bottom: none; }
table.list tbody tr:hover, table.items tbody tr:hover { background: #fafbfc; }
table.items td.num, table.items th.num { text-align: right; }
table.items td.qty, table.items th.qty { text-align: center; }

table.editable input {
    border: none;
    background: transparent;
    width: 100%;
    padding: 6px 4px;
    font-size: 13.5px;
    color: #0f172a;
    outline: none;
    font-family: inherit;
    border-bottom: 1px dashed #d1d5db;
}
table.editable input:focus {
    border-bottom-color: var(--accent);
    background: rgba(79, 140, 255, 0.04);
}

.container-wide table.list th, .container-wide table.list td { font-size: 14px; padding: 14px 16px; }
.container-wide table.list th { font-size: 11px; letter-spacing: 1.6px; }

.meta {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 26px;
    font-size: 13.5px;
}
.meta > div {
    flex: 1;
    background: #fafbfc;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 14px 18px;
}
.meta p { margin: 4px 0; color: #334155; }
.meta strong { color: #0f172a; font-weight: 700; }

/* ============================================================ */
/* BUTTONS                                                      */
/* ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    color: var(--btn-text);
    padding: 8px 18px;
    border: 1px solid var(--btn-border);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s ease;
    box-shadow: none;
    font-family: inherit;
    position: relative;
}
.btn:hover {
    color: var(--btn-text-hover);
    border-color: var(--btn-border-hover);
    background: transparent;
}
.btn:active { background: rgba(0, 0, 0, 0.03); }
.btn-secondary { background: transparent; color: var(--btn-text); border: 1px solid var(--btn-border); }
.btn-secondary:hover { color: var(--btn-text-hover); border-color: var(--btn-border-hover); }
.btn-success { background: transparent; color: #059669; border: 1px solid #a7f3d0; }
.btn-success:hover { color: #047857; border-color: #059669; }
.btn-danger { background: transparent; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { color: #b91c1c; border-color: #dc2626; }
.btn-primary { background: transparent; color: var(--btn-text); border: 1px solid var(--btn-border); }
.btn-primary:hover { color: var(--btn-text-hover); border-color: var(--btn-border-hover); }
.btn-accent { background: transparent; color: #b45309; border: 1px solid #fde68a; }
.btn-accent:hover { color: #92400e; border-color: #d97706; }
.btn-sm { padding: 6px 12px; font-size: 10px; letter-spacing: 1.6px; border-radius: 3px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; }

/* ============================================================ */
/* BADGES                                                       */
/* ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 0;
    border-radius: 0;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    background: none;
    border: none;
}
.badge-quotation { color: #475569; }
.badge-invoice   { color: #059669; }
.badge-admin     { color: #1a3d6d; }
.badge-supervisor { color: #6b21a8; }
.badge-user      { color: #4b5563; }

/* ============================================================ */
/* FORMS                                                        */
/* ============================================================ */
.form-row { margin-bottom: 16px; }
.form-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 10.5px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 1.6px;
}
input[type=text], input[type=date], input[type=month], input[type=number], input[type=password],
textarea, select {
    width: 100%;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    color: #0f172a;
    transition: all .2s;
    outline: none;
    font-family: inherit;
}
input:focus, textarea:focus, select:focus {
    border-color: #1a3d6d;
    box-shadow: 0 0 0 3px rgba(26, 61, 109, 0.10);
}
input[readonly] { background: #f9fafb; color: #64748b; cursor: not-allowed; }
select { cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ============================================================ */
/* FILTER STRIP + SUMMARY                                       */
/* ============================================================ */
.filter-strip {
    background: #fafbfc;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 18px;
}
.summary-line {
    color: #475569;
    font-size: 12.5px;
    letter-spacing: 0.4px;
    margin-bottom: 14px;
    text-transform: uppercase;
}
.summary-line strong { color: #0f172a; font-weight: 700; letter-spacing: 0.6px; }

/* ============================================================ */
/* DOCUMENT HEADER                                              */
/* ============================================================ */
.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 24px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}
.doc-header::after { display: none; }
.doc-header .company { max-width: 60%; display: flex; flex-direction: column; }
.doc-header .company p { margin-top: 6px; font-size: 12.5px; color: #475569; letter-spacing: 0.3px; }
img.logo, .doc-header .company img.logo {
    height: 70px !important;
    width: auto !important;
    max-width: 220px !important;
    display: block !important;
    margin: 0 0 10px 0 !important;
    object-fit: contain !important;
}
.logo-text-fallback {
    font-size: 24px;
    font-weight: 800;
    color: #1a3d6d;
    letter-spacing: 2px;
    margin-bottom: 8px;
}
.doc-title { display: flex; align-items: flex-start; justify-content: flex-end; padding-top: 8px; }
.doc-title h2 {
    font-size: 32px;
    font-weight: 300;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #1a3d6d;
    background: none;
    -webkit-text-fill-color: #1a3d6d;
    margin: 0;
    line-height: 1;
}
.doc-title h2::first-letter { font-weight: 700; }

/* ============================================================ */
/* TOTALS                                                       */
/* ============================================================ */
table.totals {
    width: 360px;
    margin-left: auto;
    margin-top: 24px;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-top: 3px solid #1a3d6d;
    border-radius: 6px;
    overflow: hidden;
    font-size: 14px;
    box-shadow: none;
}
table.totals td { padding: 12px 20px; border-bottom: 1px solid #f1f3f6; color: #334155; }
table.totals td.num { text-align: right; font-weight: 600; color: #1a3d6d; }
table.totals tr:last-child td { border-bottom: none; }
table.totals tr.grand td {
    background: #fafbfc;
    color: #1a3d6d;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.6px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
}

/* ============================================================ */
/* TERMS + PAYMENT BLOCK                                        */
/* ============================================================ */
.terms {
    margin-top: 30px;
    padding: 24px 28px;
    background: #fafbfc;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.65;
    color: #1f2937;
}
.terms h3 {
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 14px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}
.terms ol { margin-left: 20px; }
.terms li { margin-bottom: 8px; }
.terms p { margin: 8px 0; }
.terms strong { color: #1a3d6d; font-weight: 700; }

.payment-block {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 28px;
    row-gap: 6px;
    margin: 10px 0 16px 0;
    padding: 14px 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.7;
}
.payment-block .label { color: #1a3d6d; font-weight: 700; white-space: nowrap; letter-spacing: 0.2px; }
.payment-block .value {
    color: #1f2937;
    font-family: 'Consolas', 'Menlo', monospace;
    letter-spacing: 0.4px;
}

/* ============================================================ */
/* SIGNATURE                                                    */
/* ============================================================ */
.signature {
    margin-top: 60px;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 260px;
    text-align: center;
}
img.sig-img, .signature img.sig-img {
    height: 60px !important;
    width: auto !important;
    max-width: 180px !important;
    display: block !important;
    margin: 0 auto 4px auto !important;
    object-fit: contain !important;
}
.signature .sig-line {
    display: inline-block;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
    min-width: 200px;
    text-align: center;
    font-size: 12px;
    color: #475569;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.signature .sig-line::first-letter { font-weight: 700; }

/* ============================================================ */
/* DASHBOARD HERO + STATS                                       */
/* ============================================================ */
.hero { text-align: center; padding: 20px 0 30px; }
.hero h1 {
    font-size: 34px;
    font-weight: 300;
    letter-spacing: 1px;
    color: #0f172a;
    background: none;
    -webkit-text-fill-color: currentColor;
    margin-bottom: 8px;
}
.hero h1::first-letter { font-weight: 700; }
.hero p { color: #475569; font-size: 14px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin: 18px 0;
}
.stat-card {
    background: #fafbfc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
    transition: all .25s;
}
.stat-card:hover {
    transform: translateY(-2px);
    background: #ffffff;
    box-shadow: 0 8px 26px rgba(31, 38, 135, 0.10);
}
.stat-card .num { font-size: 20px; line-height: 1.2; font-weight: 800; color: #1a3d6d; }
.stat-card .lbl {
    font-size: 9.5px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 2px;
}

/* ============================================================ */
/* REPORTS — TABS + STATS                                       */
/* ============================================================ */
.rpt-tabs { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:14px; padding-bottom:12px; border-bottom:1px solid #e5e7eb; }
.rpt-tab {
    display:inline-flex; align-items:center; gap:5px; padding:6px 12px;
    font-size:11px; font-weight:600; letter-spacing:1.2px; text-transform:uppercase;
    color:#64748b; border:1px solid #e5e7eb; border-radius:4px; background:#fff;
    text-decoration:none; transition:all .15s ease;
}
.rpt-tab:hover { color:#0f172a; border-color:#0f172a; }
.rpt-tab.active { color:#fff; background:#1a3d6d; border-color:#1a3d6d; }

.rpt-filter { background:#fafbfc; border:1px solid #e5e7eb; border-radius:6px; padding:12px 16px; margin-bottom:16px; }
.rpt-filter-row { display:flex; align-items:flex-end; gap:10px; flex-wrap:wrap; }
.rpt-field { display:flex; flex-direction:column; gap:3px; flex:0 0 auto; }
.rpt-field label { font-size:9px; font-weight:700; text-transform:uppercase; letter-spacing:1.2px; color:#64748b; margin:0; }
.rpt-field input, .rpt-field select {
    width:155px; height:32px; padding:4px 9px; font-size:12px;
    border:1px solid #d1d5db; border-radius:4px; background:#fff;
    color:#0f172a; outline:none; font-family:inherit; transition:border-color .15s;
}
.rpt-field input[type=month] { width:140px; }
.rpt-field input[type=text]  { width:180px; }
.rpt-field select            { width:150px; }
.rpt-field input:focus, .rpt-field select:focus {
    border-color:#1a3d6d;
    box-shadow:0 0 0 3px rgba(26,61,109,0.10);
}
.rpt-actions { display:flex; gap:8px; margin-left:auto; }
.rpt-actions .btn { height:32px; padding:4px 14px; font-size:10px; letter-spacing:1.4px; }
.rpt-stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); gap:8px; margin:0 0 22px; }
.rpt-stat { background:#fafbfc; border:1px solid #e5e7eb; border-radius:8px; padding:10px 8px; text-align:center; transition:all .2s; }
.rpt-stat:hover { background:#fff; box-shadow:0 6px 18px rgba(31,38,135,0.08); }
.rpt-stat-num { font-size:18px; font-weight:800; color:#1a3d6d; line-height:1.15; letter-spacing:-0.3px; }
.rpt-stat-lbl { font-size:8.5px; text-transform:uppercase; letter-spacing:0.6px; color:#64748b; margin-top:2px; }
.rpt-head { display:flex; justify-content:space-between; align-items:flex-end; margin:24px 0 12px; flex-wrap:wrap; gap:10px; }
.rpt-totals-row td { background:#fafbfc; font-weight:700; color:#1a3d6d; border-top:2px solid #1a3d6d !important; }

/* ============================================================ */
/* POS PANEL                                                    */
/* ============================================================ */
.pos-panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 28px 32px;
    box-shadow: 0 12px 36px rgba(31, 38, 135, 0.10);
    margin: 26px auto 0;
    max-width: 720px;
}
.pos-title {
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: #1a3d6d;
    margin-bottom: 22px;
}
.pos-search { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 6px; }
.pos-search .form-row { flex: 1; margin: 0; }
.pos-hint { color: #475569; font-size: 12.5px; text-align: center; margin-top: 10px; }
.pos-summary {
    margin-top: 22px; border: 1px solid #e5e7eb;
    border-radius: 14px; overflow: hidden; background: #fafbfc;
}
.pos-summary-head {
    background: #1a3d6d; color: #fff;
    padding: 12px 18px; display: flex; justify-content: space-between;
    align-items: center; font-size: 13px;
}
.pos-summary-head strong { font-size: 14px; }
.pos-summary-body { padding: 16px 20px; }
.pos-summary-body .row {
    display: flex; justify-content: space-between;
    padding: 5px 0; font-size: 13.5px; color: #334155;
}
.pos-summary-body .row.total {
    border-top: 1px solid #e5e7eb; margin-top: 10px; padding-top: 12px;
    font-size: 16px; font-weight: 800; color: #1a3d6d;
}
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0 18px; }
.pay-method { position: relative; cursor: pointer; }
.pay-method input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.pay-method span {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 14px 8px;
    border: 2px solid #e5e7eb; border-radius: 12px;
    background: #fff; transition: all .2s;
    font-size: 12px; font-weight: 600; color: #334155;
    text-align: center; gap: 6px;
}
.pay-method span .ic { font-size: 22px; }
.pay-method:hover span { border-color: #4f8cff; }
.pay-method input:checked + span {
    border-color: #1a3d6d; background: #fafbfc; color: #1a3d6d;
    box-shadow: 0 4px 14px rgba(26, 61, 109, 0.10);
}
@media (max-width: 640px) { .pay-methods { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================ */
/* PAID STAMP                                                   */
/* ============================================================ */
.paid-stamp {
    display: inline-block; margin-top: 12px; padding: 8px 22px;
    border: 4px solid #16a34a; color: #16a34a;
    font-size: 26px; font-weight: 900; letter-spacing: 6px;
    text-transform: uppercase; transform: rotate(-8deg);
    border-radius: 10px; opacity: 0.85; background: rgba(22, 163, 74, 0.05);
}
.paid-meta { font-size: 12px; color: #334155; margin-top: 8px; line-height: 1.6; }
.paid-meta strong { color: #1a3d6d; }

/* ============================================================ */
/* RECEIPT                                                      */
/* ============================================================ */
.receipt {
    max-width: 420px; margin: 0 auto; background: #fff;
    border: 1px dashed #9ca3af; border-radius: 14px;
    padding: 26px 28px; font-family: 'Consolas', 'Menlo', monospace; color: #0f172a;
}
.receipt h2 { text-align: center; letter-spacing: 3px; font-size: 18px; margin-bottom: 4px; }
.receipt .rc-sub { text-align: center; font-size: 11px; color: #475569; margin-bottom: 16px; }
.receipt hr { border: none; border-top: 1px dashed #9ca3af; margin: 12px 0; }
.receipt .rc-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: #0f172a; }
.receipt .rc-row.total { font-weight: 800; font-size: 15px; padding-top: 8px; }
.receipt .rc-footer { text-align: center; font-size: 11px; color: #475569; margin-top: 18px; line-height: 1.6; }

/* ============================================================ */
/* LOGIN PAGE                                                   */
/* ============================================================ */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
    width: 100%; max-width: 420px; background: #ffffff;
    border-radius: 20px; padding: 40px 36px;
    box-shadow: 0 30px 60px rgba(31,38,135,0.18);
    border: 1px solid rgba(0,0,0,0.05); text-align: center;
}
.login-logo { height: 70px; width: auto; margin: 0 auto 18px; display: block; }
.login-card h1 { font-size: 22px; color: #1a3d6d; margin-bottom: 4px; }
.login-sub { color: #475569; font-size: 13px; margin-bottom: 22px; }
.login-error { background: #fdecea; color: #b91c1c; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; text-align: left; }
.login-card .form-row { text-align: left; }

/* ============================================================ */
/* RESPONSIVE                                                   */
/* ============================================================ */
@media (max-width: 1100px) {
    .site-header-inner { padding: 14px 24px; gap: 16px; }
    .main-nav { gap: 18px; }
    .nav-item { letter-spacing: 1.4px; font-size: 11px; }
    .brand-text { font-size: 18px; }
    .brand-logo { height: 28px; }
    .company-switch select, .company-label { min-width: 120px; font-size: 11px; }
}
@media (max-width: 800px) {
    .site-header-inner { flex-wrap: wrap; gap: 12px; padding: 14px 18px; }
    .main-nav {
        order: 3; width: 100%; justify-content: flex-start;
        overflow-x: auto; gap: 18px; padding-top: 6px;
        border-top: 1px solid #f3f4f6; margin-top: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .nav-item { padding: 4px 0; }
    .user-info { display: none; }

    /* Mobile: dropdowns become flat lists */
    .nav-dropdown { display: block; width: 100%; }
    .nav-dropdown > .nav-item { padding: 8px 0; }
    .nav-dropdown-menu {
        position: static !important;
        transform: none !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 0 0 12px !important;
        margin-top: 0 !important;
        min-width: 0 !important;
        background: transparent !important;
        display: flex !important;
    }
    .nav-dropdown-menu::before { display: none !important; }
    .nav-dropdown-menu a { padding: 6px 0 !important; font-size: 11px !important; background: none !important; color: #475569 !important; }
    .nav-dropdown-menu a.active { color: #1a3d6d !important; font-weight: 700 !important; }
    .nav-caret { display: none !important; }
}
@media (max-width: 640px) {
    .container { padding: 22px 18px; }
    .container.container-wide { padding: 22px 18px; }
    .doc-header { flex-direction: column; gap: 14px; }
    .doc-title { justify-content: flex-start; }
    .meta { flex-direction: column; }
    .grid-2 { grid-template-columns: 1fr; }
    table.totals { width: 100%; }
    .hero h1 { font-size: 26px; }
    img.logo { height: 55px !important; max-width: 180px !important; }
    .doc-title h2 { font-size: 24px; }
    img.sig-img { height: 50px !important; max-width: 150px !important; }
    .signature { width: 220px; }
    .btn { padding: 7px 14px; font-size: 10px; }

    .rpt-filter-row { gap: 8px; }
    .rpt-field input, .rpt-field select { width: 130px; }
    .rpt-actions { margin-left: 0; width: 100%; }
    .rpt-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================ */
/* PRINT                                                        */
/* ============================================================ */
@media print {
    @page { size: A4; margin: 15mm 12mm; }

    html, body {
        background: #fff !important; padding: 0 !important;
        margin: 0 !important; font-size: 12px !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    body::before, body::after { display: none !important; }

    .site-header, .toolbar, .no-print, .hero, .stat-grid,
    .rpt-tabs, .rpt-filter, .rpt-stats,
    button, .btn, .login-wrap { display: none !important; }

    .container, .container.container-wide {
        max-width: 100% !important; width: 100% !important;
        margin: 0 !important; padding: 0 !important;
        background: #fff !important; box-shadow: none !important;
        border: none !important; border-radius: 0 !important;
    }

    .doc-header {
        display: flex !important; justify-content: space-between !important;
        align-items: flex-start !important; border-bottom: 1px solid #ddd !important;
        padding-bottom: 12px !important; margin-bottom: 16px !important;
    }
    .doc-header::after { display: none !important; }

    img.logo, .doc-header .company img.logo {
        height: 70px !important; max-width: 200px !important;
        display: block !important; margin: 0 0 8px 0 !important;
    }
    .doc-title h2 {
        font-size: 26px !important; color: #1a3d6d !important;
        -webkit-text-fill-color: #1a3d6d !important;
        background: none !important; letter-spacing: 4px !important; font-weight: 300 !important;
    }
    .doc-header .company p { font-size: 11px !important; color: #475569 !important; }

    .meta { display: flex !important; gap: 16px !important; }
    .meta > div {
        background: #fafbfc !important; border: 1px solid #ddd !important;
        padding: 10px 14px !important; border-radius: 6px !important; flex: 1 !important;
    }
    .meta p { margin: 3px 0 !important; }

    table.items, table.list {
        width: 100% !important; border-collapse: collapse !important;
        border: 1px solid #ccc !important; border-radius: 0 !important;
        box-shadow: none !important;
    }
    table.items th, table.list th {
        background: #1a3d6d !important; color: #fff !important;
        padding: 8px 10px !important; font-size: 11px !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    table.items td, table.list td {
        padding: 8px 10px !important; border-bottom: 1px solid #e5e7eb !important;
    }
    table.items tr, table.list tr { page-break-inside: avoid !important; }

    table.totals {
        width: 300px !important; border-collapse: collapse !important;
        border: 1px solid #ccc !important; border-top: 3px solid #1a3d6d !important;
        border-radius: 6px !important; box-shadow: none !important;
    }
    table.totals td { padding: 8px 14px !important; border-bottom: 1px solid #e5e7eb !important; }
    table.totals tr.grand td {
        background: #fafbfc !important; color: #1a3d6d !important;
        font-size: 13px !important; font-weight: 700 !important;
    }

    .terms {
        background: #fafbfc !important; border: 1px solid #ddd !important;
        padding: 14px 18px !important; border-radius: 6px !important;
        page-break-inside: avoid !important;
    }
    .terms h3 { color: #475569 !important; border-bottom: 1px solid #ddd !important; }

    .payment-block {
        background: #fff !important; border: 1px solid #ddd !important;
        padding: 10px 14px !important;
    }
    .payment-block .label { color: #1a3d6d !important; }
    .payment-block .value { font-family: inherit !important; letter-spacing: 0 !important; }

    .signature {
        margin-top: 50px !important; margin-left: auto !important;
        display: flex !important; flex-direction: column !important;
        align-items: center !important; width: 240px !important;
        text-align: center !important; page-break-inside: avoid !important;
    }
    img.sig-img {
        height: 55px !important; max-width: 160px !important;
        display: block !important; margin: 0 auto 4px auto !important;
    }
    .signature .sig-line {
        display: inline-block !important; border-top: 1px solid #222 !important;
        padding-top: 6px !important; font-size: 11.5px !important;
        color: #475569 !important; text-align: center !important;
        letter-spacing: 2px !important; text-transform: uppercase !important;
    }

    a[href]::after { content: "" !important; }
    .receipt { border: none; padding: 10px; }
}