:root {
    --primary: #1463ff;
    --primary-dark: #0f2447;
    --accent: #ff980f;
    --success: #21b45b;
    --danger: #e53935;
    --warning: #ff980f;
    --purple: #7c3aed;
    --bg: #f8fbff;
    --surface: #ffffff;
    --line: #e6edf7;
    --muted: #7890b5;
    --text: #0e2a57;
    --shadow: 0 16px 50px rgba(15, 36, 71, .08);
    --radius: 18px;
    --font-family: "IBM Plex Sans Arabic", "Noto Kufi Arabic", "Cairo", Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: radial-gradient(circle at top right, #ffffff 0, #f8fbff 42%, #f7fbff 100%);
    color: var(--text);
    font-family: var(--font-family);
    font-size: 14px;
    direction: rtl;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
.app-shell { min-height: 100vh; }
.topbar {
    height: 74px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: 290px 1fr 310px;
    align-items: center;
    padding: 0 34px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; justify-content: flex-start; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 14px;
    background: conic-gradient(from 20deg, #ff980f, #ffb74d, #ff980f, #fff3df, #ff980f);
    position: relative;
}
.brand-mark:after {
    content: ""; position: absolute; inset: 12px; border-radius: 50%; background: #fff;
}
.brand-title { font-size: 18px; font-weight: 800; color: #0e2a57; }
.brand-subtitle { color: var(--muted); font-size: 12px; margin-top: 2px; }
.global-search { max-width: 520px; margin: 0 auto; position: relative; width: 100%; }
.global-search input {
    width: 100%; height: 48px; border: 1px solid var(--line); border-radius: 14px;
    background: #fff; padding: 0 46px 0 58px; color: var(--text); outline: none;
    box-shadow: inset 0 1px 2px rgba(15,36,71,.03);
}
.search-icon { position: absolute; right: 18px; top: 14px; color: #64799d; }
.user-area { display: flex; align-items: center; gap: 18px; justify-content: flex-end; direction: ltr; }
.icon-btn {
    width: 42px; height: 42px; border: 1px solid var(--line); background: #fff; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center; color: #607596; position: relative;
}
.icon-btn .counter { position: absolute; top: -7px; right: -7px; background: var(--accent); color:#fff; border-radius: 20px; font-size: 11px; min-width: 20px; height: 20px; display:flex; align-items:center; justify-content:center; border:2px solid #fff; }
.user-card { display: flex; gap: 12px; align-items: center; padding-left: 20px; border-left: 1px solid var(--line); direction: rtl; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: var(--shadow); background:#eef5ff; }
.user-name { font-weight: 800; color: #0e2a57; }
.user-role { color: var(--muted); font-size: 12px; }
.navbar {
    height: 64px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 22px; padding: 0 34px; overflow-x: auto; position: sticky; top:74px; z-index:19;
}
.nav-link { height:64px; display:flex; align-items:center; gap:8px; color:#486285; font-weight:700; border-bottom:3px solid transparent; white-space: nowrap; padding:0 6px; }
.nav-link.active { color: var(--primary); border-bottom-color: var(--primary); }
.nav-link.accent.active { color: var(--accent); border-bottom-color: var(--accent); }
.page { padding: 28px 34px 34px; }
.page-head { display:flex; justify-content:space-between; align-items:flex-start; gap:20px; margin-bottom:22px; }
.breadcrumb { color:#7086a9; font-size:13px; display:flex; gap:10px; align-items:center; margin-bottom:12px; }
.page-title { font-size:28px; font-weight:900; margin:0; color:#0d2a57; letter-spacing:-.3px; display:flex; align-items:center; gap:10px; }
.page-subtitle { color:var(--muted); margin-top:7px; }
.grid { display:grid; gap:18px; }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
    background: rgba(255,255,255,.95); border:1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 10px 35px rgba(15,36,71,.04); padding: 18px;
}
.stat-card { min-height:116px; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.stat-card .label { color:#425b80; font-weight:700; }
.stat-card .value { font-size:26px; font-weight:900; margin-top:8px; color:#12335f; }
.stat-card .hint { color:var(--muted); font-size:12px; margin-top:4px; }
.stat-card .icon {
    width:58px; height:58px; border-radius: 20px; display:flex; align-items:center; justify-content:center;
    background:#edf5ff; color:var(--primary); font-size:24px; flex:0 0 auto;
}
.icon.green { background:#eafaf0; color:var(--success); }
.icon.orange { background:#fff4e6; color:var(--accent); }
.icon.red { background:#fff0f0; color:var(--danger); }
.icon.purple { background:#f4ecff; color:var(--purple); }
.toolbar { display:flex; justify-content:space-between; gap:14px; align-items:center; flex-wrap:wrap; margin-bottom:16px; }
.tabs { display:flex; gap:6px; align-items:center; background:#f7faff; border:1px solid var(--line); border-radius:14px; padding:5px; }
.tab { padding:10px 18px; border-radius:10px; color:#587198; font-weight:700; border:0; background:transparent; }
.tab.active { background:var(--primary); color:#fff; box-shadow:0 8px 18px rgba(20,99,255,.2); }
.btn {
    border: 1px solid var(--line); background:#fff; color:var(--text); height:44px; border-radius:12px;
    display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:0 18px; font-weight:800; cursor:pointer;
}
.btn-primary { background: linear-gradient(180deg, #1970ff, #0758ed); color:#fff; border-color:#0b61ff; box-shadow:0 10px 28px rgba(20,99,255,.24); }
.btn-accent { background: linear-gradient(180deg, #ffab22, #ff8d00); color:#fff; border-color:#ff980f; box-shadow:0 10px 28px rgba(255,152,15,.22); }
.btn-danger { color:var(--danger); border-color:#ffd5d5; }
.btn-ghost { background:#f9fbff; }
.form-grid { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-group label { display:block; font-weight:800; margin-bottom:7px; color:#183963; }
.form-control {
    width:100%; height:44px; border:1px solid var(--line); border-radius:11px; background:#fff;
    padding:0 14px; color:#17365e; outline:none;
}
textarea.form-control { height:94px; padding-top:12px; resize:vertical; }
.form-control:focus { border-color:#98bdff; box-shadow:0 0 0 4px rgba(20,99,255,.08); }
.table-wrap { overflow:auto; border:1px solid var(--line); border-radius:14px; background:#fff; }
table { width:100%; border-collapse:collapse; min-width:760px; }
th, td { padding:13px 14px; border-bottom:1px solid var(--line); text-align:right; white-space:nowrap; }
th { background:#fbfdff; color:#496282; font-size:12px; font-weight:900; }
td { color:#24476f; }
tr:last-child td { border-bottom:0; }
.badge { display:inline-flex; align-items:center; justify-content:center; height:26px; border-radius:20px; padding:0 10px; font-weight:800; font-size:12px; }
.badge-green { background:#eafaf0; color:#178b48; }
.badge-blue { background:#ecf4ff; color:#1463ff; }
.badge-orange { background:#fff4e6; color:#e07a00; }
.badge-red { background:#fff0f0; color:#d42d2d; }
.badge-gray { background:#f1f4f9; color:#64799d; }
.actions { display:flex; gap:8px; }
.action-btn { width:34px; height:34px; border:1px solid var(--line); background:#fff; border-radius:9px; display:inline-flex; align-items:center; justify-content:center; color:#607596; cursor:pointer; }
.layout-2-1 { display:grid; grid-template-columns: 1fr 360px; gap:18px; align-items:start; }
.toggle { position:relative; width:48px; height:26px; display:inline-block; }
.toggle input { display:none; }
.toggle span { position:absolute; inset:0; background:#d8e0ec; border-radius:20px; transition:.2s; }
.toggle span:before { content:""; position:absolute; width:20px; height:20px; right:3px; top:3px; border-radius:50%; background:#fff; transition:.2s; box-shadow:0 2px 6px rgba(0,0,0,.15); }
.toggle input:checked + span { background:var(--primary); }
.toggle input:checked + span:before { right:25px; }
.login-screen { min-height:100vh; display:grid; place-items:center; padding:24px; background:linear-gradient(135deg,#f9fcff,#eef6ff); }
.login-card { width:min(440px,100%); background:#fff; border:1px solid var(--line); border-radius:26px; padding:30px; box-shadow:var(--shadow); }
.login-logo { display:flex; align-items:center; gap:12px; justify-content:center; margin-bottom:24px; }
.mobile-card { display:none; }
.footer { display:flex; justify-content:space-between; color:#7d91b1; padding:20px 4px; font-size:12px; }
@media (max-width: 1100px) {
    .topbar { grid-template-columns: 1fr; height:auto; gap:14px; padding:16px; }
    .brand { justify-content:center; }
    .user-area { display:none; }
    .navbar { top:0; height:60px; padding:0 16px; position:relative; }
    .page { padding:20px 16px 90px; }
    .grid-5, .grid-4, .grid-3, .grid-2, .layout-2-1 { grid-template-columns:1fr; }
    .form-grid, .form-grid.cols-3 { grid-template-columns:1fr; }
    .page-head { display:block; }
    .desktop-table { display:none; }
    .mobile-card { display:block; }
    .mobile-item { background:#fff; border:1px solid var(--line); border-radius:16px; padding:14px; margin-bottom:12px; box-shadow:0 8px 24px rgba(15,36,71,.04); }
    .mobile-row { display:flex; justify-content:space-between; gap:10px; padding:7px 0; border-bottom:1px dashed #edf2fa; }
    .mobile-row:last-child { border-bottom:0; }
    .bottom-nav { position:fixed; bottom:0; right:0; left:0; height:72px; background:#fff; border-top:1px solid var(--line); display:flex; justify-content:space-around; z-index:40; }
    .bottom-nav a { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; font-size:11px; color:#607596; }
    .bottom-nav a.active { color:var(--primary); }
}
@media (min-width: 1101px) { .bottom-nav { display:none; } }

.profile-hero { background: linear-gradient(135deg,#fff,#f6fbff); }
.patient-avatar { width:64px;height:64px;border-radius:22px;background:linear-gradient(180deg,var(--primary),#0a52dc);color:#fff;display:flex;align-items:center;justify-content:center;font-size:30px;font-weight:900;box-shadow:0 14px 35px rgba(20,99,255,.22); }
.info-list { display:grid; gap:12px; }
.info-list div { display:flex; justify-content:space-between; gap:16px; padding:11px 0; border-bottom:1px dashed var(--line); }
.info-list div:last-child { border-bottom:0; }
.info-list span { color:var(--muted); }
.info-list b { color:var(--text); text-align:left; }
@media (max-width:1100px){ .profile-hero .btn{width:100%;} }

.mb-18{margin-bottom:18px}.mt-18{margin-top:18px}.muted{color:var(--muted);line-height:1.8}.code-box{background:#f5f8ff;border:1px solid var(--line);border-radius:14px;padding:14px;direction:ltr;text-align:left;overflow:auto}.clean-list{margin:0;padding:0 18px;line-height:2}.progress{height:10px;border-radius:999px;background:#edf3fb;overflow:hidden}.progress span{display:block;height:100%;background:linear-gradient(90deg,var(--primary),var(--accent));border-radius:999px}.feature-card{display:block;min-height:150px;transition:.2s}.feature-card:hover{transform:translateY(-2px);box-shadow:var(--shadow)}.feature-icon{width:56px;height:56px;border-radius:18px;background:#edf5ff;color:var(--primary);display:flex;align-items:center;justify-content:center;font-weight:900;margin-bottom:12px}.feature-card h3{margin:0 0 8px}.feature-card p{margin:0;color:var(--muted);line-height:1.7}.tooth-grid{direction:ltr;text-align:center;line-height:4}.tooth{width:54px;height:54px;border:1px solid var(--line);border-radius:16px;background:#fff;color:var(--primary);font-weight:900;margin:4px;cursor:pointer}.tooth:hover{background:var(--primary);color:#fff}.full{grid-column:1/-1}.textarea{min-height:90px;padding-top:10px}.modal{position:fixed;inset:0;background:rgba(15,36,71,.35);display:none;align-items:center;justify-content:center;z-index:99;padding:20px}.modal.open{display:flex}.modal-card{background:#fff;border-radius:22px;border:1px solid var(--line);box-shadow:var(--shadow);width:min(720px,100%);padding:18px}.modal-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.modal-head h3{margin:0}.modal-close{border:0;background:#f4f7fb;border-radius:12px;width:38px;height:38px;font-size:22px;cursor:pointer}.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}
@media (max-width: 760px){.responsive-table thead{display:none}.responsive-table,.responsive-table tbody,.responsive-table tr,.responsive-table td{display:block;width:100%}.responsive-table tr{border:1px solid var(--line);border-radius:18px;margin-bottom:12px;padding:10px;background:#fff}.responsive-table td{border:0!important;display:flex;justify-content:space-between;gap:15px;padding:9px 4px!important}.responsive-table td:before{content:attr(data-label);font-weight:800;color:#607596}.grid-5,.grid-4,.grid-3,.grid-2{grid-template-columns:1fr!important}.form-grid,.form-grid.cols-3{grid-template-columns:1fr}.page{padding-bottom:95px}.topbar{grid-template-columns:1fr; height:auto; padding:12px 16px}.global-search,.user-area{display:none}.navbar{display:none}.page-title{font-size:22px}.page-head{display:block}.btn{width:100%;margin-top:8px}.bottom-nav{display:flex!important}}


/* === Clinicore 13.1 fixes: grouped menu, panels, modals, delete icons, scroll header === */
.grouped-navbar { overflow: visible; gap: 10px; justify-content: center; }
.nav-group { position: relative; }
.nav-group-toggle { cursor: pointer; background: transparent; border: 0; }
.nav-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 245px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: .18s ease;
    z-index: 60;
}
.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-menu-link { display:flex; align-items:center; gap:10px; padding:11px 12px; border-radius:13px; color:#607596; font-weight:700; }
.nav-menu-link:hover, .nav-menu-link.active { background:#eef5ff; color:var(--primary); }
.quick-panel {
    position: fixed;
    top: 82px;
    left: 32px;
    width: min(360px, calc(100vw - 32px));
    background:#fff;
    border:1px solid var(--line);
    border-radius:22px;
    box-shadow: var(--shadow);
    padding: 12px;
    z-index: 90;
    opacity:0;
    visibility:hidden;
    transform: translateY(8px);
    transition: .18s ease;
}
.quick-panel.open { opacity:1; visibility:visible; transform:translateY(0); }
.quick-panel-head { display:flex; justify-content:space-between; align-items:center; padding:8px 10px 12px; border-bottom:1px solid var(--line); }
.quick-panel-close { width:34px; height:34px; border:0; background:#f4f7fb; border-radius:11px; cursor:pointer; font-size:20px; }
.quick-panel-item { padding:12px 10px; border-bottom:1px dashed var(--line); display:grid; gap:4px; }
.quick-panel-item:last-child { border-bottom:0; }
.quick-panel-item span { color:var(--muted); font-size:13px; line-height:1.6; }
body.hide-header-on-scroll-enabled .topbar { transition: transform .25s ease, opacity .25s ease; }
body.topbar-hidden .topbar { transform: translateY(-110%); opacity:0; pointer-events:none; }
.action-btn, button.action-btn { border:1px solid var(--line); background:#fff; color:#607596; width:36px; height:36px; display:inline-flex; align-items:center; justify-content:center; border-radius:12px; cursor:pointer; padding:0; }
.action-btn:hover { color:var(--primary); border-color:#c9d9ff; background:#f3f7ff; }
.action-btn.danger:hover, .js-delete-form .action-btn:hover, [data-confirm-delete] .action-btn:hover { color:var(--danger); background:#fff5f5; border-color:#ffc9c9; }
.actions { display:flex; gap:8px; align-items:center; }
.modal { backdrop-filter: blur(4px); }
.modal-card { max-height: calc(100vh - 50px); overflow:auto; }
.modal-shake .modal-card { animation: modalShake .22s ease; }
@keyframes modalShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(6px)} 75%{transform:translateX(-6px)} }
.modal-note { font-size:12px; color:var(--muted); margin-top:8px; }
@media (max-width: 1100px) {
    .quick-panel { top: 16px; left: 16px; right: 16px; width:auto; }
    .grouped-navbar { display:none; }
}


/* === Clinicore 13.2 Professional Audit Fixes === */
.brand-logo-img {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 12px 26px rgba(15,36,71,.08);
}
.topbar {
    transition: transform .24s ease, opacity .24s ease;
    will-change: transform;
}
.navbar {
    height: 50px;
    top: 74px;
    gap: 10px;
    padding: 0 34px;
    overflow: visible;
    transition: top .24s ease, box-shadow .24s ease, border-color .24s ease;
    will-change: top;
}
body.topbar-hidden .topbar {
    transform: translateY(-110%);
    opacity: 0;
    pointer-events: none;
}
body.topbar-hidden .navbar {
    top: 0;
    box-shadow: 0 14px 35px rgba(15,36,71,.08);
    border-color: rgba(230,237,247,.85);
}
.grouped-navbar {
    justify-content: center;
}
.mega-nav-group {
    position: relative;
}
.nav-link,
.nav-group-toggle {
    height: 50px;
    min-width: 165px;
    border: 0;
    border-radius: 13px;
    padding: 0 14px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
}
.nav-group-toggle.active,
.nav-group:hover .nav-group-toggle,
.nav-group:focus-within .nav-group-toggle {
    background: #eef5ff;
    color: var(--primary);
    border-bottom-color: transparent;
}
.nav-group-title {
    line-height: 1;
}
.nav-arrow {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    line-height: 1;
    font-size: 14px;
    margin-top: 1px;
    transition: transform .18s ease;
}
.nav-group:hover .nav-arrow,
.nav-group:focus-within .nav-arrow,
.nav-group.open .nav-arrow {
    transform: rotate(180deg);
}
.mega-nav-menu {
    min-width: 780px;
    max-width: min(880px, calc(100vw - 70px));
    display: grid;
    grid-template-columns: repeat(3, minmax(190px, 1fr));
    gap: 12px;
    padding: 14px;
    top: calc(100% + 8px);
}
.nav-menu-section {
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 8px;
    border-radius: 16px;
    background: #fbfdff;
    border: 1px solid #edf3fb;
}
.nav-menu-section h4 {
    margin: 0 0 6px;
    padding: 0 8px 8px;
    border-bottom: 1px dashed var(--line);
    color: #17365e;
    font-size: 13px;
    font-weight: 900;
}
.nav-menu-link {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
}
.nav-menu-link .menu-icon {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    background: #eef5ff;
    color: var(--primary);
    flex: 0 0 auto;
}
.quick-panel {
    top: 64px;
}
body:not(.topbar-hidden) .quick-panel {
    top: 82px;
}
.modal {
    z-index: 9999;
}
.modal-card {
    animation: modalEnter .18s ease both;
}
@keyframes modalEnter {
    from { transform: translateY(14px) scale(.98); opacity: .7; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
body.modal-is-open {
    overflow: hidden;
}
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}
.branding-preview {
    border: 1px dashed #b8cdfa;
    border-radius: 18px;
    min-height: 140px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #fbfdff, #f3f8ff);
    padding: 18px;
}
.branding-preview img {
    max-width: 130px;
    max-height: 90px;
    object-fit: contain;
}
.favicon-preview img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}
.file-help {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
    margin-top: 6px;
}
@media (max-width: 1100px) {
    .navbar { display: none; }
    .mega-nav-menu { min-width: auto; grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .topbar { transform: none !important; opacity: 1 !important; }
    body.topbar-hidden .topbar { transform: none !important; opacity: 1 !important; }
}

.details-grid { display: grid; gap: 10px; }
.details-grid div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.details-grid div:last-child { border-bottom: 0; }
.details-grid span { color: var(--muted); font-weight: 800; }
.details-grid b { color: var(--text); text-align: left; white-space: normal; }


/* === Clinicore 13.3 Final UI Repair: no global horizontal scroll, centered mega menu, mobile full menu === */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}
body.modal-is-open,
body.mobile-menu-open {
    overflow: hidden;
}
.app-shell,
.page,
.card,
.table-wrap,
.layout-2-1,
.grid {
    max-width: 100%;
    min-width: 0;
}
.table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}
.responsive-table {
    width: 100%;
}
.grouped-navbar {
    overflow: visible !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 24px !important;
}
.navbar {
    overflow: visible !important;
    height: 48px !important;
    min-height: 48px !important;
}
.nav-link,
.nav-group-toggle {
    height: 42px !important;
    min-width: 170px;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}
.nav-arrow,
.mobile-section-arrow {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    vertical-align: middle !important;
}
.mega-nav-menu,
.nav-menu {
    right: auto !important;
    left: 50% !important;
    transform: translate(-50%, 8px) !important;
    transform-origin: top center;
    max-width: min(780px, calc(100vw - 48px)) !important;
    z-index: 1000 !important;
}
.nav-group:hover .mega-nav-menu,
.nav-group:focus-within .mega-nav-menu,
.nav-group.open .mega-nav-menu,
.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu,
.nav-group.open .nav-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translate(-50%, 0) !important;
}
.mega-nav-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}
body.topbar-hidden .navbar {
    top: 0 !important;
}
.mobile-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-direction: column;
    box-shadow: 0 10px 26px rgba(15, 36, 71, .06);
    cursor: pointer;
}
.mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    border-radius: 99px;
    background: var(--primary-dark);
    display: block;
}
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 36, 71, .34);
    backdrop-filter: blur(3px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: .2s ease;
}
.mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(390px, 92vw);
    height: 100dvh;
    background: #fff;
    border-left: 1px solid var(--line);
    box-shadow: -20px 0 60px rgba(15, 36, 71, .14);
    z-index: 10001;
    transform: translateX(105%);
    transition: transform .24s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body.mobile-menu-open .mobile-menu-overlay {
    opacity: 1;
    visibility: visible;
}
body.mobile-menu-open .mobile-menu-drawer {
    transform: translateX(0);
}
.mobile-menu-head {
    min-height: 72px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}
.mobile-menu-head b {
    display: block;
    font-size: 17px;
    color: var(--primary-dark);
}
.mobile-menu-head span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}
.mobile-menu-close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 13px;
    background: #f3f7ff;
    color: var(--primary-dark);
    font-size: 24px;
    cursor: pointer;
}
.mobile-menu-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}
.mobile-menu-search input {
    width: 100%;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 14px;
    outline: 0;
    padding: 0 14px;
    color: var(--text);
    background: #fbfdff;
}
.mobile-menu-content {
    overflow-y: auto;
    padding: 14px;
}
.mobile-menu-group {
    margin-bottom: 16px;
}
.mobile-menu-group h3 {
    margin: 0 0 10px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 900;
}
.mobile-menu-section {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfdff;
    margin-bottom: 10px;
    overflow: hidden;
}
.mobile-section-toggle {
    width: 100%;
    min-height: 46px;
    border: 0;
    background: #fff;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 900;
    color: var(--primary-dark);
    cursor: pointer;
}
.mobile-section-links {
    display: grid;
    gap: 4px;
    padding: 8px;
}
.mobile-menu-section.collapsed .mobile-section-links {
    display: none;
}
.mobile-menu-section.collapsed .mobile-section-arrow {
    transform: rotate(90deg);
}
.mobile-menu-link {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 13px;
    color: #526b91;
    font-weight: 800;
}
.mobile-menu-link.active,
.mobile-menu-link:hover {
    background: #eef5ff;
    color: var(--primary);
}
.mobile-menu-icon {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 11px;
    background: #eef5ff;
    color: var(--primary);
}
@media (max-width: 1100px) {
    .topbar {
        height: 66px !important;
        grid-template-columns: auto 1fr auto !important;
        padding: 0 14px !important;
        gap: 10px;
    }
    .mobile-menu-toggle {
        display: inline-flex !important;
        order: -1;
    }
    .brand {
        min-width: 0;
    }
    .brand-title {
        font-size: 15px;
        max-width: 190px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .brand-subtitle {
        display: none;
    }
    .brand-logo-img,
    .brand-mark {
        width: 40px !important;
        height: 40px !important;
        border-radius: 13px !important;
    }
    .user-area,
    .global-search {
        display: none !important;
    }
    .navbar,
    .grouped-navbar {
        display: none !important;
    }
    .page {
        padding: 18px 14px 96px !important;
    }
    .toolbar {
        align-items: stretch;
    }
    .toolbar > * {
        max-width: 100% !important;
    }
    .btn {
        min-height: 44px;
    }
}
@media (max-width: 760px) {
    .bottom-nav {
        max-width: 100vw;
        left: 0;
        right: 0;
    }
    .card {
        padding: 14px;
    }
    .modal {
        padding: 10px;
    }
    .modal-card {
        width: 100%;
        border-radius: 18px;
        max-height: calc(100dvh - 20px);
    }
    .responsive-table tr {
        max-width: 100%;
    }
}
