/* =========================================================
   SABAH-BMS ADMINISTRATION CENTER
   Light / Dark / System theme compatible
   ========================================================= */

:root,
html[data-theme="light"],
html[data-theme="auto"] {
    color-scheme: light;

    --sabah-bg: #f3f6fb;
    --sabah-bg-soft: #eaf0f8;
    --sabah-surface: #ffffff;
    --sabah-surface-2: #f8fafc;
    --sabah-surface-3: #eef3f9;

    --sabah-header: #061126;
    --sabah-header-2: #0b1730;

    --sabah-text: #0f172a;
    --sabah-text-soft: #334155;
    --sabah-muted: #64748b;

    --sabah-border: #dce4ef;
    --sabah-border-strong: #cbd5e1;

    --sabah-primary: #2563eb;
    --sabah-primary-hover: #1d4ed8;
    --sabah-primary-soft: #dbeafe;

    --sabah-success: #16a34a;
    --sabah-success-soft: #dcfce7;
    --sabah-warning: #d97706;
    --sabah-warning-soft: #fef3c7;
    --sabah-danger: #dc2626;
    --sabah-danger-soft: #fee2e2;

    --sabah-table-row: #ffffff;
    --sabah-table-alt: #f8fafc;
    --sabah-table-hover: #eef4ff;

    --sabah-shadow:
        0 18px 45px rgba(15, 23, 42, 0.08);

    --sabah-shadow-large:
        0 30px 75px rgba(15, 23, 42, 0.14);
}

html[data-theme="dark"] {
    color-scheme: dark;

    --sabah-bg: #091120;
    --sabah-bg-soft: #0d1729;
    --sabah-surface: #111c2f;
    --sabah-surface-2: #0f192b;
    --sabah-surface-3: #172338;

    --sabah-header: #030a19;
    --sabah-header-2: #071329;

    --sabah-text: #f8fafc;
    --sabah-text-soft: #dbe5f1;
    --sabah-muted: #94a3b8;

    --sabah-border: rgba(148, 163, 184, 0.20);
    --sabah-border-strong: rgba(148, 163, 184, 0.34);

    --sabah-primary: #3b82f6;
    --sabah-primary-hover: #60a5fa;
    --sabah-primary-soft: rgba(59, 130, 246, 0.16);

    --sabah-success: #22c55e;
    --sabah-success-soft: rgba(34, 197, 94, 0.15);
    --sabah-warning: #f59e0b;
    --sabah-warning-soft: rgba(245, 158, 11, 0.15);
    --sabah-danger: #f87171;
    --sabah-danger-soft: rgba(239, 68, 68, 0.15);

    --sabah-table-row: #111c2f;
    --sabah-table-alt: #0e192b;
    --sabah-table-hover: rgba(59, 130, 246, 0.14);

    --sabah-shadow:
        0 20px 50px rgba(0, 0, 0, 0.24);

    --sabah-shadow-large:
        0 35px 90px rgba(0, 0, 0, 0.38);
}

@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] {
        color-scheme: dark;

        --sabah-bg: #091120;
        --sabah-bg-soft: #0d1729;
        --sabah-surface: #111c2f;
        --sabah-surface-2: #0f192b;
        --sabah-surface-3: #172338;

        --sabah-header: #030a19;
        --sabah-header-2: #071329;

        --sabah-text: #f8fafc;
        --sabah-text-soft: #dbe5f1;
        --sabah-muted: #94a3b8;

        --sabah-border: rgba(148, 163, 184, 0.20);
        --sabah-border-strong: rgba(148, 163, 184, 0.34);

        --sabah-primary: #3b82f6;
        --sabah-primary-hover: #60a5fa;
        --sabah-primary-soft: rgba(59, 130, 246, 0.16);

        --sabah-success: #22c55e;
        --sabah-success-soft: rgba(34, 197, 94, 0.15);
        --sabah-warning: #f59e0b;
        --sabah-warning-soft: rgba(245, 158, 11, 0.15);
        --sabah-danger: #f87171;
        --sabah-danger-soft: rgba(239, 68, 68, 0.15);

        --sabah-table-row: #111c2f;
        --sabah-table-alt: #0e192b;
        --sabah-table-hover: rgba(59, 130, 246, 0.14);

        --sabah-shadow:
            0 20px 50px rgba(0, 0, 0, 0.24);

        --sabah-shadow-large:
            0 35px 90px rgba(0, 0, 0, 0.38);
    }
}

/* Django core variable integration */
html {
    --primary: var(--sabah-primary);
    --secondary: var(--sabah-primary-hover);
    --accent: #93c5fd;

    --body-fg: var(--sabah-text);
    --body-bg: var(--sabah-bg);
    --body-quiet-color: var(--sabah-muted);
    --body-medium-color: var(--sabah-text-soft);

    --header-bg: var(--sabah-header);
    --header-color: #ffffff;
    --header-link-color: #dbeafe;

    --breadcrumbs-bg: var(--sabah-surface);
    --breadcrumbs-fg: var(--sabah-muted);
    --breadcrumbs-link-fg: var(--sabah-primary);

    --link-fg: var(--sabah-primary);
    --link-hover-color: var(--sabah-primary-hover);
    --link-selected-fg: var(--sabah-primary-hover);

    --hairline-color: var(--sabah-border);
    --border-color: var(--sabah-border);

    --darkened-bg: var(--sabah-surface-2);
    --selected-bg: var(--sabah-primary-soft);
    --selected-row: var(--sabah-table-hover);

    --button-bg: var(--sabah-primary);
    --button-hover-bg: var(--sabah-primary-hover);
    --default-button-bg: var(--sabah-primary);
    --default-button-hover-bg: var(--sabah-primary-hover);

    --close-button-bg: #475569;
    --close-button-hover-bg: #334155;

    --delete-button-bg: #dc2626;
    --delete-button-hover-bg: #b91c1c;
}

/* Base */
* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background:
        radial-gradient(
            circle at 8% 0%,
            rgba(37, 99, 235, 0.10),
            transparent 26rem
        ),
        var(--sabah-bg) !important;
    color: var(--sabah-text) !important;
    font-family:
        Inter,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
    font-size: 14px;
}

body:not(.sabah-admin-ready) {
    opacity: 0.98;
}

body.sabah-admin-ready {
    opacity: 1;
    transition: opacity 160ms ease;
}

a:link,
a:visited {
    color: var(--sabah-primary);
}

a:hover,
a:focus {
    color: var(--sabah-primary-hover);
}

/* Header */
#header {
    min-height: 88px;
    padding: 16px 30px;
    background:
        linear-gradient(
            135deg,
            var(--sabah-header),
            var(--sabah-header-2)
        ) !important;
    color: #ffffff;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 12px 35px rgba(2, 6, 23, 0.20);
    gap: 24px;
}

#branding {
    min-width: 280px;
}

.sabah-admin-brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    color: #ffffff !important;
    text-decoration: none;
}

.sabah-brand-logo-wrap {
    width: 48px;
    height: 48px;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    background: #ffffff;
    box-shadow:
        0 12px 28px rgba(37, 99, 235, 0.30);
}

.sabah-brand-logo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sabah-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sabah-admin-title {
    color: #ffffff;
    font-size: 19px;
    font-weight: 900;
    letter-spacing: 0.3px;
    line-height: 1.1;
}

.sabah-admin-subtitle {
    color: #b9c8dc;
    font-size: 11px;
    font-weight: 700;
}

.sabah-company-badge {
    max-width: 180px;
    padding: 6px 10px;
    margin-left: 8px;
    overflow: hidden;
    color: #dbeafe;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(147, 197, 253, 0.22);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Global navigation */
.sabah-admin-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.sabah-admin-nav a {
    padding: 8px 11px;
    color: #bfdbfe !important;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    transition:
        color 160ms ease,
        background 160ms ease;
}

.sabah-admin-nav a:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08);
}

.sabah-admin-tagline {
    padding-left: 12px;
    color: #93c5fd;
    border-left: 1px solid rgba(148, 163, 184, 0.24);
    font-size: 11px;
    font-weight: 800;
}

/* User tools */
#user-tools .theme-toggle,
.theme-toggle {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    border-radius: 11px !important;
}

#user-tools a {
    color: #dbeafe !important;
    border: 0;
    font-weight: 800;
}

#user-tools a:hover {
    color: #ffffff !important;
}

.theme-toggle {
    width: 38px;
    height: 38px;
    margin-left: 6px;
    border: 1px solid rgba(147, 197, 253, 0.22);
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.12);
    transition:
        transform 160ms ease,
        background 160ms ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    background: rgba(59, 130, 246, 0.24);
}

/* Breadcrumbs */
div.breadcrumbs {
    min-height: 48px;
    padding: 14px 34px;
    background: var(--sabah-surface) !important;
    color: var(--sabah-muted) !important;
    border-bottom: 1px solid var(--sabah-border);
    font-weight: 700;
}

