/* ─────────────────────────────────────────────────────────────
   Site stylesheet — Prime Gate HelpDesk.
   Purple brand, IBM Plex, 12 px cards, 8 px controls, depth via
   1 px borders. Consumes tokens from design-tokens.css (sizes such
   as --sidebar-width and --topbar-height live there too).
   ───────────────────────────────────────────────────────────── */

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

body {
    background: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand-400); text-decoration: none; }
a:hover { color: var(--brand-500); text-decoration: underline; }
[data-theme="dark"] a:hover { color: var(--brand-700); }

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-family: var(--font-display);
    letter-spacing: -0.005em;
    font-weight: 700;
}
h5, h6 { font-weight: 600; }

/* IDs and numbers stay left to right inside Arabic text */
.inc-number, .search-hit-num, .ltr-id { direction: ltr; unicode-bidi: isolate; }

/* ════════════════════════════════════════════════════════════
   SIDEBAR — edge-to-edge, no float
   ════════════════════════════════════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--surface-1);
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    transition: transform .2s ease;
}
[dir="rtl"] .sidebar { left: auto; right: 0; border-right: none; border-left: 1px solid var(--border-soft); }

/* Workspace header */
.sidebar-workspace {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
    cursor: pointer;
    transition: background-color .12s ease;
}
.sidebar-workspace:hover { background: var(--surface-inset); }
.sidebar-workspace-mark {
    width: 28px; height: 28px;
    background: var(--brand-500);
    border-radius: var(--radius);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-contrast);
    font-weight: 700;
    font-size: .82rem;
}
.sidebar-workspace-mark { text-transform: uppercase; }
/* Uploaded logo stands in for the lettered mark. Height is fixed to the
   mark's 28px; wide wordmarks may grow sideways up to a cap so they stay legible. */
.sidebar-workspace-logo {
    height: 28px; width: auto; max-width: 110px;
    border-radius: var(--radius);
    flex-shrink: 0;
    object-fit: contain;
}
.sidebar-workspace-text { flex: 1; min-width: 0; }
.sidebar-workspace-name {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.15;
}
.sidebar-workspace-sub {
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: 1px;
}
.sidebar-workspace-chev { font-size: .62rem; color: var(--text-muted); }

/* Sidebar CTA */
.sidebar-cta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 12px 12px;
    min-height: 40px;
    padding: 8px 14px;
    border-radius: var(--radius-control);
    background: var(--brand-500);
    color: var(--brand-contrast);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid var(--brand-500);
    transition: background-color .12s ease, border-color .12s ease;
}
.sidebar-cta:hover { background: var(--brand-600); border-color: var(--brand-600); color: var(--brand-contrast); text-decoration: none; }
.sidebar-cta i { font-size: .78rem; }
.sidebar-cta span { flex: 1; white-space: nowrap; }
.sidebar-cta .sidebar-cta-kbd { flex: 0 0 auto; }
.sidebar-cta-kbd {
    font-size: .66rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* Nav */
.sidebar-nav {
    list-style: none;
    padding: 4px 8px 8px;
    margin: 0;
    flex: 1;
}
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 38px;
    padding: 8px 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    border-radius: var(--radius-control);
    margin: 2px 0;
    transition: background-color .12s ease, color .12s ease;
    position: relative;
}
.sidebar-nav li a:hover { background: var(--surface-inset); color: var(--text-primary); text-decoration: none; }
.sidebar-nav li a.active {
    background: var(--brand-100);
    color: var(--brand-500);
    font-weight: 600;
}
[data-theme="dark"] .sidebar-nav li a.active { color: var(--brand-700); }
.sidebar-nav li a.active i { color: var(--brand-500); }
[data-theme="dark"] .sidebar-nav li a.active i { color: var(--brand-700); }
.sidebar-nav li a i { width: 18px; text-align: center; color: var(--text-secondary); font-size: .95rem; }

/* Submenu */
.nav-parent-toggle { cursor: pointer; user-select: none; }
.nav-parent-toggle .nav-parent-chevron {
    margin-inline-start: auto;
    width: 10px; font-size: .58rem;
    color: var(--text-muted);
    transition: transform .15s ease;
}
.nav-parent-toggle.collapsed .nav-parent-chevron { transform: rotate(-90deg); }
.sidebar-submenu {
    list-style: none; padding: 0; margin: 0;
}
.sidebar-submenu li a {
    padding-inline-start: 42px;
    font-size: 13px;
}
.sidebar-submenu li a.active { background: var(--brand-100); color: var(--brand-500); }
[data-theme="dark"] .sidebar-submenu li a.active { color: var(--brand-700); }
.sidebar-submenu li a i { width: 14px; font-size: .78rem; }

/* Section labels */
.nav-section {
    padding: 16px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .06em;
    text-transform: uppercase;
}
[lang="ar"] .nav-section { letter-spacing: 0; }

/* Footer */
.sidebar-footer {
    padding: 8px 12px 12px;
    border-top: 1px solid var(--border-soft);
}
.sidebar-foot-form { margin: 0; }
.sidebar-foot-signout {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border-line);
    background: var(--surface-1);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: .8rem;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.sidebar-foot-signout:hover {
    background: var(--surface-inset);
    color: var(--text-primary);
    border-color: var(--border-line);
}
.sidebar-foot-signout i { font-size: .78rem; }

/* ════════════════════════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════════════════════════ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin .2s ease;
}
[dir="rtl"] .main-content { margin-left: 0; margin-right: var(--sidebar-width); }

.topbar {
    height: var(--topbar-height);
    background: var(--surface-1);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-burger {
    width: 32px; height: 32px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.topbar-burger:hover { background: var(--surface-inset); }
@media (max-width: 768px) { .topbar-burger { display: inline-flex; } }

.topbar-search {
    flex: 0 1 420px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius);
    background: var(--surface-inset);
    border: 1px solid transparent;
    color: var(--text-secondary);
    transition: background-color .12s ease, border-color .12s ease;
    position: relative;
}
.topbar-search:hover { background: var(--surface-1); border-color: var(--border-soft); }
.topbar-search:focus-within {
    background: var(--surface-1);
    border-color: var(--brand-500);
    box-shadow: 0 0 0 1px var(--brand-500);
}
.topbar-search i { color: var(--text-muted); font-size: .82rem; }
.topbar-search input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: .82rem;
    padding: 1px 0;
    min-width: 0;
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search-kbd {
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    flex-shrink: 0;
}

/* Search palette dropdown */
.topbar-search-panel {
    position: absolute;
    top: calc(100% + 4px);
    inset-inline-start: 0;
    inset-inline-end: 0;
    background: var(--surface-1);
    border: 1px solid var(--border-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 480px;
    overflow-y: auto;
    z-index: 200;
    display: none;
    padding: 4px;
}
.topbar-search-panel.open { display: block; }
.search-group-label {
    padding: 6px 10px 4px;
    font-size: .66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.search-group-label i { color: var(--brand-500); font-size: .76rem; }
.search-hit {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    font-size: .82rem;
}
.search-hit:hover, .search-hit.is-active {
    background: var(--brand-gradient-soft);
    color: var(--text-primary);
    text-decoration: none;
}
.search-hit-num {
    flex-shrink: 0;
    font-family: "Cascadia Code", "Consolas", ui-monospace, monospace;
    font-size: .74rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 80px;
}
.search-hit-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hit-status {
    flex-shrink: 0;
    font-size: .7rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 2px;
    background: var(--surface-inset);
}
.search-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: .82rem; }
.search-footer {
    display: flex;
    gap: 12px;
    padding: 6px 10px 4px;
    margin-top: 4px;
    border-top: 1px solid var(--border-soft);
    color: var(--text-muted);
    font-size: .68rem;
}
.search-footer kbd {
    background: var(--surface-inset);
    border: 1px solid var(--border-soft);
    border-radius: 2px;
    padding: 1px 5px;
    font-size: .66rem;
    margin-inline-end: 4px;
    color: var(--text-secondary);
    font-family: "Cascadia Code", "Consolas", monospace;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-inline-start: auto;
}

.topbar-icon-btn {
    width: 32px; height: 32px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    position: relative;
}
.topbar-icon-btn:hover { background: var(--surface-inset); color: var(--text-primary); }
.topbar-icon-dot {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 14px; height: 14px; padding: 0 4px;
    background: var(--accent-rose);   /* stays dark red in both themes so white text reads */
    color: #fff;
    border-radius: var(--radius-pill);
    font-size: .56rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--surface-1);
}

.topbar-lang { display: flex; align-items: center; }
.topbar-lang-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    border-radius: var(--radius);
    padding: 5px 22px 5px 8px;
    font-size: .76rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .12s ease;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path fill='%23616161' d='M2 4l3 3 3-3z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 6px center;
}
.topbar-lang-select:hover { background-color: var(--surface-inset); }
.topbar-lang-select:focus { outline: none; box-shadow: 0 0 0 1px var(--brand-500); }

.topbar-user {
    display: inline-flex;
    align-items: center;
    margin-inline-start: 4px;
    padding: 0;
    text-decoration: none;
}
.topbar-user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--brand-500);
    color: var(--brand-contrast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .78rem;
}
.topbar-user:hover .topbar-user-avatar { background: var(--brand-600); }

.page-content { padding: 20px 24px 32px; }
.page-crumbs {
    padding: 12px 24px 0;
    font-size: .78rem;
    color: var(--text-muted);
}
.page-crumbs .breadcrumb { background: transparent; padding: 0; margin: 0; font-size: .76rem; }

