/* Shared workspace refinements. Loaded after the legacy component styles. */
:root, html[data-theme="dark"] {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #93b4ff;
  --accent-gradient: linear-gradient(135deg, #2563eb, #2563eb);
  --accent-gradient-hover: linear-gradient(135deg, #1d4ed8, #1d4ed8);
  --accent-glow: 0 3px 10px rgba(37, 99, 235, .16);
  --border-focus: #6094ff;
  --border-active: #2563eb;
}
html[data-theme="light"] {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #1d4ed8;
  --accent-gradient: linear-gradient(135deg, #2563eb, #2563eb);
  --accent-gradient-hover: linear-gradient(135deg, #1d4ed8, #1d4ed8);
  --text-dim: #64748b;
  --border-focus: #2563eb;
  --border-active: #2563eb;
}
body { font-size: 14px; }
button { min-height: 36px; }
button:hover:not(:disabled) { transform: none; }
button.ghost, button.btn-ghost { background: var(--panel2); }
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 3px;
}
::-webkit-scrollbar-track { background: var(--bg); }
.topbar { min-height: 76px; gap: 24px; padding: 14px 28px; background: var(--panel); }
.brand-logo { width: 38px; height: 38px; box-shadow: none; }
.brand-title { background: none; -webkit-text-fill-color: var(--text); }
.brand-tag { margin-top: 5px; color: var(--muted); letter-spacing: .12em; }
.topbar-nav { background: transparent; border: 0; padding: 0; gap: 5px; }
.nav-item { min-height: 40px; padding: 8px 12px; white-space: nowrap; }
.nav-item.active, html[data-theme="light"] .nav-item.active {
  background: var(--info-bg); color: var(--accent-light); border-color: transparent; box-shadow: none;
}
.topbar-right { gap: 10px; min-width: 0; }
.user-info-text { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#content { max-width: 1600px; margin: 0 auto; padding: 32px; }
/* Workspace của một IR (Tasklist, Timeline, IOC... là bảng rộng): dùng hết bề ngang màn hình. */
#content.content-wide { max-width: none; }
.eyebrow { display: block; font-size: 10px; font-weight: 700; letter-spacing: .16em; color: var(--accent-light); margin-bottom: 10px; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.workspace-heading h1 { font-size: 28px; letter-spacing: -.035em; margin: 0 0 8px; }
.workspace-heading p { margin: 0; color: var(--muted); }
.workspace-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.dash-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { padding: 24px; min-height: 112px; box-shadow: none; }
.stat-card:hover { transform: none; box-shadow: none; }
.stat-card::after { top: auto; bottom: 0; width: 100%; height: 2px; opacity: .65; }
.stat-val { font-size: 30px; letter-spacing: -.04em; }
.stat-label { margin-top: 8px; font-size: 12px; }
.stat-icon-wrap { font-size: 18px; width: 42px; height: 42px; border-radius: 10px; }
.stat-icon-wrap svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dash-filters-bar { margin-bottom: 20px; }
.dash-filter-group { min-width: 0; }
.search-input-wrap { min-width: 220px; max-width: 420px; }
.search-input-wrap input, .dash-filter-select { height: 42px; background: var(--panel); }
#new-ir { min-height: 42px; }
.incident-list { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); overflow: hidden; }
.incident-list-heading { padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.incident-list-heading h2 { margin: 0; font-size: 15px; }
.incident-list-heading span { font-size: 12px; }
.incident-table-scroll, .table-wrap { max-width: 100%; overflow-x: auto; }
.incident-table-scroll table { min-width: 960px; border: 0; border-top: 1px solid var(--border); box-shadow: none; border-radius: 0; }
.incident-table-scroll th { padding: 14px 20px; font-size: 10px; }
.incident-table-scroll td { padding: 18px 20px; font-size: 13px; }
.incident-table-scroll td:nth-child(2) { min-width: 220px; max-width: 380px; overflow-wrap: anywhere; }
.dash-stats-compact { margin-bottom: 18px; }
.dash-stats-compact .stat-card { min-height: 86px; padding: 16px 20px; }
.dash-stats-compact .stat-val { font-size: 25px; }
.dash-stats-compact .stat-label { margin-top: 4px; }
.dash-controls { margin-bottom: 18px; padding: 18px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.dash-controls .dash-filters-bar { margin-bottom: 14px; align-items: flex-start; }
.dash-controls .search-input-wrap { max-width: none; min-width: 260px; }
.dash-create-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-secondary-filters { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.dash-secondary-filters label { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 12px; }
.dash-secondary-filters .dash-filter-select { height: 36px; font-size: 12px; color: var(--text); }
.dash-secondary-filters button { min-height: 36px; }
.dash-date-range { display: flex; flex-wrap: wrap; gap: 12px; }
.dash-date-range[hidden] { display: none; }
.dash-date-range input { margin: 0; height: 36px; width: 145px; padding: 6px 8px; font-size: 12px; }
.dash-controls #dash-error { margin: 12px 0 0; }
.dash-controls [hidden] { display: none; }
.incident-list-paged .incident-list-heading { padding: 15px 18px; }
.incident-list-paged .incident-table-scroll { max-height: clamp(280px, calc(100vh - 640px), 640px); }
.incident-list-paged table { width: 100%; min-width: 1150px; table-layout: fixed; }
.incident-list-paged th { position: sticky; top: 0; z-index: 1; background: var(--bg-subtle); padding: 12px; }
.incident-list-paged td { padding: 12px; font-size: 12px; overflow-wrap: anywhere; }
.incident-list-paged th:nth-child(1) { width: 100px; }
.incident-list-paged th:nth-child(2) { width: auto; }
.incident-list-paged th:nth-child(3) { width: 110px; }
.incident-list-paged th:nth-child(4) { width: 130px; }
.incident-list-paged th:nth-child(5) { width: 115px; }
.incident-list-paged th:nth-child(6) { width: 145px; }
.incident-list-paged th:nth-child(7) { width: 105px; }
.incident-list-paged th:nth-child(8) { width: 150px; }
.dash-incident-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 550; }
.incident-list-paged .dash-open-ir, .incident-list-paged .dash-open-ir:hover:not(:disabled) { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); border-radius: 5px; padding: 4px 6px; font-family: monospace; font-size: 11px; box-shadow: none; transform: none; }
.incident-list-paged .dash-open-ir { min-height: 27px; }
.incident-list-paged .dash-loading-cell { padding: 55px 20px; text-align: center; color: var(--muted); }
.dash-pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.dash-pagination nav, .dash-pagination label, .dash-pagination form { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 12px; }
.dash-pagination select, .dash-pagination input { margin: 0; height: 34px; padding: 5px 8px; font-size: 12px; }
.dash-pagination select { width: 108px; }
.dash-pagination input { width: 65px; }
.dash-pagination button { min-width: 32px; min-height: 34px; }
@media (max-width: 720px) {
  .dash-controls { padding: 14px; }
  .dash-controls .search-input-wrap { min-width: 100%; }
  .dash-secondary-filters { gap: 10px; }
  .dash-secondary-filters > label { width: 100%; display: grid; grid-template-columns: 65px minmax(0, 1fr); }
  .dash-secondary-filters .dash-filter-select { width: 100%; min-width: 0; }
  .dash-date-range { width: 100%; }
  .dash-date-range label { width: 100%; justify-content: space-between; }
  .dash-date-range input { flex: 1; max-width: calc(100% - 73px); }
  .dash-pagination { padding: 12px; }
  .dash-pagination nav { flex-wrap: wrap; gap: 5px; }
  .dash-stats-compact .stat-card { padding: 14px; }
}
th, .card-head { background: var(--bg-subtle); }
tr[data-open]:hover td { background: var(--panel-hover); }
.empty-state-cell { height: 240px; }
.empty-state-cell strong { display: block; color: var(--text-secondary); margin-bottom: 8px; font-size: 14px; }
.empty-state-cell p { font-size: 13px; }
.empty-state-icon { color: var(--accent-light); opacity: 1; }
.tabs { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
.tabs a { white-space: nowrap; }
.login-view, html[data-theme="light"] .login-view { gap: clamp(40px, 8vw, 140px); padding: 80px 40px; background: var(--bg); }
.login-intro { position: relative; z-index: 1; max-width: 460px; }
.login-intro h2 { font-size: clamp(32px, 3.5vw, 48px); line-height: 1.18; letter-spacing: -.045em; margin: 22px 0; }
.login-intro > p { max-width: 400px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.login-capabilities { display: grid; gap: 20px; margin-top: 36px; color: var(--text-secondary); font-size: 13px; }
.login-capabilities b { font-family: 'JetBrains Mono', monospace; font-size: 11px; margin-right: 14px; color: var(--accent-light); }
.login-card, html[data-theme="light"] .login-card { width: 410px; flex-shrink: 0; padding: 36px; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow-md); }
.login-header { text-align: left; margin-bottom: 28px; }
.login-emblem { margin: 0 0 20px; justify-content: flex-start; }
.emblem-glow { display: none; }
.emblem-svg { background: var(--info-bg); stroke: var(--accent-light); border-color: var(--border); }
.login-subtitle { line-height: 1.7; margin-top: 10px; }
.login-grid-pattern { opacity: .5; }
.login-ambient-glow { left: 22%; opacity: .45; }
.input-with-icon:focus-within .field-icon { stroke: var(--accent-light); }
.login-card .input-with-icon input { height: 46px; }
.login-card .form-group { margin-bottom: 20px; }
.login-footer { border-color: var(--border); }
html[data-theme="light"] .st-AWAITING_TRIAGE, html[data-theme="light"] .sev-MEDIUM { color: #92400e; }
html[data-theme="light"] .st-INVESTIGATION_INPROGRESS, html[data-theme="light"] .sev-LOW { color: #1d4ed8; }
html[data-theme="light"] .st-PENDING { color: #be185d; }
html[data-theme="light"] .st-INVESTIGATION_COMPLETED, html[data-theme="light"] .st-DONE { color: #047857; }
html[data-theme="light"] .st-POST_INCIDENT { color: #7e22ce; }
html[data-theme="light"] .st-REJECTED { color: #b91c1c; }
html[data-theme="light"] .sev-CRITICAL, html[data-theme="light"] .sev-HIGH { color: #b91c1c; }
@media (max-width: 1250px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .topbar-nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .topbar-right { margin-left: auto; }
  .topbar > .spacer { display: none; }
  .stat-card { padding: 20px 16px; gap: 12px; }
}
@media (max-width: 900px) {
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-count { display: none; }
  .login-intro { display: none; }
  .login-view { gap: 32px; padding-inline: 24px; }
}
@media (max-width: 700px) {
  #content { padding: 24px 16px; }
  .topbar { padding: 12px 16px; position: relative; }
  .topbar-right { gap: 8px; }
  .topbar-right .theme-btn span, .btn-logout span, .system-status-indicator, .user-info-text { display: none; }
  .user-profile-badge { padding: 0; border: 0; background: none; }
  .workspace-heading h1 { font-size: 24px; }
  .workspace-heading p { font-size: 13px; }
  .dash-stats { gap: 10px; }
  .stat-card { padding: 16px 12px; gap: 10px; }
  .stat-icon-wrap { width: 32px; height: 32px; font-size: 16px; }
  .stat-val { font-size: 25px; }
  .stat-label { font-size: 11px; }
  .dash-filter-group { width: 100%; flex-basis: 100%; }
  .search-input-wrap { max-width: none; flex-basis: 100%; min-width: 0; }
  .dash-filter-select { min-width: 0; flex: 1; width: 0; }
  #new-ir { width: 100%; }
  .incident-list-heading { padding: 18px 16px; }
  .login-intro { display: none; }
  .login-card, html[data-theme="light"] .login-card { max-width: 100%; padding: 28px; }
  .login-view, html[data-theme="light"] .login-view { padding: 80px 20px 32px; min-height: 100dvh; }
  .modal { max-width: calc(100vw - 24px); padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Notification routing and report schedule */
.noti-matrix { margin: 32px 0; }
.noti-matrix table { min-width: 880px; }
.noti-matrix th { width: 24%; }
.noti-matrix th:first-child { width: 28%; }
.noti-rule-cell { vertical-align: top; }
.noti-rule-cell .checkbox { margin: 0; font-size: 12px; }
.noti-rule-summary { display: block; font-size: 11px; line-height: 1.7; color: var(--muted); margin-top: 8px; overflow-wrap: anywhere; max-width: 280px; }
.noti-progress { background: var(--panel2); border: 1px solid var(--border); border-radius: 14px; padding: 24px; margin-top: 28px; }
.noti-progress h2 { margin: 0 0 8px; }
.noti-progress > .msg { display: block; }
.noti-rule-dialog { width: 700px; }
.noti-rule-dialog textarea { resize: vertical; }
.noti-help { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 8px 0 14px; overflow-wrap: anywhere; }
.noti-help code { color: var(--accent-light); }
.noti-editor-actions, .noti-interval-presets { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.noti-editor-footer { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 18px; }
.noti-preview { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-top: 16px; }
.noti-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; line-height: 1.75; max-height: 360px; overflow-y: auto; }
.noti-report-options { flex-wrap: wrap; gap: 24px; }
.noti-schedule-meta { display: flex; gap: 24px; flex-wrap: wrap; padding: 16px 0; font-size: 12px; color: var(--muted); }
.noti-schedule-meta b { color: var(--text-secondary); font-weight: 500; }
@media (max-width: 700px) {
  .noti-ch > .between, .noti-progress > .between { align-items: flex-start; flex-direction: column; }
  .noti-ch > .between > .flex { flex-wrap: wrap; }
  .noti-progress { padding: 18px; }
  .noti-editor-footer { flex-wrap: wrap; }
  .noti-matrix > .between { align-items: flex-start; }
}