div.breadcrumbs a {
    color: var(--sabah-primary) !important;
    font-weight: 800;
}

/* Navigation sidebar */
#nav-sidebar {
    background: var(--sabah-surface);
    border-right: 1px solid var(--sabah-border);
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.04);
}

#nav-sidebar .module {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

#nav-sidebar .current-app .section,
#nav-sidebar .current-model {
    background: var(--sabah-primary-soft);
    color: var(--sabah-primary);
}

.toggle-nav-sidebar {
    color: var(--sabah-primary);
    background: var(--sabah-surface);
    border-right-color: var(--sabah-border);
}

/* Main content */
#content {
    padding: 28px 34px 44px;
}

#content h1 {
    margin-bottom: 24px;
    color: var(--sabah-text);
    font-size: clamp(25px, 2.2vw, 34px);
    font-weight: 900;
    letter-spacing: -0.7px;
}

#content h2,
#content h3 {
    color: var(--sabah-text);
}

#content-main {
    min-width: 0;
}

/* Dashboard hero */
.sabah-dashboard {
    max-width: 1600px;
    margin: 0 auto;
}

.sabah-dashboard-hero {
    padding: 28px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    color: #ffffff;
    background:
        radial-gradient(
            circle at 88% 20%,
            rgba(96, 165, 250, 0.28),
            transparent 20rem
        ),
        linear-gradient(135deg, #071327, #112b5c);
    border: 1px solid rgba(147, 197, 253, 0.18);
    border-radius: 24px;
    box-shadow: var(--sabah-shadow-large);
}

.sabah-dashboard-hero h1 {
    margin: 5px 0 8px !important;
    color: #ffffff !important;
    font-size: clamp(27px, 3vw, 40px) !important;
}

.sabah-dashboard-hero p {
    max-width: 720px;
    margin: 0;
    color: #c7d7ea;
    font-size: 14px;
    line-height: 1.7;
}

.sabah-eyebrow {
    color: var(--sabah-primary);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1.25px;
}

.sabah-dashboard-hero .sabah-eyebrow {
    color: #93c5fd;
}

.sabah-hero-user {
    min-width: 210px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
}

.sabah-user-avatar {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    border-radius: 13px;
    font-size: 18px;
    font-weight: 900;
}

.sabah-hero-user strong,
.sabah-hero-user small {
    display: block;
}

.sabah-hero-user strong {
    color: #ffffff;
    font-size: 13px;
}

.sabah-hero-user small {
    margin-top: 3px;
    color: #b8cae0;
    font-size: 10px;
}

/* Quick links */
.sabah-quick-links {
    margin: 20px 0 26px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.sabah-quick-card {
    min-height: 82px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sabah-text) !important;
    background: var(--sabah-surface);
    border: 1px solid var(--sabah-border);
    border-radius: 18px;
    box-shadow: var(--sabah-shadow);
    text-decoration: none;
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.sabah-quick-card:hover {
    transform: translateY(-2px);
    border-color: var(--sabah-primary);
    box-shadow: 0 20px 42px rgba(37, 99, 235, 0.12);
}

.sabah-quick-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    color: var(--sabah-primary);
    background: var(--sabah-primary-soft);
    border-radius: 13px;
    font-size: 11px;
    font-weight: 900;
}

.sabah-quick-card strong,
.sabah-quick-card small {
    display: block;
}

.sabah-quick-card strong {
    color: var(--sabah-text);
    font-size: 13px;
}

.sabah-quick-card small {
    margin-top: 4px;
    color: var(--sabah-muted);
    font-size: 10px;
    line-height: 1.4;
}

/* Dashboard main layout */
.sabah-dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    align-items: start;
    gap: 22px;
}

.sabah-section-heading {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.sabah-section-heading h2 {
    margin: 4px 0 0;
    color: var(--sabah-text);
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -0.25px;
}

.sabah-section-note {
    color: var(--sabah-muted);
    font-size: 11px;
    font-weight: 700;
}

/* Application cards */
.sabah-app-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.sabah-app-card,
.sabah-activity-panel {
    background: var(--sabah-surface);
    border: 1px solid var(--sabah-border);
    border-radius: 20px;
    box-shadow: var(--sabah-shadow);
    overflow: hidden;
}

.sabah-app-card-header {
    padding: 15px 16px;
    display: flex;
    align-items: center;
    gap: 11px;
    background: var(--sabah-surface-2);
    border-bottom: 1px solid var(--sabah-border);
}

.sabah-app-letter {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    color: #ffffff;
    background: linear-gradient(
        135deg,
        var(--sabah-primary),
        #60a5fa
    );
    border-radius: 12px;
    font-size: 15px;
    font-weight: 900;
}

.sabah-app-card-header a,
.sabah-app-card-header strong {
    color: var(--sabah-text) !important;
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
}

.sabah-app-card-header small {
    display: block;
    margin-top: 3px;
    color: var(--sabah-muted);
    font-size: 10px;
    font-weight: 700;
}

.sabah-model-row {
    min-height: 51px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--sabah-border);
}

.sabah-model-row:last-child {
    border-bottom: 0;
}

.sabah-model-row:hover {
    background: var(--sabah-table-hover);
}

.sabah-model-name {
    min-width: 0;
}

.sabah-model-name a,
.sabah-model-name span {
    color: var(--sabah-text) !important;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.sabah-model-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sabah-model-actions a {
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 900;
    text-decoration: none;
}

.sabah-model-add {
    color: var(--sabah-success) !important;
    background: var(--sabah-success-soft);
}

.sabah-model-manage {
    color: var(--sabah-primary) !important;
    background: var(--sabah-primary-soft);
}

/* Activity panel */
.sabah-activity-panel {
    padding: 17px;
    position: sticky;
    top: 18px;
}

.sabah-activity-list {
    display: flex;
    flex-direction: column;
}

.sabah-activity-item {
    padding: 12px 2px;
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr);
    gap: 10px;
    border-bottom: 1px solid var(--sabah-border);
}

.sabah-activity-item:last-child {
    border-bottom: 0;
}

.sabah-activity-marker {
    width: 9px;
    height: 9px;
    margin-top: 4px;
    background: var(--sabah-muted);
    border-radius: 999px;
    box-shadow: 0 0 0 4px var(--sabah-surface-3);
}

.sabah-activity-marker.is-add {
    background: var(--sabah-success);
}

.sabah-activity-marker.is-change {
    background: var(--sabah-primary);
}

.sabah-activity-marker.is-delete {
    background: var(--sabah-danger);
}

.sabah-activity-item a,
.sabah-activity-item strong {
    display: block;
    color: var(--sabah-text) !important;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.4;
    text-decoration: none;
}

.sabah-activity-item small,
.sabah-activity-time {
    display: block;
    color: var(--sabah-muted);
    font-size: 9px;
    line-height: 1.5;
}

.sabah-activity-time {
    margin-top: 3px;
}

.sabah-empty-state {
    padding: 34px 22px;
    color: var(--sabah-muted);
    background: var(--sabah-surface);
    border: 1px dashed var(--sabah-border-strong);
    border-radius: 18px;
    text-align: center;
}

.sabah-empty-state.compact {
    padding: 24px 14px;
}

.sabah-empty-state strong {
    color: var(--sabah-text);
}

.sabah-empty-state p {
    margin: 7px 0 0;
}

/* Standard Django modules */
.module,
fieldset.module,
.inline-group {
    margin-bottom: 20px;
    background: var(--sabah-surface) !important;
    border: 1px solid var(--sabah-border) !important;
    border-radius: 18px !important;
    box-shadow: var(--sabah-shadow);
    overflow: hidden;
}

.module h2,
.module caption,
.inline-group h2 {
    padding: 12px 15px !important;
    color: var(--sabah-text) !important;
    background: var(--sabah-surface-2) !important;
    border-bottom: 1px solid var(--sabah-border);
    font-size: 13px !important;
    font-weight: 900 !important;
    letter-spacing: 0.1px;
}

/* Changelist */
#changelist {
    background: transparent;
}

#changelist .results {
    overflow: auto;
    background: var(--sabah-surface);
    border: 1px solid var(--sabah-border);
    border-radius: 18px;
    box-shadow: var(--sabah-shadow);
}

#changelist table {
    background: var(--sabah-surface);
}

#changelist table thead th {
    padding: 12px 11px;
    color: var(--sabah-text-soft);
    background: var(--sabah-surface-3);
    border-bottom: 1px solid var(--sabah-border);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.45px;
    text-transform: uppercase;
}

#changelist table tbody tr {
    background: var(--sabah-table-row);
}

#changelist table tbody tr:nth-child(even) {
    background: var(--sabah-table-alt);
}

#changelist table tbody tr:hover {
    background: var(--sabah-table-hover);
}

