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

:root {
    --ig-blue: #405DE6;
    --ig-purple: #833AB4;
    --ig-pink: #C13584;
    --ig-rose: #E1306C;
    --ig-red: #FD1D1D;
    --ig-orange: #F77737;
    --ig-yellow: #FCAF45;
    --primary: #C13584;
    --primary-dark: #833AB4;
    --primary-soft: #f9effb;
    --green: #22c55e;
    --green-dark: #15803d;
    --red: #ef4444;
    --red-soft: #fef1f1;
    --gray-bg: #fafafa;
    --gray-chip: #f5f5f7;
    --text: #262626;
    --text-soft: #737373;
    --text-faint: #a8a8a8;
    --border: #ededf0;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 28px rgba(24, 12, 84, .06);
    --shadow-float: 0 2px 6px rgba(0, 0, 0, .08), 0 18px 44px rgba(24, 12, 84, .12);
    --grad-ig: linear-gradient(135deg, #405DE6 0%, #833AB4 30%, #C13584 52%, #E1306C 72%, #FD1D1D 90%);
    --grad-cta: linear-gradient(45deg, #833AB4, #E1306C);
    --grad-soft: linear-gradient(160deg, #fdf3fa, #f3f4ff);
}

html { scroll-behavior: smooth; }

body {
    font-family: "Segoe UI", "Tahoma", "Leelawadee UI", "Prompt", sans-serif;
    background: var(--gray-bg);
    background-image: radial-gradient(circle at 12% -6%, rgba(192, 132, 252, .10), transparent 45%),
        radial-gradient(circle at 96% -4%, rgba(236, 72, 153, .08), transparent 42%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 15px;
    line-height: 1.5;
}

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- topbar ---------- */
.topbar {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; min-height: 60px; gap: 8px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; padding: 8px 0; }
.brand-mark {
    width: auto; height: 44px; object-fit: contain; flex: 0 0 auto;
    display: block;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: -.2px; }
.brand-text small { font-size: 11.5px; color: var(--text-faint); }

.nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.nav a {
    color: #4a4a4a; text-decoration: none; padding: 8px 12px; border-radius: 999px;
    font-size: 14px; font-weight: 500; transition: all .16s;
}
.nav a:hover { background: var(--gray-chip); color: var(--text); }
.nav a.nav-cta {
    background: var(--grad-cta); color: #fff; font-weight: 600; margin-left: 4px;
    box-shadow: 0 4px 14px rgba(225, 48, 108, .32);
}
.nav a.nav-cta:hover { filter: brightness(1.08); }
.nav a.nav-logout { color: #dc2626; }
.nav a.nav-logout:hover { background: var(--red-soft); }
.nav-user { font-size: 12.5px; color: var(--text-soft); margin-left: 8px; padding: 6px 10px; }

.nav-toggle {
    display: none; background: #fff; border: 1px solid var(--border); color: var(--text);
    font-size: 20px; border-radius: 10px; width: 42px; height: 42px; cursor: pointer;
    box-shadow: var(--shadow);
}

/* ---------- layout ---------- */
main { flex: 1; padding-top: 24px; padding-bottom: 36px; }
.page-title {
    font-size: 23px; font-weight: 800; margin-bottom: 18px; letter-spacing: -.3px;
    color: var(--text);
}
.page-title::after {
    content: ""; display: block; width: 46px; height: 4px; margin-top: 8px;
    border-radius: 99px; background: var(--grad-ig);
}

.card {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.card-title::after {
    content: ""; display: inline-block; width: 26px; height: 3px; margin-left: 8px;
    vertical-align: middle; border-radius: 99px; background: var(--grad-ig);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-actions form { display: inline; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
    font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: all .16s; line-height: 1.2; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); filter: brightness(.97); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--grad-cta); color: #fff; box-shadow: 0 6px 16px rgba(225, 48, 108, .30); }
.btn-outline { background: #fff; color: var(--primary); border-color: #e5d6ea; }
.btn-outline:hover { border-color: var(--primary); background: var(--primary-soft); }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 6px 16px rgba(239, 68, 68, .28); }
.btn-danger-soft { background: var(--red-soft); color: var(--red); border-color: #f6c8c8; }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(34, 197, 94, .28); }
.btn-ig { background: var(--grad-ig); color: #fff; box-shadow: 0 6px 18px rgba(192, 38, 150, .30); }
.btn-icon { width: 46px; height: 46px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; line-height: 1; flex: none; }
.btn-icon:hover { transform: translateY(-1px) scale(1.04); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- flash ---------- */
.flash { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.flash-success { background: #ecfdf5; color: var(--green-dark); border: 1px solid #bbf7d0; }
.flash-error { background: var(--red-soft); color: #b91c1c; border: 1px solid #fecaca; }

/* ---------- stats / cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
    text-align: left; position: relative; overflow: hidden;
    background: linear-gradient(180deg, #fff, #fdfbfe);
    border-radius: var(--radius);
}
.stat-card::before {
    content: ""; position: absolute; top: -34px; right: -34px; width: 110px; height: 110px;
    border-radius: 50%; background: var(--grad-soft); opacity: .9; pointer-events: none;
}
.stat-label { font-size: 12.5px; color: var(--text-soft); margin-bottom: 7px; letter-spacing: .2px; }
.stat-value {
    font-size: 26px; font-weight: 800; color: var(--text); word-break: break-word;
    background: linear-gradient(120deg, var(--ig-blue), var(--ig-pink));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-sub { font-size: 12.5px; color: var(--text-soft); margin-top: 5px; }
.stat-card-accent .stat-value { background: linear-gradient(120deg, var(--green), #0ea5e9); -webkit-background-clip: text; background-clip: text; color: transparent; }

.quick-links { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

/* ---------- wide layout (full-width pages) ---------- */
.container-wide { max-width: 1880px; }
.container-full { max-width: none; padding: 0 14px; }

/* ---------- ultra-compact horizontal table (ทะเบียนพอดีจอ) ---------- */
.table.table-tight { width: 100%; min-width: 0; font-size: 12px; table-layout: fixed; }
.table.table-tight th, .table.table-tight td {
    padding: 5px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    vertical-align: middle;
}
.table.table-tight thead th { font-size: 11px; letter-spacing: .2px; }
.table.table-tight .sel { width: 26px; }
.table.table-tight .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table.table-tight .td-title { min-width: 0; font-weight: 600; }
.table.table-tight .actions { display: flex; gap: 3px; align-items: center; white-space: nowrap; overflow: hidden; }
.table.table-tight .actions form { display: inline; }
.table.table-tight .actions .btn-sm { padding: 3px 6px; font-size: 11px; }

/* ---------- compact horizontal table (records/list) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 660px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table thead th {
    background: var(--gray-chip); color: #46404b; font-weight: 700; font-size: 12px;
    text-transform: uppercase; letter-spacing: .4px; position: sticky; top: 0;
}
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fcf7fe; }
.table tr.clickable { cursor: pointer; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .td-title { font-weight: 600; min-width: 180px; }
.table .actions { display: flex; gap: 5px; align-items: center; white-space: nowrap; }
.table .actions form { display: inline; }
.table .sel { width: 24px; text-align: center; }
.table .sel input { width: 15px; height: 15px; cursor: pointer; }

.table-fit { width: 100%; min-width: 0; font-size: 12.5px; }
.table-fit th, .table-fit td { padding: 7px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-fit thead th { font-size: 11.5px; letter-spacing: .3px; }
.table-fit .sel { width: 26px; }
.table-fit .num { text-align: right; }
.table-fit .td-title { min-width: 0; max-width: 340px; font-weight: 600; }
.table-fit .actions { display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.table-fit .actions .btn-sm { padding: 4px 9px; font-size: 12px; }
.table-fit td.title-cell { min-width: 160px; max-width: 340px; }
.table-fit td.nowrap-ellip { overflow: hidden; text-overflow: ellipsis; }
.bulk-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.bulk-bar .check-all { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text-soft); cursor: pointer; user-select: none; }
.bulk-bar .check-all input { width: 15px; height: 15px; cursor: pointer; }
.bulk-bar .sel-count { font-size: 13px; color: var(--primary); font-weight: 600; }
.bulk-bar .btn { margin-left: auto; }
.inline-form { display: inline; }
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: #f1f5f9; color: #475569; }
.status-badge.st-run { background: #fff3cd; color: #8a6d00; }
.status-badge.st-po { background: #dbeafe; color: #1d4ed8; }
.status-badge.st-check { background: #e9d5ff; color: #7c3aed; }
.status-badge.st-done { background: #d1fae5; color: #047857; }
.status-badge.st-cancel { background: #fee2e2; color: #b91c1c; }
.status-badge.st-plain { background: #f1f5f9; color: #475569; }
.status-badge.alt { background: #fef3c7; color: #92400e; }
.status-badge-lg { font-size: 14px; padding: 5px 14px; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mini-list li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 13.5px; }
.mini-list a { color: var(--primary); text-decoration: none; }
.mini-list a:hover { text-decoration: underline; }
.stat-card-soft { background: linear-gradient(160deg, #ffffff, #f4effb); border-color: #e4dcf3; }
.tfoot-row td { font-weight: 700; background: #faf7fd; }
.empty { color: var(--text-soft); padding: 22px 0; text-align: center; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field.field-full, .field.field-grow { grid-column: 1 / -1; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text); }
.field .req { color: var(--red); }
.field input, .field select, .field textarea {
    padding: 10px 12px; border: 1px solid #dcdce2; border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
    width: 100%; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--ig-pink);
    box-shadow: 0 0 0 3px rgba(193, 53, 132, .13);
}
.field input.readonly { background: var(--gray-chip); color: var(--text-soft); }
.hint { font-size: 12.5px; color: var(--text-soft); margin: -6px 0 10px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* combo input + ปุ่มจัดการตัวเลือก */
.combo-row { display: flex; gap: 8px; align-items: center; }
.combo-row .combo-input { flex: 1; min-width: 0; }

/* option manager */
.opt-manager-box {
    margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--gray-chip); padding: 10px 12px; display: none;
}
.opt-manager-box.open { display: block; }
.opt-list { list-style: none; margin: 0 0 8px; padding: 0; max-height: 160px; overflow-y: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.opt-list li { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 2px 6px 2px 9px; font-size: 12.5px; }
.opt-list .opt-val { word-break: break-word; }
.opt-edit, .opt-del {
    border: none; background: none; cursor: pointer; font-size: 13px;
    color: var(--primary); padding: 1px 4px; line-height: 1;
}
.opt-del { color: var(--red); }
.opt-new-row { display: flex; gap: 8px; align-items: center; }
.opt-new-row input { flex: 1; padding: 8px 10px; border: 1px solid #dcdce2; border-radius: var(--radius-sm); font-size: 13.5px; font-family: inherit; }

/* bidders */
.bidder-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; flex-wrap: wrap; }
.bidder-row .bidder-name { flex: 2 1 200px; }
.bidder-row .bidder-amount { flex: 1 1 150px; }
.bidder-row input { padding: 9px 11px; border: 1px solid #dcdce2; border-radius: var(--radius-sm); font-size: 14px; }
.bidder-win { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; cursor: pointer; white-space: nowrap; color: var(--green-dark); font-weight: 600; }
.bidder-win input { width: 17px; height: 17px; accent-color: var(--green); }

/* filter form */
.filter-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-form .field { margin-bottom: 0; flex: 1 1 170px; }
.filter-form .field.field-grow { flex: 2 1 260px; grid-column: auto; }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 2px; }

/* summary chips */
.summary { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-soft); }
.summary strong { color: var(--text); }

/* ---------- detail view ---------- */
.view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.view-item { background: var(--gray-chip); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; }
.view-item span { display: block; font-size: 12px; color: var(--text-soft); margin-bottom: 3px; }
.view-item strong { font-size: 14px; word-break: break-word; }

.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tag-green { background: #ecfdf5; color: var(--green-dark); }
.tag-gray { background: var(--gray-chip); color: var(--text-soft); }
.tag-pink { background: var(--primary-soft); color: var(--primary); }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-orange { background: #fef3c7; color: #b45309; }

.status-badge.lock { background: #fef3c7; color: #92400e; }

.btn-warn { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.btn-warn:hover { background: #d97706; border-color: #d97706; }
.btn-xs { padding: 3px 9px; font-size: 12px; }
.nowrap { white-space: nowrap; }

.progress { margin-top: 8px; height: 8px; border-radius: 999px; background: var(--gray-chip); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #16a34a); }

.alert-card { border-left: 4px solid #f59e0b; }
.chart-card { min-height: 260px; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.print-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.two-col .table { min-width: 440px; }

.view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }

/* ---------- login ---------- */
.login-wrap {
    display: flex; justify-content: center; align-items: flex-start; padding-top: 7vh;
    background-image: radial-gradient(circle at 20% 10%, rgba(192, 132, 252, .16), transparent 48%),
        radial-gradient(circle at 85% 90%, rgba(236, 72, 153, .14), transparent 46%);
}
.login-card { max-width: 410px; width: 100%; padding: 30px; }
.login-head { text-align: center; margin-bottom: 20px; }
.login-logo { height: 150px; width: auto; display: block; margin: 0 auto 14px; }
.login-badge {
    width: 66px; height: 66px; margin: 0 auto 12px; border-radius: 20px;
    background: var(--grad-ig); color: #fff; font-size: 32px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 26px rgba(192, 38, 150, .38);
}
.login-head h1 { font-size: 20px; color: var(--text); letter-spacing: -.3px; }
.login-head p { font-size: 12.5px; color: var(--text-soft); margin-top: 5px; }

/* ---------- import UI ---------- */
.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
.import-panel {
    border: 1.5px dashed #d9b9e6; border-radius: var(--radius); padding: 18px;
    background: linear-gradient(180deg, #fdf9fe, #fff);
}
.import-panel h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.import-panel p { font-size: 13px; color: var(--text-soft); margin-bottom: 12px; }
.import-panel ul { font-size: 13px; color: var(--text-soft); padding-left: 18px; margin-bottom: 12px; line-height: 1.6; }
.file-field { position: relative; }
.file-field input[type="file"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.file-drag {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 26px 18px; border: 2px dashed #d9b9e6; border-radius: var(--radius-sm);
    background: #fff; color: var(--text-soft); font-size: 13.5px; text-align: center;
    transition: all .15s; min-height: 118px;
}
.file-drag:hover { border-color: var(--ig-pink); background: var(--primary-soft); }
.file-name { font-size: 13px; color: var(--primary); font-weight: 600; margin-top: 8px; word-break: break-all; }
.file-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; align-items: center; }

/* ---------- footer ---------- */
.footer { background: #fff; border-top: 1px solid var(--border); padding: 16px 0; text-align: center; font-size: 12px; color: var(--text-soft); }

/* ---------- sidebar layout ---------- */
.app-layout { display: flex; min-height: 100vh; }
.app-layout.standalone { display: block; }

/* ---------- public bar (ยังไม่เข้าสู่ระบบ) ---------- */
.publicbar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.publicbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; flex-wrap: wrap; }
.publicbar-brand { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.35; }
.publicbar-mark { width: auto; height: 40px; object-fit: contain; flex: 0 0 auto; display: block; }
.public-hint { display: block; margin-top: 8px; font-size: 12px; color: var(--text-soft); }
@media (max-width: 640px) {
    .publicbar-brand { font-size: 11.5px; }
    .publicbar-mark { height: 32px; }
}
.sidebar {
    width: 252px; flex: 0 0 252px;
    background: #fff; border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    padding: 18px 14px;
}
.sidebar .brand { padding: 4px 8px 16px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-nav a {
    display: block; padding: 11px 14px; border-radius: 12px;
    color: #45404a; text-decoration: none; font-size: 14.5px; font-weight: 500;
    transition: all .15s;
}
.side-nav a:hover { background: var(--gray-chip); color: var(--text); }
.side-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.side-nav a.side-cta {
    margin-top: 6px; background: var(--grad-cta); color: #fff; font-weight: 600; text-align: center;
    box-shadow: 0 6px 16px rgba(225, 48, 108, .3);
}
.side-nav a.side-cta:hover { filter: brightness(1.07); }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.sidebar-foot .nav-user { margin: 0; padding: 0; color: var(--text-soft); font-size: 12.5px; }
.side-logout { color: #dc2626; text-decoration: none; font-size: 13.5px; font-weight: 600; padding: 8px 10px; border-radius: 10px; }
.side-logout:hover { background: var(--red-soft); }
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mobilebar { display: none; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(15, 12, 40, .32); z-index: 55; backdrop-filter: blur(2px); }

/* ---------- print report ---------- */
.print-page-wrapper { background: #f2f2f4; padding: 26px 0; }
.print-toolbar { max-width: 900px; margin: 0 auto 16px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.print-sheet {
    max-width: 900px; margin: 0 auto; background: #fff; border-radius: 12px;
    box-shadow: var(--shadow-float); padding: 46px 54px; color: #111;
    font-size: 14px; line-height: 1.6;
}
.print-sheet .p-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.print-sheet .p-head .p-mark {
    width: 78px; height: 78px; flex: 0 0 auto; border-radius: 16px;
    background: var(--grad-ig); color: #fff; font-size: 40px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
}
.print-sheet .p-head h1 { font-size: 20px; line-height: 1.4; font-weight: 800; }
.print-sheet .p-head p { font-size: 13px; color: #444; }
.print-sheet h2 { font-size: 16px; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 2px solid #e6e6e6; }
.print-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.print-table th, .print-table td { border: 1px solid #bbb; padding: 6px 8px; text-align: left; }
.print-table th { background: #f3f3f3; font-weight: 700; }
.print-table td.n, .print-table th.n { text-align: right; }
.print-total td { font-weight: 700; background: #fafafa; }
.print-sign { display: flex; justify-content: space-between; gap: 20px; margin-top: 46px; }
.print-sign .sig { text-align: center; font-size: 13px; width: 42%; }
.print-sign .sig-line { border-top: 1px solid #333; margin: 56px 0 6px; }
.print-note { font-size: 12px; color: #555; margin-top: 26px; border-top: 1px dashed #ccc; padding-top: 8px; }

@media print {
    body { background: #fff !important; }
    .app-layout { display: block !important; }
    .sidebar, .mobilebar, .footer, .print-toolbar, .no-print { display: none !important; }
    .content { display: block !important; }
    .print-page-wrapper { background: #fff; padding: 0; }
    .print-toolbar { display: none; }
    .print-sheet { max-width: none; box-shadow: none; border-radius: 0; padding: 0; margin: 0; }
    .container { max-width: none; padding: 0; }
}

/* ---------- responsive ---------- */
@media (max-width: 820px) {
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; height: 100vh;
        width: 280px; z-index: 60; transform: translateX(-102%);
        transition: transform .22s ease;
    }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-float); }
    .scrim.show { display: block; }
    .mobilebar {
        display: flex; align-items: center; gap: 12px;
        min-height: 58px; padding: 0 14px; background: #fff;
        border-bottom: 1px solid var(--border);
        position: sticky; top: 0; z-index: 40;
    }
    .mobilebar-title { font-weight: 700; font-size: 14.5px; color: var(--text); }
    .two-col { grid-template-columns: 1fr; }
    .import-grid { grid-template-columns: 1fr; }
    .page-title { font-size: 20px; }
    .stat-value { font-size: 22px; }
    .table { font-size: 13px; min-width: 560px; }
    .table.table-tight { min-width: 760px; font-size: 11.5px; }
    .print-sheet { padding: 24px 18px; }
}

/* ---------- custom report column picker ---------- */
.col-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; margin-bottom: 10px; }
.col-check { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 3px 0; }
.col-check input { width: 16px; height: 16px; }

/* ---------- attachments grid ---------- */
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.attach-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: #fff; display: flex; flex-direction: column; gap: 6px; }
.attach-thumb-box { height: 120px; display: flex; align-items: center; justify-content: center; background: #f8fafc; border-radius: 8px; overflow: hidden; }
.attach-thumb { max-width: 100%; max-height: 120px; object-fit: contain; }
.attach-fileicon { font-weight: 700; color: #64748b; font-size: 15px; letter-spacing: 1px; }
.attach-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-meta { font-size: 11px; color: var(--muted); }
.attach-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }

/* ---------- recent search chips ---------- */
.recent-searches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; }
.recent-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 999px; background: #f1f5f9; color: #334155; font-size: 13px; text-decoration: none; border: 1px solid var(--border); }
.chip:hover { background: #e2e8f0; }
.chip-clear { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

/* ---------- audit timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.timeline-item { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border); }
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-dot { position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px #dcfce7; }
.timeline-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.timeline-action { font-weight: 700; color: var(--text); }
.timeline-time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline-summary { margin-top: 3px; color: #374151; font-size: 13.5px; word-break: break-word; }
.timeline-meta { margin-top: 2px; font-size: 12.5px; color: var(--muted); }

.alert-card.alert-danger { border-left: 5px solid #dc2626; background: #fef2f2; }

/* ---------- annual budget allocations (settings) ---------- */
.alloc-fy { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; background: #fbfdff; }
.alloc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.alloc-head h3 { margin: 0; font-size: 15.5px; color: var(--text); }
.alloc-total { font-weight: 700; color: var(--green-dark); font-variant-numeric: tabular-nums; }
.alloc-table input { width: 100%; min-width: 90px; padding: 5px 7px; border: 1px solid var(--border); border-radius: 7px; font: inherit; font-size: 13px; }
.alloc-table .num-input { text-align: right; font-variant-numeric: tabular-nums; }
.alloc-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.alloc-add input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; font: inherit; font-size: 13px; }
.alloc-add input[name="plan_code"] { flex: 1 1 200px; }
.alloc-add input[name="note"] { flex: 1 1 130px; }
.alloc-add input.num-input { flex: 0 1 130px; text-align: right; }
.alloc-add button { margin-left: auto; }
.hidden-form { display: none; }

@media (max-width: 820px) {
    .alloc-add button { margin-left: 0; width: 100%; }
}

@media (max-width: 420px) {
    .brand-text strong { font-size: 14px; }
    .brand-text small { font-size: 10px; }
    .page-title { font-size: 18px; }
    .container { padding: 0 10px; }
    .card { padding: 14px 12px; }
    .dash-grid, .stats-grid { grid-template-columns: 1fr; gap: 10px; }
    .table { font-size: 12px; min-width: 480px; }
    .btn { padding: 8px 12px; font-size: 13.5px; }
    .mobilebar-title { font-size: 12.5px; }
    .login-card { padding: 20px 16px; }
    .flash { font-size: 13px; }
}