:root {
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-soft: #eff6ff;
    --primary-border: #bfdbfe;
    --success: #15803d;
    --success-soft: #f0fdf4;
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --warning: #b45309;
    --warning-soft: #fffbeb;
    --info: #0369a1;
    --info-soft: #f0f9ff;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --faint: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-muted: #64748b;
    --radius: 10px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 0.9375rem;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

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

h1, h2, h3, h4 {
    font-weight: 650;
    letter-spacing: -0.015em;
    color: var(--text);
}

/* ---------- Legacy top header (login page) ---------- */

.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

main {
    padding: 28px 0 48px;
}

/* ---------- Login ---------- */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    background: var(--card);
}

.login-brand {
    flex: 0 0 44%;
    background: linear-gradient(160deg, #1e3a8a 0%, #1d4ed8 55%, #3b82f6 100%);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 64px;
    position: relative;
    overflow: hidden;
}

.login-brand::after {
    content: "";
    position: absolute;
    right: -120px;
    bottom: -120px;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
}

.login-brand::before {
    content: "";
    position: absolute;
    right: 40px;
    top: -80px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.login-brand-inner {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.login-brand .brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 28px;
}

.brand-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.login-brand h1 {
    color: #ffffff;
    font-size: 2rem;
    line-height: 1.25;
    margin: 0 0 14px;
}

.login-brand p {
    color: rgba(255, 255, 255, 0.78);
    margin: 0 0 32px;
    max-width: 380px;
}

.login-points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-points li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.925rem;
}

.login-points svg {
    flex-shrink: 0;
    color: #93c5fd;
}

.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 36px 36px 32px;
}

.login-card h2 {
    margin: 0 0 6px;
    font-size: 1.5rem;
}

.login-card .sub {
    color: var(--muted);
    margin: 0 0 28px;
}

.login-meta {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--faint);
    text-align: center;
}

/* ---------- App layout ---------- */

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 18px 20px;
    color: #ffffff;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .logo:hover {
    color: #ffffff;
    text-decoration: none;
}

.sidebar .logo .brand-badge {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 12px 10px 4px;
    padding: 6px 16px;
    width: calc(100% - 20px);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-muted);
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.sidebar-group:hover {
    color: var(--sidebar-text);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-group:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    color: var(--sidebar-text);
}

