/* =========================================
   ROOT / THEME
========================================= */

:root {
    --bg: #f3f5f9;
    --panel: #fff;
    --ink: #192333;
    --muted: #657386;
    --line: #e3e8f0;
    --blue: #0959ed;
    --red: #e51b38;
    --sidebar: #101b2d;
    --side-ink: #b7c4da;
    --shadow: 0 8px 30px #18264306;
    --good: #147952;
    --warn: #996015;
    --bad: #be2943;
    --tint: #edf3ff;

    color-scheme: light;
}


body.dark {
    --bg: #131b29;
    --panel: #1c2739;
    --ink: #edf2fb;
    --muted: #a4b3ca;
    --line: #314057;
    --tint: #233956;
    --good: #78ddb0;
    --warn: #f5c477;
    --bad: #ff8ba0;

    color-scheme: dark;
}


/* =========================================
   RESET / BASE
========================================= */

* {
    box-sizing: border-box;
}


body {
    margin: 0;

    background: var(--bg);
    color: var(--ink);

    font: 15px/1.55 'Segoe UI', Arial, sans-serif;
}


button,
input,
textarea,
select {
    font: inherit;
}


button,
a {
    touch-action: manipulation;
}


button {
    border: 0;

    cursor: pointer;
}


button:disabled {
    cursor: not-allowed;

    opacity: .5;
}


a {
    color: inherit;

    text-decoration: none;
}


h1,
h2,
h3,
p {
    margin: 0;
}


h1 {
    font-size: 32px;
    line-height: 1.2;
    letter-spacing: -1px;
}


h2 {
    font-size: 21px;
    line-height: 1.3;
}


h3 {
    font-size: 17px;
}


input,
select,
textarea {
    max-width: 100%;
    min-height: 44px;

    padding: 11px 13px;

    background: var(--panel);
    color: var(--ink);

    border: 1px solid var(--line);
    border-radius: 9px;
}


input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}


a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 3px solid #4a8aff;
    outline-offset: 3px;
}


[hidden] {
    display: none !important;
}


/* =========================================
   ACCESSIBILITY
========================================= */

.skip {
    position: fixed;
    top: -100px;
    left: 10px;

    z-index: 100;

    padding: 12px;

    background: var(--panel);
}


.skip:focus {
    top: 10px;
}


/* =========================================
   GENERAL
========================================= */

.eyebrow {
    display: block;

    margin-bottom: 9px;

    color: var(--muted);

    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.8px;
}


/* =========================================
   BUTTONS
========================================= */

.primary,
.secondary,
.danger,
.text-button,
.icon-button {
    min-height: 42px;

    padding: 10px 18px;

    border-radius: 9px;

    font-weight: 600;
}


.primary {
    background: var(--blue);
    color: #fff;
}


.primary:hover {
    background: #0046c5;
}


.secondary {
    background: var(--panel);
    color: var(--ink);

    border: 1px solid var(--line);
}


.danger {
    background: #ffecf0;
    color: #b2213a;
}


.text-button {
    padding: 8px 12px;

    background: transparent;
    color: var(--muted);
}


.text-button:hover {
    background: var(--tint);
    color: var(--blue);
}


.icon-button {
    padding: 8px 12px;

    background: transparent;
    color: var(--muted);

    font-size: 21px;
}


/* =========================================
   BRAND
========================================= */

.brand {
    display: flex;
    align-items: center;

    gap: 12px;

    color: white;
}


.brand img {
    width: 54px;
    height: 54px;

    border-radius: 12px;
}


.brand > span {
    font-size: 24px;
    font-weight: 850;
    line-height: 1.05;
    letter-spacing: .5px;
}


.brand b {
    display: block;

    margin-top: 7px;

    color: #b7c4da;

    font-size: 10px;
    letter-spacing: 1.6px;
}


/* =========================================
   APPLICATION
========================================= */

.application {
    display: flex;

    min-height: 100vh;
}


/* =========================================
   SIDEBAR
========================================= */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;

    z-index: 10;

    width: 250px;
    flex: 0 0 250px;

    padding: 24px 16px;

    overflow-y: auto;

    background: var(--sidebar);
    color: var(--side-ink);
}


.sidebar .brand {
    padding: 0 8px 25px;

    border-bottom: 1px solid #ffffff12;
}


.workspace-tag {
    padding: 26px 15px 12px;

    color: #8296b4;

    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.8px;
}


.sidebar nav > a,
.sidebar summary {
    display: flex;
    align-items: center;

    gap: 13px;

    min-height: 46px;

    padding: 12px 15px;

    border-radius: 8px;

    font-size: 14px;

    cursor: pointer;
    list-style: none;
}


.sidebar summary::-webkit-details-marker {
    display: none;
}


.sidebar summary::after {
    content: '›';

    margin-left: auto;

    font-size: 18px;
}


.sidebar details[open] > summary::after {
    transform: rotate(90deg);
}


.sidebar nav > a.active {
    background: var(--blue);
    color: white;

    box-shadow: 0 4px 15px #0959ed44;
}


.sidebar summary:hover,
.sidebar nav > a:hover {
    background: #ffffff0b;
    color: white;
}


.sidebar nav > a.active:hover {
    background: var(--blue);
}


.nav-symbol {
    width: 23px;

    color: #8ea6ca;

    font-size: 19px;
    text-align: center;
}


.sidebar .active .nav-symbol {
    color: white;
}


.submenu {
    margin: 2px 0 9px 26px;
    padding: 3px 0 3px 10px;

    border-left: 1px solid #384359;
}


.submenu a {
    display: block;

    padding: 9px 12px;

    border-radius: 6px;

    font-size: 13px;
    line-height: 1.4;
}


.submenu a:hover,
.submenu a.active {
    background: #ffffff0b;
    color: #fff;
}


.submenu a.active {
    box-shadow: inset 3px 0 var(--blue);
}


.website-link {
    display: block;

    margin: 26px 12px 0;
    padding: 17px 0;

    border-top: 1px solid #ffffff12;

    font-size: 13px;
}


