/* Quản lý gói thầu tư vấn – CSS dùng chung (quy ước lớp app-* theo ezDoc) */
:root {
    --red-700: #8C0E15;
    --red-600: #B5121B;
    --red-500: #C8202A;
    --red-50: #FCEDEE;
    --gold-500: #F5C518;
    --gold-100: #FFF4D1;
    --ink-900: #1F1A17;
    --ink-700: #3D3530;
    --ink-500: #6B625C;
    --ink-400: #8F8780;
    --line-200: #EAE4DE;
    --line-100: #F3EFEB;
    --bg-50: #FAF8F6;
    --white: #fff;
    --success-700: #1E7B4F; --success-50: #E3F2EA;
    --warning-700: #7A5600; --warning-50: #FFF4D1;
    --danger-700: #B23A0C;  --danger-50: #FBE6DE;
    --info-700: #1D5FA8;    --info-50: #E6F0FB;
    --primary-700: #5B3BA8; --primary-50: #EFEAFB;
    --neutral-700: #5C5550; --neutral-50: #F0EDEA;
    --sidebar-width: 236px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --shadow-sm: 0 1px 2px rgba(31, 26, 23, .05);
    --shadow-md: 0 8px 24px rgba(31, 26, 23, .12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
    font-family: 'Be Vietnam Pro', 'Segoe UI', Arial, sans-serif;
    font-size: 14px; line-height: 1.5; color: var(--ink-700); background: var(--white);
    min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--red-600); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red-600); outline-offset: 2px; }
h1, h2, h3 { color: var(--ink-900); margin: 0; }
.app-icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.text-right, .num { text-align: right; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-muted { color: var(--ink-500); }
.text-success { color: var(--success-700); }
.text-danger { color: var(--danger-700); }
.text-strong { font-weight: 600; color: var(--ink-900); }
.nowrap { white-space: nowrap; }

/* ---------- Header ---------- */
.app-header {
    position: sticky; top: 0; z-index: 40; height: var(--header-height);
    display: flex; align-items: center; gap: 20px; padding: 0 20px;
    background: var(--red-600); color: var(--white); border-bottom: 3px solid var(--gold-500);
}
.app-brand { display: flex; align-items: center; gap: 12px; color: var(--white); min-width: 0; }
.app-brand:hover { text-decoration: none; }
.app-brand-logo { width: 40px; height: 40px; border-radius: 50%; background: var(--gold-500); color: var(--red-700); display: grid; place-items: center; flex: 0 0 auto; }
.app-brand-logo .app-icon { width: 22px; height: 22px; stroke-width: 2; }
.app-brand-name { font-weight: 700; font-size: 16px; letter-spacing: .3px; text-transform: uppercase; line-height: 1.2; }
.app-brand-sub { display: block; font-size: 12px; color: #FFE7A3; font-weight: 400; text-transform: none; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 460px; }
.app-header-search { margin-left: auto; position: relative; width: min(360px, 32vw); }
.app-header-search input { width: 100%; height: 38px; border: 0; border-radius: 8px; padding: 0 12px 0 36px; background: var(--white); color: var(--ink-900); }
.app-header-search .app-icon { position: absolute; left: 11px; top: 10px; color: var(--ink-400); }
.app-header-actions { display: flex; align-items: center; gap: 12px; }
.app-user-menu { position: relative; }
.app-user-trigger { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; color: var(--white); cursor: pointer; padding: 4px; border-radius: 8px; text-align: left; }
.app-user-trigger:hover { background: rgba(255,255,255,.1); }
.app-user-avatar { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--gold-500); display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--red-700); }
.app-user-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.app-user-role { display: block; font-size: 12px; color: #FFE7A3; font-weight: 400; }
.app-user-popover { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--white); color: var(--ink-700); border: 1px solid var(--line-200); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 6px; z-index: 50; }
.app-user-popover a, .app-user-popover button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 6px; color: var(--ink-700); cursor: pointer; text-align: left; }
.app-user-popover a:hover, .app-user-popover button:hover { background: var(--bg-50); text-decoration: none; }
.app-user-popover form { margin: 0; }
.app-mobile-toggle { display: none; background: none; border: 0; color: var(--white); cursor: pointer; padding: 6px; }