#changelist table tbody td,
#changelist table tbody th {
    padding: 11px;
    color: var(--sabah-text);
    border-bottom: 1px solid var(--sabah-border);
}

#changelist table tbody th a {
    color: var(--sabah-primary);
    font-weight: 900;
}

/* Toolbar / actions */
#toolbar,
.actions {
    margin-bottom: 14px;
    padding: 12px !important;
    color: var(--sabah-text);
    background: var(--sabah-surface) !important;
    border: 1px solid var(--sabah-border) !important;
    border-radius: 16px !important;
    box-shadow: var(--sabah-shadow);
}

#toolbar form {
    display: flex;
    align-items: center;
    gap: 8px;
}

#toolbar #searchbar {
    min-height: 40px;
    flex: 1;
}

/* Filters */
#changelist-filter {
    padding-bottom: 14px;
    background: var(--sabah-surface) !important;
    border: 1px solid var(--sabah-border);
    border-radius: 18px;
    box-shadow: var(--sabah-shadow);
}

#changelist-filter h2 {
    padding: 13px 15px;
    color: #ffffff;
    background: linear-gradient(
        135deg,
        var(--sabah-primary),
        #3b82f6
    );
    border-radius: 17px 17px 0 0;
    font-weight: 900;
}

#changelist-filter h3 {
    color: var(--sabah-text);
    font-weight: 900;
}

#changelist-filter li a {
    color: var(--sabah-muted);
    font-weight: 700;
}

#changelist-filter li.selected a {
    color: var(--sabah-primary);
    font-weight: 900;
}

/* Inputs */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
    max-width: 100%;
    color: var(--sabah-text) !important;
    background: var(--sabah-surface-2) !important;
    border: 1px solid var(--sabah-border-strong) !important;
    border-radius: 11px !important;
    box-shadow: none !important;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select {
    min-height: 40px;
    padding: 8px 11px !important;
}

textarea {
    min-height: 100px;
    padding: 10px 11px !important;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--sabah-primary) !important;
    box-shadow:
        0 0 0 4px var(--sabah-primary-soft) !important;
    outline: none;
}

select option {
    color: var(--sabah-text);
    background: var(--sabah-surface);
}

/* Forms */
.form-row {
    min-height: 63px;
    padding: 14px 16px !important;
    border-bottom: 1px solid var(--sabah-border) !important;
}

.form-row:last-child {
    border-bottom: 0 !important;
}

.form-row label {
    color: var(--sabah-text) !important;
    font-weight: 900 !important;
}

.form-row .fieldBox {
    margin-right: 26px;
}

.form-row select,
.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="email"],
.form-row input[type="url"] {
    min-width: min(330px, 100%);
}

.readonly {
    color: var(--sabah-text);
    font-weight: 800;
}

.help,
.helptext,
p.help {
    color: var(--sabah-muted) !important;
    font-size: 10px !important;
    font-weight: 600;
    line-height: 1.6;
}

.related-widget-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

/* Buttons */
.button,
input[type="submit"],
input[type="button"],
.submit-row input,
a.button {
    min-height: 39px;
    padding: 9px 16px !important;
    color: #ffffff !important;
    background:
        linear-gradient(
            135deg,
            var(--sabah-primary),
            #3b82f6
        ) !important;
    border: 0 !important;
    border-radius: 11px !important;
    box-shadow:
        0 10px 22px rgba(37, 99, 235, 0.18);
    font-weight: 900 !important;
    transition:
        transform 150ms ease,
        filter 150ms ease;
}

.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
.submit-row input:hover,
a.button:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.object-tools a {
    padding: 9px 14px;
    color: #ffffff !important;
    background:
        linear-gradient(
            135deg,
            #16a34a,
            #22c55e
        ) !important;
    border-radius: 11px;
    font-weight: 900;
}

.deletelink,
.submit-row a.deletelink {
    color: #ffffff !important;
    background:
        linear-gradient(
            135deg,
            #b91c1c,
            #ef4444
        ) !important;
    border-radius: 11px !important;
    font-weight: 900 !important;
}

/* Submit row */
.submit-row {
    padding: 13px !important;
    position: sticky;
    bottom: 12px;
    z-index: 20;
    background: color-mix(
        in srgb,
        var(--sabah-surface) 93%,
        transparent
    ) !important;
    border: 1px solid var(--sabah-border) !important;
    border-radius: 16px !important;
    box-shadow: var(--sabah-shadow-large);
    backdrop-filter: blur(14px);
}

/* Inlines */
.inline-related {
    background: var(--sabah-surface-2) !important;
}

.inline-group table thead th {
    color: var(--sabah-text-soft);
    background: var(--sabah-surface-3) !important;
    font-weight: 900;
}

.inline-group table td,
.inline-group table th {
    border-bottom: 1px solid var(--sabah-border);
}

/* Remove duplicate inline object labels */
.inline-group .tabular td.original,
.inline-group .tabular th.original {
    display: none !important;
}

.inline-group .tabular tr.has_original td {
    vertical-align: middle !important;
}

.inline-group .tabular td.field-product,
.inline-group .tabular td.field-quantity,
.inline-group .tabular td.field-unit,
.inline-group .tabular td.field-unit_price,
.inline-group .tabular td.field-unit_cost,
.inline-group .tabular td.field-total_price,
.inline-group .tabular td.field-total_cost {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}

/* Pagination */
.paginator {
    padding: 12px !important;
    color: var(--sabah-muted) !important;
    background: var(--sabah-surface) !important;
    border: 1px solid var(--sabah-border);
    border-radius: 14px;
    font-weight: 800;
}

/* Messages */
.messagelist li {
    padding: 13px 16px !important;
    color: var(--sabah-text);
    background: var(--sabah-surface);
    border: 1px solid var(--sabah-border);
    border-radius: 14px;
    box-shadow: var(--sabah-shadow);
    font-weight: 800;
}

.messagelist li.success {
    color: var(--sabah-success);
    background: var(--sabah-success-soft);
}

.messagelist li.warning {
    color: var(--sabah-warning);
    background: var(--sabah-warning-soft);
}

.messagelist li.error {
    color: var(--sabah-danger);
    background: var(--sabah-danger-soft);
}

/* Payment administration */
.app-payments.model-payment .form-row .fieldBox {
    min-width: min(330px, 100%);
}

.app-payments.model-payment textarea {
    min-height: 100px;
}

/* Login page */
body.sabah-login-page {
    background:
        radial-gradient(
            circle at 10% 20%,
            rgba(37, 99, 235, 0.17),
            transparent 28rem
        ),
        radial-gradient(
            circle at 90% 80%,
            rgba(14, 165, 233, 0.10),
            transparent 24rem
        ),
        var(--sabah-bg) !important;
}

body.sabah-login-page #header {
    display: none;
}

body.sabah-login-page #container {
    min-width: 100%;
    background: transparent;
    border: 0;
}

body.sabah-login-page #content {
    min-height: 100vh;
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sabah-login-shell {
    width: min(960px, 100%);
    min-height: 590px;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    background: var(--sabah-surface);
    border: 1px solid var(--sabah-border);
    border-radius: 28px;
    box-shadow: var(--sabah-shadow-large);
    overflow: hidden;
}

.sabah-login-brand-panel {
    padding: 54px;
    display: flex;
    align-items: center;
    color: #ffffff;
    background:
        radial-gradient(
            circle at 75% 15%,
            rgba(96, 165, 250, 0.30),
            transparent 18rem
        ),
        linear-gradient(145deg, #061126, #123875);
}

.sabah-login-brand-content {
    max-width: 420px;
}

.sabah-login-logo {
    width: 135px !important;
    height: 135px !important;
    padding: 8px !important;
    margin: 0 0 32px 0 !important;

    display: block;
    object-fit: cover;
    object-position: center;

    background: #ffffff;
    border-radius: 26px;

    box-shadow:
        0 22px 48px rgba(0, 0, 0, 0.28),
        0 0 0 1px rgba(255, 255, 255, 0.25);

    transform: scale(1.08);
    transform-origin: left center;
}

.sabah-login-brand-panel h1 {
    margin: 7px 0 12px !important;
    color: #ffffff !important;
    font-size: 39px !important;
}

.sabah-login-brand-panel p {
    color: #c5d5e9;
    font-size: 14px;
    line-height: 1.75;
}

.sabah-login-security {
    margin-top: 36px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 16px;
}

.sabah-login-security strong,
.sabah-login-security span {
    display: block;
}

.sabah-login-security strong {
    color: #ffffff;
    font-size: 12px;
}

.sabah-login-security span {
    margin-top: 5px;
    color: #b9cce4;
    font-size: 10px;
    line-height: 1.6;
}

.sabah-login-form-panel {
    padding: 54px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sabah-login-form-heading h2 {
    margin: 5px 0 7px;
    color: var(--sabah-text);
    font-size: 27px;
    font-weight: 900;
}

.sabah-login-form-heading p {
    margin: 0 0 28px;
    color: var(--sabah-muted);
}

.sabah-login-field {
    margin-bottom: 19px;
}

.sabah-login-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--sabah-text);
    font-size: 11px;
    font-weight: 900;
}