/* =========================================
   WORKSPACE
========================================= */

.workspace {
    width: calc(100% - 250px);
    min-width: 0;

    margin-left: 250px;
}


/* =========================================
   TOPBAR
========================================= */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    min-height: 88px;

    padding: 18px 35px;

    background: var(--panel);

    border-bottom: 1px solid var(--line);
}


.breadcrumb {
    color: var(--muted);

    font-size: 12px;
    letter-spacing: 1px;
}


.breadcrumb span {
    margin: 0 12px;

    color: #a7b1c1;
}


.breadcrumb b {
    color: var(--ink);

    font-weight: 600;
    letter-spacing: 0;
}


.topbar-right {
    display: flex;
    align-items: center;

    gap: 12px;
}


.branch-label {
    color: var(--muted);

    font-size: 12px;
}


#branch {
    max-width: 180px;
    min-height: 39px;

    padding: 8px 11px;

    font-size: 13px;
}


.profile {
    display: flex;
    align-items: center;

    gap: 10px;

    background: transparent;
    color: var(--ink);

    font-size: 13px;
}


.profile > span:first-child {
    display: grid;
    place-items: center;

    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    aspect-ratio: 1 / 1;

    background: var(--tint);
    color: var(--blue);

    border-radius: 50%;

    font-weight: 800;
}


.profile small {
    display: block;

    color: var(--muted);

    font-size: 11px;
    text-align: left;
}


#menu-toggle {
    display: none;
}


/* =========================================
   MAIN
========================================= */

main {
    max-width: 1800px;
    min-height: calc(100vh - 155px);

    margin: auto;
    padding: 35px;
}


/* =========================================
   PAGE TOP
========================================= */

.page-top {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 28px;
}


.page-top p {
    margin-top: 9px;

    color: var(--muted);

    font-size: 14px;
}


.page-top .actions {
    display: flex;
    flex-wrap: wrap;

    gap: 10px;
}


.date-tag {
    padding: 10px 14px;

    background: var(--panel);
    color: var(--muted);

    border: 1px solid var(--line);
    border-radius: 8px;

    font-size: 13px;

    white-space: nowrap;
}


/* =========================================
   STATS
========================================= */

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));

    gap: 18px;

    margin-bottom: 25px;
}


.stat {
    position: relative;

    padding: 23px;

    background: var(--panel);

    border: 1px solid var(--line);
    border-radius: 13px;

    box-shadow: var(--shadow);
}


.stat-icon {
    display: grid;
    place-items: center;

    width: 39px;
    height: 39px;

    margin-bottom: 20px;

    background: var(--tint);
    color: var(--blue);

    border-radius: 10px;

    font-size: 20px;
}


.stat:nth-child(2) .stat-icon {
    background: #fff0f3;
    color: var(--red);
}


.stat:nth-child(3) .stat-icon {
    background: #e8f7f4;
    color: #14837b;
}


.stat strong {
    display: block;

    font-size: 31px;
    line-height: 1.15;
    letter-spacing: -1px;
}


.stat-label {
    display: block;

    margin-top: 8px;

    color: var(--muted);

    font-size: 13px;
}


.stat small {
    display: block;

    margin-top: 15px;

    color: var(--muted);

    font-size: 12px;
}


/* =========================================
   DASHBOARD
========================================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.7fr 1fr;

    gap: 24px;

    margin-bottom: 24px;
}


/* =========================================
   PANEL
========================================= */

.panel {
    overflow: hidden;

    background: var(--panel);

    border: 1px solid var(--line);
    border-radius: 13px;

    box-shadow: var(--shadow);
}


.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 24px 25px;

    border-bottom: 1px solid var(--line);
}


.panel-head h2 {
    font-size: 17px;
}


.panel-head p {
    margin-top: 4px;

    color: var(--muted);

    font-size: 12px;
}


/* =========================================
   CHART
========================================= */

.chart {
    display: flex;
    align-items: end;

    gap: 20px;

    height: 255px;

    padding: 30px 30px 24px;
}


.chart-column {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: end;

    gap: 9px;

    min-width: 0;
    height: 100%;
}


.bar {
    width: 100%;
    max-width: 48px;
    min-height: 3px;

    background: #0a5bea;

    border-radius: 6px 6px 0 0;
}


.chart-column:last-child .bar {
    background: var(--red);
}


.chart-count,
.chart-month {
    color: var(--muted);

    font-size: 12px;
}


.chart-month {
    white-space: nowrap;
}


/* =========================================
   QUICK LIST
========================================= */

.quick-list {
    padding: 10px 23px;
}


.quick-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 17px 0;

    border-bottom: 1px solid var(--line);

    font-size: 14px;
}


.quick-list a:last-child {
    border: 0;
}


.quick-list b {
    color: var(--blue);

    font-size: 18px;
}


.quick-list span {
    color: var(--muted);
}


/* =========================================
   NOTICE
========================================= */

.notice {
    margin-bottom: 22px;
    padding: 16px 20px;

    background: var(--tint);
    color: var(--muted);

    border: 1px solid var(--line);
    border-radius: 10px;

    font-size: 14px;
}


.notice strong {
    color: var(--ink);
}


.notice a {
    color: var(--blue);

    font-weight: 700;
}


/* =========================================
   TOOLBAR / SEARCH
========================================= */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 14px;

    padding: 20px 24px;

    border-bottom: 1px solid var(--line);
}


.search-form {
    display: flex;

    gap: 8px;

    width: 450px;
    max-width: 100%;
}


.search-form input {
    width: 100%;
    min-width: 0;
}


/* =========================================
   TABLE
========================================= */

.table-scroll {
    overflow: auto;
}


table {
    width: 100%;

    border-collapse: collapse;

    text-align: left;
    white-space: nowrap;
}