/* ════════════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════════════ */
.card {
    --bs-card-bg: var(--surface-1);
    --bs-card-border-color: var(--border-line);
    --bs-card-border-radius: var(--radius-card);
    --bs-card-inner-border-radius: calc(var(--radius-card) - 1px);
    background: var(--surface-1);
    border: 1px solid var(--border-line);
    border-radius: var(--radius-card);
    box-shadow: none;
}
.card:hover { box-shadow: none; }
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-soft);
    border-radius: calc(var(--radius-card) - 1px) calc(var(--radius-card) - 1px) 0 0 !important;
    padding: 16px 20px;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 16px;
}
.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-soft);
    padding: 12px 20px;
}
.card-body { color: var(--text-primary); padding: 20px; }
/* Tables flush with the card edges keep the card's rounded corners */
.card > .table-responsive:last-child, .card > .table:last-child { border-radius: 0 0 var(--radius-card) var(--radius-card); }

/* ════════════════════════════════════════════════════════════
   KPI / STAT TILES — flat, neutral, single color block
   ════════════════════════════════════════════════════════════ */
.stat-card {
    background: var(--surface-1);
    border: 1px solid var(--border-line);
    border-radius: var(--radius-card);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color .12s ease;
}
.stat-card:hover { border-color: var(--border-line); }

.stat-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    flex-shrink: 0;
    color: var(--brand-500);
    background: var(--brand-gradient-soft);
}
.stat-value {
    font-size: 24px; font-weight: 700; line-height: 1.1;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.stat-label { color: var(--text-muted); font-size: 12px; font-weight: 600; margin-top: 2px; }

/* Bootstrap bg-* hooks: keep semantic color but flat tint */
.stat-icon.bg-primary   { background: var(--soft-sky)      !important; color: var(--soft-sky-ink)      !important; }
.stat-icon.bg-info      { background: var(--soft-sky)      !important; color: var(--soft-sky-ink)      !important; }
.stat-icon.bg-success   { background: var(--soft-mint)     !important; color: var(--soft-mint-ink)     !important; }
.stat-icon.bg-warning   { background: var(--soft-peach)    !important; color: var(--soft-peach-ink)    !important; }
.stat-icon.bg-danger    { background: var(--soft-rose)     !important; color: var(--soft-rose-ink)     !important; }
.stat-icon.bg-secondary { background: var(--soft-lavender) !important; color: var(--soft-lavender-ink) !important; }
.stat-icon.bg-dark      { background: var(--surface-inset) !important; color: var(--text-primary)      !important; }

/* ════════════════════════════════════════════════════════════
   PRIORITY + STATUS BADGES
   ════════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    line-height: 1.35;
    letter-spacing: 0;
    border: 1px solid transparent;
    vertical-align: middle;
}
.badge i { font-size: .85em; }
.badge.fs-6 { font-size: 13px !important; padding: 4px 12px; }

/* Priority: the purple scale for the five live levels (board Main).
   Priority chips keep a 6 px radius so they read differently from status pills. */
.badge-critical, .badge-high, .badge-medium, .badge-low, .badge-info { border-radius: 6px; }
.badge-critical { background: var(--priority-critical-bg); color: var(--priority-critical-fg); }
.badge-high     { background: var(--priority-high-bg);     color: var(--priority-high-fg); }
.badge-medium   { background: var(--priority-medium-bg);   color: var(--priority-medium-fg); }
.badge-low      { background: var(--priority-low-bg);      color: var(--priority-low-fg); }
.badge-info     { background: var(--priority-informational-bg); color: var(--priority-informational-fg); border: var(--priority-informational-border); }

/* Status pills: blue-grey for work in progress, neutral for not started / done,
   green, amber and red only for outcome and time. */
.badge-new         { background: var(--surface-inset); color: var(--text-secondary); }
.badge-assigned    { background: var(--soft-sky);      color: var(--soft-sky-ink); }
.badge-inprogress  { background: var(--soft-sky);      color: var(--soft-sky-ink); }
.badge-pending     { background: var(--soft-sand);     color: var(--soft-sand-ink); }
.badge-resolved    { background: var(--soft-mint);     color: var(--soft-mint-ink); }
.badge-closed      { background: var(--surface-inset); color: var(--text-secondary); }
.badge-cancelled   { background: var(--soft-rose);     color: var(--soft-rose-ink); }

/* Bootstrap colour badges used across the views → the same soft pairs.
   Scoped to .badge so progress bars and other bg-* uses stay solid. */
.badge.bg-success   { background: var(--soft-mint)     !important; color: var(--soft-mint-ink)     !important; }
.badge.bg-warning   { background: var(--soft-sand)     !important; color: var(--soft-sand-ink)     !important; }
.badge.bg-danger    { background: var(--soft-rose)     !important; color: var(--soft-rose-ink)     !important; }
.badge.bg-info      { background: var(--soft-sky)      !important; color: var(--soft-sky-ink)      !important; }
.badge.bg-primary   { background: var(--brand-100)     !important; color: var(--brand-500)         !important; }
.badge.bg-secondary,
.badge.bg-light     { background: var(--surface-inset) !important; color: var(--text-secondary)    !important; }
.badge.bg-dark      { background: var(--brand-500)     !important; color: var(--brand-contrast)    !important; }
[data-theme="dark"] .badge.bg-primary { color: var(--brand-700) !important; }
.badge.bg-opacity-75, .badge.bg-opacity-50, .badge.bg-opacity-25, .badge.bg-opacity-10 { --bs-bg-opacity: 1; }

/* ════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════ */
/* Buttons: primary, secondary and ghost; 38 px high, small 32 px. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    border-radius: var(--radius-control);
    font-weight: 600;
    padding: 7px 16px;
    font-size: 14px;
    border: 1px solid transparent;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
    line-height: 1.3;
}
.btn:focus { box-shadow: none; }
.btn:focus-visible, .btn-check:focus-visible + .btn {
    outline: none;
    box-shadow: var(--focus-ring);
}
.btn-sm, .btn-group-sm > .btn { min-height: 32px; padding: 5px 12px; font-size: 13px; border-radius: var(--radius-control); }
.btn-lg { min-height: 44px; padding: 9px 20px; font-size: 15px; }
.btn-close { min-height: 0; }

.btn-primary {
    background: var(--brand-500);
    border-color: var(--brand-500);
    color: var(--brand-contrast);
}
.btn-primary:hover, .btn-primary:focus { background: var(--brand-600); border-color: var(--brand-600); color: var(--brand-contrast); }
.btn-primary:active, .btn-primary.active { background: var(--brand-700); border-color: var(--brand-700); color: var(--brand-contrast); }
[data-theme="dark"] .btn-primary:active { background: var(--brand-600); border-color: var(--brand-600); }

/* Secondary: white with a strong hairline, ink text */
.btn-secondary, .btn-light, .btn-outline-secondary, .btn-outline-dark {
    background: var(--surface-1);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
}
.btn-secondary:hover, .btn-light:hover, .btn-outline-secondary:hover, .btn-outline-dark:hover,
.btn-secondary:active, .btn-light:active, .btn-outline-secondary:active {
    background: var(--surface-inset);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

/* Ghost: text-only action in the secondary purple (Cancel, Dismiss) */
.btn-ghost, .btn-link {
    background: transparent;
    border-color: transparent;
    color: var(--brand-400);
    text-decoration: none;
}
.btn-ghost:hover, .btn-link:hover { background: var(--brand-100); color: var(--brand-500); text-decoration: none; }
[data-theme="dark"] .btn-ghost:hover, [data-theme="dark"] .btn-link:hover { color: var(--brand-700); }

.btn-success {
    background: var(--accent-emerald); border-color: var(--accent-emerald); color: #fff;
}
.btn-success:hover { background: #124D30; border-color: #124D30; color: #fff; }

.btn-warning {
    background: var(--accent-amber); border-color: var(--accent-amber); color: #fff;
}
.btn-warning:hover { background: #6E3C00; border-color: #6E3C00; color: #fff; }

.btn-danger {
    background: var(--accent-rose); border-color: var(--accent-rose); color: #fff;
}
.btn-danger:hover { background: #821F16; border-color: #821F16; color: #fff; }

.btn-info {
    background: var(--accent-cyan); border-color: var(--accent-cyan); color: #fff;
}
.btn-info:hover { background: #32326A; border-color: #32326A; color: #fff; }

.btn-outline-primary {
    background: var(--surface-1); border: 1px solid var(--border-strong); color: var(--brand-500);
}
.btn-outline-primary:hover, .btn-outline-primary:active { background: var(--brand-100); border-color: var(--brand-400); color: var(--brand-500); }
[data-theme="dark"] .btn-outline-primary, [data-theme="dark"] .btn-outline-primary:hover { color: var(--brand-700); }

.btn-outline-danger { background: transparent; border: 1px solid var(--accent-rose); color: var(--accent-rose); }
.btn-outline-danger:hover { background: var(--accent-rose); color: #fff; }
.btn-outline-warning { background: transparent; border: 1px solid var(--accent-amber); color: var(--accent-amber); }
.btn-outline-warning:hover { background: var(--accent-amber); color: #fff; }
.btn-outline-success { background: transparent; border: 1px solid var(--accent-emerald); color: var(--accent-emerald); }
.btn-outline-success:hover { background: var(--accent-emerald); color: #fff; }

/* ════════════════════════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════════════════════════ */
.alert {
    border-radius: var(--radius-card);
    border: 1px solid transparent;
    padding: 12px 16px;
    font-size: 14px;
    box-shadow: none;
}
.alert-success { background: var(--soft-mint);  color: var(--soft-mint-ink);  border-color: color-mix(in srgb, var(--soft-mint-ink) 22%, transparent); }
.alert-warning { background: var(--soft-sand);  color: var(--soft-sand-ink);  border-color: color-mix(in srgb, var(--soft-sand-ink) 26%, transparent); }
.alert-danger  { background: var(--soft-rose);  color: var(--soft-rose-ink);  border-color: color-mix(in srgb, var(--soft-rose-ink) 22%, transparent); }
.alert-info    { background: var(--soft-sky);   color: var(--soft-sky-ink);   border-color: color-mix(in srgb, var(--soft-sky-ink) 22%, transparent); }
.alert-secondary { background: var(--surface-inset); color: var(--text-secondary); border-color: var(--border-soft); }

/* ════════════════════════════════════════════════════════════
   TABLES — dense, neutral, hairline borders
   ════════════════════════════════════════════════════════════ */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-soft);
    --bs-table-striped-bg: var(--surface-2);
    --bs-table-hover-bg: var(--surface-2);
    font-size: 13px;
    color: var(--text-primary);
}
.table thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: 1px solid var(--border-line);
    padding: 10px 14px;
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 14px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-primary);
}
/* Numbers right-aligned (end-aligned in Arabic) with tabular figures */
.table th.num, .table td.num, .table .text-end { text-align: end; font-variant-numeric: tabular-nums; }
/* Sticky header for any table inside a scroll container */
.table-responsive > .table thead th, .table-sticky thead th { position: sticky; top: 0; z-index: 1; }
.table-hover tbody tr { transition: background .10s ease; }
.table-hover tbody tr:hover > * { background: var(--surface-inset) !important; }

.sla-breached { color: var(--accent-rose); font-weight: 600; }
.sla-warning  { color: var(--accent-amber); }
.sla-row-response   { background: var(--soft-peach) !important; border-inline-start: 3px solid var(--accent-amber); }
.sla-row-resolution { background: var(--soft-rose)  !important; border-inline-start: 3px solid var(--accent-rose); }
.sla-row-response td:first-child, .sla-row-resolution td:first-child { padding-inline-start: 10px; }
.sla-badge { box-shadow: none; }

/* ════════════════════════════════════════════════════════════
   INCIDENTS LIST — KPI tiles + chips
   ════════════════════════════════════════════════════════════ */
.inc-kpi .inc-stat-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    color: inherit;
    transition: border-color .12s ease;
    text-decoration: none;
}
.inc-kpi .inc-stat-card:hover { border-color: var(--brand-500); text-decoration: none; }
.inc-kpi .inc-stat-card.active {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 1px var(--brand-500);
}
.inc-stat-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
    background: var(--brand-gradient-soft);
    color: var(--brand-500);
}
.inc-stat-icon.bg-primary   { background: var(--soft-sky)      !important; color: var(--soft-sky-ink)      !important; }
.inc-stat-icon.bg-info      { background: var(--soft-sky)      !important; color: var(--soft-sky-ink)      !important; }
.inc-stat-icon.bg-success   { background: var(--soft-mint)     !important; color: var(--soft-mint-ink)     !important; }
.inc-stat-icon.bg-warning   { background: var(--soft-peach)    !important; color: var(--soft-peach-ink)    !important; }
.inc-stat-icon.bg-danger    { background: var(--soft-rose)     !important; color: var(--soft-rose-ink)     !important; }
.inc-stat-icon.bg-secondary { background: var(--soft-lavender) !important; color: var(--soft-lavender-ink) !important; }
.inc-stat-value { font-size: 1.4rem; font-weight: 600; line-height: 1; color: var(--text-primary); }
.inc-stat-label { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; margin-top: 4px; font-weight: 600; }

/* Quick-filter chips */
.inc-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.inc-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius);
    background: var(--surface-1);
    border: 1px solid var(--border-line);
    color: var(--text-secondary);
    font-size: .76rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.inc-chip:hover { background: var(--surface-inset); color: var(--text-primary); text-decoration: none; }
.inc-chip.active {
    background: var(--brand-500);
    color: var(--brand-contrast);
    border-color: var(--brand-500);
}
.inc-chip.active.critical { background: var(--accent-rose); border-color: var(--accent-rose); }
.inc-chip.active.high     { background: var(--accent-amber); border-color: var(--accent-amber); color:#fff; }
.inc-chip.muted { color: var(--text-muted); }
.inc-chip-sep { width: 1px; height: 18px; background: var(--border-soft); margin: 0 4px; }

/* Incidents list table */
.inc-table-card { overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border-soft); background: var(--surface-1); }
.inc-table-scroll { max-height: 70vh; overflow-y: auto; overflow-x: auto; }
.inc-table thead th {
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-line);
    position: sticky; top: 0; z-index: 2;
}
.inc-tabs .nav-link { color: var(--text-secondary); font-weight: 500; border-radius: 0; }
.inc-tabs .nav-link.active { color: var(--brand-500); background: transparent; border-bottom-color: var(--brand-500); }
.inc-row { transition: background-color .10s ease; }
.inc-row:hover { background: var(--surface-inset); }
.inc-row > td { padding-top: 10px; padding-bottom: 10px; vertical-align: middle; }
.inc-number { font-size: .82rem; font-family: "Cascadia Code", "Consolas", ui-monospace, monospace; }
.inc-title { font-size: .84rem; color: var(--text-primary); max-width: 420px; margin: 2px 0; line-height: 1.35; }
.inc-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: .68rem; flex-shrink: 0;
    border: none;
    box-shadow: none;
}
.inc-unassigned { font-size: .74rem; color: var(--text-muted); font-style: italic; }
.inc-row-action {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
}
.inc-row:hover .inc-row-action { background: var(--surface-1); color: var(--brand-500); }

