/* Vendor Payment Management System — no build step, deliberately. */

:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --ink: #16202e;
    --ink-soft: #5b6878;
    --line: #dfe5ee;
    --brand: #1c4f9c;
    --brand-dark: #14396f;
    --brand-soft: #e8f0fc;
    --ok: #1a7f4b;
    --ok-soft: #e6f4ec;
    --warn: #a76a08;
    --warn-soft: #fdf3e2;
    --danger: #b3261e;
    --danger-soft: #fdecea;
    --info-soft: #eaf2fb;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(22, 32, 46, .06), 0 4px 14px rgba(22, 32, 46, .05);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

/* ---- Top bar ---------------------------------------------------------- */

.topbar {
    background: var(--brand-dark);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 58px;
}

.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 32px; height: 32px; border-radius: 7px;
    background: #fff; color: var(--brand-dark);
    display: grid; place-items: center;
    font-weight: 700; font-size: 16px;
}
.brand strong { display: block; font-size: 15px; line-height: 1.1; }
.brand small { display: block; font-size: 11px; opacity: .75; }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.who { text-align: right; line-height: 1.2; }
.who strong { display: block; font-size: 13px; }
.who small { font-size: 11px; opacity: .75; }

.bell { color: #fff; font-size: 13px; position: relative; padding-right: 6px; }
.badge-count {
    background: #ffb020; color: #3b2a00;
    border-radius: 10px; padding: 1px 6px;
    font-size: 11px; font-weight: 700; margin-left: 4px;
}

/* ---- Shell ------------------------------------------------------------ */

.shell { display: flex; align-items: flex-start; }

.sidebar {
    width: 218px;
    flex: 0 0 218px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    min-height: calc(100vh - 58px);
    padding: 14px 10px 40px;
    position: sticky;
    top: 58px;
    max-height: calc(100vh - 58px);
    overflow-y: auto;
}

.sidebar a {
    display: block;
    padding: 7px 11px;
    border-radius: 6px;
    color: var(--ink);
    font-size: 13.5px;
}
.sidebar a:hover { background: var(--bg); text-decoration: none; }
.sidebar a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }

.nav-group {
    display: block;
    padding: 14px 11px 5px;
    font-size: 10.5px;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-soft);
    font-weight: 700;
}