th {
    padding: 14px 24px;

    background: var(--bg);
    color: var(--muted);

    border-bottom: 1px solid var(--line);

    font-size: 11px;
    font-weight: 800;
    letter-spacing: .6px;
    text-transform: uppercase;
}


td {
    max-width: 290px;

    padding: 17px 24px;

    overflow: hidden;

    border-bottom: 1px solid var(--line);

    font-size: 13px;

    text-overflow: ellipsis;
}


td .cell-sub {
    display: block;

    margin-top: 3px;

    color: var(--muted);

    font-size: 11px;
}


tbody tr:last-child td {
    border-bottom: 0;
}


tbody tr:hover {
    background: var(--tint);
}


.record-name {
    font-weight: 650;
}


/* =========================================
   BADGES
========================================= */

.badge {
    display: inline-flex;

    padding: 4px 9px;

    background: var(--bg);
    color: var(--muted);

    border-radius: 6px;

    font-size: 11px;
    font-weight: 700;
}


.badge.good {
    background: #e3f6ec;
    color: #146b45;
}


.badge.warn {
    background: #fff3db;
    color: #8d6111;
}


.badge.bad {
    background: #ffe8ed;
    color: #b1203d;
}


.badge.info {
    background: #e8f0ff;
    color: #1553b0;
}


/* =========================================
   ROW ACTIONS
========================================= */

.row-actions {
    display: flex;

    gap: 7px;
}


.row-actions button {
    min-height: 32px;

    padding: 6px 10px;

    background: var(--panel);
    color: var(--blue);

    border: 1px solid var(--line);
    border-radius: 7px;

    font-size: 12px;
}


.row-actions .void {
    color: var(--bad);
}


/* =========================================
   PAGINATION
========================================= */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 18px 24px;

    color: var(--muted);

    font-size: 13px;
}


.pagination > div {
    display: flex;

    gap: 9px;
}


.pagination button {
    min-height: 36px;

    padding: 7px 13px;
}


/* =========================================
   EMPTY STATE
========================================= */

.empty {
    padding: 55px 25px;

    text-align: center;
    white-space: normal;
}


.empty-icon {
    display: block;

    margin-bottom: 15px;

    color: var(--blue);

    font-size: 34px;
}


.empty h2 {
    margin-bottom: 9px;

    font-size: 20px;
}


.empty p {
    max-width: 440px;

    margin: 0 auto 20px;

    color: var(--muted);

    font-size: 14px;
}


/* =========================================
   REPORT TABS
========================================= */

.report-tabs {
    display: flex;
    flex-wrap: wrap;

    gap: 8px;

    margin-bottom: 22px;
}


.report-tabs a {
    padding: 9px 15px;

    background: var(--panel);

    border: 1px solid var(--line);
    border-radius: 8px;

    font-size: 13px;
}


.report-tabs a.active {
    background: var(--blue);
    color: white;

    border-color: var(--blue);
}


/* =========================================
   FOOTER
========================================= */

footer {
    display: flex;
    justify-content: space-between;

    gap: 20px;

    padding: 20px 35px;

    color: var(--muted);

    border-top: 1px solid var(--line);

    font-size: 12px;
}


/* =========================================
   LOGIN / AUTH
========================================= */

.auth {
    display: grid;
    grid-template-columns: 1fr 1fr;

    min-height: 100vh;
}


.auth-story {
    position: relative;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    gap: 60px;

    padding: 60px 12%;

    overflow: hidden;

    background: #0d1a31;
    color: white;
}


.auth-story::after {
    content: '';

    position: absolute;
    right: -180px;
    bottom: 100px;

    width: 370px;
    height: 370px;

    border: 60px solid #1158df28;
    border-radius: 50%;

    pointer-events: none;
}


.auth-story .brand img {
    width: 78px;
    height: 78px;
}


.auth-story .brand b {
    margin-top: 3px;

    color: #fff;

    font-size: 24px;
    letter-spacing: .5px;
}


.auth-story h1 {
    margin: 25px 0;

    font-size: clamp(44px, 4vw, 64px);
    line-height: 1.1;
    letter-spacing: -2px;
}


.auth-story h1 em {
    color: #5b99ff;

    font-style: normal;
}


.auth-story p {
    max-width: 350px;

    color: #a9bddb;
}


.auth-story .eyebrow {
    color: #a9bddb;
}


.auth-footer {
    color: #7d96bd;

    font-size: 11px;
    letter-spacing: 2px;
}


.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;

    padding: 65px 16%;

    background: var(--panel);
}


.auth-panel h2 {
    margin-bottom: 10px;

    font-size: 29px;
    letter-spacing: -.5px;
}


.auth-panel > p {
    margin-bottom: 28px;

    color: var(--muted);
}


.field {
    margin-bottom: 19px;
}


.field label {
    display: block;

    margin-bottom: 7px;

    font-size: 13px;
    font-weight: 650;
}


.field input,
.field select,
.field textarea {
    width: 100%;
}


.field small {
    display: block;

    margin-top: 6px;

    color: var(--muted);

    font-size: 12px;
}


.field textarea {
    min-height: 100px;

    resize: vertical;
}


.auth-panel .primary {
    width: 100%;

    margin-top: 7px;
}


.error {
    margin: 12px 0;

    color: var(--bad);

    font-size: 13px;

    white-space: pre-wrap;
}


.auth-note {
    margin-top: 25px;

    color: var(--muted);

    font-size: 12px;
}


.connection-error {
    padding: 30px;

    background: var(--panel);

    border: 1px solid var(--line);
    border-radius: 14px;
}


/* =========================================
   FUSION BRANCH LOGIN
========================================= */

#auth-form select {
    width: 100%;
    min-height: 50px;

    padding: 0 14px;

    background: var(--panel);
    color: var(--ink);

    border: 1px solid var(--line);
    border-radius: 10px;

    font: inherit;

    color-scheme: dark;
}


#auth-form select option {
    background: #2c2c43;
    color: #f4f4ff;
}


#auth-form select option:checked {
    background: #7368ff;
    color: #ffffff;
}