/* ---------- Shell ---------- */
.app-shell { flex: 1; display: flex; min-height: 0; }
.app-sidebar { width: var(--sidebar-width); flex: 0 0 var(--sidebar-width); border-right: 1px solid var(--line-200); padding: 14px 10px 24px; background: var(--white); position: sticky; top: var(--header-height); align-self: flex-start; height: calc(100vh - var(--header-height)); overflow-y: auto; }
.app-menu-group-label { font-size: 11px; font-weight: 700; color: var(--ink-400); letter-spacing: .8px; text-transform: uppercase; padding: 14px 10px 6px; }
.app-menu-group-label:first-child { padding-top: 2px; }
.app-menu { list-style: none; margin: 0; padding: 0; }
.app-menu a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-700); font-weight: 500; }
.app-menu a:hover { background: var(--bg-50); text-decoration: none; }
.app-menu a.is-active { background: var(--red-600); color: var(--white); }
.app-menu a.is-active .app-menu-count { color: var(--gold-100); }
.app-menu .app-icon { width: 17px; height: 17px; color: var(--ink-400); }
.app-menu a.is-active .app-icon { color: var(--gold-500); }
.app-menu-count { margin-left: auto; font-size: 12px; color: var(--ink-400); font-weight: 500; }
.app-main { flex: 1; min-width: 0; padding: 20px 28px 40px; }
.app-footer { background: var(--red-700); color: #F7D9DA; font-size: 12px; padding: 10px 20px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Page header ---------- */
.app-breadcrumb { font-size: 12px; color: var(--ink-500); margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.app-breadcrumb a { color: var(--ink-500); }
.app-breadcrumb span + span::before, .app-breadcrumb a + span::before, .app-breadcrumb a + a::before { content: "/"; margin-right: 6px; color: var(--line-200); }
.app-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.app-page-title { font-size: 24px; font-weight: 700; color: var(--red-600); line-height: 1.25; }
.app-page-description { margin: 4px 0 0; color: var(--ink-500); }
.app-page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Buttons ---------- */
.app-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--red-600); background: var(--red-600); color: var(--white); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.app-btn:hover { background: var(--red-700); border-color: var(--red-700); text-decoration: none; }
.app-btn:disabled, .app-btn.is-loading { opacity: .6; cursor: not-allowed; }
.app-btn-secondary { background: var(--white); color: var(--ink-900); border-color: var(--line-200); }
.app-btn-secondary:hover { background: var(--bg-50); border-color: #D8D0C8; }
.app-btn-success { background: var(--success-700); border-color: var(--success-700); }
.app-btn-success:hover { background: #17633F; border-color: #17633F; }
.app-btn-danger { background: var(--white); color: var(--danger-700); border-color: #F0C4B4; }
.app-btn-danger:hover { background: var(--danger-50); }
.app-btn-ghost { background: transparent; border-color: transparent; color: var(--red-600); }
.app-btn-ghost:hover { background: var(--red-50); border-color: transparent; }
.app-btn-sm { height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; }
.app-btn-sm .app-icon { width: 15px; height: 15px; }
.app-icon-action { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--ink-500); cursor: pointer; }
.app-icon-action:hover { background: var(--bg-50); border-color: var(--line-200); color: var(--red-600); text-decoration: none; }
.app-icon-action--danger:hover { color: var(--danger-700); background: var(--danger-50); }
.app-icon-action .app-icon { width: 16px; height: 16px; }
.app-row-actions { display: flex; gap: 2px; justify-content: flex-end; white-space: nowrap; }

/* ---------- Cards ---------- */
.app-card { background: var(--white); border: 1px solid var(--line-200); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.app-card + .app-card { margin-top: 16px; }
.app-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-100); }
.app-card-title { font-size: 16px; font-weight: 700; color: var(--red-600); }
.app-card-body { padding: 16px 18px; }
.app-grid { display: grid; gap: 16px; }
.app-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.app-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.app-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.app-grid-main-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.app-grid > .app-card + .app-card { margin-top: 0; }
.app-stack > * + * { margin-top: 16px; }

/* KPI */
.app-kpi { padding: 16px 18px; }
.app-kpi-label { color: var(--ink-500); font-size: 13px; }
.app-kpi-value { font-size: 28px; font-weight: 700; color: var(--ink-900); line-height: 1.25; margin: 4px 0; }
.app-kpi-value small { font-size: 15px; font-weight: 500; color: var(--ink-500); }
.app-kpi-note { font-size: 13px; color: var(--ink-500); }
.app-progress { height: 8px; background: var(--line-100); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.app-progress > span { display: block; height: 100%; background: var(--red-600); border-radius: 99px; }
.app-bar-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 90px 90px; gap: 12px; align-items: center; padding: 7px 0; }
.app-bar-row + .app-bar-row { border-top: 1px dashed var(--line-100); }
.app-bar { height: 12px; background: #F3DCDD; border-radius: 3px; position: relative; overflow: hidden; }
.app-bar > span { position: absolute; inset: 0 auto 0 0; background: var(--red-600); border-radius: 3px; }
.app-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-500); margin-top: 10px; }
.app-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; }
.app-alert-list { display: grid; gap: 8px; }
.app-alert-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line-200); color: var(--ink-700); }
.app-alert-item strong { font-size: 20px; }
.app-alert-item:hover { text-decoration: none; border-color: var(--red-600); }
.app-alert-item.tone-danger { background: var(--danger-50); border-color: #F3CDBF; }
.app-alert-item.tone-danger strong { color: var(--danger-700); }
.app-alert-item.tone-warning { background: var(--warning-50); border-color: #F0DFA8; }
.app-alert-item.tone-warning strong { color: var(--warning-700); }

/* ---------- Filter & forms ---------- */
.app-filter-card { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px 16px; margin-bottom: 16px; }
.app-filter-card .app-field { min-width: 170px; flex: 0 1 220px; }
.app-filter-card .app-field--grow { flex: 1 1 280px; }
.app-filter-actions { display: flex; gap: 8px; align-items: center; }
.app-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.app-field > label, .app-label { font-size: 13px; font-weight: 600; color: var(--ink-700); }
.required-mark { color: var(--red-600); margin-left: 2px; }
.form-hint { font-size: 12px; color: var(--ink-500); font-weight: 400; }
.app-control, .app-form input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),
.app-form select, .app-form textarea, .app-filter-card input:not([type=checkbox]):not([type=radio]), .app-filter-card select {
    width: 100%; height: 38px; padding: 0 12px; border: 1px solid #DCD4CC; border-radius: 8px; background: var(--white); color: var(--ink-900); transition: border-color .15s, box-shadow .15s;
}
.app-form textarea, textarea.app-control { height: auto; min-height: 76px; padding: 8px 12px; resize: vertical; }
.app-control:focus, .app-form input:focus, .app-form select:focus, .app-form textarea:focus, .app-filter-card input:focus, .app-filter-card select:focus { outline: none; border-color: var(--red-600); box-shadow: 0 0 0 3px rgba(181, 18, 27, .12); }
.app-form input[readonly], .app-control[readonly] { background: var(--bg-50); color: var(--ink-500); }
.app-form .input-num, input.js-money, input.js-percent, input.js-int { text-align: right; font-variant-numeric: tabular-nums; }
.field-validation-error { color: var(--danger-700); font-size: 12px; }
.is-invalid, .app-form .is-invalid { border-color: var(--danger-700) !important; }
.app-form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.col-12 { grid-column: span 12; } .col-9 { grid-column: span 9; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.app-form-section + .app-form-section { margin-top: 16px; }
.app-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.app-choice-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.app-choice-option { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid #DCD4CC; border-radius: 8px; cursor: pointer; font-weight: 500; }
.app-choice-option:has(input:checked) { border-color: var(--red-600); background: var(--red-50); color: var(--red-700); }
.app-choice-option input { accent-color: var(--red-600); margin: 0; }
.app-checkbox-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.app-checkbox-label input { width: 16px; height: 16px; accent-color: var(--red-600); margin: 0; }
.app-input-suffix { position: relative; }
.app-input-suffix > span { position: absolute; right: 12px; top: 9px; color: var(--ink-400); pointer-events: none; }
.app-input-suffix input { padding-right: 32px !important; }

/* Select2 */
.select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single { height: 38px; border: 1px solid #DCD4CC; border-radius: 8px; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 36px; padding-left: 12px; color: var(--ink-900); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }
.select2-container--default.select2-container--focus .select2-selection--single, .select2-container--default.select2-container--open .select2-selection--single { border-color: var(--red-600); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--red-600); }
.select2-dropdown { border-color: #DCD4CC; border-radius: 8px; overflow: hidden; z-index: 2000; }
.select2-search--dropdown .select2-search__field { border-radius: 6px; border-color: #DCD4CC; }

/* ---------- Tabs ---------- */
.app-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-200); margin-bottom: 16px; overflow-x: auto; }
.app-tabs a { padding: 10px 14px; color: var(--ink-500); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.app-tabs a:hover { color: var(--red-600); text-decoration: none; }
.app-tabs a.is-active { color: var(--red-600); border-bottom-color: var(--red-600); }
.app-tabs a .app-tab-count { display: inline-block; margin-left: 6px; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--line-100); color: var(--ink-500); }
.app-tabs a.is-active .app-tab-count { background: var(--red-50); color: var(--red-600); }

/* ---------- Tables ---------- */
.app-data-card { overflow: hidden; }
.app-table-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-100); color: var(--ink-500); font-size: 13px; flex-wrap: wrap; }
.app-table-summary strong { color: var(--ink-900); }
.app-table-wrap { overflow-x: auto; position: relative; }
.app-table { width: 100%; border-collapse: collapse; }
.app-table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-500); text-transform: uppercase; letter-spacing: .3px; background: var(--bg-50); padding: 10px 12px; border-bottom: 1px solid var(--line-200); white-space: nowrap; }
.app-table th.num { text-align: right; }
.app-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-100); vertical-align: top; }
.app-table tbody tr:hover { background: #FFFBF4; }
.app-table tfoot td { font-weight: 700; background: var(--gold-100); color: var(--ink-900); }
.app-cell-index { width: 48px; color: var(--ink-400); }
.app-cell-title { font-weight: 600; color: var(--ink-900); display: block; }
.app-cell-sub { display: block; font-size: 12px; color: var(--ink-500); }
.app-table a.app-cell-title:hover { color: var(--red-600); }
.app-table-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; color: var(--ink-500); font-size: 13px; flex-wrap: wrap; }
.app-pager { display: flex; gap: 6px; align-items: center; }
.app-pager a, .app-pager span.app-pager-current { min-width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line-200); color: var(--ink-700); }
.app-pager a:hover { border-color: var(--red-600); color: var(--red-600); text-decoration: none; }
.app-pager .is-disabled { opacity: .45; pointer-events: none; }
.app-empty { padding: 40px 16px; text-align: center; color: var(--ink-500); }
.app-empty .app-icon { width: 36px; height: 36px; color: var(--line-200); margin-bottom: 8px; }
.app-mini-progress { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.app-mini-progress .app-progress { flex: 1; margin: 0; height: 6px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-50); color: var(--success-700); }
.badge-warning { background: var(--warning-50); color: var(--warning-700); }
.badge-danger { background: var(--danger-50); color: var(--danger-700); }
.badge-info { background: var(--info-50); color: var(--info-700); }
.badge-primary { background: var(--primary-50); color: var(--primary-700); }
.badge-neutral { background: var(--neutral-50); color: var(--neutral-700); }
.app-tag { display: inline-block; padding: 1px 8px; border-radius: 4px; background: var(--line-100); color: var(--ink-700); font-size: 12px; font-weight: 600; }

