@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

html.ai-workspace-open, html.ai-workspace-open body { overflow: hidden; overscroll-behavior: none; }
html.ai-workspace-open .saas-footer { display: none; }

:root {
    --brand-900: #123b38;
    --brand-700: #087963;
    --brand-500: #16a085;
    --brand-100: #e7f7f2;
    --ink-900: #173b39;
    --ink-700: #526d69;
    --ink-500: #718581;
    --surface: #ffffff;
    --canvas: #f4f8f7;
    --line: #d9e8e4;
    --shadow-sm: 0 4px 14px rgba(18, 59, 56, .06);
    --shadow-md: 0 12px 32px rgba(18, 59, 56, .11);
    --radius-sm: 8px;
    --radius-md: 14px;
    --ease: 180ms ease;
}
[data-theme="dark"] {
    --ink-900: #f2f4f5; --ink-700: #b4bbc3; --ink-500: #b4bbc3; --surface: #191c20; --canvas: #0b0c0e;
    --line: #343940; --brand-100: #20252a; --shadow-sm: 0 4px 14px rgba(0,0,0,.28); --shadow-md: 0 12px 32px rgba(0,0,0,.42);
}
[data-theme="dark"] body, [data-theme="dark"] .saas-shell { background: var(--canvas); color: var(--ink-900); }
[data-theme="dark"] .saas-header { background: #15191e; border-color: var(--line); }
[data-theme="dark"] .saas-brand, [data-theme="dark"] .product-nav-link, [data-theme="dark"] .account-chip { color: var(--ink-900); }
[data-theme="dark"] .product-nav-link:hover, [data-theme="dark"] .product-nav-link.active { background: var(--brand-100); color: #75dec7; }
[data-theme="dark"] .panel, [data-theme="dark"] .metric-card, [data-theme="dark"] .state-panel, [data-theme="dark"] .dialog-card, [data-theme="dark"] .filter-panel { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .form-control, [data-theme="dark"] select, [data-theme="dark"] input, [data-theme="dark"] textarea { background: #15191e; color: var(--ink-900); border-color: #3a424b; }
[data-theme="dark"] .data-table th, [data-theme="dark"] .data-table td { border-color: var(--line); }
[data-theme="dark"] .data-table th, [data-theme="dark"] .page-head p, [data-theme="dark"] .metric-card > span, [data-theme="dark"] .metric-card small, [data-theme="dark"] .filter-grid label { color: var(--ink-500); }
[data-theme="dark"] .btn-outline-secondary { background: #1d2329; color: var(--ink-900); border-color: #46505a; }

[data-theme="dark"] .page-head h1, [data-theme="dark"] .section-title h2, [data-theme="dark"] .panel-heading h2, [data-theme="dark"] .panel-heading h3, [data-theme="dark"] .dialog-head h2 { color: var(--ink-900); }
[data-theme="dark"] .metric-card > span, [data-theme="dark"] .metric-card small, [data-theme="dark"] .page-head p, [data-theme="dark"] .panel-note, [data-theme="dark"] .activity-row small, [data-theme="dark"] .compact-row small, [data-theme="dark"] .usage-row small { color: var(--ink-700); }
[data-theme="dark"] .metric-card strong, [data-theme="dark"] .panel-heading > strong { color: #f2fbf9; }
[data-theme="dark"] .bar-column { color: #b2c8c3; }
[data-theme="dark"] .bar-column i { background: linear-gradient(#4ccbb4, #238f82); }
[data-theme="dark"] .activity-row, [data-theme="dark"] .compact-row, [data-theme="dark"] .usage-row { border-color: var(--line); }
[data-theme="dark"] .detail-grid > div, [data-theme="dark"] .code-result, [data-theme="dark"] .grant-row, [data-theme="dark"] .impact-grid > div { background: #15191e; border-color: var(--line); }
[data-theme="dark"] .empty-state, [data-theme="dark"] .state-panel, [data-theme="dark"] .muted { color: var(--ink-700); }
[data-theme="dark"] .status-badge { background: #304541; color: #d7e8e4; }
[data-theme="dark"] .status-badge.completed { background: #20533f; color: #baf1d3; }
[data-theme="dark"] .status-badge.processing, [data-theme="dark"] .status-badge.queued { background: #234b62; color: #c9e9ff; }
[data-theme="dark"] .status-badge.failed { background: #603b39; color: #ffd2cc; }
[data-theme="dark"] .status-badge.cancelled { background: #45413e; color: #e1d8d2; }
html[data-theme="light"], html[data-theme="light"] body { background: #f4f8f7; color: #173b39; }
html[data-theme="light"] .saas-shell { background: #f4f8f7; color: #173b39; }
html[data-theme="dark"], html[data-theme="dark"] body { background: #0b0c0e !important; color: #f2f4f5; }
html[data-theme="dark"] .saas-shell { background: #0b0c0e !important; color: #f2f4f5; }
html[data-theme="dark"] .saas-header { background: var(--canvas) !important; border-color: #343940 !important; }
html[data-theme="dark"] .saas-content { background: transparent !important; }
html[data-theme="dark"] .saas-footer { background: #0b0c0e !important; color: #b4bbc3; }
html[data-theme="dark"] .workspace-picker select { background: #111316 !important; color: #f2f4f5 !important; border-color: #343940 !important; }
html[data-theme="dark"] .page-head h1, html[data-theme="dark"] .section-title h2, html[data-theme="dark"] .panel-heading h2, html[data-theme="dark"] .panel-heading h3, html[data-theme="dark"] .metric-card strong { color: #f2f4f5 !important; }
html[data-theme="dark"] .metric-card, html[data-theme="dark"] .panel, html[data-theme="dark"] .filter-panel, html[data-theme="dark"] .dialog-card { background: #191c20 !important; border-color: #343940 !important; }
html[data-theme="dark"] .metric-card.featured { background: #191c20 !important; border: 1px solid #087963 !important; }
html[data-theme="dark"] .metric-card.featured span, html[data-theme="dark"] .metric-card.featured strong, html[data-theme="dark"] .metric-card.featured small { color: #f2f4f5 !important; }
html[data-theme="dark"] .form-control, html[data-theme="dark"] select, html[data-theme="dark"] input, html[data-theme="dark"] textarea { background: #111316 !important; color: #f2f4f5 !important; border-color: #343940 !important; }
html[data-theme="dark"] .metric-card > span, html[data-theme="dark"] .metric-card small, html[data-theme="dark"] .page-head p, html[data-theme="dark"] .filter-grid label, html[data-theme="dark"] .panel-note { color: #b4bbc3 !important; }
/* Xử lý AI (Pages/Index.razor.css): component stylesheet có màu sáng cố định */
html[data-theme="dark"] .support-card, html[data-theme="dark"] .admin-card { background: #191c20 !important; border-color: #343940 !important; box-shadow: 0 12px 36px rgba(0,0,0,.35) !important; }
html[data-theme="dark"] .support-card h1, html[data-theme="dark"] .support-card h2, html[data-theme="dark"] .support-card label, html[data-theme="dark"] .support-card .file-name, html[data-theme="dark"] .support-card .result-file-title { color: #f2f4f5 !important; }
html[data-theme="dark"] .support-card .form-control, html[data-theme="dark"] .support-card select, html[data-theme="dark"] .support-card textarea { background: #111316 !important; color: #f2f4f5 !important; border-color: #343940 !important; }
html[data-theme="dark"] .support-card .upload-zone { background: #15181c !important; border-color: #555d66 !important; color: #f2f4f5 !important; }
html[data-theme="dark"] .support-card .upload-zone:hover, html[data-theme="dark"] .support-card .upload-zone:focus-within { background: #20252a !important; border-color: #16a085 !important; }
html[data-theme="dark"] .support-card .upload-help, html[data-theme="dark"] .support-card .file-size, html[data-theme="dark"] .support-card .file-separator { color: #b4bbc3 !important; }
html[data-theme="dark"] .support-card .upload-item, html[data-theme="dark"] .support-card .result-file, html[data-theme="dark"] .support-card .output-box { background: #15181c !important; border-color: #343940 !important; }
html[data-theme="dark"] .support-card .output-format-option { color: #f2f4f5 !important; }
html[data-theme="dark"] .support-card .status-message.success { background: #18352f !important; color: #b9eadc !important; }
html[data-theme="dark"] .support-card .status-message.error { background: #3a2023 !important; color: #ffd1d5 !important; }

html, body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--canvas);
    color: var(--ink-900);
    min-height: 100%;
    font-size: 15px;
    line-height: 1.5;
}

a, .btn-link {
    color: #0366d6;
}

.btn-primary {
    color: #fff;
    background: var(--brand-700);
    border-color: var(--brand-700);
}

.btn { border-radius: var(--radius-sm); font-weight: 700; letter-spacing: .01em; transition: transform var(--ease), box-shadow var(--ease), background-color var(--ease), border-color var(--ease); }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn-outline-secondary { color: var(--ink-700); border-color: #c9d9d5; background: var(--surface); }
.btn-outline-secondary:hover:not(:disabled) { color: var(--brand-700); border-color: #9ccfc2; background: var(--brand-100); }

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.page-head, .section-title, .panel-heading, .filter-actions, .pagination, .dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.page-head { margin-bottom: 1.25rem; }
.page-head h1, .section-title h2, .panel-heading h2, .panel-heading h3, .dialog-head h2 { margin: 0; color: var(--ink-900); letter-spacing: -.025em; }
.page-head h1 { font-size: clamp(1.55rem, 2.6vw, 2.1rem); font-weight: 800; }
.page-head p { margin: .35rem 0 0; color: #647b79; }
.eyebrow, .panel-heading span, .section-title span { color: #16877f; font-size: .72rem; font-weight: 700; letter-spacing: .09em; }
.page-actions { display: flex; align-items: end; gap: .75rem; }
.compact-field { margin: 0; color: #617774; font-size: .78rem; }
.compact-field select { min-width: 110px; margin-top: .25rem; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.metric-card, .panel, .state-panel, .dialog-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--ease), border-color var(--ease), transform var(--ease);
}
.panel:hover, .metric-card:hover { border-color: #c7ddd8; box-shadow: var(--shadow-md); }
.metric-card { padding: 1.1rem 1.2rem; }
.metric-card > span, .metric-card small { display: block; color: #6d807e; }
.metric-card strong { display: block; margin: .25rem 0; color: #173e3b; font-size: 1.7rem; line-height: 1.15; }
.metric-card.featured { background: linear-gradient(135deg, #126f69, #1b9990); border: 0; }
.metric-card.featured span, .metric-card.featured strong, .metric-card.featured small { color: #fff; }
.metric-grid.compact .metric-card strong { font-size: 1.4rem; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 1.25rem; }
.dashboard-history { margin-bottom: 1.5rem; }
.panel { padding: clamp(1rem, 2vw, 1.35rem); }
.panel-heading { margin-bottom: .8rem; }
.panel-heading a { white-space: nowrap; }
.bar-chart { display: flex; align-items: end; gap: .4rem; min-height: 250px; padding-top: 2rem; overflow-x: auto; }
.bar-column { display: grid; grid-template-rows: 1.2rem 190px 1.2rem; align-items: end; justify-items: center; min-width: 22px; flex: 1; color: #70817f; font-size: .7rem; }
.bar-column i { display: block; width: min(24px, 78%); min-height: 5px; border-radius: 6px 6px 2px 2px; background: linear-gradient(#21aa9f, #13776f); }
.bar-value { white-space: nowrap; transform: rotate(-45deg); transform-origin: center; }
.activity-row, .compact-row, .usage-row { display: flex; align-items: center; gap: .7rem; padding: .75rem 0; border-bottom: 1px solid #edf3f2; }
.activity-row { color: inherit; text-decoration: none; }
.activity-row > div, .compact-row > div, .usage-row > div { min-width: 0; flex: 1; }
.activity-row strong, .activity-row small, .compact-row strong, .compact-row small, .usage-row strong, .usage-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-row small, .compact-row small, .usage-row small { color: #758784; }
.status-badge { display: inline-block; padding: .24rem .5rem; border-radius: 99px; background: #eef3f2; color: #526663; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.status-badge.completed { background: #dcf6e9; color: #197348; }
.status-badge.processing, .status-badge.queued { background: #e2f1ff; color: #26679d; }
.status-badge.failed { background: #fee8e7; color: #aa3933; }
.status-badge.cancelled { background: #f0eceb; color: #705d59; }
.section-block { margin-top: 1.5rem; }
.section-title { margin-bottom: .75rem; }
.three-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.panel-note { margin: .8rem 0 0; color: #687c79; }
.panel-note.warning { color: #976314; }

.filter-panel { margin-bottom: 1rem; background: #fbfefd; }
.filter-grid { display: grid; grid-template-columns: 1.5fr repeat(5, minmax(125px, 1fr)); gap: .75rem; }
.filter-grid label { margin: 0; color: #5f7572; font-size: .78rem; }
.filter-grid .form-control { margin-top: .25rem; }
.form-control, .form-select, select, input, textarea { border-color: #cddedb; border-radius: var(--radius-sm); transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease); }
.form-control:hover, select:hover, input:hover, textarea:hover { border-color: #9fc9bf; }
.form-control:focus, select:focus, input:focus, textarea:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(22, 160, 133, .14); }
.filter-actions { justify-content: flex-end; margin-top: .8rem; }
.responsive-table { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px; border-bottom: 1px solid #e7efee; vertical-align: top; text-align: left; }
.data-table th { color: #607571; font-size: .75rem; white-space: nowrap; }
.data-table td small { display: block; color: #788987; }
.row-actions { white-space: nowrap; }
.data-table td.row-actions { display: flex; align-items: center; gap: 8px; min-width: 220px; white-space: nowrap; }
.data-table td.row-actions .btn { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.pagination { padding-top: 1rem; }
.pagination > div { display: flex; gap: .5rem; }
.empty-state, .state-panel { padding: 1.5rem; color: #71827f; text-align: center; }
.empty-state span { display: block; }
.loading-ring { display: inline-block; width: 18px; height: 18px; margin-right: .5rem; border: 2px solid #bee0dc; border-top-color: #16877f; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-backdrop-custom { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 1rem; background: rgba(7, 35, 33, .52); animation: fade-in var(--ease) both; }
.dialog-card { width: min(760px, 100%); max-height: 88vh; padding: clamp(1rem, 3vw, 1.5rem); overflow: auto; box-shadow: var(--shadow-md); animation: dialog-in 220ms ease both; }
.dialog-head { margin-bottom: 16px; }
.dialog-head h2 { font-size: 1rem; word-break: break-all; }
.icon-close { border: 0; background: none; color: #526663; font-size: 1.8rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.detail-grid > div { padding: .8rem; border-radius: 8px; background: #f4f8f7; }
.detail-grid dt { color: #748683; font-size: .75rem; }
.detail-grid dd { margin: .2rem 0 0; }
.muted { color: #82918f; }
.auth-grid, .settings-grid, .admin-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.auth-grid > *, .settings-grid > *, .admin-layout > *, .metric-grid > *, .dashboard-grid > *, .three-columns > * { min-width: 0; }
.admin-layout { grid-template-columns: minmax(0, 1.7fr) minmax(290px, .8fr); }
.form-panel { display: flex; flex-direction: column; gap: 12px; }
.form-panel .form-control { margin: 0; }
.field-label { margin: 4px 0 -6px; color: #5f7572; font-size: .78rem; font-weight: 700; }
.form-actions, .inline-form { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.inline-form .form-control { min-width: 170px; flex: 1; }
.oauth-panel { margin-top: 1rem; }
.checkbox-row { display: inline-flex; align-items: center; gap: .4rem; margin: 0; color: #526663; white-space: nowrap; }
.code-result { display: grid; gap: .35rem; padding: .75rem; border-radius: 8px; background: #f0f7f6; color: #315754; }
.code-result code { max-width: 100%; overflow-wrap: anywhere; color: #176d66; }
.admin-wide { min-width: 0; }
.endpoint-cell { max-width: 280px; overflow-wrap: anywhere; }
.grant-toolbar { align-items: end; margin-top: 1rem; }
.grant-toolbar .field-label { flex: 0 0 auto; }
.grant-list { display: grid; gap: .55rem; margin-top: 1rem; padding-top: .85rem; border-top: 1px solid #e7efee; }
.grant-list > strong { color: #526d69; font-size: .82rem; }
.grant-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem .75rem; border: 1px solid #e7efee; border-radius: 9px; }
.grant-row span { min-width: 0; }
.grant-row strong, .grant-row small { display: block; overflow-wrap: anywhere; }
.grant-row small { color: #71817f; }
.workspace-model-picker { margin-top: .75rem; }
.workspace-model-list { display: grid; gap: .45rem; max-height: 220px; overflow-y: auto; margin-top: .55rem; padding: .65rem; border: 1px solid #e2ecea; border-radius: 9px; background: #f7fbfa; }
.workspace-model-option { display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem; border-radius: 7px; }
.workspace-model-option:hover { background: #edf7f5; }
.workspace-model-option span { min-width: 0; }
.workspace-model-option strong, .workspace-model-option small { display: block; overflow-wrap: anywhere; }
.workspace-model-option small { color: #71817f; }
.workspace-token-editor { margin-top: .9rem; padding-top: .85rem; border-top: 1px solid #e2ecea; }
.workspace-token-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: .55rem 0 .7rem; }
.workspace-token-summary span { padding: .55rem .65rem; border-radius: 7px; background: #f4f8f7; color: #607571; font-size: .78rem; }
.workspace-token-summary strong { display: block; margin-top: .15rem; color: #173e3b; font-size: 1rem; }
@media (max-width: 600px) { .workspace-token-summary { grid-template-columns: 1fr; } .workspace-token-editor .inline-form { align-items: stretch; flex-direction: column; } .workspace-token-editor .inline-form .btn { width: 100%; } }
.model-empty-state, .model-warning { margin-top: .35rem; padding: .65rem .75rem; border-radius: 8px; font-size: .82rem; }
.model-empty-state { background: #f0f7f6; color: #526d69; }
.model-warning { background: #fff8e6; border: 1px solid #f1d18b; color: #765718; }
.btn:focus, .form-control:focus, a:focus-visible, button:focus-visible { outline: 3px solid rgba(22, 135, 127, .24); outline-offset: 2px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

@media (max-width: 1100px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .three-columns { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
    .page-head, .section-title, .page-actions { align-items: stretch; flex-direction: column; }
    .metric-grid, .dashboard-grid, .filter-grid, .detail-grid { grid-template-columns: 1fr; }
    .page-actions .btn { width: 100%; }
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr { padding: .6rem 0; border-bottom: 1px solid #dfe9e7; }
    .data-table td { display: grid; grid-template-columns: 38% 1fr; padding: .35rem 0; border: 0; }
    .data-table td::before { content: attr(data-label); color: #687c79; font-size: .75rem; font-weight: 700; }
    .data-table td.row-actions { display: flex !important; flex-wrap: wrap; grid-template-columns: none !important; min-width: 0; gap: .4rem; }
    .data-table td.row-actions .btn { flex: 1 1 auto; }
    .row-actions::before { display: none; }
    .auth-grid, .settings-grid, .admin-layout { grid-template-columns: minmax(0, 1fr); }
    .data-table td { min-width: 0; overflow-wrap: anywhere; }
    .form-actions .btn, .inline-form .btn { flex: 1 1 auto; }
    .panel-heading, .filter-actions, .pagination { align-items: stretch; flex-wrap: wrap; }
    .pagination > div { width: 100%; }
    .pagination > div .btn { flex: 1; }
    .grant-toolbar { align-items: stretch; }
    .grant-toolbar .field-label { flex-basis: 100%; }
    .grant-row { align-items: stretch; flex-direction: column; }
    .grant-row .btn { width: 100%; }
}

@media(max-width:820px){.saas-shell.menu-open .product-nav{display:flex!important}}

/* Workspace application management */
.page-description { margin: .45rem 0 0; color: #647b78; }
.access-denied { padding: clamp(24px,4vw,42px); }
.access-denied h1 { margin: .3rem 0 .6rem; }
.access-denied p { color: #647b78; margin-bottom: 1.2rem; }
.unsaved-warning { background: #fff8e6; border: 1px solid #f1d18b; border-radius: 8px; color: #765718; margin-bottom: 12px; padding: 9px 11px; }
.dependency-list { max-height: 280px; overflow-y: auto; margin: 1rem 0; border: 1px solid var(--border-color, #dbe4ea); border-radius: .5rem; }
.dependency-row { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem .85rem; border-bottom: 1px solid var(--border-color, #dbe4ea); }
.dependency-row:last-child { border-bottom: 0; }
.dependency-row span { color: #64748b; text-align: right; }
.btn-danger { color: #fff; background: #b42318; border-color: #b42318; }
.btn-danger:hover, .btn-danger:focus { color: #fff; background: #8f1d14; border-color: #8f1d14; }
@media (max-width: 600px) { .dependency-row { display: block; } .dependency-row span { display: block; text-align: left; margin-top: .2rem; } }
.admin-layout { grid-template-columns: 1fr; }
.admin-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.admin-layout > .admin-wide { width: 100%; }
.data-table td:first-child strong, .data-table td:nth-child(2) { overflow-wrap: anywhere; word-break: normal; }
@media (max-width: 767px) { .admin-metrics { grid-template-columns: 1fr; } }
.impact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: 1rem 0; }
.impact-grid > div { padding: .7rem .8rem; border: 1px solid #e2ecea; border-radius: 8px; background: #f7fbfa; }
.impact-grid dt { color: #71827f; font-size: .75rem; }
.impact-grid dd { margin: .2rem 0 0; color: #173e3b; font-weight: 700; }
@media (max-width: 600px) { .impact-grid { grid-template-columns: 1fr; } }

/* Khoảng cách dùng chung cho form, danh sách và hộp thoại. */
.form-panel .form-control, .filter-grid .form-control, .inline-form .form-control { min-height: 40px; padding: 8px 12px; }
.form-panel .panel-heading { margin-bottom: 4px; }
.form-actions { margin-top: 4px; }
.section-header, .prompt-toolbar, .item-actions, .dialog-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.section-header { justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.prompt-toolbar { flex: 0 1 460px; min-width: 0; }
.prompt-toolbar .form-control { flex: 1 1 180px; min-width: 0; }
.prompt-toolbar .btn { flex: 0 0 auto; }
.item-actions { flex: 0 0 auto; }
.dialog-card > h2 { margin: 0 0 20px; }
.dialog-card > label:not(.checkbox-row) { display: block; margin: 16px 0 6px; }
.dialog-card > .form-control { min-height: 40px; padding: 8px 12px; }
.dialog-card > .upload-help { display: block; margin: 6px 0 0; }
.dialog-card > .checkbox-row { display: flex; gap: 8px; margin: 12px 0; min-height: 32px; white-space: normal; }
.dialog-card .dialog-actions { justify-content: flex-end; margin-top: 20px; }
.dialog-card .icon-close { flex: 0 0 44px; min-height: 44px; }
.status-message { margin-block: 12px; padding: 12px; }
.alert, .validation-message { overflow-wrap: anywhere; }
.checkbox-row { column-gap: 8px; }
@media (max-width: 1024px) {
    .saas-content .btn, .dialog-card .btn, .saas-content .form-control, .dialog-card .form-control { min-height: 44px; }
    .saas-content .btn, .dialog-card .btn { padding: 10px 12px; }
    .data-table td.row-actions .btn { min-height: 44px; }
}
@media (max-width: 767px) {
    .data-table tr { padding-block: 12px; }
    .data-table td { gap: 8px 12px; padding-block: 8px; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
    .data-table td.row-actions { gap: 8px; padding-top: 12px; }
    .inline-form .form-control { min-width: 0; flex-basis: 100%; }
    .checkbox-row { min-height: 44px; white-space: normal; }
    .dialog-card > .checkbox-row { min-height: 44px; }
    .dialog-card { max-height: calc(100dvh - 24px); padding: 16px; }
    .modal-backdrop-custom { padding: 12px; }
    .dialog-actions .btn { flex: 1 1 auto; }
    .prompt-toolbar { flex-basis: 100%; }
    .item-actions { gap: 8px; }
    .item-actions .btn { flex: 1 1 auto; }
    .page-actions, .filter-actions, .pagination > div { gap: 12px; }
}