#auth-form select option:disabled {
    background: #25253a;
    color: #8f8eaa;
}


.remember-login {
    display: flex;
    align-items: center;

    gap: 8px;

    margin: -2px 0 4px;

    color: var(--muted);

    font-size: 13px;

    cursor: pointer;
}


.remember-login input {
    width: 16px;
    height: 16px;

    margin: 0;

    accent-color: var(--blue);
}


/* =========================================
   BRANCH DROPDOWN - DASHBOARD
========================================= */

body.dark #branch {
    width: 100%;

    background: #2c2c43;
    color: #f4f4ff;

    border: 1px solid #7368ff;

    color-scheme: dark;
}


body.dark #branch option {
    background: #2c2c43;
    color: #f4f4ff;
}


body.dark #branch option:checked {
    background: #7368ff;
    color: #ffffff;
}


body.dark #branch option:disabled {
    background: #25253a;
    color: #8f8eaa;
}


/* =========================================
   DIALOG
========================================= */

dialog {
    width: 650px;
    max-width: 94vw;
    max-height: 90vh;

    padding: 0;

    background: var(--panel);
    color: var(--ink);

    border: 1px solid var(--line);
    border-radius: 18px;

    box-shadow: 0 25px 100px #0005;
}


dialog::backdrop {
    background: #0a1529a6;

    backdrop-filter: blur(3px);
}


.dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 25px 28px;

    border-bottom: 1px solid var(--line);
}


.dialog-head .eyebrow {
    font-size: 10px;
}


.dialog-head h2 {
    font-size: 24px;
}


#editor-form {
    padding: 24px 28px;
}


#editor-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 0 18px;
}


#editor-fields .full {
    grid-column: 1 / -1;
}


.dialog-actions {
    display: flex;
    justify-content: end;

    gap: 10px;

    margin-top: 6px;
    padding-top: 20px;

    border-top: 1px solid var(--line);
}


/* =========================================
   TOAST
========================================= */

.toast {
    position: fixed;
    right: 25px;
    bottom: 25px;

    z-index: 100;

    max-width: 90vw;

    padding: 14px 23px;

    background: var(--ink);
    color: var(--panel);

    border-radius: 10px;

    box-shadow: 0 8px 30px #0003;

    font-size: 14px;
}


/* =========================================
   ROLES
========================================= */

.role-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);

    gap: 18px;
}


.role-card {
    padding: 25px;
}


.role-card h2 {
    margin-bottom: 12px;

    text-transform: capitalize;
}


.role-card p {
    color: var(--muted);

    font-size: 14px;
}


/* =========================================
   AUDIT / LOADING
========================================= */

.audit-detail {
    max-width: 400px;

    white-space: normal;
    word-break: break-word;

    font: 12px/1.5 monospace;
}


.loading {
    padding: 70px;

    color: var(--muted);

    text-align: center;
}


.mono {
    color: var(--muted);

    font-family: monospace;
}


/* =========================================
   CONTACT ENQUIRIES
========================================= */

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 18px;
}


.contact-card {
    padding: 22px;

    background: var(--panel);

    border: 1px solid var(--line);
    border-radius: 13px;

    box-shadow: var(--shadow);
}


.contact-card.is-new {
    border-left: 4px solid var(--blue);
}


.contact-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 18px;
}


.contact-card-head h2 {
    margin: 10px 0 4px;
}


.contact-card-head time {
    color: var(--muted);

    font-size: 11px;

    white-space: nowrap;
}


.contact-phone {
    color: var(--blue);

    font-weight: 700;
}


.contact-message {
    margin: 20px 0;
    padding: 16px;

    background: var(--bg);
    color: var(--ink);

    border-radius: 9px;

    white-space: pre-wrap;
}


.contact-actions {
    display: flex;
    flex-wrap: wrap;

    gap: 9px;
}


.contact-actions .primary,
.contact-actions .secondary,
.contact-actions .danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 13px;
}


.contact-wa {
    background: #147952;
}


.contact-wa:hover {
    background: #0f6443;
}


/* =========================================
   RESPONSIVE - 1200PX
========================================= */

@media (max-width: 1200px) {

    .sidebar {
        width: 225px;
        flex-basis: 225px;
    }


    .workspace {
        width: calc(100% - 225px);

        margin-left: 225px;
    }


    main {
        padding: 25px;
    }


    .topbar {
        padding: 16px 25px;
    }


    .branch-label,
    .breadcrumb {
        display: none;
    }


    .stats {
        grid-template-columns: repeat(2, 1fr);
    }


    .stat {
        padding: 20px;
    }


    .stat-icon {
        float: right;

        margin-bottom: 0;
    }


    .dashboard-grid {
        grid-template-columns: 1.5fr 1fr;
    }


    .chart {
        gap: 12px;

        padding: 25px 20px;
    }


    #menu-toggle {
        display: block;
    }


    .application.sidebar-closed .sidebar {
        transform: translateX(-100%);
    }


    .application.sidebar-closed .workspace {
        width: 100%;

        margin-left: 0;
    }

}


/* =========================================
   RESPONSIVE - 850PX
========================================= */

@media (max-width: 850px) {

    .sidebar {
        width: 250px;

        transform: translateX(-100%);

        box-shadow: 15px 0 40px #0002;
    }


    .application.sidebar-open .sidebar {
        transform: translateX(0);
    }


    .workspace {
        width: 100%;

        margin-left: 0;
    }


    .topbar {
        position: sticky;
        top: 0;

        z-index: 9;

        min-height: 75px;

        padding: 13px 20px;
    }


    .topbar-right {
        gap: 5px;
    }


    #profile-name {
        display: none;
    }


    .topbar .text-button {
        padding: 8px;

        font-size: 12px;
    }


    .auth-story {
        padding: 45px 8%;
    }


    .auth-panel {
        padding: 45px 10%;
    }


    .dashboard-grid {
        grid-template-columns: 1fr;
    }


    .auth-story h1 {
        font-size: 43px;
    }


    .auth-story .brand > span {
        font-size: 18px;
    }


    .auth-story .brand b {
        font-size: 18px;
    }


    .auth-story .brand img {
        width: 65px;
        height: 65px;
    }


    .contacts-grid {
        grid-template-columns: 1fr;
    }

}