/* ════════════════════════════════════════════════════════════
   INCIDENT DETAIL
   ════════════════════════════════════════════════════════════ */
.inc-detail-header {
    display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap;
    padding: 12px 16px;
    margin-bottom: 14px;
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    position: sticky; top: calc(var(--topbar-height) + 16px); z-index: 10;
}
@media (max-width: 768px) { .inc-detail-header { top: var(--topbar-height); } }
.inc-detail-title {
    font-size: 1.1rem; font-weight: 600; margin: 4px 0 2px;
    color: var(--text-primary); line-height: 1.3;
}
.inc-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 600; line-height: 1.35;
}
.inc-hero .inc-description { font-size: .9rem; color: var(--text-primary); line-height: 1.55; }
.inc-comments { display: flex; flex-direction: column; gap: 10px; }
.inc-comment {
    display: flex; gap: 12px;
    padding: 12px 14px;
    background: var(--surface-1);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-line);
}
/* Internal note bubble (board Main / UI-S06) */
.inc-comment.is-internal {
    background: var(--note-internal-bg);
    border-color: var(--note-internal-border);
}
.inc-comment-body { flex: 1; min-width: 0; }
.inc-avatar-sm { width: 28px; height: 28px; font-size: .66rem; }
.inc-person { display: flex; align-items: center; gap: 10px; }

/* ════════════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════════════ */
/* Labels 12 px semibold; inputs 38 px with an 8 px radius */
.form-label {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.form-control, .form-select, .form-control:not([type=file]) {
    border: 1px solid var(--border-line);
    border-radius: var(--radius-control);
    font-size: 14px;
    min-height: 38px;
    padding: 7px 12px;
    background-color: var(--surface-1);
    color: var(--text-primary);
    box-shadow: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.form-select { padding-inline-end: 36px; }
.form-control-sm, .form-select-sm { min-height: 32px; font-size: 13px; padding-top: 4px; padding-bottom: 4px; }
textarea.form-control { min-height: 76px; }
.form-control:focus, .form-select:focus {
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-400) 22%, transparent);
    color: var(--text-primary);
    background-color: var(--surface-1);
}
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--surface-2); color: var(--text-muted); }
.form-control::placeholder { color: var(--text-muted); }
.form-text { color: var(--text-muted); font-size: 12px; }
.form-check-input { border-color: var(--border-strong); background-color: var(--surface-1); border-radius: 4px; }
.form-check-input[type=radio] { border-radius: 50%; }
.form-check-input:checked { background-color: var(--brand-500); border-color: var(--brand-500); }
.form-check-input:focus { box-shadow: var(--focus-ring); border-color: var(--brand-400); }
.form-switch .form-check-input { background-color: var(--surface-inset); border-color: var(--border-strong); border-radius: var(--radius-pill); }
.form-switch .form-check-input:checked { background-color: var(--brand-500); }
.input-group-text {
    background: var(--surface-2);
    border-color: var(--border-line);
    color: var(--text-secondary);
    border-radius: var(--radius-control);
}
.text-danger.small, .field-validation-error { color: var(--status-danger) !important; }

/* ════════════════════════════════════════════════════════════
   PAGE HEADER
   ════════════════════════════════════════════════════════════ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
/* Page title 24 bold */
.page-header h1, .page-header h2, .page-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
    color: var(--text-primary);
}
.page-header .breadcrumb {
    font-size: .76rem;
    margin: 0;
    background: transparent;
    padding: 0;
}
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-secondary); }

/* ════════════════════════════════════════════════════════════
   TIMELINE
   ════════════════════════════════════════════════════════════ */