.sabah-login-field input {
    width: 100%;
    min-height: 47px;
    padding: 11px 13px !important;
}

.sabah-password-wrapper {
    position: relative;
}

.sabah-password-wrapper input {
    padding-right: 67px !important;
}

.sabah-password-toggle {
    padding: 5px 8px;
    position: absolute;
    right: 8px;
    top: 50%;
    color: var(--sabah-primary);
    background: var(--sabah-primary-soft);
    border: 0;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 900;
    transform: translateY(-50%);
    cursor: pointer;
}

.sabah-login-submit {
    width: 100%;
    min-height: 48px !important;
    margin-top: 6px;
    padding: 11px 18px !important;

    color: #ffffff !important;
    background: linear-gradient(
        135deg,
        var(--sabah-primary),
        #3b82f6
    ) !important;

    border: 0 !important;
    border-radius: 12px !important;

    box-shadow:
        0 12px 26px rgba(37, 99, 235, 0.24) !important;

    font-family: inherit;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;

    transition:
        transform 160ms ease,
        filter 160ms ease,
        box-shadow 160ms ease;
}

.sabah-login-submit:hover {
    transform: translateY(-1px);
    filter: brightness(1.07);
    box-shadow:
        0 16px 32px rgba(37, 99, 235, 0.30) !important;
}

.sabah-login-submit:focus {
    outline: none;
    box-shadow:
        0 0 0 4px var(--sabah-primary-soft),
        0 12px 26px rgba(37, 99, 235, 0.24) !important;
}

.sabah-login-footer {
    margin: 25px 0 0;
    color: var(--sabah-muted);
    font-size: 9px;
    font-weight: 700;
    text-align: center;
}

.sabah-form-alert {
    margin-bottom: 18px;
    padding: 12px 13px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.5;
}

.sabah-form-alert.error {
    color: var(--sabah-danger);
    background: var(--sabah-danger-soft);
    border: 1px solid color-mix(
        in srgb,
        var(--sabah-danger) 25%,
        transparent
    );
}

.sabah-form-alert.warning {
    color: var(--sabah-warning);
    background: var(--sabah-warning-soft);
}

.sabah-field-error {
    margin-top: 5px;
    color: var(--sabah-danger);
    font-size: 10px;
    font-weight: 700;
}

/* Logged-out page */
body.sabah-logged-out-page #content {
    min-height: calc(100vh - 90px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sabah-logout-card {
    width: min(510px, 100%);
    padding: 42px;
    color: var(--sabah-text);
    background: var(--sabah-surface);
    border: 1px solid var(--sabah-border);
    border-radius: 24px;
    box-shadow: var(--sabah-shadow-large);
    text-align: center;
}

.sabah-logout-logo {
    width: 62px;
    height: 62px;
    padding: 8px;
    margin: 0 auto 20px;
    display: block;
    object-fit: contain;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: var(--sabah-shadow);
}

.sabah-success-mark {
    width: 44px;
    height: 44px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sabah-success);
    background: var(--sabah-success-soft);
    border-radius: 999px;
    font-size: 20px;
    font-weight: 900;
}

.sabah-logout-card h1 {
    margin: 7px 0 12px !important;
    font-size: 27px !important;
}

.sabah-logout-card p {
    margin: 0 auto 25px;
    max-width: 390px;
    color: var(--sabah-muted);
    line-height: 1.7;
}

.sabah-primary-link,
.sabah-secondary-link {
    min-height: 43px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 900;
    text-decoration: none;
}

.sabah-primary-link {
    color: #ffffff !important;
    background: var(--sabah-primary);
}

.sabah-secondary-link {
    margin-left: 7px;
    color: var(--sabah-primary) !important;
    background: var(--sabah-primary-soft);
}

/* Responsive */
@media (max-width: 820px) {
    .sabah-login-logo {
        width: 105px !important;
        height: 105px !important;
        margin-bottom: 24px !important;
    }
}
@media (max-width: 1100px) {
    #header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .sabah-admin-nav {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

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

    .sabah-activity-panel {
        position: static;
    }

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

@media (max-width: 820px) {
    #header {
        padding: 14px 18px;
    }

    #content {
        padding: 20px 16px 36px;
    }

    div.breadcrumbs {
        padding: 12px 16px;
    }

    .sabah-company-badge,
    .sabah-admin-tagline {
        display: none;
    }

    .sabah-dashboard-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .sabah-app-grid {
        grid-template-columns: 1fr;
    }

    .sabah-login-shell {
        grid-template-columns: 1fr;
    }

    .sabah-login-brand-panel {
        padding: 35px;
    }

    .sabah-login-form-panel {
        padding: 35px;
    }

    .sabah-login-logo {
        width: 62px;
        height: 62px;
        margin-bottom: 20px;
    }

    .sabah-login-brand-panel h1 {
        font-size: 31px !important;
    }
}

@media (max-width: 560px) {
    .sabah-brand-logo-wrap {
        width: 43px;
        height: 43px;
    }

    .sabah-admin-title {
        font-size: 16px;
    }

    .sabah-admin-subtitle {
        font-size: 9px;
    }

    .sabah-admin-nav {
        display: none;
    }

    .sabah-quick-links {
        grid-template-columns: 1fr;
    }

    .sabah-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .sabah-model-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .sabah-login-brand-panel,
    .sabah-login-form-panel {
        padding: 27px 23px;
    }

    .sabah-logout-card {
        padding: 32px 22px;
    }

    .sabah-primary-link,
    .sabah-secondary-link {
        width: 100%;
        margin: 7px 0 0;
    }

    .submit-row {
        position: static;
    }
}

/* Mobile administration controls must remain reachable on every admin page. */
@media (max-width: 680px) {
    html,
    body {
        min-width: 320px !important;
        height: auto !important;
        min-height: 100% !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    #container,
    #main,
    .main,
    main {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    #header {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        height: auto !important;
        padding: 10px 12px !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        align-items: center !important;
        gap: 9px !important;
        overflow: visible !important;
    }

    #branding {
        width: auto !important;
        min-width: 0 !important;
    }

    #header .sabah-admin-brand {
        min-width: 0 !important;
    }

    #header .sabah-brand-copy {
        overflow: hidden !important;
    }

    #user-tools {
        width: auto !important;
        min-width: 42px !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 0 !important;
        overflow: visible !important;
        font-size: 0 !important;
        white-space: nowrap !important;
    }

    #user-tools > a,
    #user-tools > strong,
    #user-tools > #logout-form {
        display: none !important;
    }

    #user-tools .theme-toggle {
        display: inline-flex !important;
        flex: 0 0 42px !important;
    }

    .sabah-admin-nav {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding-top: 7px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        gap: 7px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scrollbar-width: thin;
    }

    .sabah-admin-nav > a {
        display: none !important;
    }

    .sabah-admin-nav > a:nth-of-type(1),
    .sabah-admin-nav > a:nth-of-type(2) {
        min-height: 40px !important;
        padding: 9px 11px !important;
        display: inline-flex !important;
        align-items: center !important;
        flex: 0 0 auto !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(147, 197, 253, 0.20) !important;
    }

    .sabah-admin-search {
        display: none !important;
    }

    .sabah-admin-logout {
        margin: 0 0 0 auto !important;
        display: block !important;
        flex: 0 0 auto !important;
    }

    .sabah-admin-logout button {
        min-height: 40px !important;
        color: #ffffff !important;
        background: rgba(220, 38, 38, 0.28) !important;
        border-color: rgba(254, 202, 202, 0.35) !important;
    }
}

/* =========================================================
   2026 UI unification — transparent brand and command search
   ========================================================= */
#header .sabah-brand-logo-wrap {
    width: 54px !important;
    height: 60px !important;
    flex: 0 0 54px !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    filter: drop-shadow(0 13px 25px rgba(37, 99, 235, 0.42));
}

#header .sabah-admin-brand:hover .sabah-brand-logo-wrap {
    transform: translateY(-1px) scale(1.035);
    box-shadow: none !important;
}

#header .sabah-brand-logo,
.sabah-login-logo,
.sabah-logout-logo,
.sabah-logout-logo-wrap,
body.sabah-logged-out-page > #container .sabah-logout-card > img.sabah-logout-logo {
    padding: 0 !important;
    object-fit: contain !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.sabah-login-logo {
    width: 142px !important;
    height: 158px !important;
    filter: drop-shadow(0 25px 42px rgba(37, 99, 235, 0.30));
}

.sabah-logout-logo-wrap {
    width: 86px !important;
    height: 98px !important;
    overflow: visible !important;
    filter: drop-shadow(0 18px 30px rgba(37, 99, 235, 0.25));
}