/* =========================================
   RESPONSIVE - 550PX
========================================= */

@media (max-width: 550px) {

    main {
        padding: 24px 16px;
    }


    .topbar {
        padding: 12px;
    }


    .page-top {
        align-items: start;
        flex-wrap: wrap;

        gap: 16px;
    }


    h1 {
        font-size: 27px;
    }


    .date-tag {
        display: none;
    }


    .stats {
        gap: 12px;
    }


    .stat {
        padding: 17px 14px;
    }


    .stat strong {
        font-size: 25px;
    }


    .stat-icon {
        display: none;
    }


    .stat-label {
        font-size: 12px;
    }


    .stat small {
        font-size: 11px;
    }


    .panel-head {
        padding: 20px;
    }


    .toolbar {
        flex-wrap: wrap;

        padding: 15px;
    }


    .search-form {
        width: 100%;
    }


    .pagination {
        gap: 10px;

        padding: 15px;

        font-size: 12px;
    }


    th,
    td {
        padding: 14px 17px;
    }


    .page-top .actions {
        width: 100%;
    }


    .page-top .actions button {
        font-size: 13px;
    }


    .auth {
        grid-template-columns: 1fr;
    }


    .auth-story {
        gap: 25px;

        padding: 25px;
    }


    .auth-story > div,
    .auth-footer {
        display: none;
    }


    .auth-story .brand img {
        width: 55px;
        height: 55px;
    }


    .auth-panel {
        justify-content: start;

        min-height: calc(100vh - 105px);

        padding: 40px 28px;
    }


    .role-grid {
        grid-template-columns: 1fr;
    }


    footer {
        padding: 20px 16px;

        font-size: 11px;
    }


    footer span {
        display: none;
    }


    #editor-fields {
        grid-template-columns: 1fr;
    }


    #editor-form {
        padding: 20px;
    }


    .dialog-head {
        padding: 20px;
    }


    .dialog-head h2 {
        font-size: 21px;
    }


    #branch {
        max-width: 125px;
    }


    .profile {
        padding: 0;
    }


    .profile > span:first-child {
        width: 33px;
        height: 33px;
    }


    .chart {
        gap: 9px;
    }


    .chart-month {
        font-size: 10px;
    }


    .contact-card-head {
        flex-direction: column;
    }


    .contact-card-head time {
        white-space: normal;
    }


    .contact-actions > * {
        flex: 1;
    }

}


/* =========================================
   PRINT
========================================= */

@media print {

    .sidebar,
    .topbar,
    .page-top .actions,
    .toolbar,
    .pagination,
    .report-tabs,
    footer,
    .row-actions,
    .toast {
        display: none !important;
    }


    .workspace {
        width: 100%;

        margin: 0;
    }


    body {
        background: white;
        color: black;
    }


    main {
        padding: 0;
    }


    .panel {
        border: 0;

        box-shadow: none;
    }


    .table-scroll {
        overflow: visible;
    }


    table {
        white-space: normal;
    }


    th,
    td {
        padding: 7px;

        border-bottom: 1px solid #ddd;

        font-size: 10px;
    }


    .page-top {
        margin: 0 0 20px;
    }

}


/* =========================================
   REDUCED MOTION
========================================= */

@media (prefers-reduced-motion: reduce) {

    * {
        scroll-behavior: auto !important;
        transition: none !important;
    }

}
/* =========================================
   STUDENT REGISTRATION TOKEN
========================================= */

.registration-generator {
    margin-bottom: 24px;
}

.registration-controls {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    align-items: end;
    gap: 16px;
    padding: 0 28px 28px;
}

.registration-controls .field {
    margin: 0;
}

.registration-link-box {
    margin: 0 28px 28px;
    padding: 20px;
    background: var(--tint);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.registration-link-box label {
    display: block;
    margin: 14px 0 7px;
    font-size: 12px;
    font-weight: 800;
}

.registration-link-box label:first-child {
    margin-top: 0;
}

.copy-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.copy-row input {
    min-width: 0;
}

.registration-link-box small {
    display: block;
    margin-top: 14px;
    color: var(--muted);
}

@media(max-width:650px) {
    .registration-controls,
    .copy-row {
        grid-template-columns: 1fr;
    }

    .registration-controls {
        padding: 0 18px 20px;
    }

    .registration-link-box {
        margin: 0 18px 20px;
    }
}

/* =========================
STUDENT BRANCH VIEW FILTER
========================= */

.student-branch-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.student-branch-filter label {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.student-branch-filter select,
.branch-locked {
    min-width: 190px;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line, #45455f);
    border-radius: 10px;
    background: var(--panel, #2d2d49);
    color: inherit;
}

.branch-locked {
    display: flex;
    align-items: center;
    justify-content: space-between;
    opacity: .85;
}

#branch:disabled {
    opacity: 1;
    cursor: default;
}

@media (max-width: 760px) {
    .student-branch-filter {
        width: 100%;
        margin-left: 0;
        align-items: stretch;
        flex-direction: column;
    }

    .student-branch-filter select,
    .branch-locked {
        width: 100%;
    }
}


/* =========================================
   PROFILE DROPDOWN
========================================= */

.profile-wrap {
    position: relative;
}


.profile {
    border: 0;
    cursor: pointer;
}


.profile-chevron {
    margin-left: 2px;
    color: var(--muted);
    font-size: 14px;
    transition: transform .18s ease;
}


.profile[aria-expanded="true"] .profile-chevron {
    transform: rotate(180deg);
}


.profile-menu {
    position: absolute;
    z-index: 1200;
    top: calc(100% + 12px);
    right: 0;
    width: 245px;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .28);
}


.profile-menu[hidden] {
    display: none !important;
}


.profile-menu-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}