.timeline { position: relative; padding-inline-start: 24px; }
.timeline::before {
    content: '';
    position: absolute;
    inset-inline-start: 8px;
    top: 0; bottom: 0;
    width: 1px;
    background: var(--border-line);
}
.timeline-item { position: relative; margin-bottom: 12px; }
.timeline-dot {
    position: absolute;
    inset-inline-start: -20px;
    top: 4px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--brand-500);
    border: 2px solid var(--surface-1);
    box-shadow: 0 0 0 1px var(--brand-500);
}
.timeline-content {
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: .8rem;
    color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════════
   CATALOG CARDS
   ════════════════════════════════════════════════════════════ */
.catalog-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: border-color .12s ease, box-shadow .12s ease;
    background: var(--surface-1);
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}
.catalog-card:hover {
    border-color: var(--brand-500);
    text-decoration: none;
    color: inherit;
}
.catalog-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius);
    background: var(--brand-gradient-soft);
    color: var(--brand-500);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    margin-bottom: 10px;
}

/* ════════════════════════════════════════════════════════════
   PAGINATION
   ════════════════════════════════════════════════════════════ */
.pagination .page-link {
    border-radius: var(--radius);
    margin: 0 2px;
    font-size: .82rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-line);
    background: var(--surface-1);
    padding: 4px 10px;
}
.pagination .page-link:hover { background: var(--surface-inset); color: var(--text-primary); }
.pagination .page-item.active .page-link {
    background: var(--brand-500);
    border-color: var(--brand-500);
    color: var(--brand-contrast);
}
.pagination .page-item.disabled .page-link { color: var(--text-muted); background: var(--surface-1); }

/* ════════════════════════════════════════════════════════════
   NAV-TABS / NAV-PILLS
   ════════════════════════════════════════════════════════════ */
/* Tabs: underline, ink text, purple bar on the current tab */
.nav-tabs { border-bottom: 1px solid var(--border-line); gap: 4px; }
.nav-tabs .nav-link {
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    margin-bottom: -1px;
    font-weight: 500;
    font-size: 14px;
    padding: 10px 14px;
}
.nav-tabs .nav-link:hover { color: var(--text-primary); background: transparent; border-bottom-color: var(--border-strong); }
.nav-tabs .nav-link.active {
    color: var(--text-primary);
    font-weight: 600;
    background: transparent;
    border-bottom-color: var(--brand-500);
}
[data-theme="dark"] .nav-tabs .nav-link.active { border-bottom-color: var(--brand-400); }
.nav-pills .nav-link { color: var(--text-secondary); border-radius: var(--radius-pill); font-weight: 500; }
.nav-pills .nav-link.active { background: var(--brand-500); color: var(--brand-contrast); }

/* ════════════════════════════════════════════════════════════
   MODAL / DROPDOWN
   ════════════════════════════════════════════════════════════ */
.modal-content {
    background: var(--surface-1);
    border: 1px solid var(--border-line);
    border-radius: var(--radius-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
}
.modal-header { border-bottom: 1px solid var(--border-soft); padding: 14px 16px; }
.modal-footer { border-top: 1px solid var(--border-soft); padding: 12px 16px; }
.modal-title { font-weight: 600; font-size: .95rem; }

.dropdown-menu {
    background: var(--surface-1);
    border: 1px solid var(--border-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 4px;
}
.dropdown-item {
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: .82rem;
}
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-inset); color: var(--text-primary); }
.dropdown-divider { border-color: var(--border-soft); }

/* Progress: Primary-tint track, Secondary fill */
.progress { background: var(--brand-100); border-radius: var(--radius-pill); height: 6px; }
.progress-bar { background: var(--brand-400); border-radius: var(--radius-pill); }

/* List group */
.list-group-item {
    background: var(--surface-1);
    border-color: var(--border-soft);
    color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════════════════════════ */
.login-wrapper {
    min-height: 100vh;
    background: var(--surface-inset);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
[data-theme="dark"] .login-wrapper { background: var(--bg-app); }
.login-card {
    background: var(--surface-1);
    border: 1px solid var(--border-line);
    border-radius: var(--radius-card);
    padding: 32px 28px;
    width: 100%; max-width: 400px;
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════════
   BG UTILITIES (dark-mode aware)
   ════════════════════════════════════════════════════════════ */
.bg-white   { background: var(--surface-1) !important; }
.bg-light   { background: var(--surface-inset) !important; }
.bg-body    { background: var(--bg-app) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-dark  { color: var(--text-primary) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--border-soft) !important; }

/* ════════════════════════════════════════════════════════════
   ADMIN DASHBOARD
   ════════════════════════════════════════════════════════════ */
.admin-dash { display: flex; flex-direction: column; gap: 14px; }

.admin-dash-header h1 { font-size: 1.4rem; font-weight: 600; margin: 0; }

.admin-dash-section-label {
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 4px 0 2px;
    margin-top: 4px;
}

.admin-kpi-row {
    display: grid;
    grid-template-columns: 1.6fr repeat(6, 1fr);
    gap: 10px;
}
@media (max-width: 1400px) { .admin-kpi-row { grid-template-columns: 1fr 1fr 1fr 1fr; } .admin-kpi--hero { grid-column: span 4; } }
@media (max-width: 760px)  { .admin-kpi-row { grid-template-columns: 1fr 1fr; } .admin-kpi--hero { grid-column: span 2; } }

.admin-kpi {
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color .12s ease;
}
.admin-kpi:hover { border-color: var(--border-line); }
.admin-kpi--hero { flex-direction: column; align-items: stretch; background: var(--surface-1); }
.admin-kpi--hero .admin-kpi-meta { display: flex; align-items: baseline; justify-content: space-between; }

.admin-kpi-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--brand-500);
    background: var(--brand-gradient-soft);
    font-size: .9rem;
    flex-shrink: 0;
}
.admin-kpi-icon--lavender { background: var(--soft-lavender) !important; color: var(--soft-lavender-ink) !important; }
.admin-kpi-icon--peach    { background: var(--soft-peach)    !important; color: var(--soft-peach-ink)    !important; }
.admin-kpi-icon--rose     { background: var(--soft-rose)     !important; color: var(--soft-rose-ink)     !important; }
.admin-kpi-icon--amber    { background: var(--soft-sand)     !important; color: var(--soft-sand-ink)     !important; }
.admin-kpi-icon--emerald  { background: var(--soft-mint)     !important; color: var(--soft-mint-ink)     !important; }
.admin-kpi-icon--cyan     { background: var(--soft-sky)      !important; color: var(--soft-sky-ink)      !important; }

.admin-kpi-meta { flex: 1; min-width: 0; }
.admin-kpi-label {
    font-size: .7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.admin-kpi-value { font-size: 1.5rem; font-weight: 600; line-height: 1.1; color: var(--text-primary); }
.admin-kpi-unit { font-size: .8rem; font-weight: 500; color: var(--text-muted); margin-inline-start: 4px; }
.admin-kpi-bar {
    height: 4px;
    background: var(--surface-inset);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}
.admin-kpi-bar-fill { height: 100%; background: var(--brand-500); border-radius: 2px; }

.admin-grid { display: grid; gap: 10px; }
.admin-grid--charts { grid-template-columns: 2fr 1fr; }
.admin-grid--2      { grid-template-columns: 1fr 1fr; }
.admin-grid--quick  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .admin-grid--charts, .admin-grid--2 { grid-template-columns: 1fr; } .admin-grid--quick { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .admin-grid--quick { grid-template-columns: 1fr; } }

.admin-card { padding: 14px 16px; }
.admin-card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.admin-card-title { font-size: .92rem; font-weight: 600; color: var(--text-primary); }
.admin-card-sub   { font-size: .72rem; color: var(--text-muted); margin-top: 2px; font-weight: 500; }
.admin-chart-wrap { position: relative; height: 220px; }
.admin-card--donut .admin-chart-wrap { height: 220px; }

.admin-table-wrap { margin: 0 -16px -14px; }
.admin-table thead th {
    background: var(--surface-2);
    padding: 10px 16px;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-line);
}
.admin-table tbody td { padding: 10px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }

.admin-activity { display: flex; flex-direction: column; gap: 8px; }
.admin-activity-row { display: flex; align-items: center; gap: 10px; }
.admin-activity-body { flex: 1; min-width: 0; }
.admin-activity-line { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .82rem; }
.admin-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: .85rem; }