.sabah-admin-nav {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
}

.sabah-admin-search {
    position: relative;
    width: min(440px, 36vw);
    margin-left: auto;
}

.sabah-admin-search-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.sabah-admin-search-icon {
    position: absolute;
    top: 50%;
    left: 13px;
    z-index: 2;
    color: #93c5fd;
    font-size: 20px;
    transform: translateY(-53%);
    pointer-events: none;
}

.sabah-admin-search input {
    width: 100%;
    min-height: 40px;
    padding: 9px 14px 9px 39px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(147, 197, 253, 0.24);
    border-radius: 12px;
    outline: 0;
    font-size: 12px;
    font-weight: 750;
}

.sabah-admin-search input::placeholder {
    color: #a9c2e4;
}

.sabah-admin-search input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.sabah-admin-suggestions {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    z-index: 10000;
    width: min(460px, calc(100vw - 28px));
    max-height: 520px;
    padding: 8px;
    overflow-y: auto;
    color: var(--sabah-text);
    background: var(--sabah-surface);
    border: 1px solid var(--sabah-border);
    border-radius: 16px;
    box-shadow: var(--sabah-shadow-large);
}

.sabah-admin-suggestion-heading {
    padding: 8px 10px;
    color: var(--sabah-muted);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.65px;
    text-transform: uppercase;
}

.sabah-admin-suggestions a {
    min-height: 52px;
    padding: 9px 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 10px;
    color: var(--sabah-text) !important;
    border-radius: 11px;
    text-decoration: none;
}

.sabah-admin-suggestions a strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sabah-admin-suggestions a small {
    color: var(--sabah-muted);
    font-size: 10px;
}

.sabah-admin-suggestions a span {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    color: var(--sabah-primary);
}

.sabah-admin-suggestions a:hover,
.sabah-admin-suggestions a.is-active {
    background: var(--sabah-primary-soft);
}

.sabah-admin-logout {
    margin: 0;
}

.sabah-admin-logout button {
    min-height: 40px;
    padding: 9px 13px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(147, 197, 253, 0.20);
    border-radius: 11px;
    font-size: 11px;
    font-weight: 850;
    cursor: pointer;
}

.sabah-admin-logout button:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(252, 165, 165, 0.32);
}

/* Consistent internal admin surfaces. */
.change-list #content,
.change-form #content,
.delete-confirmation #content {
    width: min(1540px, calc(100% - 34px));
    margin: 18px auto 34px !important;
}

.change-list #changelist,
.change-form #content-main > form,
.delete-confirmation #content-main {
    overflow: visible;
    background: var(--sabah-surface);
    border: 1px solid var(--sabah-border);
    border-radius: 20px;
    box-shadow: var(--sabah-shadow);
}

.change-form fieldset.module,
.change-form .inline-group {
    margin: 0 0 18px;
    overflow: hidden;
    background: var(--sabah-surface);
    border: 1px solid var(--sabah-border);
    border-radius: 16px;
}

.change-form fieldset.module > h2,
.change-form .inline-group > h2 {
    padding: 13px 16px;
    color: var(--sabah-text);
    background: linear-gradient(135deg, var(--sabah-primary-soft), var(--sabah-surface-2));
    border-bottom: 1px solid var(--sabah-border);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.4px;
}

.change-form .form-row {
    padding: 15px 18px;
}

.change-form .form-row .flex-container {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px 16px;
}

.change-form .form-row .fieldBox {
    min-width: min(210px, 100%);
    flex: 1 1 210px;
    margin: 0 !important;
}

.change-form .form-row input:not([type="checkbox"]):not([type="radio"]),
.change-form .form-row select,
.change-form .form-row textarea {
    max-width: 100%;
}

.change-form .inline-group .tabular {
    max-width: 100%;
    overflow-x: auto;
    border-radius: 0 0 14px 14px;
}

.change-form .inline-group .tabular table {
    width: max-content;
    min-width: 100%;
}

.change-form .inline-group .tabular input:not([type="checkbox"]),
.change-form .inline-group .tabular select,
.change-form .inline-group .tabular textarea {
    min-width: 0;
    max-width: 230px;
}

.change-form .inline-group .tabular td,
.change-form .inline-group .tabular th {
    padding: 9px 10px !important;
}

.change-form .inline-group .add-row a {
    min-height: 38px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    border-radius: 10px;
    font-weight: 900;
}

.change-list #toolbar,
.change-list #changelist-filter {
    background: var(--sabah-surface-2);
    border-color: var(--sabah-border);
}

.change-list .results {
    overflow-x: auto;
    border-radius: 14px;
}

.change-list #result_list thead th {
    position: sticky;
    top: 0;
    z-index: 3;
}

@media (max-width: 1120px) {
    .sabah-admin-search {
        order: 10;
        width: 100%;
        margin-left: 0;
    }

    .sabah-admin-nav {
        flex-wrap: wrap;
    }
}

@media (max-width: 680px) {
    .sabah-admin-nav > a {
        display: none;
    }

    .sabah-admin-search {
        width: calc(100% - 84px);
    }

    .change-list #content,
    .change-form #content,
    .delete-confirmation #content {
        width: calc(100% - 18px);
    }

    .change-form .form-row .flex-container {
        display: grid;
        grid-template-columns: 1fr;
    }

    .change-form .form-row .fieldBox {
        min-width: 0;
        width: 100%;
    }
}
/* =========================================================
   SABAH ADMIN DASHBOARD — RESPONSIVE LAYOUT FIX
   ========================================================= */

.sabah-dashboard {
    width: 100%;
    max-width: 1600px;
    margin-inline: auto;
}

.sabah-dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}

.sabah-activity-panel {
    position: static;
    width: 100%;
}

.sabah-app-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(min(330px, 100%), 1fr));
    gap: 16px;
}

.sabah-quick-links {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 14px;
}

.sabah-section-heading {
    align-items: flex-start;
    flex-wrap: wrap;
}

.sabah-section-note {
    max-width: 260px;
    line-height: 1.5;
}

.sabah-model-row {
    min-width: 0;
}

.sabah-model-name {
    flex: 1;
    min-width: 0;
}

.sabah-model-name a,
.sabah-model-name span {
    overflow-wrap: anywhere;
}

.sabah-model-actions {
    flex-shrink: 0;
}

/* Recent Actions only moves right on genuinely wide screens */
@media (min-width: 1450px) {
    .sabah-dashboard-layout {
        grid-template-columns: minmax(0, 1fr) 350px;
        align-items: start;
    }

    .sabah-activity-panel {
        position: sticky;
        top: 18px;
    }
}

@media (max-width: 800px) {
    .sabah-quick-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sabah-dashboard-hero {
        padding: 22px;
    }

    .sabah-section-note {
        display: none;
    }
}

@media (max-width: 520px) {
    .sabah-quick-links {
        grid-template-columns: 1fr;
    }

    .sabah-model-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .sabah-model-actions {
        width: 100%;
    }
}
/* =========================================================
   SABAH ADMIN DASHBOARD — TRUE FULL WIDTH FIX
   Django default dashboard.css limits content to ~600px.
   ========================================================= */

body.sabah-admin-dashboard #container {
    width: 100% !important;
    max-width: none !important;
}

body.sabah-admin-dashboard .main,
body.sabah-admin-dashboard main {
    width: 100% !important;
    max-width: none !important;
}

body.sabah-admin-dashboard #content {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 30px 40px 50px !important;
}

body.sabah-admin-dashboard #content-main {
    width: 100% !important;
    max-width: none !important;
    float: none !important;
}

body.sabah-admin-dashboard .sabah-dashboard {
    width: 100% !important;
    max-width: 1700px !important;
    margin: 0 auto !important;
}

body.sabah-admin-dashboard .sabah-dashboard-hero {
    width: 100% !important;
    min-height: 250px;
}

body.sabah-admin-dashboard .sabah-quick-links {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

body.sabah-admin-dashboard .sabah-dashboard-layout {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    align-items: start;
    gap: 24px;
}

body.sabah-admin-dashboard .sabah-applications-area {
    width: 100%;
    min-width: 0;
}

body.sabah-admin-dashboard .sabah-app-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

body.sabah-admin-dashboard .sabah-app-card {
    width: 100%;
    min-width: 0;
    align-self: start;
}

body.sabah-admin-dashboard .sabah-activity-panel {
    width: 350px;
    position: sticky;
    top: 20px;
}

/* =========================================================
   ADMIN INDEX — DENSE INDEPENDENT COLUMNS
   The previous row-based grid left a large blank area below every
   shorter module whenever its neighbour had more records.
   ========================================================= */

body.sabah-admin-dashboard .sabah-dashboard-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 26px;
}

body.sabah-admin-dashboard .sabah-app-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 18px;
}

body.sabah-admin-dashboard .sabah-app-column {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 18px;
}

body.sabah-admin-dashboard .sabah-app-card {
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.055);
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease;
}