.profile-menu-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    background: var(--tint);
    color: var(--blue);
    border-radius: 50%;
    font-weight: 800;
}


.profile-menu-head strong,
.profile-menu-head small {
    display: block;
}


.profile-menu-head strong {
    color: var(--ink);
    font-size: 13px;
}


.profile-menu-head small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}


.profile-menu > button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 13px 16px;
    background: transparent;
    color: var(--muted);
    border: 0;
    border-radius: 0;
    text-align: left;
    cursor: pointer;
}


.profile-menu > button:hover,
.profile-menu > button:focus-visible {
    background: var(--tint);
    color: var(--ink);
}


.profile-menu > button span {
    width: 18px;
    text-align: center;
}


@media (max-width: 850px) {
    .profile-menu {
        position: fixed;
        top: 74px;
        right: 16px;
        width: min(280px, calc(100vw - 32px));
    }
}

/* Student Particulars: partial loading only */
#student-results{min-height:180px;position:relative}
.student-inline-loading{min-height:180px;display:flex;align-items:center;justify-content:center;gap:10px;color:var(--muted,#aaa)}
.student-spinner{width:20px;height:20px;border:2px solid rgba(255,255,255,.18);border-top-color:currentColor;border-radius:50%;animation:studentSpin .7s linear infinite}
.student-inline-error{padding:28px;text-align:center;color:#ff8fa3}
@keyframes studentSpin{to{transform:rotate(360deg)}}

/* =========================================
   STUDENT PARTICULARS - MOBILE / TABLET
========================================= */

@media (max-width: 1024px) {
    .toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: stretch;
        gap: 12px;
    }

    .toolbar .search-form {
        grid-column: 1 / -1;
        width: 100%;
    }

    .toolbar .student-branch-filter {
        width: 100%;
        min-width: 0;
        margin: 0;
    }

    .toolbar .student-branch-filter select,
    .toolbar .branch-locked {
        width: 100%;
        min-width: 0;
    }

    #import-students {
        width: 100%;
    }

    .toolbar > .badge {
        width: 100%;
        justify-self: stretch;
        text-align: center;
    }

    #student-results .table-scroll {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #student-results table {
        min-width: 1180px;
    }
}


@media (max-width: 700px) {
    main {
        padding: 28px 18px;
    }

    .page-top {
        gap: 18px;
    }

    .page-top .actions {
        width: auto;
        margin-left: auto;
    }

    .page-top .actions .primary,
    #add-record {
        width: auto;
        min-height: 48px;
        padding-inline: 18px;
        white-space: nowrap;
    }

    .toolbar {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 10px;
    }

    .toolbar .search-form,
    .toolbar .student-branch-filter,
    #import-students,
    .toolbar > .badge {
        grid-column: 1;
    }

    .search-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }

    .search-form input {
        min-width: 0;
        width: 100%;
    }

    .search-form button {
        min-width: 76px;
    }

    .student-branch-filter {
        flex-direction: row;
    }

    .student-branch-filter select,
    .branch-locked {
        min-height: 50px;
        font-size: 15px;
    }

    #student-results {
        min-height: 300px;
    }

    #student-results .pagination {
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }
}


@media (max-width: 480px) {
    main {
        padding: 22px 12px;
    }

    .page-top {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
    }

    .page-top > div:first-child {
        min-width: 0;
    }

    .page-top .eyebrow {
        font-size: 11px;
    }

    .page-top h1 {
        font-size: 30px;
    }

    .page-top p {
        grid-column: 1 / -1;
    }

    .page-top .actions {
        width: auto;
    }

    .page-top .actions .primary,
    #add-record {
        min-height: 44px;
        padding: 0 14px;
        font-size: 13px;
    }

    .panel {
        border-radius: 14px;
    }

    .toolbar {
        padding: 12px;
    }

    .search-form button {
        min-width: 68px;
        padding-inline: 12px;
    }

    .pagination {
        padding: 14px 12px;
    }
}


/* Compact icon-only import/export actions */
.icon-action {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px;
    min-height: 46px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    line-height: 1;
    flex: 0 0 46px;
}

@media (max-width: 768px) {
    .icon-action {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px;
        min-height: 44px;
        flex-basis: 44px;
    }
}

/* Specific file action icons: Excel import/export, PDF export and Settings */
.file-action-icon {
    position: relative;
    width: 27px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.8px solid currentColor;
    border-radius: 4px;
    font-weight: 800;
    line-height: 1;
}

.file-action-icon::after {
    content: "";
    position: absolute;
    top: -1.8px;
    right: -1.8px;
    width: 8px;
    height: 8px;
    border-left: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    background: inherit;
}

.file-action-icon .file-type {
    font-size: 12px;
    letter-spacing: -0.5px;
    transform: translateX(-2px);
}

.file-action-icon.pdf-icon .file-type {
    font-size: 8px;
    letter-spacing: -0.4px;
}

.file-action-icon .file-arrow {
    position: absolute;
    right: -7px;
    bottom: -5px;
    min-width: 15px;
    height: 15px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--panel, #2d2e49);
    font-size: 13px;
    font-weight: 900;
}

.settings-icon-action {
    font-size: 23px;
}


/* =========================================
   STUDENT PARTICULARS - <= 1024px STACKED FILTERS
   Search, Branch and Centre each use one full row.
   Import + Settings stay side-by-side.
========================================= */
.student-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 1024px) {
    .toolbar {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .toolbar .search-form,
    .toolbar .student-branch-filter,
    .toolbar .student-toolbar-actions {
        grid-column: 1 / -1 !important;
        width: 100%;
        min-width: 0;
    }

    .toolbar .student-branch-filter select,
    .toolbar .branch-locked {
        width: 100%;
        min-width: 0;
    }

    .toolbar .student-toolbar-actions {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
    }

    .toolbar .student-toolbar-actions #import-students,
    .toolbar .student-toolbar-actions #student-settings {
        width: 46px !important;
        min-width: 46px !important;
        flex: 0 0 46px;
    }
}