/* ---------- Alerts ---------- */
.app-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; border: 1px solid; margin-bottom: 16px; }
.app-alert .app-icon { margin-top: 1px; }
.app-alert-info { background: var(--info-50); border-color: #C6DCF5; color: #17497F; }
.app-alert-warning { background: var(--warning-50); border-color: #F0DFA8; color: var(--warning-700); }
.app-alert-danger { background: var(--danger-50); border-color: #F3CDBF; color: var(--danger-700); }
.app-alert-success { background: var(--success-50); border-color: #BFE2CF; color: var(--success-700); }

/* ---------- Definition list / side panels ---------- */
.app-dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.app-dl dt { color: var(--ink-500); }
.app-dl dd { margin: 0; color: var(--ink-900); font-weight: 500; }
.app-calc-list { display: grid; gap: 0; margin: 0; }
.app-calc-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line-100); }
.app-calc-list > div:last-child { border-bottom: 0; }
.app-calc-list dt { color: var(--ink-500); font-size: 13px; }
.app-calc-list dd { margin: 0; font-weight: 700; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.app-calc-list .is-highlight dd { color: var(--red-600); font-size: 17px; }
.app-side-list { list-style: none; margin: 0; padding: 0; }
.app-side-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line-100); font-size: 13px; }
.app-side-list li:last-child { border: 0; }
.app-note-list { margin: 0; padding-left: 18px; color: var(--ink-500); font-size: 13px; }
.app-note-list li + li { margin-top: 6px; }

/* ---------- Tracking matrix ---------- */
.tm-table td { padding: 8px; min-width: 150px; }
.tm-table td:first-child { min-width: 220px; position: sticky; left: 0; background: var(--white); z-index: 1; border-right: 1px solid var(--line-200); }
.tm-table th:first-child { position: sticky; left: 0; z-index: 2; }
.tm-cell { display: block; border-radius: 8px; padding: 8px 10px; border: 1px solid; color: inherit; min-height: 74px; font-size: 12px; line-height: 1.4; }
.tm-cell:hover { text-decoration: none; box-shadow: var(--shadow-md); }
.tm-cell strong { display: block; font-size: 12px; }
.tm-cell .tm-nt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-700); }
.tm-cell .tm-val { font-weight: 700; color: var(--ink-900); margin-top: 2px; }
.tm-signed { background: var(--success-50); border-color: #BFE2CF; }
.tm-signed strong { color: var(--success-700); }
.tm-unsigned { background: var(--warning-50); border-color: #F0DFA8; }
.tm-unsigned strong { color: var(--warning-700); }
.tm-nocontractor { background: var(--danger-50); border-color: #F3CDBF; }
.tm-nocontractor strong { color: var(--danger-700); }
.tm-empty { color: var(--line-200); text-align: center; display: block; padding-top: 24px; }
.tm-legend { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Steps (import) ---------- */
.app-steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.app-step { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 99px; background: var(--bg-50); color: var(--ink-500); font-weight: 600; }
.app-step b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--white); border: 1px solid var(--line-200); }
.app-step.is-done b { background: var(--success-700); color: var(--white); border-color: var(--success-700); }
.app-step.is-active { background: var(--red-50); color: var(--red-600); }
.app-step.is-active b { background: var(--red-600); color: var(--white); border-color: var(--red-600); }
.app-step .app-icon { width: 14px; height: 14px; stroke-width: 3; }
.app-issue-row { display: grid; grid-template-columns: 100px minmax(0, 1fr) 80px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-100); }
.app-issue-row:last-child { border: 0; }
.app-issue-count { font-size: 22px; font-weight: 700; text-align: right; color: var(--ink-900); }
.app-file-picker { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px; border: 2px dashed #DCD4CC; border-radius: var(--radius-md); background: var(--bg-50); cursor: pointer; text-align: center; color: var(--ink-500); }
.app-file-picker:hover { border-color: var(--red-600); }
.app-file-picker .app-icon { width: 34px; height: 34px; color: var(--red-600); }
.app-file-picker input { display: none; }
details.app-details summary { cursor: pointer; color: var(--red-600); font-weight: 600; font-size: 13px; }

/* ---------- Dialog (jQuery UI) ---------- */
.ui-widget-overlay { background: rgba(31, 26, 23, .45); opacity: 1; }
.ui-dialog.app-dialog { padding: 0; border: 0; border-radius: 12px; box-shadow: var(--shadow-md); font-family: inherit; overflow: hidden; }
.ui-dialog.app-dialog .ui-dialog-titlebar { background: var(--white); border: 0; border-bottom: 1px solid var(--line-100); border-radius: 0; padding: 14px 18px; }
.ui-dialog.app-dialog .ui-dialog-title { color: var(--red-600); font-weight: 700; font-size: 16px; }
.ui-dialog.app-dialog .ui-dialog-titlebar-close { right: 14px; width: 28px; height: 28px; margin-top: -14px; border: 0; background: none; }
.ui-dialog.app-dialog .ui-dialog-content { padding: 0; font-family: inherit; font-size: 14px; color: var(--ink-700); }
.app-dialog-body { padding: 16px 18px; max-height: calc(100vh - 220px); overflow-y: auto; }
.app-dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-100); background: var(--bg-50); margin: 0; }
.app-dialog-context { padding: 10px 12px; background: var(--gold-100); border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.app-dialog-context strong { display: block; color: var(--ink-900); }
.app-dialog-error { margin-bottom: 12px; }

/* Toast */
#toast-container { position: fixed; right: 20px; bottom: 20px; z-index: 3000; display: grid; gap: 8px; }
.app-toast { min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 8px; background: var(--ink-900); color: var(--white); box-shadow: var(--shadow-md); display: flex; gap: 10px; align-items: flex-start; animation: toast-in .2s ease; }
.app-toast.success { background: var(--success-700); }
.app-toast.error { background: var(--danger-700); }
.app-toast.warning { background: #9A6B00; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: var(--red-600); color: var(--white); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; border-right: 6px solid var(--gold-500); }
.login-hero h1 { color: var(--white); font-size: 30px; line-height: 1.3; text-transform: uppercase; margin-top: 24px; }
.login-hero p { color: #FFE7A3; font-size: 15px; }
.login-panel { display: grid; place-items: center; padding: 32px; background: var(--bg-50); }
.login-card { width: min(400px, 100%); padding: 28px; }
.login-card h2 { font-size: 22px; color: var(--red-600); margin-bottom: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .app-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app-grid-main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
    .app-grid-2, .app-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .app-brand-sub, .app-header-search { display: none; }
    .login-page { grid-template-columns: 1fr; }
    .login-hero { display: none; }
}
@media (max-width: 768px) {
    .app-shell { flex-direction: column; }
    .app-mobile-toggle { display: inline-flex; }
    .app-sidebar { position: static; width: 100%; height: auto; flex: none; border-right: 0; border-bottom: 1px solid var(--line-200); display: none; }
    body.menu-open .app-sidebar { display: block; }
    .app-main { padding: 16px; }
    .app-grid-4 { grid-template-columns: minmax(0, 1fr); }
    .app-form-grid > * { grid-column: span 12; }
    .app-user-name { display: none; }
    .app-bar-row { grid-template-columns: minmax(0, 1fr) 80px; }
    .app-bar-row .app-bar, .app-bar-row .app-bar-extra { display: none; }
    .app-dl { grid-template-columns: minmax(0, 1fr); }
}

/* Radio group, misc */
.app-radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.app-radio { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line-200); border-radius: 8px; cursor: pointer; font-weight: 500; }
.app-radio:has(input:checked) { border-color: var(--red-600); background: var(--red-50); color: var(--red-600); }
.app-radio input { accent-color: var(--red-600); margin: 0; }
.app-bar { height: 8px; border-radius: 99px; background: var(--line-100); overflow: hidden; min-width: 80px; }
.app-bar > span { display: block; height: 100%; background: var(--red-600); border-radius: 99px; }
.app-bar.is-good > span { background: #1a7f45; }
.app-inline-form { display: inline-flex; gap: 6px; align-items: center; }
pre.app-code { background: var(--bg-50); border: 1px solid var(--line-100); border-radius: 8px; padding: 10px; font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; margin: 0; }
.app-page-header > div:first-child { min-width: 0; }
.app-page-title, .app-page-description { overflow-wrap: anywhere; }
