/* Shell only. The module iframes keep their own styles and behavior. */
body.bracore-ui {
  margin: 0;
  min-height: 100dvh;
  background: var(--br-bg);
  color: var(--br-text);
  overflow: hidden;
}
body.bracore-ui .shell {
  --br-sidebar-width: 238px;
  display: grid;
  grid-template-columns: var(--br-sidebar-width) minmax(0, 1fr);
  grid-template-rows: 72px minmax(0, 1fr);
  height: 100dvh;
  background: var(--br-bg);
}
body.bracore-ui .shell.br-sidebar-collapsed { --br-sidebar-width: 72px; }
body.bracore-ui .shell:not(.authenticated) .br-sidebar,
body.bracore-ui .shell:not(.authenticated) .content { display: none; }
body.bracore-ui .br-sidebar {
  grid-column: 1;
  grid-row: 1 / 3;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 10px;
  border-right: 1px solid var(--br-divider);
  background: linear-gradient(180deg, var(--br-midnight), var(--br-graphite));
  overflow-y: auto;
}
body.bracore-ui .br-sidebar-top { display: flex; align-items: center; gap: 8px; padding: 0 4px 12px; min-height: 46px; border-bottom: 1px solid var(--br-divider); }
body.bracore-ui .br-sidebar-brand { color: var(--br-text); font-size: 14px; font-weight: 900; letter-spacing: .14em; white-space: nowrap; }
body.bracore-ui .br-sidebar-brand b { display: block; color: var(--br-coral); font-size: 10px; line-height: 1; letter-spacing: .24em; text-align: right; }
body.bracore-ui .br-nav-toggle,
body.bracore-ui .br-mobile-toggle {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--br-divider);
  border-radius: var(--br-radius-sm);
  background: var(--br-surface);
  color: var(--br-text);
  cursor: pointer;
  font: 700 19px/1 var(--br-font);
}
body.bracore-ui .br-mobile-toggle { display: none; }
body.bracore-ui .br-mobile-user { display: none; }
body.bracore-ui .shell .br-sidebar .nav,
body.bracore-ui .shell .br-sidebar .admin-nav { display: flex; flex-direction: column; gap: 4px; width: 100%; margin: 0; padding: 0; overflow: visible; }
body.bracore-ui .shell .br-sidebar .admin-nav { display: none; border-top: 1px solid var(--br-divider); padding-top: 12px; }
body.bracore-ui .shell .br-sidebar .admin-nav.visible { display: flex; }
body.bracore-ui .br-nav-group { margin: 11px 8px 3px; padding: 14px 4px 0; border-top: 1px solid var(--br-divider); color: var(--br-muted); font: 750 10px/1.2 var(--br-font); letter-spacing: .15em; }
body.bracore-ui .shell .br-sidebar .nav button,
body.bracore-ui .shell .br-sidebar .admin-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--br-radius-sm);
  background: transparent;
  color: var(--br-muted);
  text-align: left;
  font: 650 13px/1.3 var(--br-font);
  cursor: pointer;
  margin: 0;
  box-shadow: none;
  white-space: nowrap;
}
body.bracore-ui .shell .br-sidebar .nav button[hidden],
body.bracore-ui .shell .br-sidebar .admin-nav button[hidden] { display: none !important; }
body.bracore-ui .shell .br-sidebar .nav button.active,
body.bracore-ui .shell .br-sidebar .admin-nav button.active { background: linear-gradient(100deg, #0e6273, #174659); border-color: #2b8ba0; color: #fff; box-shadow: inset 3px 0 0 var(--br-cyan), 0 6px 20px rgb(0 0 0 / 13%); }
body.bracore-ui .shell .br-sidebar .nav button:hover:not(.active),
body.bracore-ui .shell .br-sidebar .admin-nav button:hover:not(.active) { background: var(--br-surface-hover); color: var(--br-text); }
body.bracore-ui .shell .br-sidebar .nav button.driver { margin-left: 0; }
body.bracore-ui .br-nav-icon { display: inline-flex; flex: 0 0 20px; width: 20px; height: 20px; align-items: center; justify-content: center; }
body.bracore-ui .br-nav-icon svg { display: block; width: 19px; height: 19px; }
body.bracore-ui .shell .br-sidebar button.active .br-nav-icon { color: #95f0f6; }
body.bracore-ui .br-nav-label { overflow: hidden; text-overflow: ellipsis; }
body.bracore-ui .shell.br-sidebar-collapsed .br-sidebar-brand,
body.bracore-ui .shell.br-sidebar-collapsed .br-nav-label,
body.bracore-ui .shell.br-sidebar-collapsed .br-nav-group { display: none; }
body.bracore-ui .shell.br-sidebar-collapsed .br-sidebar .nav button,
body.bracore-ui .shell.br-sidebar-collapsed .br-sidebar .admin-nav button { justify-content: center; padding-inline: 0; }
body.bracore-ui .shell .top {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 10px clamp(16px, 2vw, 28px);
  border-bottom: 1px solid var(--br-divider);
  background: var(--br-midnight);
  box-shadow: 0 6px 24px rgb(0 0 0 / 16%);
  backdrop-filter: none;
}
body.bracore-ui .shell .brandrow { min-height: 50px; display: flex; align-items: center; gap: clamp(10px, 1.3vw, 18px); min-width: 0; }
body.bracore-ui .shell .brandrow .grow { flex: 1; }
body.bracore-ui .shell .br-header-brand { flex: 0 0 auto; min-width: 0; }
body.bracore-ui .shell .top .logo { display: none; }
body.bracore-ui .shell .top .brand { color: var(--br-text); font-size: 17px; letter-spacing: .11em; white-space: nowrap; }
body.bracore-ui .shell .top .sub { color: var(--br-muted); font-size: 11px; }
body.bracore-ui .shell .top .version { display: block !important; max-width: clamp(120px, 17vw, 260px); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: transparent; color: var(--br-text); font-size: 12px; }
body.bracore-ui .shell .globalLogout { min-height: 44px; border: 1px solid var(--br-border); background: var(--br-surface); color: var(--br-text); }
body.bracore-ui .shell .globalLogout:hover { border-color: var(--br-coral); color: var(--br-coral); }
body.bracore-ui .shell .branchPicker { min-width: 150px; }
body.bracore-ui .shell .branchPicker summary,
body.bracore-ui .shell .globalSel { min-height: 44px; background: var(--br-surface); border: 1px solid var(--br-border); color: var(--br-text); border-radius: var(--br-radius-sm); }
body.bracore-ui .shell .branchPicker[open] summary { border-color: var(--br-cyan); box-shadow: 0 0 0 3px rgb(25 212 230 / 15%); }
body.bracore-ui .shell .branchIcon { color: var(--br-cyan); }
body.bracore-ui .shell .branchMenu { background: var(--br-surface); border: 1px solid var(--br-border); }
body.bracore-ui .shell .branchMenu button { color: var(--br-text); }
body.bracore-ui .shell .branchMenu button.active { background: var(--br-petrol); color: var(--br-cyan); }
body.bracore-ui .shell .content { grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; background: var(--br-bg); }
body.bracore-ui .shell .frame { width: 100%; height: 100%; border: 0; background: var(--br-bg); }
@media (min-width: 641px) and (max-width: 1100px) {
  body.bracore-ui .shell .top .sub { display: none; }
  body.bracore-ui .shell .top .brand { font-size: 14px; letter-spacing: .06em; }
  body.bracore-ui .shell .branchPicker { min-width: 128px; }
  body.bracore-ui .shell #globalBranchWrap { min-width: 0; }
  body.bracore-ui .shell .top .version { max-width: 160px; font-size: 11px; }
}
@media (min-width: 641px) and (max-width: 820px) {
  body.bracore-ui .shell:not(.br-sidebar-collapsed) .br-header-brand { display: none; }
  body.bracore-ui .shell .top .version { flex: 0 1 auto; min-width: 150px; max-width: none; overflow: visible; text-overflow: clip; white-space: normal; line-height: 1.25; }
}

body.bracore-ui .auth-gate { background: radial-gradient(900px 560px at 84% 12%, #153646, transparent 65%), var(--br-graphite); }
body.bracore-ui .auth-card { width: min(440px, 100%); padding: 32px; background: linear-gradient(145deg, var(--br-surface), #0b1a24); border: 1px solid var(--br-border); box-shadow: var(--br-shadow-modal); }
body.bracore-ui .auth-brand .logo { display: none; }
body.bracore-ui .auth-card h1 { color: var(--br-text); font-size: 21px; letter-spacing: .1em; }
body.bracore-ui .auth-card p { color: var(--br-muted); }
body.bracore-ui .auth-field label { color: var(--br-text); }
body.bracore-ui .auth-field input { min-height: 48px; background: var(--br-input-bg); color: var(--br-text); border: 1px solid var(--br-border); }
body.bracore-ui .auth-submit { min-height: 48px; background: var(--br-cyan); border-color: var(--br-cyan); color: var(--br-on-accent); box-shadow: 0 8px 26px rgb(25 212 230 / 18%); }
body.bracore-ui .auth-error { color: var(--br-coral); }
body.bracore-ui :where(.br-nav-toggle, .br-mobile-toggle, .globalLogout, .nav button, .admin-nav button, .branchPicker summary, .branchMenu button, .auth-field input, .auth-submit):focus-visible { outline: 3px solid var(--br-focus); outline-offset: 2px; }
body.bracore-ui .br-mobile-scrim { display: none; }
@media (max-width: 920px) {
  body.bracore-ui .shell { --br-sidebar-width: 72px; }
  body.bracore-ui .shell .br-sidebar-brand,
  body.bracore-ui .shell .br-nav-label,
  body.bracore-ui .shell .br-nav-group { display: none; }
  body.bracore-ui .shell .br-sidebar .nav button,
  body.bracore-ui .shell .br-sidebar .admin-nav button { justify-content: center; padding-inline: 0; }
  body.bracore-ui .shell:not(.br-sidebar-collapsed) { --br-sidebar-width: 238px; }
  body.bracore-ui .shell:not(.br-sidebar-collapsed) .br-sidebar-brand,
  body.bracore-ui .shell:not(.br-sidebar-collapsed) .br-nav-label { display: initial; }
  body.bracore-ui .shell:not(.br-sidebar-collapsed) .br-nav-group { display: block; }
  body.bracore-ui .shell:not(.br-sidebar-collapsed) .br-sidebar .nav button,
  body.bracore-ui .shell:not(.br-sidebar-collapsed) .br-sidebar .admin-nav button { justify-content: flex-start; padding-inline: 12px; }
}
@media (max-width: 640px) {
  body.bracore-ui .shell,
  body.bracore-ui .shell:not(.br-sidebar-collapsed) { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 66px minmax(0, 1fr); width: 100%; }
  body.bracore-ui .shell .top { grid-column: 1; grid-row: 1; padding: 8px 10px; overflow: visible; }
  body.bracore-ui .shell .brandrow { display: flex; min-height: 50px; width: 100%; flex-wrap: nowrap; gap: 8px; }
  body.bracore-ui .br-mobile-toggle { display: inline-block; }
  body.bracore-ui .shell .top .brand { font-size: 13px; }
  body.bracore-ui .shell .top .sub,
  body.bracore-ui .shell .top .version,
  body.bracore-ui .shell .top .grow { display: none !important; }
  body.bracore-ui .shell .top .br-mobile-user { display: inline-flex; flex: 0 0 32px; width: 32px; height: 32px; align-items: center; justify-content: center; border-radius: 50%; color: var(--br-on-accent); background: var(--br-cyan); font-weight: 800; }
  body.bracore-ui .shell .br-header-brand { margin-right: auto; }
  body.bracore-ui .shell #globalBranchWrap { width: auto; min-width: 0; max-width: 132px; }
  body.bracore-ui .shell .branchPicker { min-width: 0; }
  body.bracore-ui .shell .branchPicker summary,
  body.bracore-ui .shell .globalSel { min-width: 0; width: 100%; max-width: 132px; padding: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; }
  body.bracore-ui .shell .branchMenu { position: absolute; top: calc(100% + 6px); left: auto; right: 0; min-width: 190px; max-height: 50dvh; overflow-y: auto; }
  body.bracore-ui .shell .globalLogout { min-width: 44px; padding: 7px; font-size: 11px; }
  body.bracore-ui .shell .content { grid-column: 1; grid-row: 2; }
  body.bracore-ui .shell .br-sidebar { position: fixed; z-index: 60; top: 66px; bottom: 0; left: 0; width: min(280px, 86vw); transform: translateX(-100%); transition: transform var(--br-duration) var(--br-ease); box-shadow: var(--br-shadow-modal); }
  body.bracore-ui .shell.br-mobile-open .br-sidebar { transform: translateX(0); }
  body.bracore-ui .shell .br-sidebar-brand,
  body.bracore-ui .shell .br-nav-label { display: initial; }
  body.bracore-ui .shell .br-nav-group { display: block; }
  body.bracore-ui .shell .br-sidebar .nav button,
  body.bracore-ui .shell .br-sidebar .admin-nav button { justify-content: flex-start; padding-inline: 12px; }
  body.bracore-ui .shell.br-mobile-open .br-mobile-scrim { display: block; position: fixed; z-index: 50; inset: 66px 0 0; border: 0; background: var(--br-overlay); }
  body.bracore-ui .auth-card { padding: 22px; }
}
@media (max-width: 380px) {
  body.bracore-ui .shell,
  body.bracore-ui .shell:not(.br-sidebar-collapsed) { grid-template-rows: 112px minmax(0, 1fr); }
  body.bracore-ui .shell .brandrow { flex-wrap: wrap; align-content: center; gap: 6px 8px; }
  body.bracore-ui .shell #globalBranchWrap { order: 5; flex: 1 1 100%; max-width: none; }
  body.bracore-ui .shell .branchPicker summary,
  body.bracore-ui .shell .globalSel { max-width: none; }
  body.bracore-ui .shell .br-sidebar { top: 112px; }
  body.bracore-ui .shell.br-mobile-open .br-mobile-scrim { inset-block-start: 112px; }
}
@media (prefers-reduced-motion: reduce) {
  body.bracore-ui .shell .br-sidebar { transition: none; }
}