@media (max-width: 768px) {
    .toolbar .student-toolbar-actions #import-students,
    .toolbar .student-toolbar-actions #student-settings {
        width: 44px !important;
        min-width: 44px !important;
        flex-basis: 44px;
    }
}

/* =========================================
   STUDENT PARTICULARS - WIDE TOOLBAR FILL
   Fill the whole toolbar row on desktop/tablet landscape.
========================================= */
@media (min-width: 1025px) {
    .toolbar .search-form {
        flex: 1.45 1 360px;
        width: auto;
        min-width: 260px;
    }

    .toolbar .student-branch-filter {
        flex: 1 1 220px;
        width: auto;
        min-width: 190px;
        margin-left: 0;
    }

    .toolbar .student-branch-filter select,
    .toolbar .student-branch-filter .branch-locked {
        width: 100%;
        min-width: 0;
    }

    .toolbar .student-toolbar-actions {
        flex: 0 0 auto;
        margin-left: 0;
    }
}


/* Login password visibility */
.password-input-wrap { position: relative; }
.password-input-wrap > input { width: 100%; padding-right: 52px; }
.password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; opacity: .72; }
.password-toggle:hover, .password-toggle:focus-visible, .password-toggle.is-visible { opacity: 1; background: rgba(255,255,255,.06); }


/* =====================================================
   TOPBAR QUICK LINKS
===================================================== */

.quick-links-wrap {
    position: relative;
}

.quick-links-wrap .top-shortcuts {
    border: 0;
    cursor: pointer;
    font: inherit;
}

.quick-links-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1000;
    width: 310px;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 18px 45px rgba(0,0,0,.22);
}

.quick-links-menu[hidden] {
    display: none !important;
}

.quick-links-title {
    padding: 14px 16px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid var(--line);
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quick-link-item {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 12px;
    color: var(--muted);
    text-align: center;
    text-decoration: none;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.quick-link-item:nth-child(2n) {
    border-right: 0;
}

.quick-link-item:nth-last-child(-n+2) {
    border-bottom: 0;
}

.quick-link-item:hover {
    background: rgba(112, 99, 255, .08);
    color: var(--ink);
}

.quick-link-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
    color: var(--muted);
    font-size: 20px;
}

@media (max-width: 760px) {
    .quick-links-menu {
        position: fixed;
        top: 76px;
        right: 12px;
        width: min(310px, calc(100vw - 24px));
    }
}

/* Quick Links topbar button — match the other topbar icons */
.quick-links-wrap .top-shortcuts {
    appearance: none;
    -webkit-appearance: none;
    background: transparent !important;
    color: var(--muted);
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
    padding: 0;
    min-width: auto;
    min-height: auto;
}

.quick-links-wrap .top-shortcuts:hover,
.quick-links-wrap .top-shortcuts:focus,
.quick-links-wrap .top-shortcuts:focus-visible,
.quick-links-wrap .top-shortcuts[aria-expanded="true"] {
    background: transparent !important;
    color: var(--muted);
    box-shadow: none !important;
    outline: none;
}

/* =========================================================
   ORGANIZED SIDEBAR
========================================================= */

#menu .nav-section {
    margin: 2px 0;
}

#menu .nav-section > summary {
    font-weight: 600;
}

#menu .nav-section .submenu {
    padding-top: 4px;
    padding-bottom: 6px;
}

.website-link {
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 700;
}

/* Full-page user editor */
.user-page-panel{max-width:none}
.user-page-form{display:grid;grid-template-columns:1fr 1fr;gap:20px 18px;padding:26px 28px}
.user-page-form .full{grid-column:1/-1}
.user-page-actions{display:flex;gap:10px;padding-top:18px;border-top:1px solid var(--line)}

/* Role permission matrix */
.role-permission-panel{padding-top:30px}
.role-picker{max-width:460px;margin-bottom:30px;padding:18px 20px 22px}.role-picker label{display:block;margin-bottom:12px;font-weight:700}.role-picker select{padding:12px 16px;min-height:46px}
.permission-table-wrap{padding-top:8px}
.permission-table th:not(:first-child),.permission-table td:not(:first-child){text-align:center;width:11%}
.permission-table input[type="checkbox"]{width:18px;height:18px;accent-color:var(--accent);cursor:pointer}
.permission-column-head{display:flex;align-items:center;justify-content:center;gap:10px;min-height:28px}.permission-column-head span{white-space:nowrap}.permission-column-head input{margin:0}
.permission-group th{text-align:left!important;background:color-mix(in srgb,var(--panel) 78%,var(--accent) 22%);letter-spacing:.1em;text-transform:uppercase;font-size:12px;padding-top:15px!important;padding-bottom:15px!important;border-top:1px solid color-mix(in srgb,var(--line) 60%,var(--accent) 40%)}
.permission-group-gap td{height:22px!important;padding:0!important;border:0!important;background:transparent!important}
.permission-actions{display:flex;justify-content:flex-end;margin-top:26px;padding-top:20px;border-top:1px solid var(--line)}
@media(max-width:760px){.user-page-form{grid-template-columns:1fr;padding:20px 16px}.user-page-form .full{grid-column:auto}.permission-table{min-width:760px}}


/* =========================================
   TABLE OUTER SPACING — ALL ADMIN TABLES
========================================= */

.panel > .table-scroll,
.panel .table-scroll.permission-table-wrap {
    width: auto;
    margin: 20px 24px 24px;

    border: 1px solid var(--line);
    border-radius: 10px;
}


.panel > .toolbar + .table-scroll {
    margin-top: 24px;
}


.permission-table-wrap {
    padding-top: 0;
}


.role-permission-panel {
    padding: 30px 24px 24px;
}


.role-permission-panel .role-picker {
    margin: 0 0 30px;
    padding: 18px 20px 22px;
}


.role-permission-panel .permission-table-wrap {
    margin: 0;
}