.content { flex: 1; padding: 22px 26px 60px; min-width: 0; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.page-head h1 { margin: 0; font-size: 21px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.muted { color: var(--ink-soft); margin: 4px 0 0; font-size: 13px; }

/* ---- Cards & grid ----------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
    overflow: hidden;
}
.card-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.card-head h2 { margin: 0; font-size: 15px; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---- Metric tiles ----------------------------------------------------- */

.tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
}
.tile .label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-soft);
    font-weight: 700;
}
.tile .value { font-size: 21px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.tile .sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.tile.alert { border-left: 3px solid var(--danger); }
.tile.warn { border-left: 3px solid var(--warn); }
.tile.good { border-left: 3px solid var(--ok); }

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

.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td {
    padding: 9px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
table.data th {
    background: #fafbfd;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-soft);
    white-space: nowrap;
}
table.data tbody tr:hover { background: #fbfcfe; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tfoot td { font-weight: 700; background: #fafbfd; }

.empty { padding: 30px 16px; text-align: center; color: var(--ink-soft); }

/* ---- Badges ----------------------------------------------------------- */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    white-space: nowrap;
    background: var(--bg);
    color: var(--ink-soft);
    border: 1px solid var(--line);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: #bfe3ce; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #f0dcb6; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: #f3c9c5; }
.badge.info { background: var(--info-soft); color: var(--brand); border-color: #c9dcf4; }

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

label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; color: var(--ink); }
.field { margin-bottom: 14px; }
.hint { font-size: 11.5px; color: var(--ink-soft); margin-top: 3px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font: inherit;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(28, 79, 156, .12);
}
input[readonly], input:disabled, select:disabled, textarea:disabled { background: #f5f7fa; color: var(--ink-soft); }
textarea { min-height: 78px; resize: vertical; }

.checkline { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.checkline input { margin-top: 3px; }
.checkline label { margin: 0; font-weight: 500; }

.form-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-actions { display: flex; gap: 8px; padding-top: 6px; flex-wrap: wrap; }

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

.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.35;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--bg); color: var(--ink); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8e1e17; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #15633b; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }

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

.alert {
    padding: 11px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13.5px;
    border: 1px solid;
}
.alert-success { background: var(--ok-soft); border-color: #bfe3ce; color: #14603a; }
.alert-error { background: var(--danger-soft); border-color: #f3c9c5; color: #8e1e17; }
.alert-warn { background: var(--warn-soft); border-color: #f0dcb6; color: #7d4f06; }
.alert-info { background: var(--info-soft); border-color: #c9dcf4; color: var(--brand-dark); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert strong { display: block; margin-bottom: 2px; }

/* Blocking-control callout — the rules from SOP section 24. */
.blockers {
    background: var(--danger-soft);
    border: 1px solid #f3c9c5;
    border-left: 3px solid var(--danger);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 16px;
}
.blockers h3 { margin: 0 0 6px; font-size: 13px; color: #8e1e17; text-transform: uppercase; letter-spacing: .05em; }
.blockers ul { margin: 0; padding-left: 18px; color: #8e1e17; font-size: 13px; }
.blockers li { margin-bottom: 3px; }

/* ---- Definition lists ------------------------------------------------- */

dl.detail { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; font-size: 13px; }
dl.detail dt { color: var(--ink-soft); font-weight: 600; }
dl.detail dd { margin: 0; word-break: break-word; }

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

.chain { list-style: none; margin: 0; padding: 0; }
.chain li {
    display: flex;
    gap: 11px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 13px;
}
.chain li:last-child { border-bottom: none; }
.chain .step {
    width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 11px; font-weight: 700;
    background: var(--bg); color: var(--ink-soft);
    border: 1px solid var(--line);
    flex: 0 0 24px;
}
.chain .step.done { background: var(--ok-soft); color: var(--ok); border-color: #bfe3ce; }
.chain .step.rejected { background: var(--danger-soft); color: var(--danger); border-color: #f3c9c5; }
.chain .who-line { font-size: 12px; color: var(--ink-soft); }

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

.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filters .field { margin-bottom: 0; min-width: 150px; }

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

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(150deg, var(--brand-dark), #0d2547);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
}
.login-card h1 { margin: 0 0 3px; font-size: 20px; }
.login-card .sub { color: var(--ink-soft); font-size: 13px; margin: 0 0 20px; }
.login-mark {
    width: 44px; height: 44px; border-radius: 10px;
    background: var(--brand-dark); color: #fff;
    display: grid; place-items: center;
    font-weight: 700; font-size: 20px; margin-bottom: 14px;
}

/* ---- Pagination ------------------------------------------------------- */

.pager { display: flex; gap: 5px; padding: 12px 16px; flex-wrap: wrap; align-items: center; }
.pager a, .pager span {
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 12.5px;
    background: #fff;
    color: var(--ink);
}
.pager .current { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager .disabled { opacity: .45; }
.pager .info { border: none; background: none; color: var(--ink-soft); margin-left: auto; }

/* ---- Line-item editor ------------------------------------------------- */

table.items { width: 100%; border-collapse: collapse; font-size: 13px; }
table.items th, table.items td { padding: 6px; border-bottom: 1px solid var(--line); }
table.items th { font-size: 11px; text-transform: uppercase; color: var(--ink-soft); text-align: left; }
table.items input, table.items select { padding: 6px 8px; }
table.items td.num input { text-align: right; }

.stack { display: flex; flex-direction: column; gap: 3px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.mt { margin-top: 16px; }
.mb0 { margin-bottom: 0; }

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar {
        width: 100%; flex: none; position: static; max-height: none;
        min-height: 0; border-right: none; border-bottom: 1px solid var(--line);
        display: flex; flex-wrap: wrap; gap: 4px;
    }
    .nav-group { width: 100%; padding-bottom: 0; }
    .content { padding: 16px; }
}
