/* A shared 72px header keeps the brand and toolbar on the same baseline. */
:root { --shell-header-height: 72px; }
html[data-theme] .sidebar .sidebar-inner {
    padding: 0 16px 20px;
}
html[data-theme] .sidebar .brand-wrapper {
    flex: 0 0 var(--shell-header-height);
    height: var(--shell-header-height);
    min-height: var(--shell-header-height);
    width: calc(100% + 32px);
    margin: 0 -16px 22px;
    padding: 0 26px;
    gap: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border: 0;
    border-bottom: 1px solid var(--theme-border-light);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
html[data-theme] .sidebar .brand-logo {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 13px;
    font-size: 18px;
    display: grid;
    place-items: center;
}
html[data-theme] .sidebar .brand-logo i { display: block; line-height: 1; }
html[data-theme] .sidebar .brand-text { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
html[data-theme] .sidebar .brand-name { font-size: 17px; font-weight: 800; letter-spacing: -.025em; line-height: 1.2; }
html[data-theme] .sidebar .brand-sub { font-size: 9px; font-weight: 500; letter-spacing: .035em; line-height: 1.5; margin: 0; white-space: normal; text-transform: none; max-width: 170px; text-wrap: balance; }
html[data-theme] .topbar { height: var(--shell-header-height); min-height: var(--shell-header-height); }
@media (min-width: 992px) {
    html[data-theme] .sidebar.collapsed .sidebar-inner { padding: 0 0 20px; }
    html[data-theme] .sidebar.collapsed .brand-wrapper {
        width: 100%; margin: 0 0 22px; padding: 0; gap: 0;
        align-items: center; justify-content: center;
    }
    html[data-theme] .sidebar.collapsed .brand-text { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
    html[data-theme] .menu-toggle { transition: background .16s ease, border-color .16s ease; }
}

/* Desktop webview: content is already beside the app sidebar. Do not slide it in. */
html.digikang-desktop body .layout-wrapper > .sidebar,
html.digikang-desktop body .sidebar-overlay,
html.digikang-desktop body .topbar,
html.digikang-desktop body .topbar .menu-toggle,
html.digikang-desktop body .mobile-shell-brand { display: none !important; }
html.digikang-desktop body .sidebar,
html.digikang-desktop body .app-main { transition: none !important; }
html.digikang-desktop body .app-main {
    margin-left: 0 !important;
    margin-inline-start: 0 !important;
    width: 100% !important;
    max-width: none !important;
    padding-top: 0 !important;
}
html.digikang-desktop,
html.digikang-desktop body {
    height: 100% !important;
    overflow: hidden !important;
    background: #0a1220 !important;
    background-image: none !important;
    font-family: "Segoe UI", system-ui, sans-serif !important;
}
html.digikang-desktop body .layout-wrapper,
html.digikang-desktop body .app-main {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}
html.digikang-desktop body .main-content-area {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    padding: 20px 22px 16px !important;
}
html.digikang-desktop body.page-mutasi:not(.page-dashboard) .mutasi-table-wrap {
    overflow: auto !important;
    max-height: min(62vh, calc(100dvh - 318px)) !important;
    min-height: 240px !important;
    height: auto !important;
}
html.digikang-desktop body.page-dashboard:has(#dashboard-mutasi:not([hidden])) .main-content-area {
    overflow: auto !important;
    display: flex !important;
    flex-direction: column !important;
}
html.digikang-desktop body.page-dashboard:has(#dashboard-mutasi:not([hidden])) #accounts-grid {
    flex: 0 0 auto !important;
    max-height: none !important;
    overflow: visible !important;
}
html.digikang-desktop body.page-dashboard #dashboard-mutasi:not([hidden]) {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    display: block !important;
    margin-top: 16px !important;
    overflow: visible !important;
}
html.digikang-desktop body.page-dashboard #dashboard-mutasi #inline-mutasi-panel,
html.digikang-desktop body.page-dashboard #dashboard-mutasi #mutasi-table-section,
html.digikang-desktop body.page-dashboard #dashboard-mutasi #mutasi-table-section .section-card-body {
    flex: none !important;
    display: block !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
}
html.digikang-desktop body.page-dashboard #dashboard-mutasi .mutasi-table-wrap {
    flex: none !important;
    max-height: none !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
}
html.digikang-desktop body .mutasi-table-card.is-refreshing .mutasi-table-wrap { pointer-events: auto !important; }
html.digikang-desktop body .page-dashboard .dashboard-overview {
    display: contents !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
html.digikang-desktop body .page-head {
    display: flex !important;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 16px !important;
    flex-wrap: wrap;
}
html.digikang-desktop body .section-header {
    display: flex !important;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 16px !important;
    flex-wrap: wrap;
}
html.digikang-desktop body .page-head-text { flex: 1 1 240px; min-width: 0; }
html.digikang-desktop body .page-head-text::before,
html.digikang-desktop body .section-header-text::before {
    content: "WORKSPACE";
    display: block;
    margin: 0 0 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    color: #7d9bc5;
}
html.digikang-desktop body .page-head-title,
html.digikang-desktop body .section-header-text h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: "Segoe UI", system-ui, sans-serif !important;
    font-size: 28px !important;
    font-weight: 700 !important;
    letter-spacing: -.04em !important;
    line-height: 1.15 !important;
    color: #e6edf9 !important;
    margin: 0 0 6px !important;
}
html.digikang-desktop body .dashboard-heading-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 11px;
    background: #1e3a5f;
    color: #8ebdff;
    font-size: 18px;
}
html.digikang-desktop body .page-head-sub,
html.digikang-desktop body .section-header-text p {
    font-size: 13px !important;
    color: #93a7c3 !important;
    margin: 0 !important;
    max-width: none !important;
}
html.digikang-desktop body .desktop-page-tools {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 0 0 auto;
    padding: 6px;
    border: 1px solid #2d4564;
    border-radius: 14px;
    background: #112037;
}
html.digikang-desktop body .section-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
html.digikang-desktop body .desktop-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid #355781;
    border-radius: 10px;
    background: #1e3657;
    color: #dceaff;
    font: 600 12px "Segoe UI", system-ui, sans-serif;
    cursor: pointer;
}
html.digikang-desktop body .desktop-page-btn:hover { background: #27497a; border-color: #4d7ab3; }
html.digikang-desktop body .page-head-stat {
    display: flex !important;
    align-items: center;
    gap: 8px;
    width: auto;
    min-width: 0;
    min-height: 36px;
    margin: 0;
    padding: 0 10px 0 4px !important;
    border: 0 !important;
    border-right: 1px solid #2d4564 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-align: left;
}
html.digikang-desktop body .page-head-stat-icon {
    display: grid !important;
    place-items: center;
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    width: 28px;
    height: 28px;
    border: 1px solid #365782;
    border-radius: 8px;
    background: #213c60;
    color: #8ebdff;
    font-size: 14px;
}
html.digikang-desktop body .page-head-stat-label {
    font-size: 9px !important;
    letter-spacing: .06em;
    color: #93add0 !important;
    text-transform: uppercase;
    margin: 0;
}
html.digikang-desktop body .page-head-stat-value { font-size: 18px !important; color: #e9f2ff !important; line-height: 1; }
html.digikang-desktop body .toolbar {
    background: #112037 !important;
    border: 1px solid #2d4564 !important;
    border-radius: 14px !important;
    box-shadow: none !important;
    padding: 12px 14px !important;
    margin: 0 0 18px !important;
}
html.digikang-desktop body .toolbar .search-wrap .form-input {
    min-height: 42px;
    border-radius: 10px;
    background: #0c1829 !important;
    border: 1px solid #324b69 !important;
    color: #dce8fa;
}
html.digikang-desktop body.page-dashboard #accounts-grid,
html.digikang-desktop body #accounts-grid,
html.digikang-desktop body #webadmin-grid.accounts-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 360px)) !important;
    justify-content: start !important;
    gap: 16px !important;
    width: 100% !important;
}
html.digikang-desktop body .account-card {
    width: auto !important;
    max-width: 360px !important;
    min-width: 0 !important;
    box-shadow: none !important;
    border-color: #2b3d57 !important;
}
html.digikang-desktop body .page-webadmin-intro {
    display: block;
    margin: 0 0 18px !important;
    padding: 14px 16px 16px !important;
    border: 1px solid #2c4564 !important;
    border-radius: 16px !important;
    background: linear-gradient(180deg, #122033, #0f1b2d) !important;
    box-shadow: none !important;
}
html.digikang-desktop body .page-webadmin-intro .robot-intro-body { display: block !important; padding: 0 !important; }
html.digikang-desktop body .webadmin-guide-summary { padding: 0 0 12px !important; cursor: default; }
html.digikang-desktop body .webadmin-guide-summary > i { display: none !important; }
html.digikang-desktop body .robot-intro-text { margin: 0 0 12px !important; color: #8ea6c6; }
html.digikang-desktop body .robot-install-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}
html.digikang-desktop body .robot-install-steps li {
    counter-increment: step;
    margin: 0;
    padding: 12px;
    border: 1px solid #2a415e;
    border-radius: 12px;
    background: #101b2c;
    color: #8ea6c6;
    font-size: 12px;
    line-height: 1.45;
}
html.digikang-desktop body .robot-install-steps li::before {
    content: counter(step, decimal-leading-zero);
    display: block;
    margin-bottom: 6px;
    color: #759acb;
    font-size: 11px;
    font-weight: 700;
}
html.digikang-desktop body .section-header-actions .btn { min-height: 42px; border-radius: 10px; }

/* Account management lives in the dashboard, in one accessible dialog. */
#account-modal { z-index: 500; }
#account-modal .account-editor-panel { max-width: 600px; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px; }
.account-editor-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.account-editor-heading-icon { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-size: 20px; }
.account-editor-heading-copy { flex: 1; min-width: 0; }
.account-editor-heading-copy .modal-title { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.account-editor-heading-copy p { margin: 5px 0 0; color: var(--theme-text-muted); font-size: 12px; line-height: 1.5; }
#account-modal .form-label { font-size: 12px; }
#account-modal .form-label .text-muted { font-size: 10px; font-weight: 500; }
#account-modal .form-input { min-height: 42px; border-radius: 10px; }
#account-modal #account-owner-context { border-radius: 12px; }
@media (max-width: 640px) {
    #account-modal { padding: 12px; }
    #account-modal .account-editor-panel { padding: 20px 16px; max-height: calc(100dvh - 24px); }
    .account-editor-heading { gap: 10px; }
    .account-editor-heading-icon { width: 38px; height: 38px; flex-basis: 38px; }
    .account-editor-heading-copy .modal-title { font-size: 18px; }
    #account-modal .grid-2 { grid-template-columns: 1fr; }
}

html:has(#account-modal.open), body:has(#account-modal.open) { overflow: hidden; }
#account-modal .account-editor-footer { position: sticky; bottom: -26px; background: var(--theme-bg-primary); padding: 14px 0 4px !important; border-top: 1px solid var(--theme-border-light); margin-top: 18px; }
@media (max-width: 640px) { #account-modal .account-editor-footer { bottom: -20px; padding-bottom: 8px !important; } }

html[data-theme] .page-dashboard .account-actions.account-actions-mutasi-only { display: grid; }