.role-permission-panel .permission-actions {
    margin-top: 26px;
    padding-top: 20px;
}


@media (max-width: 760px) {

    .panel > .table-scroll,
    .panel .table-scroll.permission-table-wrap {
        margin: 16px;
    }


    .role-permission-panel {
        padding: 20px 16px;
    }


    .role-permission-panel .permission-table-wrap {
        margin: 0;
    }

}


/* Save Permissions loading state */
#save-role-permissions.is-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    cursor: wait;
    opacity: .85;
}

.button-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: fusionButtonSpin .7s linear infinite;
}

@keyframes fusionButtonSpin {
    to { transform: rotate(360deg); }
}

/* =========================================
   ROLES & ACCESS — STICKY TABLE HEADER
========================================= */

@media (min-width: 761px) {

    .role-permission-panel .permission-table-wrap {
        overflow: visible;
    }


    .permission-table thead th {
        position: sticky;
        top: 0;
        z-index: 30;

        background: var(--panel);
        box-shadow: 0 1px 0 var(--line);
    }


    .permission-table thead th:first-child {
        text-align: left;
    }
}


@media (max-width: 760px) {

    .role-permission-panel .permission-table-wrap {
        overflow-x: auto;
    }
}

/* =========================================
   ROLES & ACCESS — RESPONSIVE STICKY HEADER
   Mobile / iPad / Desktop
========================================= */

/* Desktop */
@media (min-width: 1025px) {
    .role-permission-panel .permission-table-wrap {
        overflow: visible;
    }

    .permission-table {
        width: 100%;
    }

    .permission-table thead th {
        position: sticky;
        top: 0;
        z-index: 40;
        background: var(--panel);
        box-shadow: 0 1px 0 var(--line), 0 5px 12px rgba(0,0,0,.10);
    }
}

/* iPad / Tablet */
@media (min-width: 761px) and (max-width: 1024px) {
    .role-permission-panel {
        padding: 22px 18px;
    }

    .role-permission-panel .role-picker {
        max-width: 100%;
    }

    .role-permission-panel .permission-table-wrap {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    .permission-table {
        min-width: 760px;
    }

    .permission-table thead th {
        position: sticky;
        top: 0;
        z-index: 40;
        background: var(--panel);
        box-shadow: 0 1px 0 var(--line), 0 5px 12px rgba(0,0,0,.10);
    }

    .permission-table th:first-child,
    .permission-table td:first-child {
        min-width: 210px;
    }
}

/* Mobile */
@media (max-width: 760px) {
    .role-permission-panel {
        padding: 16px 12px 20px;
    }

    .role-permission-panel .role-picker {
        max-width: none;
        width: 100%;
        margin-bottom: 18px;
        padding: 14px;
    }

    .role-permission-panel .permission-table-wrap {
        width: 100%;
        margin: 0;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    .permission-table {
        min-width: 680px;
    }

    .permission-table thead th {
        position: sticky;
        top: 0;
        z-index: 40;
        padding: 12px 9px;
        background: var(--panel);
        box-shadow: 0 1px 0 var(--line), 0 5px 12px rgba(0,0,0,.10);
        font-size: 12px;
    }

    .permission-table th:first-child,
    .permission-table td:first-child {
        min-width: 180px;
    }

    .permission-table td {
        padding: 12px 9px;
    }

    .permission-table input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    .permission-actions {
        position: sticky;
        bottom: 0;
        z-index: 35;
        margin-top: 18px;
        padding: 12px 0 0;
        background: var(--panel);
    }

    #save-role-permissions {
        width: 100%;
    }
}

/* =========================================
   ROLES & ACCESS — FINAL STICKY FIX
   Desktop / iPad / Mobile
========================================= */

/* The generic .panel uses overflow:hidden, which clips a sticky thead. */
.role-permission-panel {
    overflow: visible;
}

.permission-table thead th {
    position: sticky;
    z-index: 80;
    background: var(--panel);
    box-shadow: 0 2px 0 var(--line), 0 7px 14px rgba(0, 0, 0, .12);
}

/* Desktop: stick to the browser viewport while the page scrolls. */
@media (min-width: 1025px) {
    .role-permission-panel .permission-table-wrap {
        overflow: visible;
    }

    .permission-table thead th {
        top: 0;
    }
}

/* iPad/tablet: table gets its own scroll area so sticky header is reliable
   while horizontal and vertical scrolling. */
@media (min-width: 761px) and (max-width: 1024px) {
    .role-permission-panel .permission-table-wrap {
        max-height: calc(100vh - 150px);
        overflow: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .permission-table thead th {
        top: 0;
    }
}

/* Mobile: same reliable internal table scroll, with larger touch targets. */
@media (max-width: 760px) {
    .role-permission-panel .permission-table-wrap {
        max-height: calc(100vh - 125px);
        overflow: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .permission-table thead th {
        top: 0;
    }
}

/* =========================================
   ROLES & ACCESS — STICK BELOW APP TOPBAR
   Never cover Branch / Theme / Profile header
========================================= */

/* Desktop */
@media (min-width: 1025px) {
    .permission-table thead th {
        top: 88px;
    }
}

/* iPad / Tablet landscape / medium desktop */
@media (min-width: 851px) and (max-width: 1024px) {
    .permission-table thead th {
        top: 88px;
    }
}

/* iPad portrait + Mobile: topbar is 75px and sticky */
@media (max-width: 850px) {
    .permission-table thead th {
        top: 75px;
    }
}

/* LOGIN ONLY: branch field must match other inputs */
body .auth-panel #login-form .field #branch {
    display: block;
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: 49px;
}

/* Login form: all fields use exactly the same width */
.auth-panel #login-form { width: 100%; min-width: 0; }
.auth-panel #login-form .field { width: 100%; min-width: 0; max-width: none; }
.auth-panel #login-form .field select,
.auth-panel #login-form .field input,
.auth-panel #login-form .field #branch {
    display: block !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 49px;
}
