@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg: #f5f8fc;
    --surface: rgba(255, 255, 255, .86);
    --surface-solid: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e3eaf4;
    --soft-line: #eef4fb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eef5ff;
    --cyan: #06b6d4;
    --green: #059669;
    --orange: #ea580c;
    --red: #dc2626;
    --purple: #7c3aed;
    --navy: #0b1220;
    --shadow: 0 26px 80px rgba(15, 23, 42, .12);
    --shadow-soft: 0 14px 38px rgba(15, 23, 42, .075);
    --radius: 24px;
    --radius-sm: 16px;
    --container: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: 'Cairo', 'Inter', Tahoma, Arial, sans-serif;
    background:
        radial-gradient(circle at 8% -8%, rgba(37, 99, 235, .20), transparent 34%),
        radial-gradient(circle at 92% 0%, rgba(6, 182, 212, .16), transparent 30%),
        radial-gradient(circle at 50% 110%, rgba(124, 58, 237, .10), transparent 35%),
        linear-gradient(180deg, #f9fbff 0%, var(--bg) 50%, #f8fafc 100%);
}
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(15,23,42,.032) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15,23,42,.032) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.46), transparent 72%);
}
body.rtl { direction: rtl; }
body.ltr { direction: ltr; font-family: 'Inter', 'Cairo', Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; position: relative; z-index: 1; }
.main-content {
    width: min(var(--container), calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0 44px;
    position: relative;
    z-index: 2;
}

/* Top Navigation */
.top-navigation {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 14px 20px 10px;
    background: linear-gradient(180deg, rgba(245,248,252,.92), rgba(245,248,252,.64));
    backdrop-filter: blur(18px);
}
.nav-container {
    width: min(var(--container), 100%);
    margin: 0 auto;
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-radius: 30px;
    background: rgba(255,255,255,.72);
    box-shadow: 0 18px 60px rgba(15,23,42,.09);
    backdrop-filter: blur(20px);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 210px;
    padding: 6px 8px;
    border-radius: 22px;
    transition: transform .2s ease, background .2s ease;
}
.brand:hover { transform: translateY(-1px); background: rgba(37,99,235,.05); }
.brand-icon, .login-logo {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, #38bdf8, #2563eb 52%, #7c3aed);
    color: #fff;
    font-size: 23px;
    font-weight: 900;
    box-shadow: 0 18px 34px rgba(37, 99, 235, .28);
}
.hospital-brand-icon {
    overflow: hidden;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
.hospital-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.brand strong { display: block; font-size: 17px; line-height: 1.2; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 800; margin-top: 1px; }
.nav-menu {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 1;
    min-width: 0;
}
.nav-dropdown { position: relative; }
.nav-trigger, .profile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 0 13px;
    color: #1e293b;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-weight: 900;
    transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.nav-trigger:hover, .profile-trigger:hover,
.nav-dropdown.open > .nav-trigger,
.nav-dropdown.open > .profile-trigger,
.nav-dropdown.active > .nav-trigger {
    color: var(--primary-dark);
    background: #fff;
    box-shadow: 0 12px 26px rgba(15,23,42,.07);
    transform: translateY(-1px);
}
.nav-icon {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--primary-soft);
}
.chevron { font-size: 16px; line-height: 1; transition: transform .18s ease; opacity: .75; }
.nav-dropdown.open .chevron, .nav-dropdown:hover .chevron { transform: rotate(180deg); }
.dropdown-panel {
    position: absolute;
    top: calc(100% + 12px);
    inset-inline-start: 0;
    width: 278px;
    padding: 10px;
    border-radius: 22px;
    background: rgba(255,255,255,.96);
    box-shadow: var(--shadow);
    border: 1px solid rgba(226,232,240,.68);
    backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(.98);
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.nav-dropdown:hover > .dropdown-panel,
.nav-dropdown.open > .dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 48px;
    padding: 10px 12px;
    border-radius: 16px;
    color: #334155;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.dropdown-item span:first-child {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #f1f5f9;
}
.dropdown-item:hover { background: #f8fbff; color: var(--primary-dark); transform: translateX(-2px); }
.ltr .dropdown-item:hover { transform: translateX(2px); }
.dropdown-item.active {
    background: linear-gradient(135deg, #eef5ff, #eff6ff);
    color: var(--primary-dark);
}
.dropdown-item strong { font-size: 14px; }
.nav-profile { margin-inline-start: auto; }
.profile-trigger { padding: 5px 8px 5px 12px; }
.avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    color: #fff;
    font-weight: 900;
    background: linear-gradient(135deg, #10b981, #06b6d4);
    box-shadow: 0 10px 20px rgba(6,182,212,.22);
}
.profile-text { text-align: start; max-width: 130px; }
.profile-text strong { display: block; font-size: 13px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-text small { display: block; color: var(--muted); font-size: 10px; font-weight: 800; }
.profile-panel { inset-inline-start: auto; inset-inline-end: 0; width: 235px; }
.menu-toggle {
    display: none;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 16px;
    background: var(--navy);
    color: #fff;
    font-size: 20px;
    box-shadow: 0 16px 35px rgba(15,23,42,.18);
}
.sidebar-backdrop { display: none; }

/* Page hero */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin: 18px 0 22px;
    padding: clamp(18px, 3vw, 28px);
    border-radius: 32px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,255,255,.70)),
        radial-gradient(circle at 10% 10%, rgba(37,99,235,.12), transparent 30%);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
    overflow: hidden;
    position: relative;
}
.topbar::after {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,.14), transparent 70%);
    inset-inline-end: -80px;
    bottom: -110px;
    pointer-events: none;
}
.topbar-title { display: flex; align-items: center; gap: 16px; min-width: 0; position: relative; z-index: 1; }
.page-mark {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    display: grid;
    place-items: center;
    border-radius: 21px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: var(--primary);
    font-size: 26px;
    box-shadow: inset 0 0 0 1px rgba(37,99,235,.08), 0 14px 28px rgba(37,99,235,.10);
}
.eyebrow { display: inline-block; color: var(--primary); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.topbar h1 { margin: 0 0 3px; font-size: clamp(25px, 2.7vw, 38px); line-height: 1.15; letter-spacing: -.03em; }
.topbar p { margin: 0; color: var(--muted); font-size: 14px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; position: relative; z-index: 1; }
.lang-switch {
    min-width: 46px;
    min-height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
    font-weight: 900;
    box-shadow: 0 12px 26px rgba(15,23,42,.16);
}

/* Cards, layout */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
    background: var(--surface);
    border: 1px solid rgba(226,232,240,.78);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 22px;
    backdrop-filter: blur(18px);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 18px 46px rgba(15, 23, 42, .10); background: rgba(255,255,255,.93); }
.card-title { margin: 0 0 16px; font-size: 20px; letter-spacing: -.01em; }
.section-header, .page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}
.section-header p, .page-toolbar p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 132px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.stat-card::after {
    content: '';
    position: absolute;
    width: 132px;
    height: 132px;
    border-radius: 999px;
    background: rgba(37, 99, 235, .08);
    inset-inline-end: -46px;
    bottom: -50px;
}
.stat-card span { color: var(--muted); font-size: 14px; font-weight: 800; }
.stat-card strong { display: block; font-size: 38px; margin-top: 8px; color: var(--primary); line-height: 1; }
.stat-card > span:last-child {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: var(--primary-soft);
    font-size: 24px;
    position: relative;
    z-index: 1;
}