body.sabah-admin-dashboard .sabah-app-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--sabah-primary) 34%, var(--sabah-border));
    box-shadow: 0 18px 34px rgba(37, 99, 235, 0.12);
}

body.sabah-admin-dashboard .sabah-app-card-header {
    min-height: 70px;
    padding: 14px 16px;
}

body.sabah-admin-dashboard .sabah-app-card-title {
    min-width: 0;
}

body.sabah-admin-dashboard .sabah-app-card-header a,
body.sabah-admin-dashboard .sabah-app-card-header strong,
body.sabah-admin-dashboard .sabah-model-name a,
body.sabah-admin-dashboard .sabah-model-name span {
    text-decoration: none !important;
}

body.sabah-admin-dashboard .sabah-model-row {
    min-height: 48px;
    padding: 8px 14px;
}

body.sabah-admin-dashboard .sabah-model-row:hover {
    background: linear-gradient(90deg, var(--sabah-table-hover), transparent 80%);
}

body.sabah-admin-dashboard .sabah-model-actions {
    gap: 5px;
}

body.sabah-admin-dashboard .sabah-model-actions a {
    min-width: 45px;
    padding: 5px 7px;
    text-align: center;
    border: 1px solid transparent;
}

body.sabah-admin-dashboard .sabah-model-actions a:hover {
    border-color: var(--sabah-border-strong);
    filter: brightness(0.98);
}

body.sabah-admin-dashboard .sabah-activity-panel {
    width: 320px;
    padding: 18px;
    border-radius: 20px;
}

body.sabah-admin-dashboard .sabah-activity-item {
    padding: 11px 1px;
}

@media (max-width: 1200px) {
    body.sabah-admin-dashboard .sabah-dashboard-layout {
        grid-template-columns: 1fr;
    }

    body.sabah-admin-dashboard .sabah-activity-panel {
        width: 100%;
    }
}

@media (max-width: 760px) {
    body.sabah-admin-dashboard .sabah-app-grid {
        grid-template-columns: 1fr;
    }
}

/* Medium screens */
@media (max-width: 1200px) {
    body.sabah-admin-dashboard #content {
        padding: 26px 24px 45px !important;
    }

    body.sabah-admin-dashboard .sabah-dashboard-layout {
        grid-template-columns: 1fr;
    }

    body.sabah-admin-dashboard .sabah-activity-panel {
        width: 100%;
        position: static;
    }

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

/* Tablets */
@media (max-width: 760px) {
    body.sabah-admin-dashboard #content {
        padding: 20px 16px 36px !important;
    }

    body.sabah-admin-dashboard .sabah-app-grid {
        grid-template-columns: 1fr;
    }

    body.sabah-admin-dashboard .sabah-dashboard-hero {
        min-height: auto;
    }
}

/* Phones */
@media (max-width: 520px) {
    body.sabah-admin-dashboard .sabah-quick-links {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   ADMIN LEFT SIDEBAR — LIGHT / DARK TEXT VISIBILITY FIX
   ========================================================= */

#nav-sidebar {
    background: var(--sabah-surface) !important;
    color: var(--sabah-text) !important;
}

/* Sidebar application headings */
#nav-sidebar .module caption,
#nav-sidebar .module caption a,
#nav-sidebar .module caption a.section,
#nav-sidebar .module h2,
#nav-sidebar .section {
    color: var(--sabah-text) !important;
    background: var(--sabah-surface-2) !important;
    font-weight: 900 !important;
    opacity: 1 !important;
}

/* Sidebar model links */
#nav-sidebar .module table th,
#nav-sidebar .module table td,
#nav-sidebar .module table th a,
#nav-sidebar .module table td a {
    color: var(--sabah-text-soft) !important;
    background: transparent !important;
    font-weight: 750 !important;
    opacity: 1 !important;
}

/* Application card borders */
#nav-sidebar .module {
    margin: 10px 10px 14px !important;
    background: var(--sabah-surface) !important;
    border: 1px solid var(--sabah-border) !important;
    border-radius: 16px !important;
    overflow: hidden !important;
}

/* App heading area */
#nav-sidebar .module caption {
    padding: 12px 16px !important;
    border-bottom: 1px solid var(--sabah-border) !important;
    text-align: left !important;
}

/* App heading links */
#nav-sidebar .module caption a.section {
    display: block !important;
    color: var(--sabah-text) !important;
    text-decoration: none !important;
    text-transform: uppercase !important;
    letter-spacing: 0.35px !important;
}

/* Model rows */
#nav-sidebar .module tbody tr {
    background: var(--sabah-surface) !important;
}

#nav-sidebar .module tbody tr:hover {
    background: var(--sabah-table-hover) !important;
}

#nav-sidebar .module tbody th,
#nav-sidebar .module tbody td {
    padding: 9px 13px !important;
    border-bottom: 1px solid var(--sabah-border) !important;
}

/* Selected application / model */
#nav-sidebar .current-app .section,
#nav-sidebar .current-model {
    color: var(--sabah-primary) !important;
    background: var(--sabah-primary-soft) !important;
}

#nav-sidebar .current-model a {
    color: var(--sabah-primary) !important;
    font-weight: 900 !important;
}



/* =========================================================
   PURCHASE LIST — MATCH SALES ADMIN
   ========================================================= */

body.app-purchases.model-purchase.change-list
#changelist .results {
    overflow-x: auto !important;
}

body.app-purchases.model-purchase.change-list
#result_list {
    min-width: 900px !important;
}

body.app-purchases.model-purchase.change-list
#result_list tbody tr {
    background: var(--sabah-table-row) !important;
}

body.app-purchases.model-purchase.change-list
#result_list tbody tr:nth-child(even) {
    background: var(--sabah-table-alt) !important;
}

body.app-purchases.model-purchase.change-list
#result_list tbody tr:hover {
    background: var(--sabah-table-hover) !important;
}

body.app-purchases.model-purchase.change-list
#result_list tbody th,
body.app-purchases.model-purchase.change-list
#result_list tbody td {
    position: static !important;
    left: auto !important;
    right: auto !important;

    color: var(--sabah-text) !important;
    background: transparent !important;

    box-shadow: none !important;
    border-bottom: 1px solid var(--sabah-border) !important;
}

body.app-purchases.model-purchase.change-list
#result_list thead th {
    position: static !important;
    left: auto !important;
    right: auto !important;

    color: var(--sabah-text-soft) !important;
    background: var(--sabah-surface-3) !important;
}

body.app-purchases.model-purchase.change-list
#result_list tbody th a {
    color: var(--sabah-primary) !important;
    font-weight: 900 !important;
}




/* Sidebar search */
#nav-filter {
    color: var(--sabah-text) !important;
    background: var(--sabah-surface-2) !important;
    border: 1px solid var(--sabah-border-strong) !important;
}

#nav-filter::placeholder {
    color: var(--sabah-muted) !important;
    opacity: 1 !important;
}

/* Explicit dark-theme sidebar contrast */
html[data-theme="dark"] #nav-sidebar .module caption,
html[data-theme="dark"] #nav-sidebar .module caption a,
html[data-theme="dark"] #nav-sidebar .module caption a.section {
    color: #f8fafc !important;
    background: #172338 !important;
}

html[data-theme="dark"] #nav-sidebar .module table th a,
html[data-theme="dark"] #nav-sidebar .module table td a {
    color: #cbd5e1 !important;
}



/* =========================================================
   SABAH-BMS LOGOUT PAGE — PREMIUM POLISH
   ========================================================= */

body.sabah-logged-out-page {
    min-height: 100vh;

    background:
        radial-gradient(
            circle at 15% 20%,
            rgba(37, 99, 235, 0.16),
            transparent 28rem
        ),
        radial-gradient(
            circle at 85% 80%,
            rgba(14, 165, 233, 0.10),
            transparent 24rem
        ),
        var(--sabah-bg) !important;
}

body.sabah-logged-out-page #header,
body.sabah-logged-out-page .breadcrumbs,
body.sabah-logged-out-page #nav-sidebar,
body.sabah-logged-out-page .toggle-nav-sidebar {
    display: none !important;
}

body.sabah-logged-out-page #container,
body.sabah-logged-out-page .main,
body.sabah-logged-out-page main {
    width: 100% !important;
    max-width: none !important;
    min-height: 100vh !important;
    background: transparent !important;
}

body.sabah-logged-out-page #content {
    width: 100% !important;
    max-width: none !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 28px !important;

    display: flex;
    align-items: center;
    justify-content: center;
}

body.sabah-logged-out-page #content-main {
    width: 100% !important;
    max-width: none !important;
}

