:root{
  --p50-shell-sidebar:264px;
  --p50-shell-sidebar-collapsed:82px;
  --p50-topbar:68px;
  --p50-line:var(--oilora-border,#dfe8e4);
  --p50-muted:var(--oilora-text-muted,#687c74);
  --p50-surface:var(--oilora-surface,#fff);
  --p50-soft:var(--oilora-surface-subtle,#f6faf8);
  --p50-brand:var(--oilora-primary-800,#087b60);
  --p50-accent:var(--oilora-primary-500,#18ebb0);
}

/* Hard app boundaries: a previous public/customer tree must never bleed into admin. */
html[data-oilora-app="admin"] :is(.public-page,.public-shell,.public-site-shell,.public-architecture,[data-oilora-home],[data-landing-rebuild],[data-customer-portal]){display:none!important}
html[data-oilora-app="public"] :is([data-admin-shell],[data-phase50-route-loading],.p50-boundary-loader){display:none!important}
html[data-oilora-app="customer"] :is([data-admin-shell],.public-page,.public-shell,.public-site-shell,.p50-boundary-loader){display:none!important}

/* Immediate route boundary. This appears before route-specific CSS/API work starts. */
.p50-boundary-loader{position:fixed;inset:0;z-index:999;background:#f6faf8;display:grid;place-content:center;justify-items:center;gap:12px;color:#10221c;text-align:center;font-family:var(--font-primary,inherit)}
.p50-boundary-loader img{width:48px;height:48px;border-radius:15px;object-fit:contain;background:#09251d;padding:7px;box-shadow:0 10px 32px rgba(7,67,51,.12)}
.p50-boundary-loader>div{display:grid;gap:3px}.p50-boundary-loader b{font-size:14px}.p50-boundary-loader span{font-size:10px;color:#718078}
.p50-boundary-loader>i{width:92px;height:3px;border-radius:99px;background:#dbe7e2;overflow:hidden;position:relative}.p50-boundary-loader>i:after{content:"";position:absolute;inset-block:0;width:40%;border-radius:inherit;background:var(--p50-accent);animation:p50Load 1s ease-in-out infinite alternate}
@keyframes p50Load{from{inset-inline-start:0}to{inset-inline-start:60%}}

/* Stable desktop shell: the expanded sidebar is the default after one-time migration. */
@media(min-width:981px){
  :root{--oilora-shell-sidebar:var(--p50-shell-sidebar);--oilora-app-sidebar:var(--p50-shell-sidebar);--oilora-shell-sidebar-collapsed:var(--p50-shell-sidebar-collapsed);--oilora-app-sidebar-collapsed:var(--p50-shell-sidebar-collapsed);--oilora-shell-topbar:var(--p50-topbar);--oilora-app-topbar:var(--p50-topbar)}
  .shell[data-admin-stability="50"]>.sidebar{width:var(--p50-shell-sidebar)!important}
  .shell[data-admin-stability="50"]>.main{width:calc(100% - var(--p50-shell-sidebar))!important}
  .shell[data-admin-stability="50"].sidebar-collapsed>.sidebar{width:var(--p50-shell-sidebar-collapsed)!important}
  .shell[data-admin-stability="50"].sidebar-collapsed>.main{width:calc(100% - var(--p50-shell-sidebar-collapsed))!important}
}

/* Sidebar footer now carries branch context instead of consuming header width. */
.p50-branch-summary{width:100%;min-height:48px;border:1px solid rgba(255,255,255,.075);background:rgba(255,255,255,.035);border-radius:12px;color:#d9e9e2;display:grid;grid-template-columns:28px 1fr auto;align-items:center;gap:8px;padding:8px 9px;text-align:right;cursor:pointer;margin-bottom:8px}
.p50-branch-summary:hover{background:rgba(255,255,255,.065)}.p50-branch-summary>.oil-icon{color:var(--p50-accent);width:17px}.p50-branch-summary div{display:grid;gap:1px;min-width:0}.p50-branch-summary small{font-size:8px;color:#78998b}.p50-branch-summary b{font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.p50-branch-summary>i{font-style:normal;color:#78998b;font-size:11px}
.shell[data-admin-stability="50"].sidebar-collapsed .p50-branch-summary{grid-template-columns:1fr;justify-items:center;padding:9px 0}.shell[data-admin-stability="50"].sidebar-collapsed .p50-branch-summary div,.shell[data-admin-stability="50"].sidebar-collapsed .p50-branch-summary>i{display:none}

/* Header: three calm zones, no panel/branch duplication. */
.shell[data-admin-stability="50"] .p50-topbar{display:grid!important;grid-template-columns:minmax(150px,.65fr) minmax(280px,560px) auto!important;gap:14px!important;padding-inline:18px!important;height:var(--p50-topbar)!important;min-height:var(--p50-topbar)!important}
.shell[data-admin-stability="50"] .p50-topbar .topbar-start{min-width:0}.shell[data-admin-stability="50"] .page-identity small{font-size:8.5px!important;margin-bottom:1px!important}.shell[data-admin-stability="50"] .page-identity b{font-size:13px!important}
.shell[data-admin-stability="50"] .topbar-search-wrap{width:100%;max-width:560px;justify-self:center}.shell[data-admin-stability="50"] .topbar-search{height:40px!important;border-radius:12px!important;padding-inline:11px!important}.shell[data-admin-stability="50"] .topbar-search input{font-size:10.5px!important}.shell[data-admin-stability="50"] .topbar-search kbd{font-size:8px!important}
.shell[data-admin-stability="50"] .p50-top-actions{justify-self:end;gap:6px!important;flex-wrap:nowrap}.shell[data-admin-stability="50"] .p50-top-actions :is(.icon-btn,.theme-toggle){width:38px!important;height:38px!important;min-width:38px!important;border-radius:11px!important}.shell[data-admin-stability="50"] .quick-create{height:38px!important;padding-inline:12px!important;border-radius:11px!important}.shell[data-admin-stability="50"] .profile-pro{height:40px!important;max-width:170px;padding-block:3px!important}.shell[data-admin-stability="50"] .profile-pro .avatar{width:30px!important;height:30px!important}.shell[data-admin-stability="50"] .profile-text b{font-size:9.5px!important}.shell[data-admin-stability="50"] .profile-text small{font-size:8px!important}
.shell[data-admin-stability="50"] .panel-switch-wrap,.shell[data-admin-stability="50"] .branch-btn{display:none!important}

/* Route loading is shown inside the real shell after session validation. */
.p50-route-loading{background:var(--p50-surface);border:1px solid var(--p50-line);border-radius:18px;padding:18px;min-height:340px;display:grid;gap:14px;align-content:start;box-shadow:0 5px 20px rgba(16,48,30,.025)}
.p50-route-loading header{display:flex;align-items:center;gap:10px}.p50-skeleton-dot{width:38px;height:38px;border-radius:12px;background:linear-gradient(110deg,#e8f2ee,#f7faf9,#e8f2ee);background-size:220% 100%;animation:p50Shimmer 1.2s linear infinite}.p50-route-loading header div{display:grid;gap:6px;flex:1}.p50-route-loading header i:first-child{width:180px;height:11px}.p50-route-loading header i:last-child{width:280px;max-width:60%;height:7px}.p50-route-loading i{display:block;border-radius:999px;background:linear-gradient(110deg,#edf3f0,#fafcfb,#edf3f0);background-size:220% 100%;animation:p50Shimmer 1.2s linear infinite}.p50-skeleton-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}.p50-skeleton-grid i{height:76px;border-radius:14px}.p50-skeleton-panel{border:1px solid #edf2ef;border-radius:14px;padding:14px;display:grid;gap:11px}.p50-skeleton-panel i{height:10px}.p50-skeleton-panel i:nth-child(1){width:42%}.p50-skeleton-panel i:nth-child(2){width:88%}.p50-skeleton-panel i:nth-child(3){width:68%}.p50-route-loading p{margin:0;color:var(--p50-muted);font-size:9px;text-align:center}
@keyframes p50Shimmer{to{background-position:-220% 0}}

/* Branch operations page */
.p50-branches-page{display:grid;gap:14px;max-width:1450px}.p50-branches-hero{background:linear-gradient(135deg,#fff 0%,#fbfefd 62%,rgba(24,235,176,.08) 100%);border:1px solid var(--p50-line);border-radius:20px;padding:22px;display:flex;align-items:flex-end;justify-content:space-between;gap:22px}.p50-branches-hero>div:first-child{max-width:760px}.p50-branches-hero>div:first-child>span{font-size:8px;font-weight:900;letter-spacing:.08em;color:var(--p50-brand)}.p50-branches-hero h1{font-size:25px;margin:6px 0 5px;line-height:1.4}.p50-branches-hero p{margin:0;color:var(--p50-muted);font-size:10px;line-height:1.9}.p50-branches-hero-actions{display:flex;gap:7px;flex-wrap:wrap}
.p50-branches-metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}.p50-branches-metrics article{background:var(--p50-surface);border:1px solid var(--p50-line);border-radius:15px;padding:14px;display:flex;flex-direction:column;gap:3px;min-height:88px;justify-content:center}.p50-branches-metrics small{font-size:8px;color:var(--p50-muted)}.p50-branches-metrics strong{font-size:20px}.p50-branches-metrics span{font-size:7.5px;color:var(--p50-muted)}
.p50-branches-panel{background:var(--p50-surface);border:1px solid var(--p50-line);border-radius:18px;overflow:hidden}.p50-branches-panel>header{display:flex;justify-content:space-between;align-items:center;gap:18px;padding:15px 16px;border-bottom:1px solid var(--p50-line)}.p50-branches-panel h2{font-size:14px;margin:0}.p50-branches-panel header p{font-size:8px;color:var(--p50-muted);margin:2px 0 0}.p50-branch-search{width:min(330px,42vw);height:38px;border:1px solid var(--p50-line);background:var(--p50-soft);border-radius:10px;display:flex;align-items:center;gap:7px;padding-inline:10px}.p50-branch-search .oil-icon{width:16px;color:var(--p50-muted)}.p50-branch-search input{border:0;outline:0;background:transparent;min-width:0;width:100%;font:inherit;font-size:9px;color:inherit}.p50-branch-list{display:grid}.p50-branch-row{display:grid;grid-template-columns:34px minmax(220px,1.5fr) minmax(140px,.7fr) minmax(110px,.55fr) auto;gap:12px;align-items:center;padding:13px 15px;border-bottom:1px solid #edf2ef}.p50-branch-row:last-child{border-bottom:0}.p50-branch-row:hover{background:#fbfdfc}.p50-branch-index{width:30px;height:30px;border-radius:9px;background:var(--p50-soft);display:grid;place-items:center;font-size:8px;font-weight:800;color:var(--p50-muted)}.p50-branch-main{min-width:0}.p50-branch-main>div{display:flex;align-items:center;gap:7px}.p50-branch-main b{font-size:10.5px}.p50-branch-main small,.p50-branch-hours small,.p50-branch-staff small{font-size:7.5px;color:var(--p50-muted)}.p50-branch-hours,.p50-branch-staff{display:grid;gap:2px}.p50-branch-hours b,.p50-branch-staff b{font-size:9px}.p50-branch-state{display:inline-flex;align-items:center;gap:4px;font-size:7px;font-weight:800;padding:4px 6px;border-radius:99px;background:#eef3f1;color:#607168}.p50-branch-state i{width:5px;height:5px;border-radius:50%;background:currentColor}.p50-branch-state.open{background:#e9f8f1;color:#087b60}.p50-branch-state.closed{background:#fff0ef;color:#b53d34}.p50-branch-actions{display:flex;align-items:center;gap:6px}.p50-danger-icon{color:#b53d34!important}.p50-branches-panel>footer{padding:10px 15px;border-top:1px solid var(--p50-line);display:flex;justify-content:space-between;color:var(--p50-muted);font-size:7px}.p50-branches-empty{min-height:220px;display:grid;place-content:center;justify-items:center;gap:5px;text-align:center;padding:25px;color:var(--p50-muted)}.p50-branches-empty>span{width:42px;height:42px;border-radius:12px;background:var(--p50-soft);display:grid;place-items:center;color:var(--p50-brand);font-size:18px}.p50-branches-empty b{color:var(--oilora-text,#10221c);font-size:12px}.p50-branches-empty p{margin:0;font-size:8.5px}.p50-branches-empty.error>span{background:#fff0ef;color:#b53d34}

@media(max-width:1180px) and (min-width:981px){
  .shell[data-admin-stability="50"] .p50-topbar{grid-template-columns:minmax(130px,.5fr) minmax(240px,1fr) auto!important;padding-inline:12px!important;gap:9px!important}.shell[data-admin-stability="50"] .profile-text{display:none}.shell[data-admin-stability="50"] .profile-pro{width:40px;padding:4px!important}.shell[data-admin-stability="50"] .profile-caret{display:none}.shell[data-admin-stability="50"] .topbar-search kbd{display:none}
}
@media(max-width:980px){
  .p50-boundary-loader{padding:20px}.shell[data-admin-stability="50"] .p50-topbar{grid-template-columns:minmax(0,1fr) auto!important;height:64px!important;min-height:64px!important;padding-inline:10px!important}.shell[data-admin-stability="50"] .topbar-search-wrap{display:none}.shell[data-admin-stability="50"] .topbar-search-wrap.mobile-open{display:block!important;position:absolute;inset-inline:10px;top:58px;z-index:90;max-width:none}.shell[data-admin-stability="50"] .mobile-search-trigger{display:grid!important}.shell[data-admin-stability="50"] .quick-create{display:none!important}.shell[data-admin-stability="50"] .profile-text{display:none}.shell[data-admin-stability="50"] .profile-pro{width:38px;padding:3px!important}.shell[data-admin-stability="50"] .profile-caret{display:none}.p50-branches-metrics{grid-template-columns:repeat(2,1fr)}.p50-branches-hero{align-items:flex-start;flex-direction:column}.p50-branch-row{grid-template-columns:30px minmax(0,1fr) auto}.p50-branch-hours,.p50-branch-staff{grid-column:2}.p50-branch-actions{grid-column:3;grid-row:1/4}.p50-skeleton-grid{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:640px){
  .p50-branches-hero{padding:16px;border-radius:16px}.p50-branches-hero h1{font-size:20px}.p50-branches-hero-actions{width:100%}.p50-branches-hero-actions .btn{flex:1}.p50-branches-metrics{grid-template-columns:1fr 1fr;gap:7px}.p50-branches-metrics article{min-height:78px;padding:11px}.p50-branches-panel>header{align-items:stretch;flex-direction:column}.p50-branch-search{width:100%}.p50-branch-row{padding:12px 10px;gap:8px}.p50-branch-actions{align-self:start}.p50-route-loading{padding:13px}.p50-skeleton-grid{grid-template-columns:1fr 1fr}.p50-skeleton-grid i{height:58px}
}
@media(prefers-reduced-motion:reduce){.p50-boundary-loader>i:after,.p50-route-loading i,.p50-skeleton-dot{animation:none!important}}

html[data-theme="dark"] .p50-boundary-loader{background:#0c1a16;color:#eaf5f0}.shell[data-admin-stability="50"] .p50-branches-hero,html[data-theme="dark"] .p50-branches-panel,html[data-theme="dark"] .p50-branches-metrics article,html[data-theme="dark"] .p50-route-loading{background:var(--oilora-shell-surface,#10231d);border-color:var(--oilora-border,#294038)}html[data-theme="dark"] .p50-branch-row:hover{background:#12261f}html[data-theme="dark"] .p50-branch-search{background:#0d1b16}