.stat-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.stat-link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid transparent;
    transition: border-color .18s ease, box-shadow .18s ease;
    pointer-events: none;
}
.stat-link:hover::before {
    border-color: rgba(37,99,235,.20);
    box-shadow: inset 0 0 0 1px rgba(37,99,235,.08);
}
.stat-link:hover strong { transform: translateY(-1px); }
.stat-link strong { transition: transform .18s ease; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-group { display: grid; gap: 8px; }
.form-group.full { grid-column: 1 / -1; }
label { font-weight: 900; font-size: 13px; color: #172033; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.96);
    color: var(--text);
    padding: 12px 14px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
select { cursor: pointer; }
textarea { min-height: 120px; resize: vertical; line-height: 1.8; }
input:focus, select:focus, textarea:focus {
    border-color: rgba(37,99,235,.62);
    box-shadow: 0 0 0 4px rgba(37,99,235,.10);
    background: #fff;
}
.help { color: var(--muted); font-size: 13px; }
.actions-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.filters, .user-filters { display: grid; gap: 12px; align-items: end; margin-bottom: 16px; }
.filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.user-filters { grid-template-columns: 1.4fr 1fr 1fr auto; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 999px;
    font-weight: 900;
    text-decoration: none;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, color .16s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    box-shadow: 0 14px 30px rgba(37,99,235,.25);
}
.btn-primary:hover { box-shadow: 0 18px 36px rgba(37,99,235,.30); }
.btn-secondary, .btn-light {
    color: #0f172a;
    background: #fff;
    box-shadow: 0 10px 22px rgba(15,23,42,.07);
}
.btn-secondary:hover, .btn-light:hover { color: var(--primary-dark); background: #f8fbff; }
.btn-block { width: 100%; }

/* Tables */
.table-wrap {
    overflow-x: auto;
    border-radius: 20px;
    border: 1px solid var(--soft-line);
    background: rgba(255,255,255,.82);
}
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 14px 15px; text-align: start; border-bottom: 1px solid var(--soft-line); vertical-align: middle; }
th { color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: rgba(248,250,252,.94); }
td { color: #1e293b; font-size: 14px; }
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: rgba(239,246,255,.62); }
tbody tr:last-child td { border-bottom: 0; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    background: #eef2ff;
    color: #3730a3;
}
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-orange { background: #fff7ed; color: #c2410c; }
.badge-green { background: #ecfdf5; color: #047857; }
.badge-red { background: #fef2f2; color: #b91c1c; }
.badge-purple { background: #f5f3ff; color: #6d28d9; }
.role-pill {
    display: inline-flex;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    background: #f1f5f9;
    color: #334155;
}
.role-pill.admin { background: #f5f3ff; color: var(--purple); }
.role-pill.quality { background: #ecfeff; color: #0e7490; }
.role-pill.manager { background: #fff7ed; color: var(--orange); }
.role-pill.user { background: #eff6ff; color: var(--primary-dark); }

/* Dashboard charts */
.empty-state {
    min-height: 110px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--muted);
    font-weight: 800;
    border-radius: 18px;
    background: rgba(248,250,252,.72);
}
.chart-bars { display: grid; gap: 13px; }
.bar-row { display: grid; grid-template-columns: minmax(150px, 1fr) 2fr auto; gap: 12px; align-items: center; }
.bar-row span:first-child { color: #334155; font-weight: 800; font-size: 13px; }
.bar-track { height: 12px; border-radius: 999px; background: #e8eef8; overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--cyan)); }

/* Details and comments */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.detail-item {
    padding: 14px;
    border-radius: 18px;
    background: rgba(248,250,252,.78);
    border: 1px solid var(--soft-line);
}
.detail-item span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; margin-bottom: 4px; }
.detail-item strong { font-size: 14px; }
.comment {
    padding: 14px;
    border-radius: 18px;
    background: rgba(248,250,252,.85);
    border: 1px solid var(--soft-line);
    margin-top: 12px;
}
.comment strong { display: block; }
.comment p { margin: 8px 0 0; line-height: 1.8; }

/* Users page */
.users-layout { display: grid; grid-template-columns: 0.95fr 1.35fr; gap: 18px; align-items: start; }
.user-form-card { position: sticky; top: 106px; }
.permissions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border-radius: 15px;
    background: rgba(248,250,252,.88);
    border: 1px solid var(--soft-line);
    cursor: pointer;
}
.check-item input { width: auto; accent-color: var(--primary); }
.user-name-cell { display: flex; align-items: center; gap: 10px; }
.user-mini-avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    font-weight: 900;
}

/* Alerts */
.alert {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 18px;
    font-weight: 800;
    box-shadow: 0 12px 26px rgba(15,23,42,.06);
}
.alert-success { background: #ecfdf5; color: #047857; }
.alert-error { background: #fef2f2; color: #b91c1c; }
.alert-info { background: #eff6ff; color: #1d4ed8; }

/* Login */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    position: relative;
    z-index: 1;
    isolation: isolate;
    background-color: #145b9e;
    background-image: url('../images/login-hospital.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 100% auto;
}
.auth-page::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    background: linear-gradient(90deg, rgba(3,31,72,.40) 0%, rgba(3,31,72,.18) 24%, transparent 48%);
}
.auth-shell {
    width: min(470px, 100%);
    min-height: 0;
    display: block;
    margin-right: auto;
    margin-left: clamp(12px, 5vw, 88px);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 32px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 34px 100px rgba(3,22,54,.28);
    backdrop-filter: blur(22px);
}
.auth-card {
    width: min(500px, 100%);
    margin: 0 auto;
    padding: 28px 36px 32px;
    align-self: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}
.login-brand-logo {
    display: none;
    width: 105px;
    height: 113px;
    margin: 0 auto 10px;
    object-fit: contain;
}
.login-logo { margin: 0 auto 16px; }
.auth-card h1 { margin: 0; text-align: center; font-size: 28px; letter-spacing: -.02em; }
.auth-card p { text-align: center; color: var(--muted); margin: 10px 0 20px; line-height: 1.7; }
.auth-card .help a { color: var(--primary); font-weight: 900; }

@media (min-width: 821px) and (max-width: 1400px) {
    .auth-page {
        padding: calc(100vw / 3) 0 0;
        place-items: stretch;
        background-color: #fff;
        background-size: 100% auto;
        background-position: top center;
    }
    .auth-page::before { display: none; }
    .auth-shell {
        width: 100%;
        min-height: calc(100vh - 100vw / 3);
        margin: 0;
        display: grid;
        place-items: center;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: #fff;
        box-shadow: none;
        backdrop-filter: none;
    }
    .auth-card { width: min(430px, calc(100% - 40px)); padding: 24px 20px 28px; }
    .auth-card h1 { font-size: 25px; }
    .login-brand-logo { display: block; width: 92px; height: 99px; margin: 0 auto 8px; }
}

@media (max-width: 820px) {
    .auth-page {
        padding: calc(100vw / 3) 0 0;
        place-items: stretch;
        background-color: #fff;
        background-position: top center;
        background-size: 100% auto;
    }
    .auth-page::before { display: none; }
    .auth-shell {
        width: 100%;
        min-height: calc(100vh - 100vw / 3);
        margin: 0;
        display: grid;
        place-items: center;
        border: 0;
        border-radius: 0;
        background: #fff;
        box-shadow: none;
        backdrop-filter: none;
    }
    .auth-card { width: min(390px, calc(100% - 32px)); padding: 24px 20px 28px; }
    .login-brand-logo { width: 104px; height: 112px; margin-bottom: 10px; }
    .login-brand-logo { display: block; }
    .auth-card h1 { font-size: 24px; }
}

@media (max-width: 480px) {
    .auth-page {
        padding: calc(100vw / 3) 0 0;
        place-items: stretch;
        background-color: #fff;
        background-position: top center;
        background-size: 100% auto;
    }
    .auth-page::before { display: none; }
    .auth-shell {
        width: 100%;
        min-height: calc(100vh - 100vw / 3);
        border: 0;
        border-radius: 0;
    }
    .auth-card { align-self: center; width: min(360px, calc(100% - 28px)); padding: 18px 16px 24px; }
    .login-brand-logo { width: 82px; height: 88px; margin-bottom: 6px; }
}

/* Reveal */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .45s ease, transform .45s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1120px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .users-layout { grid-template-columns: 1fr; }
    .user-form-card { position: static; }
}

@media (max-width: 1280px) {
    .top-navigation { padding: 10px 14px; }
    .nav-container { min-height: 66px; border-radius: 24px; }
    .brand { min-width: 0; flex: 1; }
    .brand strong { font-size: 15px; }
    .menu-toggle { display: grid; place-items: center; order: 3; }
    .nav-profile { order: 2; margin-inline-start: 0; }
    .profile-text, .profile-trigger .chevron { display: none; }
    .nav-menu {
        position: fixed;
        top: 86px;
        inset-inline: 14px;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 14px;
        border-radius: 24px;
        background: rgba(255,255,255,.96);
        box-shadow: var(--shadow);
        max-height: calc(100vh - 112px);
        overflow: auto;
    }
    body.mobile-nav-open .nav-menu { display: flex; }
    body.mobile-nav-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 40;
        background: rgba(15,23,42,.26);
        backdrop-filter: blur(2px);
    }
    body.mobile-nav-open .top-navigation { z-index: 60; }
    .nav-trigger { width: 100%; justify-content: space-between; background: #f8fafc; }
    .nav-trigger > span:nth-child(2) { margin-inline-end: auto; }
    .ltr .nav-trigger > span:nth-child(2) { margin-inline-start: 0; margin-inline-end: auto; }
    .dropdown-panel {
        position: static;
        width: 100%;
        padding: 6px 0 0;
        border: 0;
        box-shadow: none;
        background: transparent;
        opacity: 1;
        visibility: visible;
        transform: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height .22s ease;
    }
    .nav-dropdown.open > .dropdown-panel { max-height: 360px; }
    .dropdown-item { margin-top: 6px; background: rgba(248,250,252,.88); }
    .profile-panel {
        position: absolute;
        top: calc(100% + 10px);
        inset-inline-end: 0;
        width: 230px;
        padding: 10px;
        border: 1px solid rgba(226,232,240,.68);
        box-shadow: var(--shadow);
        background: rgba(255,255,255,.96);
        max-height: none;
        opacity: 0;
        visibility: hidden;
        transform: translateY(8px) scale(.98);
        overflow: visible;
    }
    .nav-profile.open > .profile-panel,
    .nav-profile:hover > .profile-panel { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
    .topbar { flex-direction: column; align-items: stretch; }
    .topbar-actions { justify-content: flex-start; }
    .rtl .topbar-actions { justify-content: flex-start; }
    .filters, .user-filters { grid-template-columns: 1fr !important; }
}

@media (max-width: 720px) {
    .main-content { width: min(100% - 24px, var(--container)); padding-bottom: 28px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .permissions-grid { grid-template-columns: 1fr; }
    .topbar { border-radius: 24px; padding: 18px; }
    .topbar-title { align-items: flex-start; }
    .page-mark { width: 48px; height: 48px; flex-basis: 48px; border-radius: 17px; }
    .card { border-radius: 22px; padding: 18px; }
    .section-header, .page-toolbar { align-items: flex-start; flex-direction: column; }
    .bar-row { grid-template-columns: 1fr; gap: 8px; }
    .detail-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 24px; border-radius: 26px; }
    .btn { width: 100%; }
    .topbar-actions .btn, .topbar-actions .lang-switch { width: auto; }
}

/* === Wtheeq Quality Services Platform v3 UI upgrade === */
:root {
    --container: 1920px;
    --radius: 28px;
    --radius-sm: 18px;
    --shadow: 0 28px 90px rgba(15, 23, 42, .12);
    --shadow-soft: 0 16px 50px rgba(15, 23, 42, .085);
}

body {
    background:
        radial-gradient(circle at 6% 0%, rgba(37, 99, 235, .22), transparent 32%),
        radial-gradient(circle at 96% 6%, rgba(20, 184, 166, .20), transparent 34%),
        radial-gradient(circle at 50% 100%, rgba(124, 58, 237, .12), transparent 38%),
        linear-gradient(180deg, #f8fbff 0%, #f4f8fd 45%, #f8fafc 100%);
}

.main-content {
    width: min(var(--container), calc(100% - 72px));
    padding-top: 28px;
}

.nav-container {
    width: min(var(--container), calc(100% - 24px));
}

.topbar {
    min-height: 132px;
    margin-top: 16px;
    margin-bottom: 26px;
    padding: clamp(24px, 3vw, 38px);
    border: 1px solid rgba(255,255,255,.74);
    background:
        linear-gradient(135deg, rgba(255,255,255,.94), rgba(255,255,255,.72)),
        radial-gradient(circle at 15% 15%, rgba(37,99,235,.16), transparent 36%),
        radial-gradient(circle at 85% 30%, rgba(6,182,212,.13), transparent 34%);
}

.topbar h1 { font-size: clamp(32px, 2.2vw, 48px); }
.topbar p { font-size: 15px; }
.card { padding: clamp(22px, 1.65vw, 32px); }
.card-title { font-size: clamp(20px, 1.2vw, 26px); }

.wide-card,
.report-header {
    border-radius: var(--radius);
    background: rgba(255,255,255,.86);
    border: 1px solid rgba(226,232,240,.78);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 24px;
    margin-bottom: 18px;
}
.report-header h2 { margin: 0 0 10px; font-size: clamp(22px, 1.5vw, 34px); }

.icon-bubble {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 19px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: var(--primary-dark);
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(37,99,235,.08), 0 14px 28px rgba(37,99,235,.10);
}

/* Create report */
.create-report-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(330px, .62fr);
    gap: 22px;
    align-items: start;
}
.create-form-card { min-height: 620px; }
.spacious-grid { gap: 18px; }
.form-section-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 22px 0 12px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #eff6ff;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 900;
}
.form-section-label:first-of-type { margin-top: 4px; }
.form-actions-big { justify-content: flex-end; }
.rtl .form-actions-big { justify-content: flex-start; }
.create-side-panel { display: grid; gap: 18px; position: sticky; top: 112px; }
.flow-steps { display: grid; gap: 12px; }
.flow-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--soft-line);
    border-radius: 18px;
    background: rgba(248,250,252,.82);
}
.flow-step span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    color: #fff;
    font-weight: 900;
}
.flow-step strong { font-size: 14px; }
.hint-card { overflow: hidden; position: relative; }
.hint-card h3 { margin: 14px 0 8px; }
.hint-card p { color: var(--muted); line-height: 1.85; margin: 0; }

/* Policies */
.policy-page-layout {
    display: grid;
    grid-template-columns: minmax(360px, .72fr) minmax(0, 1.28fr);
    gap: 22px;
    align-items: start;
}
.policy-form-card { position: sticky; top: 112px; }
.policy-search-hero { align-items: flex-start; }
.policy-search-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
}
.policy-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 14px;
}
.policy-card,
.policy-mini-card {
    border: 1px solid rgba(226,232,240,.82);
    border-radius: 22px;
    background: rgba(248,250,252,.86);
    padding: 16px;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.policy-card:hover,
.policy-mini-card:hover {
    transform: translateY(-2px);
    background: #fff;
    box-shadow: 0 18px 36px rgba(15,23,42,.08);
}
.policy-card[hidden], .policy-mini-card[hidden] { display: none !important; }
.policy-card-head { display: flex; align-items: flex-start; gap: 12px; }
.policy-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    border-radius: 17px;
    background: #e0f2fe;
}
.policy-card h3,
.policy-mini-card strong { margin: 0; font-size: 17px; line-height: 1.45; }
.policy-card-head p,
.policy-mini-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 800; }
.policy-keywords {
    margin: 12px 0 0;
    color: #1d4ed8;
    font-size: 13px;
    line-height: 1.7;
    font-weight: 800;
}
.policy-summary,
.policy-mini-card p {
    margin: 10px 0 0;
    color: #475569;
    line-height: 1.8;
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.policy-meta {
    display: grid;
    gap: 5px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.policy-empty { margin-bottom: 14px; }
.policy-mini-list { display: grid; gap: 10px; margin-top: 14px; max-height: 560px; overflow: auto; padding-inline-end: 4px; }
.policy-mini-card { padding: 14px; }

/* Report view */
.report-view-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.34fr) minmax(380px, .66fr);
    gap: 22px;
    align-items: start;
}
.report-side-column { display: grid; gap: 18px; }
.side-sticky { position: sticky; top: 112px; }
.side-card-offset { position: relative; }
.compact-form-grid { grid-template-columns: 1fr 1fr; }
.preline-text { white-space: pre-wrap; line-height: 1.9; color: #334155; }
.file-list { display: flex; flex-wrap: wrap; gap: 10px; }
.file-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid var(--soft-line);
    font-weight: 800;
}
.file-pill span { color: var(--primary-dark); font-size: 12px; }

.btn-danger {
    color: #b91c1c;
    background: #fff1f2;
    box-shadow: 0 10px 22px rgba(185,28,28,.08);
}
.btn-danger:hover { background: #ffe4e6; color: #991b1b; }

input[type="file"] {
    padding: 10px;
}
input[type="file"]::file-selector-button {
    border: 0;
    border-radius: 999px;
    padding: 9px 13px;
    margin-inline-end: 10px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 900;
    cursor: pointer;
}

@media (min-width: 1600px) {
    .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .filters { grid-template-columns: 1.4fr .9fr .9fr .9fr auto; }
}

@media (max-width: 1280px) {
    .create-report-layout,
    .policy-page-layout,
    .report-view-layout { grid-template-columns: 1fr; }
    .create-side-panel,
    .policy-form-card,
    .side-sticky { position: static; }
}

@media (max-width: 920px) {
    .main-content { width: min(100% - 28px, var(--container)); }
    .policy-search-box { grid-template-columns: 1fr; }
    .report-header { flex-direction: column; align-items: stretch; }
    .compact-form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .main-content { width: min(100% - 22px, var(--container)); }
    .policy-list { grid-template-columns: 1fr; }
    .form-actions-big { justify-content: stretch; }
}


/* === v3.2 polished writable filters === */
.reports-filters {
    grid-template-columns: minmax(260px, 1.4fr) minmax(190px, 1fr) minmax(170px, .85fr) minmax(170px, .85fr);
    gap: 14px;
    align-items: end;
}
.reports-filters .department-filter { grid-column: span 2; }
.reports-filters .filter-actions {
    margin: 0;
    align-self: end;
    justify-content: flex-start;
}
body.rtl .reports-filters .filter-actions { justify-content: flex-end; }
.combo-field { position: relative; }
.combo-shell { position: relative; }
.combo-input {
    padding-inline-end: 44px;
    min-height: 46px;
    border-radius: 16px;
    background: rgba(255,255,255,.96);
}
body.rtl .combo-input {
    padding-inline-end: 14px;
    padding-inline-start: 44px;
}
.combo-toggle {
    position: absolute;
    inset-inline-end: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 12px;
    background: #f1f5f9;
    color: #334155;
    cursor: pointer;
    font-weight: 900;
    line-height: 1;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}
body.rtl .combo-toggle {
    inset-inline-end: auto;
    inset-inline-start: 8px;
}
.combo-toggle:hover { background: var(--primary-soft); color: var(--primary-dark); }
.combo-field.open .combo-toggle { transform: translateY(-50%) rotate(180deg); }
.combo-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    inset-inline: 0;
    display: none;
    max-height: 250px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--soft-line);
    border-radius: 18px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 22px 50px rgba(15,23,42,.14);
    backdrop-filter: blur(18px);
}
.combo-field.open .combo-menu { display: grid; gap: 4px; animation: menuIn .14s ease both; }
.combo-option {
    display: flex;
    width: 100%;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: var(--text);
    padding: 10px 11px;
    text-align: start;
    cursor: pointer;
    font-weight: 850;
    transition: background .14s ease, color .14s ease;
}
.combo-option:hover,
.combo-option.is-active {
    background: #eff6ff;
    color: var(--primary-dark);
}
.combo-option[hidden] { display: none !important; }
.combo-option-rich {
    flex-direction: column;
    gap: 3px;
}
.combo-option-rich strong { font-size: 12px; color: var(--primary-dark); }
.combo-option-rich span { color: #475569; font-size: 12px; font-weight: 800; }
.muted-option { color: var(--muted); }

@media (min-width: 1600px) {
    .reports-filters {
        grid-template-columns: minmax(280px, 1.4fr) minmax(190px, 1fr) minmax(170px, .85fr) minmax(170px, .85fr);
    }
}

@media (max-width: 1100px) {
    .reports-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .reports-filters .department-filter { grid-column: auto; }
    .reports-filters .filter-actions { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    .reports-filters { grid-template-columns: 1fr; }
    .reports-filters .filter-actions { grid-column: auto; }
}

/* === v3.4 policy library improvements === */
.policy-edit-card {
    max-width: 980px;
    margin-inline: auto;
}
.policy-view-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(380px, .95fr);
    gap: 22px;
    align-items: start;
}
.policy-details-card,
.policy-preview-card { min-height: 360px; }
.policy-detail-grid > div {
    padding: 14px;
    border-radius: 18px;
    background: rgba(248,250,252,.78);
    border: 1px solid var(--soft-line);
}
.policy-detail-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    margin-bottom: 5px;
}
.policy-detail-grid strong {
    display: block;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}
.policy-section-box {
    margin-top: 16px;
    padding: 16px;
    border-radius: 20px;
    background: rgba(248,250,252,.76);
    border: 1px solid var(--soft-line);
}
.policy-section-box h3 {
    margin: 0 0 10px;
    font-size: 15px;
}
.policy-section-box p {
    margin: 0;
    line-height: 1.9;
    color: #334155;
}
.policy-preview-frame {
    width: 100%;
    min-height: 620px;
    border: 1px solid var(--soft-line);
    border-radius: 22px;
    background: #fff;
    overflow: hidden;
}
.image-preview {
    display: grid;
    place-items: center;
    padding: 12px;
}
.image-preview img {
    display: block;
    max-width: 100%;
    max-height: 680px;
    border-radius: 16px;
    object-fit: contain;
}
.policy-card .actions-row {
    gap: 8px;
}
.policy-card .actions-row .btn {
    padding: 9px 11px;
}
.policy-form-card .combo-menu,
.policy-edit-card .combo-menu {
    max-height: 310px;
}

@media (max-width: 1280px) {
    .policy-view-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .policy-preview-frame { min-height: 460px; }
}

/* Report policy attachment improvements */
.attached-policies-box {
    border: 1px solid rgba(37,99,235,.14);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(239,246,255,.82), rgba(240,253,250,.68));
    padding: 12px;
    margin: 14px 0;
}
.attached-policies-box h4,
.policy-subtitle-row h4 {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 900;
}
.policy-attached-list { max-height: 360px; }
.policy-mini-card.is-attached {
    background: #fff;
    border-color: rgba(37,99,235,.22);
    box-shadow: 0 14px 30px rgba(15,23,42,.06);
}
.policy-search-control { margin-top: 14px; }
.policy-subtitle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
}
.inline-form { display: inline-flex; margin: 0; }
.compact-empty {
    padding: 12px;
    margin: 12px 0;
    min-height: auto;
}
.policy-mini-actions .badge { align-self: center; }