.sidebar-group .chevron {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.sidebar-section.collapsed .sidebar-group .chevron {
    transform: rotate(-90deg);
}

.sidebar-section.collapsed .sidebar-group {
    margin-bottom: 4px;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-section.collapsed .sidebar-links {
    display: none;
}

.sidebar-section.active-section {
    background: rgba(29, 78, 216, 0.16);
    border-radius: 10px;
    margin: 6px;
    padding-bottom: 8px;
}

.sidebar-section.active-section .sidebar-group {
    color: #93c5fd;
    margin-top: 6px;
}

.sidebar-section.active-section .sidebar-group:hover {
    color: #ffffff;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 9px 16px;
    margin: 0 10px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.12s ease, color 0.12s ease;
}

.sidebar-nav a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.75;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.sidebar-nav a.active svg {
    opacity: 1;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-meta {
    min-width: 0;
    line-height: 1.3;
}

.user-name {
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-role {
    color: var(--sidebar-muted);
    font-size: 0.75rem;
    text-transform: capitalize;
}

.sidebar-logout {
    margin: 4px 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    color: var(--sidebar-muted);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.12s ease, color 0.12s ease;
}

.sidebar-logout:hover {
    background: rgba(185, 28, 28, 0.18);
    color: #fca5a5;
    text-decoration: none;
}

.sidebar-logout svg {
    width: 17px;
    height: 17px;
}

.content-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content-wrap main {
    flex: 1;
    width: 100%;
    padding: 30px 0 56px;
}

.content-wrap .container {
    max-width: 90%;
}

/* ---------- Page headers ---------- */

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    margin: 0 0 4px;
    font-size: 1.65rem;
}

.page-header .text-muted {
    margin: 0;
    font-size: 0.9rem;
}

.page-header .header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Header filter dropdowns should hug their content, not stretch to full width. */
.page-header .header-actions select {
    width: auto;
    min-width: 200px;
    max-width: 340px;
}

.text-muted {
    color: var(--muted);
}

/* ---------- Cards ---------- */

.card,
.detail-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.detail-card {
    margin-bottom: 20px;
}

.form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 28px;
    max-width: none;
}

.form-card.form-wide {
    max-width: none;
}

.detail-card h2,
.detail-card h3,
.form-card h2 {
    margin-top: 0;
    font-size: 1.05rem;
    font-weight: 650;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* ---------- Sectioned form (request form) ---------- */

#request-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

.form-section > h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 650;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.form-section > h2::before {
    content: attr(data-num);
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    font-size: 0.8rem;
    font-weight: 700;
}

.form-section > h2 + .help-text,
.form-section > h2 + p {
    margin-top: 12px;
}

.form-section > .form-group:last-child,
.form-section > .form-row:last-child > .form-group {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .form-section {
        padding: 14px;
    }
    .form-section > h2 {
        font-size: 1rem;
    }
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.card-head h2 {
    margin: 0;
    padding: 0;
    border-bottom: none;
}

/* ---------- Forms ---------- */

.form-group {
    margin-bottom: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.8625rem;
    color: #334155;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-family: inherit;
    background: #ffffff;
    color: var(--text);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input::placeholder,
textarea::placeholder {
    color: var(--faint);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

input[disabled],
select[disabled],
textarea[disabled] {
    background: #f8fafc;
    color: var(--faint);
    cursor: not-allowed;
}

input[type="file"] {
    padding: 8px;
    background: #f8fafc;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

input[type="file"]:hover {
    border-color: var(--primary);
}

.help-text {
    color: var(--muted);
    font-size: 0.8rem;
    display: block;
    margin-top: 5px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

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

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    background: #f1f5f9;
    color: #334155;
    border-color: var(--border-strong);
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
    white-space: nowrap;
}

.btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    text-decoration: none;
}

.btn:focus-visible,
a.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.25);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #166534;
    color: #ffffff;
}

.btn-danger {
    background: #ffffff;
    border-color: #fecaca;
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
}

.btn-danger-solid {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
}

.btn-danger-solid:hover {
    background: #991b1b;
    color: #ffffff;
}

.btn-sm {
    padding: 5px 11px;
    font-size: 0.8125rem;
    border-radius: 7px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn svg {
    width: 16px;
    height: 16px;
}

/* ---------- Alerts ---------- */

/* Flash messages scroll with the page (team feedback 2026-10-16: no sticky
   blocks that cover the content below while scrolling). */
.flash-messages {
    margin-bottom: 20px;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-size: 0.9rem;
    border: 1px solid;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.alert.alert-fading {
    opacity: 0;
    transform: translateY(-6px);
}

.alert::before {
    content: "";
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    background: currentColor;
}

.alert-success { background: var(--success-soft); color: #166534; border-color: #bbf7d0; }
.alert-danger { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--info-soft); color: #075985; border-color: #bae6fd; }

/* ---------- Tables ---------- */

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background 0.1s ease;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tfoot td {
    font-weight: 650;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    border-bottom: none;
}

.data-table td.num,
.data-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table .mono {
    font-family: var(--mono);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
}

/* Per-column filter row under the table headings (server-side search). */
.data-table .filter-row th {
    padding: 5px 6px 7px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}

.data-table .filter-input {
    width: 100%;
    min-width: 78px;
    padding: 5px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--card);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.78rem;
    line-height: 1.3;
}

.data-table .filter-input::placeholder {
    color: var(--faint);
    opacity: 0.75;
}

.data-table .filter-input:focus {
    outline: 2px solid var(--primary-border);
    outline-offset: 0;
    border-color: var(--primary);
}

/* Planner sticky batch toolbar + quick filter chips. */
.planner-toolbar {
    position: sticky;
    top: 0;
    z-index: 15;
    margin: -4px -4px 10px;
    padding: 8px 4px 10px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.planner-toolbar-main,
.planner-toolbar-sub {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.planner-toolbar-main {
    justify-content: space-between;
}

.planner-toolbar-sub {
    margin-top: 8px;
}

.planner-payout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.82rem;
}

.planner-payout input[type="date"] {
    width: auto;
    padding: 5px 8px;
}

.planner-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.chip {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--card);
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
    text-decoration: none;
}

.chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.chip.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.data-table .batch-row td {
    padding: 7px 10px;
    background: #eef2f7;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
}

/* ---------- Status badges ---------- */

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--border-strong);
    background: #f1f5f9;
    color: #475569;
}

.status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-submitted { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.status-approved { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.status-hod { background: #fdf2f8; color: #9d174d; border-color: #fbcfe8; }
.status-management { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.status-paid { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.status-rejected { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.status-admin { background: #faf5ff; color: #7e22ce; border-color: #e9d5ff; }
.status-account { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.status-finance { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.status-draft { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.status-active { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.status-ended { background: #f8fafc; color: #64748b; border-color: #e2e8f0; }
.status-sent { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.status-partially { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.status-received { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.status-pv { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.status-planned { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.status-cancelled { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.status-manual { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.status-extracted { background: #cffafe; color: #155e75; border-color: #a5f3fc; }
.status-reviewed { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
/* Treasury payout summaries (Phase 2 states). */
.status-pending, .status-pending-approval { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.status-returned, .status-return { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.status-partly-paid { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.status-unpaid { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.status-superseded { background: #f8fafc; color: #94a3b8; border-color: #e2e8f0; }
.status-pv-issued { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.no-print { }
@media print { .no-print { display: none !important; } }

/* ---------- App modal (Pre-PV form etc.) ---------- */
.app-modal { border: none; border-radius: 10px; padding: 0; max-width: 760px; width: 92%; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25); }
.app-modal::backdrop { background: rgba(0, 0, 0, 0.45); }
.app-modal form { padding: 20px 22px; }
.app-modal-head { display: flex; align-items: center; justify-content: space-between; }
.app-modal-head h2 { margin: 0; }
.app-modal-close { border: none; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: #6b655c; }
.app-modal-close:hover { color: #1c1a17; }
.app-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group-wide { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- History filter bar ---------- */
.filter-fields { display: flex; flex-wrap: wrap; gap: 12px; }
.filter-fields .form-group { margin-bottom: 0; min-width: 160px; }
.filter-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- Treasury journey + queue action bar ---------- */
.journey-subtitle { margin: 2px 0 6px; font-size: 0.9rem; }
.queue-actions { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---------- KPI / summary cards ---------- */

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.summary-card {
    text-align: left;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 3px solid var(--border-strong);
}

.summary-status .status {
    font-size: 0.72rem;
}

.summary-card .summary-amount {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.summary-card .summary-label {
    font-size: 0.8125rem;
    color: var(--muted);
}

/* ---------- Filters ---------- */

.filter-bar {
    margin-bottom: 18px;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
}

.filter-form label {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--muted);
}

.filter-form select,
.filter-form input[type="date"] {
    width: auto;
    min-width: 160px;
}

.filter-form input[type="date"] {
    min-width: 150px;
}

/* ---------- Detail views ---------- */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.detail-list {
    display: grid;
    grid-template-columns: 168px 1fr;
    gap: 10px 16px;
    margin: 0;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8125rem;
    padding-top: 1px;
}

.detail-list dd {
    margin: 0;
    font-size: 0.9rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
    align-items: flex-start;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form input[type="text"],
.inline-form input[type="number"],
.inline-form input[type="date"] {
    width: auto;
    min-width: 150px;
}

.inline-form input[type="text"] {
    min-width: 220px;
}

.back-link {
    margin-top: 24px;
}

.back-link a {
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.request-number {
    font-family: var(--mono);
    font-size: 0.95rem;
    color: var(--primary);
    font-weight: 600;
}

.text-center {
    text-align: center;
}

.checkbox-group {
    display: flex;
    align-items: center;
    min-height: 44px;
    margin-top: 6px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text);
    margin: 0;
}

.checkbox-group input[type="checkbox"],
.radio-option input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
}

.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}

/* ---------- Chooser / home ---------- */

.chooser-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chooser-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chooser-card:hover {
    border-color: var(--primary-border);
    box-shadow: var(--shadow);
}

.chooser-card h2 {
    margin-top: 0;
    font-size: 1.15rem;
}

.chooser-card h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
}

.chooser-card p {
    margin: 0 0 10px;
}

.chooser-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
    margin-bottom: 10px;
}

.chooser-icon svg {
    width: 24px;
    height: 24px;
}

.chooser-card .btn {
    pointer-events: none;
}

/* ---------- Items tables ---------- */

.items-table input,
.items-table select {
    min-width: 96px;
}

.items-table .line-no {
    color: var(--faint);
    font-weight: 600;
    font-size: 0.8125rem;
}

.items-table .row-amount,
.items-table .grand-total {
    font-weight: 650;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.items-table .total-label {
    text-align: right;
    font-weight: 650;
    color: var(--muted);
}

.items-table .row-amount {
    text-align: right;
}

/* ---------- Approval timeline ---------- */

.trail {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 4px 0;
}

.trail-step {
    display: flex;
    gap: 14px;
    position: relative;
    padding-bottom: 22px;
}

.trail-step:last-child {
    padding-bottom: 4px;
}

.trail-step::before {
    content: "";
    position: absolute;
    left: 15px;
    top: 30px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.trail-step:last-child::before {
    display: none;
}

.trail-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
}

.trail-dot svg {
    width: 15px;
    height: 15px;
    color: var(--faint);
}

.trail-step.done .trail-dot {
    background: var(--success-soft);
    border-color: #bbf7d0;
}

.trail-step.done .trail-dot svg {
    color: var(--success);
}

.trail-step.active .trail-dot {
    background: var(--primary-soft);
    border-color: var(--primary-border);
}

.trail-step.active .trail-dot svg {
    color: var(--primary);
}

.trail-step.rejected .trail-dot {
    background: var(--danger-soft);
    border-color: #fecaca;
}

.trail-step.rejected .trail-dot svg {
    color: var(--danger);
}

.trail-body {
    padding-top: 4px;
    min-width: 0;
}

.trail-title {
    font-weight: 650;
    font-size: 0.9rem;
}

.trail-desc {
    color: var(--muted);
    font-size: 0.8375rem;
    margin-top: 2px;
}

.trail-note {
    display: block;
    margin-top: 4px;
    font-size: 0.8125rem;
    color: var(--muted);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 5px 10px;
}

/* ---------- Empty states ---------- */

.empty-state {
    text-align: center;
    padding: 44px 20px;
    background: var(--card);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--muted);
}

.empty-state .empty-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 14px;
    border-radius: 12px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state .empty-icon svg {
    width: 22px;
    height: 22px;
    color: var(--faint);
}

.empty-state p {
    margin: 0 0 14px;
}

/* ---------- Success page ---------- */

.success-hero {
    text-align: center;
    padding: 48px 24px;
}

.success-check {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--success-soft);
    border: 1px solid #bbf7d0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-check svg {
    width: 30px;
    height: 30px;
    color: var(--success);
}

/* ---------- Budget panel ---------- */

.budget-panel {
    background: #f8fafc;
    border: 1px solid var(--border);
    box-shadow: none;
}

.budget-panel .detail-list {
    grid-template-columns: 150px 1fr;
}

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--border);
    color: var(--faint);
    text-align: center;
    padding: 18px 0;
    font-size: 0.8125rem;
    background: var(--card);
}

.site-footer p {
    margin: 0;
}

/* ---------- My Dashboard ---------- */

.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.task-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.task-card:hover {
    border-color: var(--primary-border);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--text);
}

.task-count {
    font-size: 1.6rem;
    font-weight: 750;
    line-height: 1;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    min-width: 44px;
    text-align: center;
    flex-shrink: 0;
}

.task-count.task-clear {
    color: var(--faint);
}

.task-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.task-title {
    font-weight: 650;
    font-size: 0.9rem;
}

.task-label {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
}

.stat-list {
    display: flex;
    flex-direction: column;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #eef2f7;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--muted);
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.stat-value {
    font-weight: 650;
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
}

/* ---------- Inline quick create ---------- */

.checklist-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.checklist-row {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 500;
    cursor: pointer;
    margin: 0;
}

.checklist-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
}

.select-with-new {
    display: flex;
    gap: 8px;
    align-items: center;
}

.select-with-new select {
    flex: 1;
    min-width: 0;
}

.quick-create-btn {
    flex-shrink: 0;
}

.quick-create {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.quick-create .qc-input {
    width: auto;
    flex: 1;
    min-width: 200px;
}

.quick-create .help-text {
    width: 100%;
}

.qc-error {
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 600;
    width: 100%;
}

/* ---------- Roles / permissions ---------- */

.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.role-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
}

.role-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.role-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 650;
}

.role-users {
    color: var(--muted);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.role-desc {
    margin: 0;
    color: var(--muted);
    font-size: 0.875rem;
    min-height: 2.6em;
}

.role-card .cap-badges {
    min-width: 0;
}

.role-card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.cap-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 260px;
}

.perm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.perm-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    cursor: pointer;
    font-weight: 500;
    margin: 0;
}

.perm-row:hover {
    border-color: var(--primary-border);
}

.perm-row input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.perm-row strong {
    font-size: 0.9rem;
    color: var(--text);
}

.perm-row small {
    display: block;
    margin-top: 2px;
    font-weight: 400;
    color: var(--muted);
}

/* ---------- Utility ---------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 26px 0 22px;
}

.amount-positive { color: var(--success); font-weight: 650; }
.amount-negative { color: var(--danger); font-weight: 650; }

/* ---------- Responsive ---------- */

@media (max-width: 992px) {
    .login-brand {
        display: none;
    }
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 8px;
        gap: 2px;
    }

    .sidebar-nav a {
        margin: 0;
        padding: 7px 12px;
    }

    .sidebar-group {
        width: auto;
        margin: 8px 8px 4px;
        padding: 6px 12px;
    }

    .form-row,
    .detail-grid,
    .chooser-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }

    .actions,
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-form input[type="text"],
    .inline-form input[type="number"],
    .inline-form input[type="date"] {
        width: 100%;
        min-width: 0;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media print {
    .sidebar,
    .site-footer,
    .btn,
    .filter-bar,
    .flash-messages {
        display: none !important;
    }

    .card,
    .detail-card {
        box-shadow: none;
        border: 1px solid #cbd5e1;
    }
}

/* Class-based display rules must not defeat the hidden attribute. */
[hidden] {
    display: none !important;
}

/* ---------- Users table filters / sorting ---------- */

.filter-bar.filter-form {
    align-items: flex-end;
}

.filter-bar.filter-form .form-group {
    margin-bottom: 0;
}

.filter-bar.filter-form input,
.filter-bar.filter-form select {
    width: auto;
    min-width: 180px;
}

.sort-btn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sort-btn:hover {
    color: var(--primary);
}

.sort-arrow {
    font-size: 0.7em;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
}

/* Show/hide (eye) toggle for password fields */
.password-field {
    position: relative;
    display: block;
}
.password-field input[type="password"],
.password-field input[type="text"] {
    width: 100%;
    padding-right: 42px;
}
.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 4px;
    margin: 0;
    cursor: pointer;
    color: #6b655c;
    line-height: 0;
    border-radius: 6px;
}
.password-toggle:hover { color: #1c1a17; background: rgba(0, 0, 0, 0.05); }
.password-toggle.is-visible { color: #b4562a; }

.status-urgent { background: #fee2e2; color: #b91c1c; border-color: #fecaca; font-weight: 700; }

/* Text utilities used across templates */
.text-danger { color: #b3261e; }
.text-right { text-align: right; }
.req { color: #c0392b; }

/* Inline notice boxes (warm palette) */
.notice { margin: 12px 0; padding: 10px 12px; border-left: 4px solid; border-radius: 6px; }
.notice-warning { border-color: #b8860b; background: #fdf6e3; color: #5c4a12; }
.notice-success { border-color: #2f7d4f; background: #e4f2e9; color: #1f4d33; }
.notice-danger { border-color: #b3261e; background: #fbe4e2; color: #7a1a15; }
.notice-muted { border-color: #8a8578; background: #f3f1ec; color: #4a463d; }

/* Skip link (keyboard/screen-reader bypass block) */
.skip-link {
    position: absolute;
    left: 8px;
    top: -48px;
    z-index: 2000;
    background: var(--primary);
    color: #fff;
    padding: 10px 16px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    transition: top 0.15s ease;
}
.skip-link:focus {
    top: 0;
    outline: 2px solid #fff;
    outline-offset: -4px;
}

/* Compact mobile header: single scrollable nav row instead of a tall stack */
@media (max-width: 768px) {
    .sidebar-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
    }
    .sidebar-nav a {
        white-space: nowrap;
        flex: 0 0 auto;
    }
    .sidebar .logo {
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .content-wrap {
        padding-top: 0;
    }
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 16px 0 4px;
}
.pagination-info {
    color: var(--muted);
    font-size: 0.875rem;
}
.pagination .btn.pagination-disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

/* ---------- Type-ahead combobox for supplier/item pickers ---------- */
.combo-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    background: #fff;
    color: var(--text);
}
.combo-input.combo-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 2px var(--danger-soft);
}
.combo-list {
    position: fixed;
    z-index: 1200;
    max-height: 280px;
    overflow-y: auto;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: none;
}
.combo-list.open { display: block; }
.combo-item {
    padding: 7px 9px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.92rem;
}
.combo-item:hover,
.combo-item.active { background: var(--primary-soft); }
.combo-empty {
    padding: 7px 9px;
    color: var(--muted);
    font-size: 0.85rem;
}
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Quotation-based flow statuses */
.status-po { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.status-invoice { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

/* Payment request type segmented control */
.segmented { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.segmented-option { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; background: #fff; }
.segmented-option input { margin: 0; }
.segmented-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); font-weight: 600; }

/* Invoice/PO amount variance */
.variance-error { display: block; color: var(--danger); font-weight: 600; margin-top: 6px; }
.input-error { border-color: var(--danger) !important; box-shadow: 0 0 0 2px var(--danger-soft) !important; }

/* ---------- Dropdown action menu (e.g. Documents) ---------- */
.menu { position: relative; display: inline-block; }
.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 230px;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 1000;
    display: none;
    text-align: left;
}
.menu.open .menu-panel { display: block; }
.menu-panel .menu-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    padding: 6px 10px 2px;
}
.menu-panel a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.92rem;
}
.menu-panel a:hover { background: var(--primary-soft); }
.menu-panel a span.menu-note { color: var(--muted); font-size: 0.8rem; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 6px; }

/* ---------- Item table totals (request form + PO form) ---------- */
.data-table td.line-subtotal {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--text, inherit);
}
.items-totalbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 4px 0;
    margin-top: 6px;
    border-top: 2px solid var(--border);
}
.items-grand { font-size: 1.05rem; }
.items-grand strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   QFC component namespace (templates/components/ + docs/ui-components.md)
   Tabs / drawer / accordion / page header / sidebar filter.
   ========================================================================== */

/* --- qfc-tabs: peer-level page sections (role=tab, hash deep-link) --- */
.qfc-tabs { margin-top: 6px; }
.qfc-tablist {
    display: flex; gap: 2px; border-bottom: 1px solid var(--border);
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.qfc-tab {
    appearance: none; background: transparent; border: none;
    border-bottom: 2px solid transparent; padding: 9px 14px;
    font: inherit; font-weight: 600; color: var(--muted);
    cursor: pointer; white-space: nowrap;
}
.qfc-tab:hover { color: #1c1a17; }
.qfc-tab[aria-selected="true"] { color: #b4562a; border-bottom-color: #b4562a; }
.qfc-tab:focus-visible { outline: 2px solid #b4562a; outline-offset: -2px; }
.qfc-panel { padding-top: 12px; }
.qfc-panel[hidden] { display: none; }
/* .qfc-pinned: intentionally NOT sticky — a pinned block this tall covered
   the content below when scrolling (team feedback 2026-10-16). */
.qfc-tabs-context { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }

/* --- qfc-drawer: right slide-over quick view (ESC/backdrop/X close, focus trap) --- */
.qfc-drawer-overlay { position: fixed; inset: 0; z-index: 60; }
.qfc-drawer-overlay[hidden] { display: none; }
.qfc-drawer-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.44); }
.qfc-drawer-panel {
    position: absolute; top: 0; right: 0; height: 100%;
    width: min(460px, 94vw); background: #fff;
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.22);
    display: flex; flex-direction: column;
    transform: translateX(101%); transition: transform 0.22s ease;
}
.qfc-drawer-overlay.is-open .qfc-drawer-panel { transform: none; }
.qfc-drawer-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.qfc-drawer-head h2 { margin: 0; font-size: 1.05rem; }
.qfc-drawer-x { appearance: none; border: none; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; color: #6b655c; }
.qfc-drawer-x:hover { color: #1c1a17; }
.qfc-drawer-body { padding: 14px 16px; overflow: auto; flex: 1; }
.qfc-drawer-foot { padding: 12px 16px; border-top: 1px solid var(--border); }
body.qfc-drawer-open { overflow: hidden; }
.qfc-drawer-dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
.qfc-drawer-dl dt { color: var(--muted); font-size: 0.86rem; }
.qfc-drawer-dl dd { margin: 0; }

/* --- qfc-accordion: dense secondary content (styled <details>) --- */
details.qfc-accordion {
    border: 1px solid var(--border); border-radius: 8px;
    background: #faf7f2; margin: 8px 0;
}
details.qfc-accordion > summary {
    cursor: pointer; padding: 9px 12px; font-weight: 600;
    list-style: none; display: flex; justify-content: space-between; align-items: center;
}
details.qfc-accordion > summary::-webkit-details-marker { display: none; }
details.qfc-accordion > summary::after { content: "\25BE"; transition: transform 0.15s ease; }
details.qfc-accordion[open] > summary::after { transform: rotate(180deg); }
details.qfc-accordion > .qfc-accordion-body { padding: 0 12px 12px; }

/* --- qfc-page-header --- */
.qfc-page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
}
.qfc-page-header h1 { margin: 0 0 2px; }
.qfc-page-header .qfc-page-desc { color: var(--muted); margin: 0; }
.qfc-page-header .qfc-page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- sidebar quick filter --- */
.sidebar-filter { margin: 8px 12px 2px; }
.sidebar-filter input {
    width: 100%; padding: 7px 10px; border: 1px solid var(--border);
    border-radius: 8px; font: inherit;
}
.sidebar-filter input:focus { outline: 2px solid #b4562a; outline-offset: -1px; }
.sidebar-section.is-filtered-out { display: none; }
.sidebar-links a.is-filtered-out { display: none; }
.sidebar-filter-empty { margin: 4px 12px; color: var(--muted); font-size: 0.82rem; }

@media (max-width: 768px) {
    .qfc-panel { padding-top: 8px; }
    .qfc-tab { padding: 8px 11px; font-size: 0.92rem; }
}

@media print {
    .qfc-tablist, .qfc-drawer-overlay { display: none !important; }
    .qfc-panel[hidden] { display: block !important; }
}

/* UI-kit code snippets */
.qfc-snippet {
    background: #1e293b; color: #e2e8f0; border-radius: 8px;
    padding: 10px 12px; font-size: 0.8rem; overflow-x: auto; white-space: pre;
    font-family: "DejaVu Sans Mono", monospace;
}

/* --- Budget dashboard (team feedback 2026-10-16) --- */
.budget-alerts { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.budget-alert { border-radius: 8px; padding: 5px 10px; font-size: 0.86rem; font-weight: 600; }
.budget-alert.over { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.budget-alert.low { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.budget-dash { display: flex; flex-direction: column; gap: 10px; }
.budget-row-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.budget-dept { font-weight: 600; }
.budget-figures { color: #6b655c; font-size: 0.86rem; }
.budget-figures b { color: #1c1a17; font-variant-numeric: tabular-nums; }
.budget-pill { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 10px; font-size: 0.78rem; font-weight: 700; }
.budget-pill.ok { background: #dcfce7; color: #166534; }
.budget-pill.low { background: #fef3c7; color: #92400e; }
.budget-pill.over { background: #fee2e2; color: #991b1b; }
.budget-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: #f1f5f9; border: 1px solid var(--border); margin-top: 4px; }
.budget-bar .seg { display: block; height: 100%; }
.budget-bar .seg.spent { background: #b4562a; }
.budget-bar .seg.planned { background: #e0a96d; }
.budget-scale { display: flex; justify-content: space-between; color: #6b655c; font-size: 0.78rem; margin-top: 2px; }
.budget-legend { display: flex; align-items: center; gap: 6px; color: #6b655c; font-size: 0.8rem; margin-top: 4px; flex-wrap: wrap; }
.budget-legend .lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 10px; }
.budget-legend .lg.spent { background: #b4562a; }
.budget-legend .lg.planned { background: #e0a96d; }
.budget-legend .lg.rest { background: #f1f5f9; border: 1px solid var(--border); }

/* --- Payout summary matrix (per-paying-company columns) --- */
.summary-matrix th { white-space: nowrap; vertical-align: bottom; }
.summary-matrix td { vertical-align: top; }
.summary-matrix th, .summary-matrix td { padding: 9px 8px; }
.summary-matrix { font-size: 0.82rem; }
.summary-matrix .btn-sm { padding: 3px 6px; font-size: 0.72rem; }
.summary-matrix .matrix-subtotal td {
    background: #fef3c7; font-weight: 700; border-top: 2px solid #e0a96d;
}
.summary-matrix .doc-links { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 76px; }
.summary-matrix .doc-link {
    font-size: 0.74rem; font-weight: 600; line-height: 1.25;
    color: var(--primary); text-decoration: underline; text-underline-offset: 2px;
    white-space: nowrap;
}
.summary-matrix .doc-link:hover { color: var(--primary-hover); }
.combo-input.payroll-locked {
    opacity: 1 !important;
    color: #17202e !important;
    -webkit-text-fill-color: #17202e;
    background: #f7f3ea;
    cursor: not-allowed;
}