/* Mini tiles */
.admin-mini-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
@media (max-width: 1100px) { .admin-mini-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .admin-mini-row { grid-template-columns: repeat(2, 1fr); } }
.admin-mini {
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.admin-mini-label {
    font-size: .66rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.admin-mini-value { font-size: 1.25rem; font-weight: 600; color: var(--text-primary); line-height: 1.1; margin-top: 4px; }
.admin-mini-sub { font-size: .7rem; color: var(--text-muted); margin-top: 4px; }

.admin-people-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
@media (max-width: 900px) { .admin-people-row { grid-template-columns: repeat(2, 1fr); } }

.admin-role-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.admin-role-chip {
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 4px 10px;
    font-size: .76rem;
    color: var(--text-secondary);
}
.admin-role-chip strong { color: var(--text-primary); font-weight: 600; margin-inline-end: 4px; }

/* Quick links */
.admin-quick {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: border-color .12s ease;
}
.admin-quick:hover { border-color: var(--brand-500); text-decoration: none; color: inherit; }
.admin-quick-icon {
    width: 36px; height: 36px; border-radius: var(--radius);
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: .9rem;
    flex-shrink: 0;
}
.admin-quick-text { min-width: 0; }
.admin-quick-title { font-weight: 600; font-size: .88rem; color: var(--text-primary); }
.admin-quick-desc  { font-size: .74rem; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    [dir="rtl"] .main-content { margin-right: 0; }

    /* 44 px touch targets on phones */
    .btn, .btn-sm, .form-control, .form-select, .sidebar-nav li a,
    .topbar-icon-btn, .topbar-burger, .page-link, .nav-tabs .nav-link { min-height: var(--touch); }
    .topbar-icon-btn, .topbar-burger { min-width: var(--touch); }
    .page-content { padding: 16px 16px 32px; }
}

/* ── Multi-select (Tom Select) — follow the app theme ───────────────── */
.ts-wrapper .ts-control,
.ts-wrapper.single .ts-control,
.ts-dropdown { background: var(--surface-1); color: var(--text-primary); border-color: var(--border-line); }
.ts-wrapper .ts-control input { color: var(--text-primary); }
.ts-wrapper .ts-control input::placeholder { color: var(--text-muted); }
.ts-wrapper.form-select-sm .ts-control,
.ts-wrapper.form-control-sm .ts-control { min-height: calc(1.5em + .5rem + 2px); padding: .15rem .4rem; font-size: .8rem; }
.ts-wrapper.multi .ts-control > .item { background: var(--surface-inset); color: var(--text-primary); border-radius: 999px; border: 1px solid var(--border-soft); padding: 0 .45rem; font-size: .75rem; }
.ts-wrapper.multi .ts-control > .item .remove { border-left-color: var(--border-soft); }
.ts-dropdown .option { color: var(--text-primary); }
.ts-dropdown .active, .ts-dropdown .option:hover { background: var(--surface-inset); color: var(--text-primary); }
.ts-dropdown .option .ts-dot, .ts-control .item .ts-dot { margin-inline-end: .35rem; }
.ts-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; vertical-align: middle; }

/* ── Incident tags ─────────────────────────────────────────────────── */
.tag-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .1rem .5rem; border-radius: 999px;
    font-size: .7rem; font-weight: 600; line-height: 1.4;
    color: var(--tag-color); background: color-mix(in srgb, var(--tag-color) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--tag-color) 35%, transparent);
    white-space: nowrap; text-decoration: none;
}
.tag-chip::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: var(--tag-color); }
a.tag-chip:hover { text-decoration: none; filter: brightness(.9); }
.tag-list { display: flex; flex-wrap: wrap; gap: .25rem; }