/* v4 workflow additions */
.badge-yellow { background: #fef9c3; color: #854d0e; }
.dashboard-filter-card { margin-bottom: 0; }
.dashboard-filter-grid { align-items: end; }
.bar-fill.alt { background: linear-gradient(90deg, #06b6d4, #7c3aed); }
.policy-readonly-card { align-self: start; }
.report-header .badge-red, .badge-red { background:#fee2e2; color:#b91c1c; }
.report-header .badge-green, .badge-green { background:#dcfce7; color:#047857; }
.report-header .badge-orange, .badge-orange { background:#ffedd5; color:#c2410c; }
.report-header .badge-yellow, .badge-yellow { background:#fef9c3; color:#a16207; }
@media (max-width: 900px) {
  .dashboard-filter-grid { grid-template-columns: 1fr; }
}

/* v4.1 header actions + notifications */
.nav-quick-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-inline-start: auto;
    flex-wrap: wrap;
}
.nav-action-btn { min-height: 40px; padding: 0 12px; white-space: nowrap; }
.notification-trigger {
    position: relative;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: #f8fafc;
    box-shadow: 0 10px 24px rgba(15,23,42,.08);
    display: grid;
    place-items: center;
    font-size: 18px;
}
.notification-badge {
    position: absolute;
    inset-block-start: -5px;
    inset-inline-end: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
}
.notification-panel {
    width: min(380px, calc(100vw - 28px));
    max-height: 430px;
    overflow: auto;
    padding: 10px;
}
.notification-panel-title {
    font-weight: 900;
    padding: 10px 12px;
    color: var(--text);
}
.notification-item {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid transparent;
    transition: .18s ease;
}
.notification-item:hover { background: #f8fafc; border-color: var(--soft-line); }
.notification-item.unread { background: #eff6ff; border-color: #bfdbfe; }
.notification-item strong { font-size: 13px; }
.notification-item span { font-size: 12px; color: var(--muted); line-height: 1.6; }
.notification-item small { font-size: 11px; color: #94a3b8; }
.notification-empty { padding: 16px; color: var(--muted); font-weight: 800; text-align: center; }

.justification-locked-note,
.policy-full-card {
    border: 1px solid rgba(226,232,240,.9);
    border-radius: 20px;
    background: rgba(248,250,252,.9);
    padding: 14px;
    margin-top: 12px;
}
.policy-full-card h4 { margin: 0 0 8px; font-size: 17px; }
.policy-full-card .preline-text { margin: 10px 0 0; }
.inline-file-preview {
    margin-top: 12px;
    border: 1px solid var(--soft-line);
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
}
.file-preview-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--soft-line);
}
.inline-file-preview iframe {
    width: 100%;
    height: 440px;
    border: 0;
    display: block;
    background: #f8fafc;
}
.inline-file-preview img {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    background: #f8fafc;
}
.judgement-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

@media (max-width: 1180px) {
    .nav-quick-actions { order: 3; width: 100%; justify-content: center; }
    .nav-container { flex-wrap: wrap; }
}
@media (max-width: 680px) {
    .nav-action-btn { font-size: 12px; padding: 0 10px; }
    .notification-panel { inset-inline-end: auto; }
    .inline-file-preview iframe { height: 320px; }
}

/* v4.2 workflow, status colors, site modal, and dashboard chart */
.badge-black { background: #111827; color: #fff; }
.badge-crimson { background: #ffe4ed; color: #be123c; }
.report-header .badge-black { background: #111827; color: #fff; }
.report-header .badge-crimson { background: #ffe4ed; color: #be123c; }
.badge-blue { background: #e0f2fe; color: #0369a1; }
.report-header .badge-blue { background: #e0f2fe; color: #0369a1; }
.workflow-block {
    border: 1px solid rgba(226,232,240,.88);
    border-radius: 20px;
    padding: 16px;
    background: rgba(248,250,252,.82);
    margin-top: 12px;
}
.workflow-block h4,
.route-summary h4 { margin: 0 0 10px; font-size: 16px; }
.review-block { background: #fff7ed; border-color: #fed7aa; }
.second-justification-block { background: #eff6ff; border-color: #bfdbfe; }
.file-preview-grid { display: grid; gap: 14px; margin-top: 12px; }
.report-attachment-preview { margin-top: 0; }
.route-summary { display: grid; gap: 10px; margin-bottom: 12px; }
.soft-separator { border: 0; border-top: 1px solid var(--soft-line); margin: 18px 0; }

.site-confirm-modal { position: fixed; inset: 0; z-index: 9999; display: none; place-items: center; padding: 22px; }
.site-confirm-modal.open { display: grid; }
.site-confirm-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(8px); }
.site-confirm-card {
    position: relative;
    width: min(430px, 100%);
    border-radius: 28px;
    padding: 26px;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: 0 34px 100px rgba(15,23,42,.25);
    text-align: center;
    animation: modalIn .18s ease both;
}
.site-confirm-icon {
    width: 58px;
    height: 58px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    margin: 0 auto 14px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 25px;
}
.site-confirm-card h3 { margin: 0 0 8px; font-size: 22px; }
.site-confirm-card p { color: var(--muted); line-height: 1.8; margin: 0 0 18px; }
.site-confirm-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.vertical-chart {
    min-height: 260px;
    display: flex;
    align-items: end;
    gap: 18px;
    padding: 18px 8px 4px;
    overflow-x: auto;
}
.vertical-bar {
    min-width: 76px;
    height: 245px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    align-items: end;
    justify-items: center;
    gap: 8px;
}
.vertical-bar-track {
    width: 38px;
    height: 180px;
    border-radius: 999px 999px 12px 12px;
    background: #e8eef8;
    display: flex;
    align-items: end;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(15,23,42,.04);
}
.vertical-bar-fill {
    width: 100%;
    min-height: 10px;
    border-radius: inherit;
    background: linear-gradient(180deg, #06b6d4, #2563eb, #7c3aed);
}
.vertical-bar-value {
    font-weight: 900;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--soft-line);
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
}
.vertical-bar strong { font-size: 11px; color: var(--muted); white-space: nowrap; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 680px) {
    .vertical-chart { gap: 12px; }
    .vertical-bar { min-width: 64px; }
    .vertical-bar-track { width: 32px; height: 150px; }
}

/* v4.3 refinements */
.readonly-select,
select:disabled.readonly-select {
    background: #f8fafc;
    color: #334155;
    opacity: 1;
    cursor: not-allowed;
}
.standalone-form-card {
    position: static;
    max-width: 980px;
    margin: 0 auto;
}
.response-timeline { display: grid; gap: 14px; }
.response-round-block { background: linear-gradient(180deg, rgba(248,250,252,.94), rgba(255,255,255,.88)); }
.nested-review-block { margin-top: 14px; }
.department-vertical-chart {
    min-height: 320px;
    justify-content: center;
    align-items: end;
    padding-top: 30px;
}
.department-vertical-chart .vertical-bar { height: 292px; min-width: 82px; }
.department-vertical-chart .vertical-bar-track {
    width: 46px;
    height: 210px;
    border-radius: 13px 13px 7px 7px;
}
.department-vertical-chart .vertical-bar-fill {
    background: linear-gradient(180deg, #60a5fa, #2563eb);
    border-radius: 13px 13px 7px 7px;
}
.department-vertical-chart .dept-vertical-bar:nth-child(2n) .vertical-bar-fill { background: linear-gradient(180deg, #fbbf24, #f97316); }
.department-vertical-chart .dept-vertical-bar:nth-child(3n) .vertical-bar-fill { background: linear-gradient(180deg, #34d399, #059669); }
.department-vertical-chart .dept-vertical-bar:nth-child(4n) .vertical-bar-fill { background: linear-gradient(180deg, #f472b6, #e11d48); }
.department-vertical-chart .dept-vertical-bar:nth-child(5n) .vertical-bar-fill { background: linear-gradient(180deg, #a78bfa, #7c3aed); }
.department-vertical-chart .vertical-bar strong { max-width: 110px; font-size: 12px; }
@media (max-width: 780px) {
    .department-vertical-chart { justify-content: start; }
    .department-vertical-chart .vertical-bar { min-width: 72px; }
}


/* v4.4 refinements */
.clustered-dept-chart {
    padding: 12px 6px 2px;
}
.clustered-dept-plot {
    min-height: 285px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    padding: 24px 16px 20px;
    border-radius: 26px;
    background:
        repeating-linear-gradient(to top, transparent 0, transparent 58px, rgba(148,163,184,.28) 59px, transparent 60px),
        linear-gradient(180deg, rgba(255,255,255,.94), rgba(248,250,252,.65));
    overflow-x: auto;
}
.clustered-dept-bar {
    position: relative;
    height: 230px;
    min-width: 54px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    margin-inline: -1px;
    transition: transform .18s ease, filter .18s ease;
}
.clustered-dept-bar:hover { transform: translateY(-6px); filter: saturate(1.12); z-index: 2; }
.clustered-dept-fill {
    width: 46px;
    min-height: 16px;
    display: block;
    border-radius: 12px 12px 5px 5px;
    background: linear-gradient(180deg, #60a5fa, #2563eb);
    box-shadow: 0 18px 32px rgba(37,99,235,.22);
}
.clustered-dept-bar:nth-child(2n) .clustered-dept-fill { background: linear-gradient(180deg, #facc15, #f59e0b); box-shadow: 0 18px 32px rgba(245,158,11,.22); }
.clustered-dept-bar:nth-child(3n) .clustered-dept-fill { background: linear-gradient(180deg, #34d399, #10b981); box-shadow: 0 18px 32px rgba(16,185,129,.22); }
.clustered-dept-bar:nth-child(4n) .clustered-dept-fill { background: linear-gradient(180deg, #fb7185, #ef4444); box-shadow: 0 18px 32px rgba(239,68,68,.22); }
.clustered-dept-bar:nth-child(5n) .clustered-dept-fill { background: linear-gradient(180deg, #a78bfa, #7c3aed); box-shadow: 0 18px 32px rgba(124,58,237,.22); }
.clustered-dept-value {
    position: absolute;
    top: -2px;
    background: #fff;
    border: 1px solid var(--soft-line);
    box-shadow: 0 10px 24px rgba(15,23,42,.08);
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 900;
}
.clustered-dept-bar strong {
    position: absolute;
    bottom: -22px;
    max-width: 76px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    color: var(--muted);
}
.chart-help { margin: 12px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
@media (max-width: 760px) {
    .clustered-dept-plot { justify-content: flex-start; padding-inline: 10px; }
    .clustered-dept-bar { min-width: 48px; }
    .clustered-dept-fill { width: 40px; }
}

/* v4.5 routing message */
.routing-message-card { border-color: rgba(14,165,233,.22); background: linear-gradient(135deg, rgba(240,249,255,.96), rgba(255,255,255,.92)); }
.routing-message-block { background: rgba(240,249,255,.75); border-color: rgba(14,165,233,.20); }
.routing-message-block p { margin-bottom: 0; }

/* v4.6 routing position + improved dashboard department chart */
.routing-main-card {
    border-color: rgba(14,165,233,.18);
    background: linear-gradient(135deg, rgba(255,255,255,.97), rgba(240,249,255,.78));
}
.clustered-dept-chart { padding: 12px 0 0; }
.clustered-dept-plot {
    min-height: 320px;
    height: 320px;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    padding: 34px 28px 76px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.clustered-dept-bar {
    height: 215px;
    min-width: 82px;
    margin-inline: -4px;
    padding-inline: 0;
    isolation: isolate;
}
.clustered-dept-fill {
    width: 48px;
    border-radius: 14px 14px 6px 6px;
}
.clustered-dept-value { top: -16px; }
.clustered-dept-bar strong {
    bottom: -58px;
    width: 86px;
    max-width: 86px;
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
    line-height: 1.35;
    min-height: 34px;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.clustered-dept-bar:hover strong { color: var(--blue); font-weight: 900; }
@media (max-width: 760px) {
    .clustered-dept-plot { justify-content: flex-start; padding-inline: 18px; }
    .clustered-dept-bar { min-width: 76px; margin-inline: -3px; }
    .clustered-dept-fill { width: 44px; }
    .clustered-dept-bar strong { width: 78px; max-width: 78px; }
}


/* v4.7 dashboard chart value labels: show numbers at the bottom/start of the colored bars */
.clustered-dept-value {
    top: auto !important;
    bottom: 10px !important;
    z-index: 3;
    background: rgba(15,23,42,.82);
    color: #fff;
    border: 1px solid rgba(255,255,255,.28);
    box-shadow: 0 10px 24px rgba(15,23,42,.18);
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.clustered-dept-bar:hover .clustered-dept-value {
    background: rgba(15,23,42,.94);
    transform: translateY(-2px);
}

/* v4.8 dashboard chart: count incoming/target department reports, numbered axis, threshold line */
.bar-row-link {
    text-decoration: none;
    color: inherit;
    border-radius: 14px;
    padding: 6px 8px;
    transition: background .18s ease, transform .18s ease;
}
.bar-row-link:hover {
    background: rgba(37,99,235,.05);
    transform: translateX(-2px);
}
.chart-threshold-alert {
    margin: 6px 0 12px;
    padding: 10px 14px;
    border-radius: 16px;
    background: rgba(254, 226, 226, .72);
    border: 1px solid rgba(239, 68, 68, .22);
    color: #991b1b;
    font-weight: 800;
    font-size: 13px;
    line-height: 1.7;
}
.clustered-dept-stage {
    position: relative;
    min-height: 330px;
    height: 330px;
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.70));
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
    scrollbar-width: thin;
}
.clustered-dept-grid,
.clustered-dept-stage .clustered-dept-plot {
    position: absolute;
    inset: 30px 28px 72px 54px;
}
.clustered-dept-grid {
    pointer-events: none;
    z-index: 1;
    background: repeating-linear-gradient(
        to top,
        transparent 0,
        transparent 39px,
        rgba(148,163,184,.22) 40px,
        transparent 41px
    );
}
.clustered-dept-y-axis {
    position: absolute;
    top: 30px;
    bottom: 72px;
    left: 16px;
    width: 30px;
    z-index: 3;
    pointer-events: none;
}
.clustered-dept-y-axis span {
    position: absolute;
    left: 0;
    transform: translateY(50%);
    font-size: 11px;
    font-weight: 900;
    color: #64748b;
    background: rgba(255,255,255,.86);
    border: 1px solid rgba(226,232,240,.9);
    border-radius: 999px;
    min-width: 24px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(15,23,42,.06);
}
.dept-threshold-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 2px dashed #ef4444;
    z-index: 4;
}
.dept-threshold-line em {
    position: absolute;
    left: 8px;
    top: -15px;
    font-style: normal;
    font-size: 11px;
    font-weight: 950;
    color: #ef4444;
    background: #fff;
    border: 1px solid rgba(239,68,68,.35);
    border-radius: 999px;
    padding: 1px 8px;
    box-shadow: 0 8px 18px rgba(239,68,68,.14);
}
.clustered-dept-stage .clustered-dept-plot {
    min-height: 0 !important;
    height: auto !important;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    padding: 0 20px;
    border-radius: 0;
    background: transparent !important;
    overflow: visible !important;
    z-index: 2;
}
.clustered-dept-stage .clustered-dept-bar {
    position: relative;
    height: 100% !important;
    min-width: 56px;
    width: 56px;
    margin-inline: -1px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    transition: transform .18s ease, filter .18s ease;
}
.clustered-dept-stage .clustered-dept-bar:hover {
    transform: translateY(-5px);
    filter: saturate(1.16);
    z-index: 5;
}
.clustered-dept-stage .clustered-dept-fill {
    position: relative;
    width: 50px;
    min-height: 18px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-radius: 14px 14px 6px 6px;
    background: linear-gradient(180deg, #60a5fa, #2563eb);
    box-shadow: 0 18px 32px rgba(37,99,235,.22);
}
.clustered-dept-stage .clustered-dept-bar:nth-child(2n) .clustered-dept-fill { background: linear-gradient(180deg, #facc15, #f59e0b); box-shadow: 0 18px 32px rgba(245,158,11,.22); }
.clustered-dept-stage .clustered-dept-bar:nth-child(3n) .clustered-dept-fill { background: linear-gradient(180deg, #34d399, #10b981); box-shadow: 0 18px 32px rgba(16,185,129,.22); }
.clustered-dept-stage .clustered-dept-bar:nth-child(4n) .clustered-dept-fill { background: linear-gradient(180deg, #fb7185, #ef4444); box-shadow: 0 18px 32px rgba(239,68,68,.22); }
.clustered-dept-stage .clustered-dept-bar:nth-child(5n) .clustered-dept-fill { background: linear-gradient(180deg, #a78bfa, #7c3aed); box-shadow: 0 18px 32px rgba(124,58,237,.22); }
.clustered-dept-stage .clustered-dept-bar.hit-threshold .clustered-dept-fill {
    outline: 2px solid rgba(239,68,68,.45);
    outline-offset: 3px;
}
.clustered-dept-stage .clustered-dept-value {
    position: static !important;
    margin-bottom: 8px;
    background: rgba(15,23,42,.86);
    color: #fff;
    border: 1px solid rgba(255,255,255,.28);
    box-shadow: 0 10px 24px rgba(15,23,42,.18);
    border-radius: 999px;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 950;
}
.clustered-dept-stage .clustered-dept-bar strong {
    position: absolute;
    bottom: -52px;
    width: 74px;
    max-width: 74px;
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
    line-height: 1.3;
    min-height: 34px;
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.clustered-dept-stage .clustered-dept-bar:hover strong {
    color: var(--blue);
    font-weight: 950;
}
@media (max-width: 760px) {
    .clustered-dept-grid,
    .clustered-dept-stage .clustered-dept-plot { inset-inline-end: 18px; }
    .clustered-dept-stage .clustered-dept-plot { justify-content: flex-start; padding-inline: 14px; overflow: visible !important; }
    .clustered-dept-stage .clustered-dept-bar { min-width: 52px; width: 52px; }
    .clustered-dept-stage .clustered-dept-fill { width: 46px; }
}

/* v4.9: keep return-for-review fields directly under the latest justification response */
.review-action-block {
    margin-top: 14px;
    border-color: rgba(244, 63, 94, .22);
    background: linear-gradient(135deg, rgba(255, 241, 242, .92), rgba(255, 255, 255, .96));
}
.review-action-block textarea {
    min-height: 105px;
}

/* v5.0 system settings */
.settings-card .section-header.compact { margin-bottom: 18px; }
.settings-preview-card {
    position: relative;
    overflow: hidden;
    min-height: 340px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.settings-preview-card::before {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,.14), transparent 65%);
    inset-inline-end: -70px;
    top: -70px;
}
.settings-big-number {
    position: relative;
    z-index: 1;
    font-size: clamp(60px, 7vw, 112px);
    line-height: 1;
    font-weight: 950;
    letter-spacing: -.06em;
    color: #2563eb;
    text-shadow: 0 20px 45px rgba(37,99,235,.18);
    margin: 12px 0 8px;
}
.settings-preview-card h2,
.settings-preview-card p { position: relative; z-index: 1; }
.settings-preview-card p { color: var(--muted); line-height: 1.8; max-width: 560px; }
.settings-mini-chart {
    position: relative;
    z-index: 1;
    height: 130px;
    margin-top: 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(248,250,252,.9), rgba(255,255,255,.65));
    border: 1px solid rgba(226,232,240,.9);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    padding: 22px 30px 18px;
}
.settings-mini-chart::before {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    top: 20px;
    border-top: 2px dashed rgba(239,68,68,.8);
}
.settings-mini-chart i {
    position: absolute;
    top: 8px;
    inset-inline-start: 18px;
    font-style: normal;
    font-weight: 950;
    color: #ef4444;
    background: #fff;
    border-radius: 999px;
    border: 1px solid rgba(239,68,68,.25);
    padding: 2px 8px;
    font-size: 12px;
}
.settings-mini-bar {
    width: 34px;
    border-radius: 14px 14px 6px 6px;
    background: linear-gradient(180deg, #60a5fa, #2563eb);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: 20px;
    box-shadow: 0 18px 32px rgba(37,99,235,.20);
}
.settings-mini-bar:nth-child(2) { background: linear-gradient(180deg, #34d399, #10b981); }
.settings-mini-bar.limit { background: linear-gradient(180deg, #fb7185, #ef4444); }
.settings-mini-bar b {
    color: #fff;
    font-size: 11px;
    font-weight: 950;
    margin-bottom: 6px;
}

/* ===== July 2026 workflow upgrade ===== */
.draft-restore-note {
    margin: 10px 0 0;
    padding: 9px 12px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 10px;
    font-size: 13px;
}
.draft-actions { align-items: center; flex-wrap: wrap; }
.draft-status { color: var(--muted, #667085); font-size: 12px; }
.file-drop-zone {
    position: relative;
    min-height: 120px;
    border: 2px dashed #c7d5eb;
    border-radius: 14px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-align: center;
    background: #f8fbff;
    cursor: pointer;
    transition: .2s ease;
}
.file-drop-zone:hover,
.file-drop-zone.is-dragging { border-color: #2563eb; background: #eff6ff; transform: translateY(-1px); }
.file-drop-zone input[type=file] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.file-drop-zone span { color: #667085; font-size: 12px; }
.attachment-preview-list { display: grid; gap: 7px; margin-top: 10px; }
.attachment-preview-item {
    padding: 9px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    font-size: 13px;
}
.audit-card { overflow: hidden; }
.audit-timeline { position: relative; padding-inline-start: 12px; }
.audit-timeline::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    inset-inline-start: 18px;
    width: 2px;
    background: #dbeafe;
}
.audit-item {
    position: relative;
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 12px;
    padding: 8px 0 18px;
}
.audit-dot {
    position: relative;
    z-index: 1;
    width: 14px;
    height: 14px;
    margin-top: 5px;
    border-radius: 50%;
    border: 3px solid #fff;
    background: #2563eb;
    box-shadow: 0 0 0 2px #bfdbfe;
}
.audit-content {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
}
.audit-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.audit-title-row time, .audit-content small { color: #667085; font-size: 12px; }
.audit-detail { margin: 6px 0; font-size: 13px; }
.report-header-actions { margin: 0; justify-content: flex-end; }
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.pagination { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.pagination a, .pagination strong, .pagination span {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 9px;
    border-radius: 8px;
    border: 1px solid #d8e1ee;
    text-decoration: none;
    color: #253047;
    background: #fff;
}
.pagination strong { background: #2563eb; border-color: #2563eb; color: #fff; }
.pagination-summary { color: #667085; font-size: 13px; }
.page-size-label { display: flex; align-items: center; gap: 8px; }
.page-size-label select { min-width: 90px; }
.expanded-filters { grid-template-columns: repeat(4, minmax(150px, 1fr)); align-items: end; }
.expanded-dashboard-filters { grid-template-columns: repeat(5, minmax(145px, 1fr)); align-items: end; }
.reports-list-header { align-items: flex-start; }
.management-layout { align-items: start; }
.management-layout .actions-row { flex-wrap: wrap; }

@media (max-width: 1100px) {
    .expanded-filters, .expanded-dashboard-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .expanded-filters, .expanded-dashboard-filters { grid-template-columns: 1fr; }
    .report-header-actions { justify-content: flex-start; }
    .audit-title-row { align-items: flex-start; flex-direction: column; gap: 2px; }
    .pagination-wrap { align-items: flex-start; flex-direction: column; }
}

.automation-note {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px dashed #93c5fd;
    border-radius: 12px;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 13px;
}

/* ===== Reusable attachment uploader ===== */
.file-upload-control { width: 100%; }
.file-upload-control.compact .file-drop-zone,
.file-drop-zone.compact {
    min-height: 92px;
    padding: 16px;
}
.attachment-preview-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.attachment-preview-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.attachment-preview-details strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-preview-details span,
.attachment-preview-status {
    color: #667085;
    font-size: 12px;
}
.attachment-preview-item.is-invalid {
    border-color: #fecaca;
    background: #fff1f2;
}
.attachment-preview-item.is-invalid .attachment-preview-status { color: #dc2626; font-weight: 800; }
.management-form-page { max-width: 980px; margin-inline: auto; }
.custom-report-field { margin:18px 0 8px; padding:24px; border:1px solid #d9e2ef; border-inline-start:5px solid var(--primary); border-radius:14px; background:#fbfdff; box-shadow:0 5px 18px rgba(30,64,175,.05); }
.custom-report-field > label { display:block; margin-bottom:14px; font-size:17px; line-height:1.7; font-weight:600; color:#172033; }
.form-reference-link { display:block; width:min(100%,720px); margin:12px auto 20px; text-decoration:none; }
.form-reference-image { display:block; width:100%; max-height:560px; object-fit:contain; margin-bottom:7px; border:1px solid #dbe2ea; border-radius:10px; background:#fff; cursor:zoom-in; transition:transform .2s,box-shadow .2s; }
.form-reference-link:hover .form-reference-image { transform:translateY(-2px); box-shadow:0 10px 25px rgba(30,64,175,.14); }
.choice-grid { display:grid; gap:11px; padding:4px 0; }
.custom-report-field .choice-grid .choice-option { display:flex !important; flex-direction:row !important; align-items:center !important; justify-content:space-between !important; gap:16px !important; width:100%; min-height:48px; margin:0 !important; padding:11px 14px !important; border:1px solid #dbe2ea; border-radius:10px; background:#fff; cursor:pointer; font-size:15px; line-height:1.6; font-weight:400 !important; color:#263247; }
.custom-report-field .choice-option > span { display:block; flex:1 1 auto; width:auto; margin:0; padding:0; }
.custom-report-field .choice-option > input[type="checkbox"],
.custom-report-field .choice-option > input[type="radio"] { appearance:none !important; -webkit-appearance:none !important; display:block !important; position:static !important; width:20px !important; min-width:20px !important; max-width:20px !important; height:20px !important; min-height:20px !important; flex:0 0 20px !important; margin:0 !important; padding:0 !important; border:2px solid #8996a8 !important; border-radius:4px !important; background:#fff !important; box-shadow:none !important; }
.custom-report-field .choice-option > input[type="checkbox"]:checked,
.custom-report-field .choice-option > input[type="radio"]:checked { border-color:#1473e6 !important; background:#1473e6 !important; box-shadow:inset 0 0 0 4px #fff !important; }
.choice-grid-error { padding:10px; border:2px solid #dc2626; border-radius:12px; background:#fff5f5; }
[dir="rtl"] .choice-option { direction:rtl; text-align:right; }
[dir="ltr"] .choice-option { direction:ltr; text-align:left; }

/* Form-field management */
.secondary-language { display:block; margin-top:3px; color:var(--muted); font-weight:400; }
.field-editor-card { max-width:1050px; }
.option-builder { margin:24px 0; padding:22px; border:1px solid #dbe4f0; border-radius:16px; background:#f8fbff; }
.option-builder[hidden] { display:none !important; }
.option-builder-header { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:16px; }
.option-builder-header h3 { margin:0 0 4px; }
.option-builder-header p { margin:0; color:var(--muted); }
.option-list { display:grid; gap:10px; }
.option-row { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:12px 14px; border:1px solid #dce5f1; border-radius:12px; background:#fff; }
.option-row strong,.option-row small { display:block; }
.option-row small { margin-top:3px; color:var(--muted); direction:ltr; }
.option-row-actions { display:flex; gap:7px; }
.option-entry { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:14px; padding:16px; border:2px solid #bfdbfe; border-radius:14px; background:#fff; }
.option-entry[hidden] { display:none !important; }
.option-entry .actions-row { grid-column:1/-1; margin-top:0; }
.field-settings-grid { margin-top:22px; }
.current-field-image img { display:block; width:min(100%,520px); max-height:320px; object-fit:contain; border:1px solid #dbe4f0; border-radius:12px; background:#fff; }
.field-toggle-list { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.setting-check { display:inline-flex !important; align-items:center !important; gap:9px; min-height:44px; padding:9px 13px; border:1px solid #dbe4f0; border-radius:11px; background:#fff; font-weight:500; }
.setting-check input { width:19px !important; height:19px !important; margin:0 !important; padding:0 !important; flex:0 0 19px; }
.field-editor-actions { padding-top:20px; border-top:1px solid #e4eaf2; }
@media(max-width:700px){.option-builder-header{align-items:flex-start;flex-direction:column}.option-entry{grid-template-columns:1fr}.option-entry .actions-row{grid-column:1}.option-row{align-items:flex-start}.field-toggle-list{align-items:stretch;flex-direction:column}}

/* Workflow label editor */
.labels-editor-list { display:grid; gap:14px; margin-top:20px; }
.label-editor-row { display:grid; grid-template-columns:minmax(190px,.75fr) 1fr 1fr; align-items:end; gap:14px; padding:16px; border:1px solid #dfe7f1; border-radius:14px; background:#f9fbfe; }
.label-editor-title strong,.label-editor-title small { display:block; }
.label-editor-title small { margin-top:5px; color:var(--muted); direction:ltr; }
.table-actions { display:flex; gap:7px; align-items:center; flex-wrap:wrap; }
.table-actions form { margin:0; }

/* Responsive-only fixes: desktop design above 1280px remains unchanged */
@media (max-width:1280px) {
    html,body,.app-shell { max-width:100%; overflow-x:clip; }
    .nav-container { flex-wrap:nowrap !important; gap:8px; }
    .brand { order:1; min-width:0; flex:1 1 auto; }
    .nav-quick-actions { order:2 !important; width:auto !important; margin-inline-start:0; flex-wrap:nowrap; justify-content:flex-end; }
    .nav-quick-actions .nav-action-btn { display:none; }
    .notification-dropdown { order:3; }
    .nav-profile { order:4; }
    .menu-toggle { order:5; flex:0 0 46px; }
    .notification-panel { position:absolute !important; top:calc(100% + 10px) !important; inset-inline-start:auto !important; inset-inline-end:0 !important; width:min(380px,calc(100vw - 28px)) !important; max-height:min(430px,calc(100vh - 100px)) !important; padding:10px !important; border:1px solid rgba(226,232,240,.8) !important; background:rgba(255,255,255,.98) !important; box-shadow:var(--shadow) !important; overflow:auto !important; }
    .notification-dropdown:not(.open) > .notification-panel { opacity:0 !important; visibility:hidden !important; transform:translateY(8px) scale(.98) !important; }
    .notification-dropdown.open > .notification-panel { opacity:1 !important; visibility:visible !important; transform:none !important; }
    .main-content { width:min(var(--container),calc(100% - 28px)); }
    .wide-card,.report-header,.card,.topbar { max-width:100%; }
    .table-responsive { max-width:100%; overflow-x:auto; }
    .expanded-filters,.expanded-dashboard-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .label-editor-row { grid-template-columns:1fr 1fr; }
    .label-editor-title { grid-column:1/-1; }
}
@media (max-width:720px) {
    .top-navigation { padding:8px; backdrop-filter:none !important; -webkit-backdrop-filter:none !important; }
    .nav-container { min-height:62px; padding:7px 8px; border-radius:20px; backdrop-filter:none !important; -webkit-backdrop-filter:none !important; }
    .brand { gap:8px; padding:3px; }
    .brand-icon { width:42px; height:42px; flex-basis:42px; border-radius:14px; }
    .brand strong { font-size:14px; }
    .brand small { font-size:9px; }
    .notification-trigger,.menu-toggle { width:42px; height:42px; flex-basis:42px; border-radius:14px; }
    .nav-quick-actions { display:flex; flex:0 0 auto; }
    .nav-quick-actions .lang-switch { width:42px; height:42px; padding:0; display:grid; place-items:center; }
    .nav-menu { position:fixed !important; top:76px !important; bottom:auto !important; inset-inline:8px !important; width:auto !important; height:calc(100dvh - 84px) !important; min-height:0 !important; max-height:calc(100dvh - 84px) !important; padding:12px 12px 34px !important; border-radius:18px !important; overflow-x:hidden !important; overflow-y:auto !important; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; align-items:stretch !important; align-content:flex-start !important; z-index:1000 !important; }
    body.mobile-nav-open .nav-menu { display:flex !important; }
    body.mobile-nav-open { overflow-x:hidden; overflow-y:auto; }
    .nav-menu .nav-dropdown { flex:0 0 auto; }
    .nav-menu .nav-dropdown > .dropdown-panel,
    .nav-menu .nav-dropdown.open > .dropdown-panel { display:block !important; position:static !important; width:100% !important; max-height:none !important; padding:5px 0 9px !important; overflow:visible !important; opacity:1 !important; visibility:visible !important; transform:none !important; background:transparent !important; border:0 !important; box-shadow:none !important; }
    .nav-menu .nav-trigger .chevron { display:none; }
    .nav-menu .dropdown-panel { flex:0 0 auto; }
    .nav-menu .dropdown-item { min-height:46px; }
    .notification-panel { position:fixed !important; top:76px !important; inset-inline:8px !important; width:auto !important; max-height:calc(100vh - 88px) !important; }
    .main-content { width:calc(100% - 16px); padding-top:12px; }
    .topbar { margin-top:0; padding:16px; border-radius:20px; }
    .topbar h1 { font-size:28px; }
    .topbar p { font-size:13px; }
    .card,.report-header { padding:15px; border-radius:18px; }
    .actions-row,.report-header-actions,.section-header .actions-row { width:100%; }
    .actions-row .btn,.report-header-actions .btn,.section-header .btn { width:100%; }
    .expanded-filters,.expanded-dashboard-filters,.label-editor-row { grid-template-columns:1fr !important; }
    .label-editor-title { grid-column:auto; }
    .detail-item,.policy-card,.option-row { min-width:0; overflow-wrap:anywhere; }
    .table-actions { flex-direction:column; align-items:stretch; }
    .table-actions .btn,.table-actions form,.table-actions form button { width:100%; }

    /* No transitions/animations on phones; content must never stay hidden. */
    *,*::before,*::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
    .reveal,.reveal.is-visible { opacity:1 !important; visibility:visible !important; transform:none !important; }
    [data-reveal],.is-animating,.fade-in,.slide-in { opacity:1 !important; visibility:visible !important; transform:none !important; }
}

/* Short landscape devices: tablets, Nest Hub and low-height browser windows. */
@media (max-width:1280px) and (max-height:800px) {
    .top-navigation,.nav-container { backdrop-filter:none !important; -webkit-backdrop-filter:none !important; }
    .nav-menu { position:fixed !important; top:86px !important; bottom:auto !important; inset-inline:12px !important; width:auto !important; height:calc(100dvh - 96px) !important; min-height:0 !important; max-height:calc(100dvh - 96px) !important; padding:12px 12px 30px !important; border-radius:18px !important; overflow-x:hidden !important; overflow-y:auto !important; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; align-items:stretch !important; align-content:flex-start !important; z-index:1000 !important; }
    body.mobile-nav-open { overflow-x:hidden; overflow-y:auto; }
    body.mobile-nav-open .nav-menu { display:flex !important; }
    .nav-menu .nav-dropdown { flex:0 0 auto; }
    .nav-menu .nav-dropdown > .dropdown-panel,
    .nav-menu .nav-dropdown.open > .dropdown-panel { display:block !important; position:static !important; width:100% !important; max-height:none !important; padding:5px 0 9px !important; overflow:visible !important; opacity:1 !important; visibility:visible !important; transform:none !important; background:transparent !important; border:0 !important; box-shadow:none !important; }
    .nav-menu .nav-trigger .chevron { display:none !important; }
    .nav-menu .dropdown-item { min-height:44px; }
    .notification-panel { position:fixed !important; top:86px !important; bottom:auto !important; inset-inline:12px !important; width:auto !important; max-height:calc(100dvh - 96px) !important; overflow-y:auto !important; z-index:1001 !important; }
    *,*::before,*::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
    .reveal,.reveal.is-visible,[data-reveal],.is-animating,.fade-in,.slide-in { opacity:1 !important; visibility:visible !important; transform:none !important; }
}

/* ===== V2.8 compact mobile application layout ===== */
@media (max-width:720px) {
    .main-content { padding:8px 0 22px; }

    /* Compact page title instead of a large desktop hero. */
    .topbar { min-height:54px; margin:6px 0 10px; padding:9px 11px; border-radius:15px; box-shadow:0 8px 22px rgba(15,23,42,.07); }
    .topbar::after,.topbar .eyebrow,.topbar-title p { display:none !important; }
    .topbar-title { gap:9px; align-items:center; }
    .page-mark { width:36px; height:36px; flex:0 0 36px; border-radius:11px; font-size:18px; box-shadow:none; }
    .topbar h1 { margin:0; font-size:19px; line-height:1.25; }

    /* Denser cards and sections. */
    .grid,.report-main-column,.report-side-column,.flow-list,.labels-editor-list { gap:9px; }
    .card,.report-header,.wide-card { padding:11px; border-radius:15px; box-shadow:0 8px 24px rgba(15,23,42,.06); }
    .card-title { margin-bottom:9px; font-size:17px; }
    .section-header,.page-toolbar { gap:8px; margin-bottom:10px; }
    .section-header p,.page-toolbar p,.help { font-size:11px; line-height:1.5; }
    .report-header { gap:9px; margin-bottom:9px; }
    .report-header h2 { margin-bottom:7px; font-size:19px; }
    .report-header .actions-row { gap:6px; }
    .report-header .badge { padding:5px 7px; font-size:10px; }

    /* Two compact columns for short inputs and report details. */
    .form-grid,.spacious-grid,.compact-form-grid,.expanded-filters,.expanded-dashboard-filters { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:9px !important; }
    .form-group.full,.actions-row.full,.expanded-filters .actions-row,.expanded-dashboard-filters .actions-row { grid-column:1/-1; }
    .form-group { gap:5px; min-width:0; }
    .form-group label { font-size:11px; line-height:1.45; }
    input,select,textarea { min-width:0; padding:9px 10px; border-radius:11px; font-size:13px; }
    textarea { min-height:82px; line-height:1.55; }
    input[type="file"] { padding:7px; }
    input[type="file"]::file-selector-button { padding:7px 9px; }
    .form-section-label { margin:12px 0 7px; padding:6px 9px; font-size:10px; }
    .detail-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:7px; }
    .detail-item { padding:9px; border-radius:10px; }
    .detail-item span { margin-bottom:2px; font-size:10px; }
    .detail-item strong { font-size:12px; line-height:1.45; }

    /* Dashboard KPIs become a horizontal swipe row. */
    .grid-4:has(.stat-card) { display:flex !important; gap:9px; margin-inline:-8px; padding:0 8px 7px; overflow-x:auto; overflow-y:hidden; scroll-snap-type:x mandatory; overscroll-behavior-inline:contain; scrollbar-width:none; }
    .grid-4:has(.stat-card)::-webkit-scrollbar { display:none; }
    .grid-4:has(.stat-card) .stat-card { flex:0 0 148px; width:148px; min-height:88px; padding:11px; scroll-snap-align:start; }
    .stat-card strong { margin-top:4px; font-size:27px; }
    .stat-card span { font-size:11px; }
    .stat-card > span:last-child { width:38px; height:38px; border-radius:12px; font-size:18px; }
    .stat-card::after { width:80px; height:80px; }

    /* Compact dashboard filters and charts. */
    .dashboard-filter-card { padding:10px; }
    .dashboard-filter-grid .actions-row button { min-height:38px; }
    .chart-bars { gap:7px; }
    .bar-row { gap:7px; }
    .bar-row strong { font-size:11px; }
    .clustered-dept-chart { overflow-x:auto; }
    .clustered-dept-stage { min-width:520px; }

    /* Long new-report questions use tighter cards. */
    .create-report-layout,.report-view-layout { gap:9px; }
    .create-form-card { min-height:0; }
    .flow-card { display:none !important; }
    .custom-report-field { margin:8px 0 2px; padding:11px; border-inline-start-width:3px; border-radius:12px; box-shadow:none; }
    .custom-report-field > label { margin-bottom:7px; font-size:13px; line-height:1.5; }
    .choice-grid { gap:6px; }
    .custom-report-field .choice-grid .choice-option { min-height:38px; gap:8px !important; padding:7px 9px !important; border-radius:9px; font-size:12px; line-height:1.4; }
    .custom-report-field .choice-option > input[type="checkbox"],.custom-report-field .choice-option > input[type="radio"] { width:18px !important; min-width:18px !important; max-width:18px !important; height:18px !important; min-height:18px !important; flex-basis:18px !important; }
    .form-reference-link { width:100%; margin:7px auto 10px; }
    .form-reference-image { max-height:260px; border-radius:8px; }
    .draft-actions { display:grid; grid-template-columns:1fr 1fr; gap:7px; }
    .draft-actions .btn { width:100%; min-height:39px; padding:7px; font-size:11px; }
    .draft-actions .draft-status { grid-column:1/-1; font-size:10px; }

    /* Actions use compact button rows when space allows. */
    .actions-row { gap:6px; margin-top:10px; }
    .actions-row .btn,.report-header-actions .btn,.section-header .btn { min-height:38px; padding:7px 9px; border-radius:11px; font-size:11px; }
    .report-header-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
    .report-header-actions .btn:last-child:nth-child(odd) { grid-column:1/-1; }

    /* Lists, policies and admin editors. */
    .policy-list { gap:8px; }
    .policy-card,.policy-mini-card,.policy-full-card,.response-card,.workflow-block,.routing-main-card { padding:10px; border-radius:12px; }
    .policy-card h3,.policy-mini-card strong { font-size:14px; }
    .policy-summary,.policy-mini-card p { font-size:11px; line-height:1.55; -webkit-line-clamp:2; }
    .option-builder { margin:12px 0; padding:11px; border-radius:12px; }
    .option-row,.label-editor-row { padding:9px; border-radius:10px; }
    .labels-editor-list { max-height:65vh; overflow-y:auto; padding-inline-end:2px; }
    .table-responsive table { font-size:11px; }
    .table-responsive th,.table-responsive td { padding:8px 6px; }

    /* Keep only useful space in attachment controls. */
    .file-drop-zone { min-height:82px; padding:10px; border-radius:11px; }
    .file-drop-zone strong { font-size:12px; }
    .file-drop-zone span { font-size:10px; }
    .attachment-preview-item { padding:8px; }
}