.sabah-logout-shell {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sabah-logout-card {
    width: min(570px, 100%);
    padding: 48px 46px 38px;

    color: var(--sabah-text);
    background:
        linear-gradient(
            145deg,
            var(--sabah-surface),
            var(--sabah-surface-2)
        );

    border: 1px solid var(--sabah-border-strong);
    border-radius: 28px;

    box-shadow:
        0 35px 90px rgba(2, 6, 23, 0.28);

    text-align: center;

    animation: sabahLogoutEnter 420ms ease-out both;
}

@keyframes sabahLogoutEnter {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.sabah-logout-logo-wrap {
    width: 86px;
    height: 86px;
    margin: 0 auto 22px;
    padding: 8px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #ffffff;
    border-radius: 23px;

    box-shadow:
        0 18px 38px rgba(15, 23, 42, 0.18);
}

.sabah-logout-logo {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.sabah-logout-success {
    width: 54px;
    height: 54px;
    margin: 0 auto 23px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #22c55e;
    background: rgba(34, 197, 94, 0.14);

    border: 1px solid rgba(34, 197, 94, 0.24);
    border-radius: 999px;

    font-size: 27px;
    font-weight: 950;

    box-shadow:
        0 12px 28px rgba(34, 197, 94, 0.12);
}

.sabah-logout-eyebrow {
    display: block;
    margin-bottom: 11px;

    color: var(--sabah-primary);
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 1.4px;
}

.sabah-logout-card h1 {
    margin: 0 0 14px !important;

    color: var(--sabah-text) !important;
    font-size: clamp(27px, 3vw, 34px) !important;
    font-weight: 950 !important;
    letter-spacing: -0.7px;
}

.sabah-logout-card p {
    max-width: 440px;
    margin: 0 auto 29px;

    color: var(--sabah-muted);
    font-size: 13px;
    line-height: 1.75;
}

.sabah-logout-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.sabah-logout-primary,
.sabah-logout-secondary {
    min-height: 47px;
    padding: 11px 18px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    font-size: 11px;
    font-weight: 950;
    text-decoration: none !important;

    transition:
        transform 150ms ease,
        filter 150ms ease,
        box-shadow 150ms ease;
}

.sabah-logout-primary {
    color: #ffffff !important;

    background:
        linear-gradient(
            135deg,
            var(--sabah-primary),
            #3b82f6
        );

    box-shadow:
        0 13px 28px rgba(37, 99, 235, 0.24);
}

.sabah-logout-secondary {
    color: var(--sabah-primary) !important;
    background: var(--sabah-primary-soft);
    border: 1px solid var(--sabah-border);
}

.sabah-logout-primary:hover,
.sabah-logout-secondary:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
}

.sabah-logout-security-note {
    margin-top: 28px;
    padding-top: 20px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    color: var(--sabah-muted);
    border-top: 1px solid var(--sabah-border);

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

.sabah-security-dot {
    width: 7px;
    height: 7px;
    display: inline-block;

    background: #22c55e;
    border-radius: 999px;

    box-shadow:
        0 0 0 4px rgba(34, 197, 94, 0.12);
}

html[data-theme="dark"] .sabah-logout-card {
    background:
        linear-gradient(
            145deg,
            #111c2f,
            #0d1729
        );
}

@media (max-width: 600px) {
    body.sabah-logged-out-page #content {
        padding: 18px !important;
    }

    .sabah-logout-card {
        padding: 38px 23px 30px;
        border-radius: 23px;
    }

    .sabah-logout-logo-wrap {
        width: 76px;
        height: 76px;
    }

    .sabah-logout-actions {
        flex-direction: column;
    }

    .sabah-logout-primary,
    .sabah-logout-secondary {
        width: 100%;
    }
}

/* =========================================================
   FINAL POLISH — LOGOUT BUTTONS + THEME TOGGLE
   ========================================================= */

/* Equal, balanced logout actions */
.sabah-logout-actions {
    width: 100%;
    margin-top: 6px;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.sabah-logout-primary,
.sabah-logout-secondary {
    width: 100%;
    min-height: 50px;
    padding: 12px 18px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 13px;
    font-size: 11px;
    font-weight: 950;
    line-height: 1.2;
    text-align: center;
    text-decoration: none !important;

    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        border-color 160ms ease,
        background 160ms ease,
        color 160ms ease;
}

.sabah-logout-primary {
    color: #ffffff !important;

    background:
        linear-gradient(
            135deg,
            #2563eb 0%,
            #3b82f6 100%
        );

    border: 1px solid rgba(255, 255, 255, 0.10);

    box-shadow:
        0 13px 28px rgba(37, 99, 235, 0.26);
}

.sabah-logout-primary:hover {
    color: #ffffff !important;
    transform: translateY(-2px);

    box-shadow:
        0 17px 34px rgba(37, 99, 235, 0.34);
}

.sabah-logout-secondary {
    color: #1d4ed8 !important;
    background: #e7efff;
    border: 1px solid #c7d7fe;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
}

.sabah-logout-secondary:hover {
    color: #ffffff !important;
    background: #1e3a8a;
    border-color: #1e3a8a;
    transform: translateY(-2px);

    box-shadow:
        0 15px 30px rgba(30, 58, 138, 0.22);
}

/* Keyboard accessibility */
.sabah-logout-primary:focus-visible,
.sabah-logout-secondary:focus-visible {
    outline: none;

    box-shadow:
        0 0 0 4px rgba(59, 130, 246, 0.20),
        0 14px 30px rgba(37, 99, 235, 0.22);
}

/* Dark theme logout buttons */
html[data-theme="dark"] .sabah-logout-secondary {
    color: #bfdbfe !important;
    background: rgba(59, 130, 246, 0.13);
    border-color: rgba(96, 165, 250, 0.28);
}

html[data-theme="dark"] .sabah-logout-secondary:hover {
    color: #ffffff !important;
    background: rgba(37, 99, 235, 0.36);
    border-color: rgba(96, 165, 250, 0.48);
}

/* Premium Django theme toggle */
#user-tools .theme-toggle,
.theme-toggle {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;

    margin-left: 10px !important;
    padding: 0 !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    color: #dbeafe !important;

    background:
        linear-gradient(
            145deg,
            rgba(59, 130, 246, 0.18),
            rgba(30, 64, 175, 0.14)
        ) !important;

    border: 1px solid rgba(147, 197, 253, 0.28) !important;
    border-radius: 13px !important;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 10px 24px rgba(0, 0, 0, 0.16) !important;

    cursor: pointer;

    transition:
        transform 160ms ease,
        background 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease !important;
}

#user-tools .theme-toggle:hover,
.theme-toggle:hover {
    transform: translateY(-2px) rotate(4deg);

    background:
        linear-gradient(
            145deg,
            rgba(59, 130, 246, 0.30),
            rgba(37, 99, 235, 0.24)
        ) !important;

    border-color: rgba(147, 197, 253, 0.52) !important;

    box-shadow:
        0 15px 30px rgba(37, 99, 235, 0.22) !important;
}

#user-tools .theme-toggle:focus-visible,
.theme-toggle:focus-visible {
    outline: none !important;

    box-shadow:
        0 0 0 4px rgba(59, 130, 246, 0.22),
        0 12px 25px rgba(0, 0, 0, 0.18) !important;
}

/* =========================================================
   SABAH THEME TOGGLE — RELIABLE SUN / MOON / AUTO ICONS
   ========================================================= */

.sabah-theme-toggle {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    padding: 0 !important;
    margin-left: 10px !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    color: #dbeafe !important;
    background: rgba(59, 130, 246, 0.14) !important;

    border: 1px solid rgba(147, 197, 253, 0.30) !important;
    border-radius: 12px !important;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 8px 20px rgba(0, 0, 0, 0.16) !important;

    cursor: pointer;
    line-height: 1 !important;

    transition:
        transform 160ms ease,
        background 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease !important;
}

.sabah-theme-toggle:hover {
    transform: translateY(-2px);

    color: #ffffff !important;
    background: rgba(59, 130, 246, 0.28) !important;
    border-color: rgba(147, 197, 253, 0.55) !important;

    box-shadow:
        0 13px 28px rgba(37, 99, 235, 0.24) !important;
}

.sabah-theme-icon {
    display: none;
    color: currentColor;
    font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
    font-size: 23px;
    font-weight: 400;
    line-height: 1;
}

/* Auto / system */
html[data-theme="auto"]
.sabah-theme-toggle
.theme-icon-when-auto {
    display: block;
}

/* Light theme shows sun */
html[data-theme="light"]
.sabah-theme-toggle
.theme-icon-when-light {
    display: block;
}

/* Dark theme shows moon */
html[data-theme="dark"]
.sabah-theme-toggle
.theme-icon-when-dark {
    display: block;
}

/* Safe fallback before data-theme is available */
html:not([data-theme])
.sabah-theme-toggle
.theme-icon-when-auto {
    display: block;
}

/* Mobile logout buttons */
@media (max-width: 560px) {
    .sabah-logout-actions {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   SABAH-BMS — DISCARD CHANGES CARD
   ========================================================= */

.sabah-discard-wrapper {
    position: relative;
    display: inline-flex;
    margin-left: 8px;
    vertical-align: middle;
}

.sabah-discard-trigger {
    min-height: 43px;
    padding: 10px 15px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    color: #b45309 !important;
    background: #fffbeb !important;

    border: 1px solid #fde68a !important;
    border-radius: 12px !important;

    box-shadow: none !important;

    font-family: inherit;
    font-size: 11px;
    font-weight: 950;

    cursor: pointer;

    transition:
        transform 150ms ease,
        background 150ms ease,
        border-color 150ms ease;
}

.sabah-discard-trigger:hover {
    color: #92400e !important;
    background: #fef3c7 !important;
    border-color: #fcd34d !important;
    transform: translateY(-1px);
}

.sabah-discard-trigger > span:first-child {
    font-size: 17px;
    line-height: 1;
}

.sabah-discard-card {
    width: 285px;
    padding: 16px;

    position: absolute;
    right: 0;
    bottom: calc(100% + 11px);
    z-index: 1000;

    color: var(--sabah-text);
    background: var(--sabah-surface);

    border: 1px solid var(--sabah-border-strong);
    border-radius: 16px;

    box-shadow:
        0 24px 55px rgba(15, 23, 42, 0.20);
}

.sabah-discard-card[hidden] {
    display: none !important;
}

.sabah-discard-card::after {
    content: "";

    width: 12px;
    height: 12px;

    position: absolute;
    right: 22px;
    bottom: -7px;

    background: var(--sabah-surface);
    border-right: 1px solid var(--sabah-border-strong);
    border-bottom: 1px solid var(--sabah-border-strong);

    transform: rotate(45deg);
}

.sabah-discard-card strong {
    display: block;

    color: var(--sabah-text);
    font-size: 12px;
    font-weight: 950;
}

.sabah-discard-card p {
    margin: 7px 0 14px;

    color: var(--sabah-muted);
    font-size: 10px;
    line-height: 1.6;
}

.sabah-discard-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.sabah-discard-confirm,
.sabah-discard-cancel {
    min-height: 36px;
    padding: 8px 10px;

    border-radius: 10px !important;
    box-shadow: none !important;

    font-family: inherit;
    font-size: 9px;
    font-weight: 950;

    cursor: pointer;
}

.sabah-discard-confirm {
    color: #ffffff !important;
    background: #dc2626 !important;
    border: 1px solid #dc2626 !important;
}

.sabah-discard-confirm:hover {
    background: #b91c1c !important;
}

.sabah-discard-cancel {
    color: var(--sabah-text) !important;
    background: var(--sabah-surface-2) !important;
    border: 1px solid var(--sabah-border) !important;
}

.sabah-discard-notice {
    padding: 11px 15px;

    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9999;

    color: #166534;
    background: #dcfce7;

    border: 1px solid #bbf7d0;
    border-radius: 12px;

    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.18);

    font-size: 10px;
    font-weight: 900;

    opacity: 0;
    transform: translateY(12px);

    transition:
        opacity 200ms ease,
        transform 200ms ease;
}

.sabah-discard-notice.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Dark mode */
html[data-theme="dark"] .sabah-discard-trigger {
    color: #fcd34d !important;
    background: rgba(245, 158, 11, 0.13) !important;
    border-color: rgba(245, 158, 11, 0.28) !important;
}

html[data-theme="dark"] .sabah-discard-confirm {
    color: #fecaca !important;
    background: rgba(239, 68, 68, 0.18) !important;
    border-color: rgba(248, 113, 113, 0.35) !important;
}

@media (max-width: 650px) {
    .sabah-discard-wrapper {
        width: 100%;
        margin: 8px 0 0;
    }

    .sabah-discard-trigger {
        width: 100%;
    }

    .sabah-discard-card {
        width: min(285px, calc(100vw - 40px));
        right: 0;
    }
}

/* Fix repeated Django admin message icons */
ul.messagelist li {
    position: relative;
    background-image: none !important;
    background-repeat: no-repeat !important;
    padding-left: 52px !important;
}

ul.messagelist li::before {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: 900;
}

ul.messagelist li.success::before {
    content: "✓";
    color: #15803d;
}

ul.messagelist li.warning::before {
    content: "!";
    color: #b45309;
}

ul.messagelist li.error::before {
    content: "×";
    color: #b91c1c;
}
/* Fix hidden Discard confirmation card */
.change-form .submit-row {
    overflow: visible !important;
    position: relative !important;
    z-index: 500 !important;
}

.sabah-discard-wrapper {
    position: relative !important;
    z-index: 1000 !important;
}

.sabah-discard-card {
    display: block;
    position: absolute !important;
    right: 0 !important;
    bottom: calc(100% + 14px) !important;
    z-index: 99999 !important;

    width: 300px !important;
    max-width: calc(100vw - 32px) !important;

    overflow: visible !important;
}

.sabah-discard-card[hidden] {
    display: none !important;
}

/* Parents must not cut the popup */
.change-form #content-main,
.change-form form,
.change-form .submit-row,
.change-form .sabah-discard-wrapper {
    overflow: visible !important;
}

/* =========================================================
   SABAH-BMS GLOBAL ADMIN BRAND — CIRCULAR LOGO STANDARD
   Final override: Admin header, login and logout.
   ========================================================= */

#header .sabah-admin-brand {
    display: inline-flex !important;
    align-items: center !important;
    gap: 14px !important;
    color: #ffffff !important;
    text-decoration: none !important;
}

#header .sabah-brand-logo-wrap {
    width: 62px !important;
    height: 62px !important;
    flex: 0 0 62px !important;
    padding: 3px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    background: #ffffff !important;
    border: 3px solid rgba(255, 255, 255, 0.96) !important;
    border-radius: 50% !important;
    box-shadow:
        0 14px 32px rgba(37, 99, 235, 0.30),
        0 0 0 1px rgba(147, 197, 253, 0.16) !important;
    transition:
        transform 160ms ease,
        box-shadow 160ms ease !important;
}

#header .sabah-admin-brand:hover .sabah-brand-logo-wrap {
    transform: translateY(-1px) scale(1.02);
    box-shadow:
        0 18px 38px rgba(37, 99, 235, 0.38),
        0 0 0 1px rgba(147, 197, 253, 0.28) !important;
}

#header .sabah-brand-logo {
    width: 100% !important;
    height: 100% !important;
    padding: 1px !important;
    display: block !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #ffffff !important;
    border-radius: 50% !important;
}