/* ── Incident filter panel ─────────────────────────────────────────── */
.inc-filter-toggle .badge { font-size: .65rem; }
.inc-active-filters { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.inc-active-filters .inc-filter-pill {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .15rem .55rem; border-radius: 999px; font-size: .72rem;
    background: var(--surface-inset); color: var(--text-secondary); border: 1px solid var(--border-soft);
    text-decoration: none;
}
.inc-active-filters .inc-filter-pill:hover { color: var(--text-primary); text-decoration: none; }
.inc-active-filters .inc-filter-pill i { font-size: .65rem; opacity: .7; }

/* ── Report library cards ──────────────────────────────────────────── */
.report-card { display: flex; gap: .9rem; align-items: flex-start; padding: 1rem; height: 100%;
    background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: 10px;
    color: var(--text-primary); text-decoration: none; transition: border-color .15s, transform .15s; }
.report-card:hover { border-color: var(--brand-300, #3b82f6); text-decoration: none; color: var(--text-primary); transform: translateY(-1px); }
.report-card .report-card-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.report-card h6 { margin: 0 0 .2rem; font-weight: 600; }
.report-card p { margin: 0; font-size: .78rem; color: var(--text-muted); }
.report-table td, .report-table th { white-space: nowrap; vertical-align: middle; }
.report-table tfoot td { font-weight: 700; border-top: 2px solid var(--border-line); }
.compliance-bar { height: 6px; min-width: 80px; }

/* ── Admin → Branding: presets + live preview ─────────────────────── */
.brand-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.brand-preset { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px;
    background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
    cursor: pointer; transition: border-color .12s ease; }
.brand-preset:hover { border-color: var(--border-strong); }
.brand-preset-swatch { display: flex; width: 44px; height: 26px; border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border-soft); }
.brand-preset-swatch span { flex: 1; }
.brand-preset-name { font-size: .68rem; color: var(--text-muted); }

.brand-preview-card { position: sticky; top: 72px; }
.brand-preview { display: flex; height: 280px; border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
    overflow: hidden; font-size: .74rem; background: var(--bg-app); }
.bp-sidebar { width: 46%; padding: 10px 8px; display: flex; flex-direction: column; gap: 4px;
    background: var(--bp-side, var(--surface-1)); color: var(--bp-side-ink, var(--text-primary));
    border-inline-end: 1px solid var(--bp-side-border, var(--border-soft)); }
.bp-workspace { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; margin-bottom: 4px;
    border-bottom: 1px solid var(--bp-side-border, var(--border-soft)); min-width: 0; }
.bp-mark { width: 22px; height: 22px; border-radius: var(--radius); flex-shrink: 0; display: inline-flex;
    align-items: center; justify-content: center; font-weight: 700; background: var(--bp-500); color: var(--bp-on); }
.bp-logo { height: 22px; max-width: 60px; object-fit: contain; flex-shrink: 0; }
.bp-ws-text { min-width: 0; }
.bp-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-sub { font-size: .62rem; color: var(--bp-side-muted, var(--text-muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-cta { padding: 5px 8px; border-radius: var(--radius); font-weight: 600; margin-bottom: 4px;
    background: var(--bp-500); color: var(--bp-on); }
.bp-nav { padding: 5px 8px; border-radius: var(--radius); color: var(--bp-side-muted, var(--text-secondary)); }
.bp-nav i { width: 14px; margin-inline-end: 4px; }
.bp-nav.bp-active { font-weight: 600; background: var(--bp-active-bg, var(--bp-soft));
    color: var(--bp-active-ink, var(--bp-700)); }
.bp-main { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.bp-bar { height: 8px; width: 60%; border-radius: 4px; background: var(--border-line); }
.bp-chip-row { display: flex; gap: 6px; }
.bp-chip { padding: 2px 8px; border-radius: var(--radius-pill); background: var(--bp-soft); color: var(--bp-700); font-weight: 600; }
.bp-chip-outline { padding: 2px 8px; border-radius: var(--radius-pill); border: 1px solid var(--bp-500); color: var(--bp-500); }
.bp-link { color: var(--bp-500); text-decoration: underline; }
.bp-link:hover { color: var(--bp-600); }
.bp-progress { height: 6px; border-radius: 3px; background: var(--surface-inset); overflow: hidden; }
.bp-progress span { display: block; height: 100%; width: 64%; background: var(--bp-500); }
.bp-btn { padding: 5px 12px; border-radius: var(--radius); font-weight: 600; background: var(--bp-500); color: var(--bp-on); }
.bp-btn-outline { padding: 5px 12px; border-radius: var(--radius); border: 1px solid var(--bp-500); color: var(--bp-500); }

/* ════════════════════════════════════════════════════════════
   REDESIGN COMPONENTS (board Main). Sample page: /_design (dev only).
   Screens adopt these in later increments; nothing here changes
   behaviour, only how a value is drawn.
   ════════════════════════════════════════════════════════════ */

/* KPI labels read as sentence case in the new design */
.inc-stat-label, .admin-kpi-label, .admin-mini-label, .admin-dash-section-label {
    text-transform: none; letter-spacing: 0; font-size: 12px;
}
.admin-dash-header h1 { font-size: 24px; font-weight: 700; }
.admin-kpi, .admin-mini, .admin-quick, .inc-kpi .inc-stat-card, .catalog-card,
.inc-table-card, .inc-detail-header, .timeline-content { border-color: var(--border-line); border-radius: var(--radius-card); }
.topbar-search { border-radius: var(--radius-control); }
.topbar-user-avatar { background: var(--brand-400); color: #fff; }
.inc-number, .search-hit-num { font-family: var(--font-sans); font-variant-numeric: tabular-nums; }

/* Section label inside a card: DESCRIPTION, RESOLUTION NOTES */
.section-label {
    font-size: 12px; font-weight: 600; letter-spacing: .06em;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px;
}
[lang="ar"] .section-label { letter-spacing: 0; }

/* ── Status pill: always a word plus an icon ─────────────────── */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 600; line-height: 1.35; white-space: nowrap;
    background: var(--surface-inset); color: var(--text-secondary);
    border: 1px solid transparent;
}
.pill > i, .pill > svg { font-size: 11px; }
.pill--success { background: var(--soft-mint); color: var(--soft-mint-ink); }
.pill--warning { background: var(--soft-sand); color: var(--soft-sand-ink); }
.pill--danger  { background: var(--soft-rose); color: var(--soft-rose-ink); }
.pill--info    { background: var(--soft-sky);  color: var(--soft-sky-ink); }
.pill--neutral { background: var(--surface-inset); color: var(--text-secondary); }
.pill--current { background: var(--brand-500); color: var(--brand-contrast); }
.pill--outline { background: var(--surface-1); color: var(--text-primary); border-color: var(--border-strong); }

/* ── Priority chip: purple scale; Informational has a dashed edge ── */
.prio {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 3px 10px; border-radius: 6px;
    font-size: 12px; font-weight: 700; line-height: 1.35; white-space: nowrap;
    border: 1px solid transparent;
}
.prio--critical      { background: var(--priority-critical-bg); color: var(--priority-critical-fg); }
.prio--high          { background: var(--priority-high-bg);     color: var(--priority-high-fg); }
.prio--medium        { background: var(--priority-medium-bg);   color: var(--priority-medium-fg); }
.prio--low           { background: var(--priority-low-bg);      color: var(--priority-low-fg); }
.prio--informational { background: var(--priority-informational-bg); color: var(--priority-informational-fg); border: var(--priority-informational-border); }

/* ── SLA chip: time left in words ─────────────────────────────── */
.sla-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 600; line-height: 1.35; white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.sla-chip > i { font-size: 11px; }
.sla-chip--ok     { background: var(--sla-ok-bg);     color: var(--sla-ok-fg); }
.sla-chip--warn   { background: var(--sla-warn-bg);   color: var(--sla-warn-fg); }
.sla-chip--bad    { background: var(--sla-bad-bg);    color: var(--sla-bad-fg); }
.sla-chip--paused { background: var(--sla-paused-bg); color: var(--sla-paused-fg); }

/* ── Stepper: dots above the labels ───────────────────────────── */
.stepper {
    display: flex; list-style: none; margin: 0; padding: 16px 20px;
    background: var(--surface-1); border: 1px solid var(--border-line);
    border-radius: var(--radius-card);
}
.stepper-step {
    flex: 1; position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 500; color: var(--text-secondary); text-align: center;
}
/* connector: from this dot's centre to the next dot's centre, behind the dots.
   Logical properties keep it correct when the page is mirrored for Arabic. */
.stepper-step:not(:last-child)::after {
    content: ""; position: absolute; top: 12px; height: 1px;
    inset-inline-start: calc(50% + 18px); width: calc(100% - 36px);
    background: var(--border-strong);
}
.stepper-step.is-done:not(:last-child)::after { background: var(--brand-400); }
.stepper-dot {
    width: 24px; height: 24px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
    background: var(--surface-1); color: var(--text-secondary);
    border: 1px solid var(--border-strong); position: relative; z-index: 1;
}
.stepper-step.is-done .stepper-dot    { background: var(--brand-400); border-color: var(--brand-400); color: #fff; }
.stepper-step.is-current              { color: var(--text-primary); font-weight: 700; }
.stepper-step.is-current .stepper-dot { background: var(--brand-500); border-color: var(--brand-500); color: var(--brand-contrast); }
[data-theme="dark"] .stepper-step.is-done .stepper-dot { color: #14111B; }
@media (max-width: 576px) {
    .stepper { overflow-x: auto; gap: 12px; }
    .stepper-step { min-width: 72px; }
}

/* ── KPI tile ─────────────────────────────────────────────────── */
.kpi-tile {
    background: var(--surface-1); border: 1px solid var(--border-line);
    border-radius: var(--radius-card); padding: 20px;
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px; height: 100%;
}
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.kpi-value { font-size: 24px; font-weight: 700; line-height: 1.15; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.kpi-sub   { font-size: 12px; color: var(--text-muted); }

/* ── Banners: info and known issue ────────────────────────────── */
.banner {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 16px 20px; border-radius: var(--radius-card);
    border: 1px solid transparent;
}
.banner-icon { font-size: 16px; margin-top: 2px; flex-shrink: 0; }
.banner-body { flex: 1; min-width: 0; }
.banner-title { font-weight: 700; margin: 0 0 2px; }
.banner-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.banner--info  { background: var(--soft-sky);  color: var(--text-primary); border-color: color-mix(in srgb, var(--soft-sky-ink) 22%, transparent); }
.banner--info .banner-icon, .banner--info .banner-title { color: var(--soft-sky-ink); }
.banner--known { background: var(--soft-sand); color: var(--text-primary); border-color: color-mix(in srgb, var(--soft-sand-ink) 30%, transparent); }
.banner--known .banner-icon, .banner--known .banner-kicker { color: var(--soft-sand-ink); }
.banner-kicker { font-size: 12px; font-weight: 700; }
@media (max-width: 576px) { .banner { flex-wrap: wrap; } .banner-actions { width: 100%; } }

/* ── Internal note bubble ─────────────────────────────────────── */
.note-bubble {
    padding: 12px 14px; border-radius: var(--radius-card);
    background: var(--surface-1); border: 1px solid var(--border-line);
}
.note-bubble--internal { background: var(--note-internal-bg); border-color: var(--note-internal-border); }
.note-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; margin-bottom: 4px; }
.note-meta strong { font-weight: 700; }
.note-time { color: var(--text-muted); font-size: 12px; }
.note-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--soft-sand-ink); }

/* ── Avatar (initials) ────────────────────────────────────────── */
.avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-400); color: #fff; font-size: 11px; font-weight: 700;
}
.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.avatar--primary { background: var(--brand-500); }
[data-theme="dark"] .avatar { color: #14111B; }
[data-theme="dark"] .avatar--primary { color: #fff; }

/* ── Queue row (ticket summary card) ──────────────────────────── */
.queue-row {
    display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center;
    padding: 12px 14px; border: 1px solid var(--border-line);
    border-radius: var(--radius-card); background: var(--surface-1);
}
.queue-row-title { font-weight: 600; font-size: 14px; }
.queue-row-meta { grid-column: 1 / -1; font-size: 12px; color: var(--text-muted); }

/* ── Key / value list (Information, Timeline cards) ───────────── */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; margin: 0; }
.kv:last-child { border-bottom: none; }
.kv dt { color: var(--text-muted); font-weight: 400; }
.kv dd { margin: 0; font-weight: 600; text-align: end; }

/* ── Phones: tables scroll sideways inside their card ─────────── */
@media (max-width: 768px) {
    .card .table-responsive, .inc-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ════════════════════════════════════════════════════════════
   PORTAL SHELL (User role) — boards UI-S01 / UI-S15
   Purple top bar with the top menu; no side menu.
   ════════════════════════════════════════════════════════════ */
:root { --portal-bar-bg: var(--brand-500); --portal-bar-ink: #FFFFFF; --portal-bar-soft: rgba(255, 255, 255, .12); }
[data-theme="dark"] { --portal-bar-bg: #241F2F; }

.skip-link {
    position: absolute; inset-inline-start: 12px; top: -48px; z-index: 2000;
    padding: 8px 14px; border-radius: var(--radius-control);
    background: var(--surface-1); color: var(--text-primary); font-weight: 600;
}
.skip-link:focus { top: 8px; }

.portal-bar {
    position: sticky; top: 0; z-index: 1000;
    background: var(--portal-bar-bg); color: var(--portal-bar-ink);
    border-bottom: 1px solid transparent;
}
[data-theme="dark"] .portal-bar { border-bottom-color: var(--border-line); }
.portal-bar-inner {
    min-height: var(--topbar-height);
    display: flex; align-items: center; gap: 12px;
    padding: 0 32px;
}
.portal-bar a, .portal-bar button { color: var(--portal-bar-ink); }
.portal-bar :focus-visible { box-shadow: 0 0 0 2px var(--portal-bar-bg), 0 0 0 4px #FFFFFF; }

.portal-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; margin-inline-end: 12px; }
.portal-brand:hover { text-decoration: none; }
.portal-brand-logo { height: 34px; width: auto; max-width: 120px; border-radius: 8px; object-fit: contain; background: rgba(255,255,255,.08); }
.portal-brand-mark {
    width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-400); color: #fff; font-weight: 700; text-transform: uppercase;
}
.portal-brand-name { font-size: 17px; font-weight: 700; white-space: nowrap; }

.portal-nav-list { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.portal-link {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 36px; padding: 6px 12px; border-radius: var(--radius-control);
    background: transparent; border: 0;
    font-size: 14px; font-weight: 600; white-space: nowrap;
    color: rgba(255, 255, 255, .86) !important; text-decoration: none;
}
.portal-link:hover { background: var(--portal-bar-soft); color: #fff !important; text-decoration: none; }
.portal-link.active { background: rgba(255, 255, 255, .16); color: #fff !important; }
.portal-link.dropdown-toggle::after { margin-inline-start: 4px; }
.portal-bar .dropdown-menu .dropdown-item { color: var(--text-primary); }
.portal-bar .dropdown-menu .dropdown-item i { color: var(--text-muted); width: 16px; text-align: center; }

.portal-search { flex: 1 1 240px; max-width: 360px; background: var(--portal-bar-soft); color: rgba(255,255,255,.8); }
.portal-search:hover { background: rgba(255,255,255,.18); border-color: transparent; }
.portal-search:focus-within { background: var(--surface-1); }
.portal-search i, .portal-search input::placeholder { color: rgba(255,255,255,.75); }
.portal-search input { color: #fff; }
.portal-search:focus-within input { color: var(--text-primary); }
.portal-search:focus-within i, .portal-search:focus-within input::placeholder { color: var(--text-muted); }
.portal-search .topbar-search-kbd { background: transparent; border-color: rgba(255,255,255,.35); color: rgba(255,255,255,.8); }

.portal-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.portal-icon-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-width: 40px; height: 36px; padding: 0 12px; border-radius: var(--radius-control);
    background: var(--portal-bar-soft); border: 1px solid rgba(255, 255, 255, .14);
    font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.portal-icon-btn:hover { background: rgba(255, 255, 255, .2); text-decoration: none; }
.portal-count {
    min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--radius-pill);
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff; color: var(--brand-500); font-size: 11px; font-weight: 700;
}
[data-theme="dark"] .portal-count { color: #241F2F; }
.portal-profile {
    display: inline-flex; align-items: center; gap: 10px;
    background: transparent; border: 0; padding: 4px 6px; border-radius: var(--radius-control); cursor: pointer;
}
.portal-profile:hover { background: var(--portal-bar-soft); }
.portal-profile .avatar { width: 32px; height: 32px; font-size: 11px; background: var(--brand-400); color: #fff; }
.portal-profile-name { font-size: 14px; font-weight: 600; white-space: nowrap; }

.portal-burger {
    display: none; width: var(--touch); height: var(--touch); align-items: center; justify-content: center;
    background: transparent; border: 0; border-radius: var(--radius-control); font-size: 18px;
}
.portal-burger:hover { background: var(--portal-bar-soft); }

/* Desktop: the menu is always open; phones get the burger and a stacked menu. */
@media (min-width: 992px) {
    .portal-nav.collapse:not(.show) { display: block; }
}
@media (max-width: 1199.98px) {
    .portal-search { display: none; }
    .portal-profile-name { display: none; }
}
@media (max-width: 991.98px) {
    .portal-bar-inner { flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
    .portal-burger { display: inline-flex; order: -1; color: #fff; }
    .portal-brand { margin-inline-end: 0; }
    .portal-nav { order: 10; width: 100%; }
    .portal-nav-list { flex-direction: column; align-items: stretch; padding: 4px 0 8px; }
    .portal-link { width: 100%; min-height: var(--touch); }
    .portal-icon-btn { min-width: var(--touch); height: var(--touch); }
}
@media (max-width: 575.98px) {
    .portal-brand-name { display: none; }
    .portal-lang span { display: none; }
}

.portal-main { max-width: var(--content-max); margin: 0 auto; padding: 28px 32px 48px; outline: none; }
.portal-main > .alert { margin-left: 0 !important; margin-right: 0 !important; margin-top: 0 !important; margin-bottom: 16px; }
@media (max-width: 767.98px) { .portal-main { padding: 16px 16px 40px; } }

/* ── Portal home ──────────────────────────────────────────────── */
.portal-grid {
    display: grid; gap: 20px; align-items: start;
    grid-template-columns: minmax(0, 1fr) 452px;
}
@media (max-width: 1099.98px) { .portal-grid { grid-template-columns: minmax(0, 1fr) 360px; } }
@media (max-width: 899.98px)  { .portal-grid { grid-template-columns: minmax(0, 1fr); } }

.portal-side { display: flex; flex-direction: column; gap: 16px; }

.portal-hero { padding: 28px; }
.portal-date { font-size: 13px; color: var(--text-muted); }
.portal-greeting { font-size: 30px; font-weight: 700; line-height: 1.25; margin: 6px 0 20px; }
@media (max-width: 575.98px) { .portal-hero { padding: 20px; } .portal-greeting { font-size: 24px; } }

.portal-search-box { border: 2px solid var(--brand-400); border-radius: var(--radius-card); background: var(--surface-1); overflow: hidden; }
.portal-search-field { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 54px; }
.portal-search-field > i { color: var(--text-secondary); font-size: 16px; }
.portal-search-field input {
    flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
    font-size: 16px; color: var(--text-primary); padding: 12px 0;
}
.portal-search-field input::placeholder { color: var(--text-muted); }
.portal-search-field input::-webkit-search-cancel-button { display: none; }
.portal-search-box:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-400) 22%, transparent); }
.portal-search-field input:focus-visible { box-shadow: none; }
.portal-search-clear {
    width: 32px; height: 32px; border: 0; border-radius: var(--radius-control);
    background: transparent; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center;
}
.portal-search-clear:hover { background: var(--surface-inset); color: var(--text-primary); }
.portal-search-results { border-top: 1px solid var(--border-line); padding: 6px 12px 0; }
.portal-hit-group { font-size: 12px; font-weight: 600; color: var(--text-secondary); padding: 12px 4px 6px; }
.portal-hit {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 4px;
    border-radius: var(--radius-control); color: var(--text-primary); text-decoration: none;
}
.portal-hit:hover, .portal-hit:focus-visible { background: var(--brand-50); color: var(--text-primary); text-decoration: none; }
[data-theme="dark"] .portal-hit:hover { background: var(--surface-inset); }
.portal-hit-icon {
    width: 32px; height: 32px; flex-shrink: 0; border-radius: var(--radius-control);
    border: 1px solid var(--border-line); background: var(--surface-1);
    display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary); font-size: 13px;
}
.portal-hit-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.portal-hit-title { font-size: 14px; font-weight: 600; }
.portal-hit-meta { font-size: 12px; color: var(--text-muted); }
.portal-hit-empty { font-size: 13px; color: var(--text-muted); padding: 12px 4px 4px; margin: 0; }
.portal-search-foot {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    margin: 8px -12px 0; padding: 12px 16px; border-top: 1px solid var(--border-soft);
    font-size: 13px; color: var(--text-muted);
}
.portal-search-foot a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.portal-chevron { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
[dir="rtl"] .portal-chevron { transform: scaleX(-1); }

.portal-action {
    display: flex; flex-direction: row; align-items: center; gap: 16px; padding: 20px;
    color: var(--text-primary); text-decoration: none; transition: border-color .12s ease;
}
.portal-action:hover { border-color: var(--brand-400); color: var(--text-primary); text-decoration: none; }
.portal-action-icon {
    width: 48px; height: 48px; flex-shrink: 0; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-500); color: #fff; font-size: 20px;
}
.portal-action-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.portal-action-title { font-size: 17px; font-weight: 700; }
.portal-action-sub { font-size: 13px; color: var(--text-muted); }

.portal-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 20px; border-bottom: 1px solid var(--border-soft);
}
.portal-card-head.px-0 { border-bottom: 0; padding-top: 0; }
.portal-card-title { font-size: 16px; font-weight: 700; margin: 0; }
.portal-see-all { font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.portal-empty { padding: 20px; margin: 0; color: var(--text-muted); font-size: 14px; }

.portal-mine-list { list-style: none; margin: 0; padding: 0; }
.portal-mine-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
}
.portal-mine-row:last-child { border-bottom: 0; }
.portal-mine-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.portal-mine-title a { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.portal-mine-title a:hover { color: var(--brand-400); }
.portal-mine-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.portal-mine-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.portal-reopen { grid-column: 1 / -1; padding-top: 4px; }
@media (max-width: 575.98px) {
    .portal-mine-row { grid-template-columns: minmax(0, 1fr); }
    .portal-mine-actions { justify-content: flex-start; }
}

.portal-panel { padding: 20px; }
.portal-panel .portal-card-title { margin-bottom: 12px; }
.portal-links { list-style: none; margin: 0; padding: 0; }
.portal-links a {
    display: flex; align-items: center; gap: 12px; padding: 7px 0;
    color: var(--text-primary); font-size: 14px; text-decoration: none;
}
.portal-links a:hover { color: var(--brand-400); text-decoration: underline; }
.portal-links i { color: var(--brand-400); width: 16px; text-align: center; }
.portal-reach { display: flex; align-items: flex-start; gap: 12px; }
.portal-reach-icon {
    width: 32px; height: 32px; flex-shrink: 0; border-radius: var(--radius-control);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-inset); color: var(--text-secondary);
}
.portal-reach-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.portal-reach-sub { font-size: 12px; color: var(--text-muted); }

.portal-catalog { margin-top: 32px; }
.portal-section-title { font-size: 18px; font-weight: 700; margin: 0; }
.portal-group-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 16px 0 10px; }
.portal-services { display: grid; gap: 13px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1099.98px) { .portal-services { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px)  { .portal-services { grid-template-columns: minmax(0, 1fr); } }
.portal-service {
    display: flex; align-items: flex-start; gap: 12px; padding: 14px;
    background: var(--surface-1); border: 1px solid var(--border-line); border-radius: 10px;
    color: var(--text-primary); text-decoration: none; transition: border-color .12s ease;
}
.portal-service:hover { border-color: var(--brand-400); color: var(--text-primary); text-decoration: none; }
.portal-service-icon {
    width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--radius-control);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-inset); color: var(--text-secondary);
}
.portal-service-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.portal-service-name { font-size: 14px; font-weight: 700; }
.portal-service-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.portal-mini-pill { font-size: 11px; padding: 1px 8px; }

/* ════════════════════════════════════════════════════════════
   DASHBOARD — "My work" for staff (redesign board S05)
   ════════════════════════════════════════════════════════════ */
.my-work { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }
.my-work-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.my-work-title { font-size: 18px; font-weight: 700; margin: 0; }
.my-work-kpis { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1099.98px) { .my-work-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px)  { .my-work-kpis { grid-template-columns: minmax(0, 1fr); } }
.kpi-link { color: var(--text-primary); text-decoration: none; transition: border-color .12s ease; }
.kpi-link:hover { border-color: var(--brand-400); color: var(--text-primary); text-decoration: none; }
.kpi-link .sla-chip { margin-top: 2px; }

.my-work-card { overflow: hidden; }
.my-work-table td { vertical-align: middle; }
.my-work-row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; font-size: 14px; }
.my-work-row-title a { color: var(--text-primary); }
.my-work-row-title a:hover { color: var(--brand-400); }
.my-work-row-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.my-work-row-meta i { font-size: 10px; }
.my-work-foot { padding: 12px 20px; font-size: 13px; color: var(--text-muted); border-top: 1px solid var(--border-soft); }

.my-work-waiting { list-style: none; margin: 0; padding: 0; }
.my-work-waiting li {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px 16px;
    padding: 14px 20px; border-bottom: 1px solid var(--border-soft);
}
.my-work-waiting li:last-child { border-bottom: 0; }
@media (max-width: 575.98px) {
    .my-work-waiting li { grid-template-columns: minmax(0, 1fr) auto; }
    .my-work-waiting li .sla-chip { grid-column: 1; justify-self: start; }
}

/* ════════════════════════════════════════════════════════════
   DASHBOARD — desk overview (redesign UI-S12)
   ════════════════════════════════════════════════════════════ */
.dash { display: flex; flex-direction: column; gap: 24px; max-width: var(--content-max); }
.dash .my-work { margin-bottom: 0; }
.dash-header { margin-bottom: 0; }
.dash-section { display: flex; flex-direction: column; gap: 16px; }

.dash-kpis { display: grid; gap: 16px; }
.dash-kpis--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.dash-kpis--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1399.98px) { .dash-kpis--6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1099.98px) { .dash-kpis--6, .dash-kpis--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px)  { .dash-kpis--6, .dash-kpis--4 { grid-template-columns: minmax(0, 1fr); } }

.dash-grid { display: grid; gap: 20px; align-items: start; }
.dash-grid--charts { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.dash-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-grid--1 { grid-template-columns: minmax(0, 1fr); max-width: 640px; }
@media (max-width: 1199.98px) { .dash-grid--charts, .dash-grid--3 { grid-template-columns: minmax(0, 1fr); } }

.dash-card { overflow: hidden; }
.dash-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 18px 20px 10px;
}
.dash-card-foot {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 12px 20px 16px; font-size: 13px; color: var(--text-muted);
}
.dash-chart { position: relative; height: 260px; padding: 0 16px; }

.dash-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); }
.dash-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dash-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.dash-swatch--1 { background: var(--chart-1); }
.dash-swatch--2 { background: var(--chart-2); }

.dash-table-toggle summary { cursor: pointer; color: var(--brand-400); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.dash-table-toggle[open] { flex-basis: 100%; }
.dash-table-toggle[open] summary { margin-bottom: 8px; }

/* Backlog grid: shaded cells, darker = more tickets */
.dash-heat th, .dash-heat td { text-align: center; padding: 10px 8px; border-bottom: 1px solid var(--border-soft); }
.dash-heat thead th { white-space: normal; font-size: 12px; }
.dash-heat th[scope="row"] { text-align: start; padding-inline-start: 20px; }
.dash-heat th[scope="row"] a { text-decoration: none; }
.dash-heat tbody th[scope="row"] .prio { min-width: 96px; justify-content: flex-start; }
/* Bootstrap paints table cells from --bs-table-bg, so the shade goes through that variable. */
.dash-heat-cell { --bs-table-bg: color-mix(in srgb, var(--chart-1) var(--heat), var(--surface-1)); font-variant-numeric: tabular-nums; }
.dash-heat-cell.is-dark { color: #fff; font-weight: 700; }
[data-theme="dark"] .dash-heat-cell.is-dark { color: #14111B; }
.dash-heat tfoot th, .dash-heat tfoot td { border-bottom: 0; color: var(--text-secondary); }
.dash-heat td:last-child, .dash-heat th:last-child { padding-inline-end: 20px; }

/* Lists: overdue now, upcoming changes */
.dash-list { list-style: none; margin: 0; padding: 0 20px; }
.dash-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border-soft); }
.dash-list-main { flex: 1; min-width: 0; }
.dash-list-title { font-size: 14px; font-weight: 600; color: var(--text-primary); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-list-title:hover { color: var(--brand-400); }
.dash-date {
    flex-shrink: 0; width: 44px; padding: 4px 0; border-radius: var(--radius-control);
    display: flex; flex-direction: column; align-items: center; line-height: 1.1;
    background: var(--brand-100); color: var(--brand-500); font-size: 11px; font-weight: 600;
}
.dash-date b { font-size: 16px; }
[data-theme="dark"] .dash-date { color: var(--brand-700); }

/* Top categories: horizontal bars with the number at the end */
.dash-bars { list-style: none; margin: 0; padding: 4px 20px 16px; }
.dash-bars li { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(0, 1.4fr) 36px; align-items: center; gap: 12px; padding: 7px 0; }
.dash-bar-name { font-size: 13px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-bar-track { height: 10px; border-radius: 3px; background: var(--brand-100); overflow: hidden; }
.dash-bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--chart-1); }
.dash-bar-value { font-size: 13px; font-weight: 700; text-align: end; font-variant-numeric: tabular-nums; }

/* ════════════════════════════════════════════════════════════
   SHARED PAGE PARTS — page head, section head (Admin, Reports)
   ════════════════════════════════════════════════════════════ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head .kpi-sub { margin-top: 4px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: -4px; }
.section-title { font-size: 18px; font-weight: 700; margin: 0; }
.dash-grid--2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
@media (max-width: 1199.98px) { .dash-grid--2 { grid-template-columns: minmax(0, 1fr); } }
.kpi-tile .progress { width: 100%; margin-top: 6px; }
.kpi-split { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); }
.kpi-split b { color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* Stat list: label + sub on the start side, number on the end side */
.stat-list { list-style: none; margin: 0; padding: 0 20px 8px; }
.stat-list li { border-top: 1px solid var(--border-soft); }
.stat-list a, .stat-list .stat-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 0;
    color: var(--text-primary); text-decoration: none;
}
.stat-list a:hover .stat-list-label { color: var(--brand-400); }
.stat-list-icon {
    width: 32px; height: 32px; flex-shrink: 0; border-radius: var(--radius-control);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-100); color: var(--brand-500); font-size: 13px;
}
[data-theme="dark"] .stat-list-icon { color: var(--brand-700); }
.stat-list-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stat-list-label { font-size: 14px; font-weight: 600; }
.stat-list-sub { font-size: 12px; color: var(--text-muted); }
.stat-list-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Activity feed */
.feed { list-style: none; margin: 0; padding: 0 20px 8px; }
.feed li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border-soft); }
.feed-body { flex: 1; min-width: 0; font-size: 13px; }
.feed-body strong { font-weight: 600; }
.feed-meta { display: flex; gap: 8px; align-items: center; margin-top: 3px; font-size: 12px; color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════
   ADMIN — settings hub
   ════════════════════════════════════════════════════════════ */
.settings-hub { display: grid; gap: 20px; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; }
@media (max-width: 1399.98px) { .settings-hub { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px)  { .settings-hub { grid-template-columns: minmax(0, 1fr); } }
.settings-group { padding: 18px 20px 10px; }
.settings-group-title {
    font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-muted); margin: 0 0 6px;
}
[lang="ar"] .settings-group-title { letter-spacing: 0; }
.settings-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 8px; margin: 0 -8px;
    border-radius: var(--radius-control); color: var(--text-primary); text-decoration: none;
}
.settings-link:hover { background: var(--surface-2); color: var(--text-primary); text-decoration: none; }
.settings-link .stat-list-icon { width: 30px; height: 30px; }
.settings-link-name { font-size: 14px; font-weight: 600; display: block; }
.settings-link-desc { font-size: 12px; color: var(--text-muted); display: block; }
.settings-count {
    margin-inline-start: auto; min-width: 28px; padding: 1px 8px; border-radius: var(--radius-pill);
    background: var(--surface-inset); color: var(--text-secondary);
    font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums;
}

