:root {
    --navy: #102b46; --blue: #0874c9; --ink: #172b3d; --muted: #64788b; --line: #dce5ed; --red: #b42318;
}
* { box-sizing: border-box; }
body { margin: 0; background: #f4f7fa; color: var(--ink); font: 15px Inter, "Segoe UI", Arial, sans-serif; }
.topbar { min-height: 68px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 max(calc((100vw - 1160px)/2),24px); gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; white-space: nowrap; }
.brand-logo-box { display: block; background: #fff; border-radius: 7px; padding: 4px 8px; }
.brand-logo { display: block; width: 226px; height: 30px; object-fit: contain; }
.brand-tag { font-size: 11px; color: #c5d7e6; text-transform: uppercase; letter-spacing: .08em; }
.main-nav { display: flex; align-items: center; gap: 22px; }
.main-nav a, .nav-logout { color: #e7f0f8; text-decoration: none; font: inherit; }
.main-nav a:hover, .nav-logout:hover { color: #fff; }
.nav-user { color: #afc5d8; font-size: 13px; }
.logout-form { margin: 0; }
.nav-logout { border: 0; background: transparent; cursor: pointer; padding: 8px 0; }
.nav-toggle { display: none; background: transparent; color: white; border: 1px solid #66819a; border-radius: 8px; padding: 8px 11px; font-size: 17px; }
.page-wrap { max-width: 1160px; margin: 34px auto 64px; padding: 0 22px; min-height: calc(100vh - 170px); }
.footer { border-top: 1px solid var(--line); padding: 18px max(calc((100vw - 1160px)/2),24px); color: var(--muted); font-size: 12px; background: #fff; }
.footer span { float: right; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-heading h1 { font-size: 27px; letter-spacing: -.03em; margin: 0 0 5px; }
.page-heading p { margin: 0; color: var(--muted); }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 14px; border-radius: 8px; background: var(--blue); border: 1px solid var(--blue); color: #fff; text-decoration: none; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn:hover { background: #0563ad; color: #fff; }
.btn.secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.danger { background: #fff; color: var(--red); border-color: #e6b8b5; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 22px; box-shadow: 0 4px 14px #172b3d08; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4,minmax(0,1fr)); margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .055em; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: -.03em; }
.stat-note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
table { border-collapse: collapse; width: 100%; min-width: 660px; }
th, td { text-align: left; padding: 13px 15px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f8fafc; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td a { color: #075da2; text-decoration: none; font-weight: 600; }
.amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; border-radius: 99px; padding: 4px 9px; background: #edf3f8; color: #40576b; font-size: 11px; font-weight: 700; }
.badge.paid { background: #e7f5ec; color: #17663d; }
.badge.unpaid { background: #fff2de; color: #8a5600; }
.search-row { display: flex; gap: 8px; margin-bottom: 15px; }
.search-row input { max-width: 310px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px 20px; }
.field { min-width: 0; }
.field.full { grid-column: 1/-1; }
.field label { display: block; font-weight: 650; font-size: 13px; margin-bottom: 6px; }
.input, select, textarea { display: block; width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #cbd7e1; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
textarea.input { min-height: 82px; resize: vertical; }
.input:focus, select:focus, textarea:focus { outline: 3px solid #0b77c522; border-color: #1582d2; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.validation-summary-errors, .field-validation-error { color: var(--red); font-size: 13px; }
.validation-summary-errors ul { margin: 0 0 15px; padding-left: 20px; }
.section-title { font-size: 17px; margin: 25px 0 12px; }
.form-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 22px; }
.alert { padding: 12px 15px; border-radius: 9px; margin-bottom: 16px; }
.alert.success { background: #e8f5eb; color: #155f36; }
.alert.error { background: #fff0ef; color: #9d2017; }
.auth-card { max-width: 460px; margin: 46px auto; }
.auth-card h1 { margin: 0 0 7px; font-size: 25px; }
.auth-card > p { margin: 0 0 21px; color: var(--muted); }
.auth-card .field { margin-bottom: 16px; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-line { padding: 8px 0; border-bottom: 1px solid var(--line); }
.detail-line:last-child { border: 0; }
.detail-label { color: var(--muted); font-size: 12px; }
.detail-value { font-weight: 600; margin-top: 3px; }
.totals { width: min(100%,370px); margin-left: auto; }
.totals .row { display: flex; justify-content: space-between; padding: 9px 12px; background: #edf3fa; border-bottom: 1px solid #dce5ef; }
.totals .row.total { font-weight: 750; color: var(--navy); font-size: 17px; }
.invoice-summary { display: grid; grid-template-columns: minmax(0,1fr) minmax(280px,370px); align-items: end; gap: 24px; margin-top: 18px; }
.amount-words { min-width: 0; line-height: 1.55; overflow-wrap: anywhere; }
.amount-words strong { display: block; margin-top: 7px; font-weight: 600; }
.item-grid { display: grid; grid-template-columns: minmax(190px,2fr) minmax(90px,.7fr) minmax(75px,.6fr) minmax(105px,.8fr) minmax(75px,.6fr) 36px; gap: 8px; align-items: end; }
.item-row { margin: 9px 0; }
.item-grid label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; }
.item-grid input { width: 100%; min-width: 0; }
.icon-button { height: 42px; border: 1px solid #e4b9b5; background: #fff; color: var(--red); border-radius: 8px; cursor: pointer; }
.mobile-note { color: var(--muted); font-size: 13px; }
.mobile-label { display: none !important; }
.inline-check { display: flex; align-items: center; gap: 9px; min-height: 42px; }
.inline-check input { width: 17px; height: 17px; }
.empty { padding: 40px 15px; text-align: center; color: var(--muted); }
@media (max-width: 800px) {
    .topbar { padding: 12px 18px; flex-wrap: wrap; }
    .nav-toggle { display: block; }
    .main-nav { display: none; flex-basis: 100%; align-items: flex-start; flex-direction: column; gap: 0; padding: 5px 0 9px; }
    .nav-open .main-nav { display: flex; }
    .main-nav a, .nav-user, .nav-logout { padding: 10px 0; }
    .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .page-wrap { margin: 24px auto 42px; padding: 0 16px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .page-heading h1 { font-size: 24px; }
    .details-grid { grid-template-columns: 1fr; }
    .invoice-summary { grid-template-columns: 1fr; gap: 8px; }
    .invoice-summary .totals { width: 100%; }
    .item-grid { grid-template-columns: 1fr 1fr 1fr; align-items: start; background: #f7fafc; border: 1px solid var(--line); border-radius: 10px; padding: 11px; }
    .item-grid .description { grid-column: 1/-1; }
    .item-grid .remove-cell { align-self: end; }
    .item-grid .mobile-label { display: block !important; }
    .item-head { display: none; }
    .form-grid { gap: 14px; }
    .footer { padding: 16px 18px; }
    .footer span { float: none; display: block; margin-top: 5px; }
}
@media (max-width: 480px) {
    .brand-logo { width: 180px; height: 25px; }
    .brand-tag { display: none; }
    .stats { gap: 9px; }
    .stat { padding: 13px; }
    .stat-value { font-size: 22px; }
    .card { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
    .actions .btn { flex: 1; }
    .search-row input { max-width: none; min-width: 0; }
    .btn { min-height: 42px; }
    .page-wrap { padding: 0 12px; }
}

/* Classic white workspace theme */
:root { --navy: #263445; --blue: #2458a6; --ink: #252f3b; --muted: #687382; --line: #d9dee6; --red: #a52a2a; }
body { background: #fff; color: var(--ink); }
.topbar { background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); }
.brand-logo-box { border: 1px solid #e5e8ed; border-radius: 4px; }
.brand-tag { color: var(--muted); }
.main-nav a, .nav-logout { color: #344252; }
.main-nav a:hover, .nav-logout:hover { color: var(--blue); }
.nav-user { color: var(--muted); }
.nav-toggle { color: var(--ink); border-color: #c8ced7; border-radius: 4px; }
.page-wrap { margin-top: 28px; }
.footer { background: #fff; }
.btn { border-radius: 4px; background: var(--blue); border-color: var(--blue); }
.btn:hover { background: #1c477f; }
.card, .stat { border-radius: 6px; box-shadow: none; }
.table-wrap { border-radius: 4px; }
.auth-card { border-radius: 6px; box-shadow: none; }
.input, select, textarea { border-radius: 4px; }
.icon-button { border-radius: 4px; }