#header .sabah-brand-copy {
    min-width: 0;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 3px !important;
}

#header .sabah-admin-title {
    font-size: 20px !important;
    line-height: 1.05 !important;
}

#header .sabah-admin-subtitle {
    font-size: 10px !important;
    line-height: 1.25 !important;
}

.sabah-login-logo {
    width: 136px !important;
    height: 136px !important;
    padding: 5px !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #ffffff !important;
    border: 4px solid rgba(255, 255, 255, 0.96) !important;
    border-radius: 50% !important;
    box-shadow:
        0 24px 54px rgba(0, 0, 0, 0.30),
        0 0 0 1px rgba(147, 197, 253, 0.20) !important;
}

.sabah-logout-logo-wrap {
    width: 94px !important;
    height: 94px !important;
    padding: 4px !important;
    overflow: hidden !important;
    background: #ffffff !important;
    border: 4px solid rgba(255, 255, 255, 0.96) !important;
    border-radius: 50% !important;
    box-shadow:
        0 20px 44px rgba(15, 23, 42, 0.20) !important;
}

.sabah-logout-logo {
    width: 100% !important;
    height: 100% !important;
    padding: 1px !important;
    margin: 0 !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #ffffff !important;
    border-radius: 50% !important;
}

body.sabah-logged-out-page > #container
.sabah-logout-card > img.sabah-logout-logo {
    width: 94px !important;
    height: 94px !important;
    margin: 0 auto 22px !important;
    padding: 5px !important;
    border: 4px solid rgba(255, 255, 255, 0.96) !important;
    border-radius: 50% !important;
}

@media (max-width: 820px) {
    #header .sabah-brand-logo-wrap {
        width: 54px !important;
        height: 54px !important;
        flex-basis: 54px !important;
    }

    .sabah-login-logo {
        width: 112px !important;
        height: 112px !important;
    }
}

@media (max-width: 560px) {
    #header .sabah-brand-logo-wrap {
        width: 48px !important;
        height: 48px !important;
        flex-basis: 48px !important;
        border-width: 2px !important;
    }

    #header .sabah-admin-title {
        font-size: 16px !important;
    }

    #header .sabah-admin-subtitle {
        font-size: 9px !important;
    }

    .sabah-logout-logo-wrap,
    body.sabah-logged-out-page > #container
    .sabah-logout-card > img.sabah-logout-logo {
        width: 82px !important;
        height: 82px !important;
    }
}