/* ════════════════════════════════════════════════════════════
   REPORTS
   ════════════════════════════════════════════════════════════ */
.rpt-library { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 991.98px) { .rpt-library { grid-template-columns: minmax(0, 1fr); } }
.rpt-card {
    display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px;
    background: var(--surface-1); border: 1px solid var(--border-line); border-radius: var(--radius-card);
    color: var(--text-primary); text-decoration: none; transition: border-color .12s ease;
}
.rpt-card:hover { border-color: var(--brand-400); color: var(--text-primary); text-decoration: none; }
.rpt-card .stat-list-icon { width: 40px; height: 40px; font-size: 16px; }
.rpt-card-title { font-size: 15px; font-weight: 700; display: block; }
.rpt-card-desc { font-size: 13px; color: var(--text-muted); display: block; margin-top: 2px; }
.rpt-card-go { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--brand-400); }

/* Report tabs + filter toolbar */
.rpt-tabs { margin-bottom: 0 !important; }
.rpt-toolbar { padding: 16px 20px; }
.rpt-toolbar .form-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.rpt-toolbar-foot {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft);
    font-size: 13px; color: var(--text-muted);
}
.rpt-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.rpt-presets a {
    padding: 3px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border-line);
    color: var(--text-secondary); font-size: 12px; font-weight: 600; text-decoration: none;
}
.rpt-presets a:hover { border-color: var(--brand-400); color: var(--brand-400); }

/* Report tables: calmer numbers, end-aligned figures, readable totals */
.report-table { font-size: 13px; }
.report-table td, .report-table th { white-space: nowrap; }
.report-table tfoot td, .report-table tfoot th { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--border-line); }
.rate-cell { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.rate-cell .progress { flex: 1; height: 6px; }
.rate-cell span { font-size: 12px; font-weight: 600; min-width: 40px; text-align: end; font-variant-numeric: tabular-nums; }
.rate-cell.is-low .progress-bar { background: var(--status-danger); }
.rate-cell.is-mid .progress-bar { background: var(--status-warning); }
.num-alert { color: var(--status-danger); font-weight: 700; }
