.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

.auth-side {
  background: var(--auth-bg);
  color: var(--auth-text);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.auth-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='72' height='72' viewBox='0 0 72 72' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23C8963E' stroke-opacity='0.13' stroke-width='1'%3E%3Cpath d='M36 4 L44.5 27.5 L68 36 L44.5 44.5 L36 68 L27.5 44.5 L4 36 L27.5 27.5 Z'/%3E%3Crect x='20' y='20' width='32' height='32' transform='rotate(45 36 36)'/%3E%3Ccircle cx='36' cy='36' r='8'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.auth-side > * {
  position: relative;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: var(--gold-400);
  color: #231806;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.brand-mark .icon {
  width: 30px;
  height: 30px;
}

.auth-brand-name {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: 700;
  line-height: 1.2;
}

.auth-brand-tag {
  color: var(--auth-tag);
  font-size: var(--fs-small);
}

.auth-side h1 {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  line-height: 1.25;
  margin: 10px 0 0;
  font-weight: 700;
}

.auth-side p {
  color: var(--auth-dim);
  max-width: 460px;
  margin: 0;
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 22px;
  position: relative;
}

.auth-tools {
  position: absolute;
  top: 18px;
  inset-inline-end: 18px;
  display: flex;
  gap: 9px;
  align-items: center;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 30px 28px;
}

.auth-card h2 {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  margin: 0 0 4px;
  line-height: var(--lh-head);
}

.auth-card .sub {
  color: var(--muted);
  font-size: var(--fs-small);
  margin: 0 0 22px;
}

.auth-switch {
  margin-top: 18px;
  text-align: center;
  font-size: var(--fs-small);
  color: var(--muted);
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--brand-600);
  font-weight: 600;
  font-size: var(--fs-small);
  padding: 2px 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

html[data-theme="dark"] .link-btn {
  color: var(--brand-300);
}

.branch-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
}

.branch-card {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 30px 28px;
}

.branch-card h2 {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  margin: 0 0 4px;
  line-height: var(--lh-head);
}

.branch-card .sub {
  color: var(--muted);
  font-size: var(--fs-small);
  margin: 0 0 20px;
}

.branch-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.branch-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: start;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 15px 16px;
  line-height: 1.45;
}

.branch-item:hover {
  border-color: var(--brand-400);
}

.branch-item.active {
  border-color: var(--brand-600);
  background: var(--brand-50);
}

html[data-theme="dark"] .branch-item.active {
  background: var(--brand-900);
}

.branch-item .icon {
  width: 26px;
  height: 26px;
  color: var(--brand-600);
}

html[data-theme="dark"] .branch-item .icon {
  color: var(--brand-300);
}

.branch-item .b-name {
  font-weight: 700;
  display: block;
}

.branch-item .b-meta {
  color: var(--muted);
  font-size: var(--fs-cap);
  display: block;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-cap);
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--gold-100);
  color: var(--gold-600);
  line-height: 1.5;
}

html[data-theme="dark"] .badge {
  background: var(--gold-600);
  color: #fff7e0;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--sb-bg);
  color: var(--sb-text);
  border-inline-end: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.22s ease;
  z-index: 200;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 12px 10px;
  min-height: 60px;
}

.sidebar-head .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.sidebar-head .brand-mark .icon {
  width: 20px;
  height: 20px;
}

.sidebar-brand-text {
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-brand-text .b-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  display: block;
}

.sidebar-brand-text .b-branch {
  font-size: var(--fs-cap);
  color: var(--sb-dim);
  display: block;
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-pin {
  margin-inline-start: auto;
  border: 1px solid var(--sb-pin-border);
  background: transparent;
  color: var(--sb-pin-text);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: none;
}

.sidebar-pin .icon {
  width: 15px;
  height: 15px;
}

.sidebar-pin.active {
  background: var(--gold-400);
  border-color: var(--gold-400);
  color: #231806;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 8px 10px;
}

.nav-section-label {
  font-size: var(--fs-cap);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--sb-section);
  padding: 10px 8px 5px;
  white-space: nowrap;
}

.nav-item,
.nav-group-head {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--sb-text);
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  text-align: start;
  white-space: nowrap;
  position: relative;
}

.nav-item:hover,
.nav-group-head:hover {
  background: var(--sb-hover);
}

.nav-item.active {
  background: var(--gold-400);
  color: #231806;
  font-weight: 700;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.nav-icon .icon {
  width: 17px;
  height: 17px;
}

.nav-group.open > .nav-group-head {
  color: var(--sb-text);
  font-weight: 700;
}

.nav-group.open > .nav-group-head .nav-icon::after {
  content: "";
  position: absolute;
  bottom: -4px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 3px;
  border-radius: 3px;
  background: var(--gold-400);
}

html[dir="rtl"] .nav-group.open > .nav-group-head .nav-icon::after {
  transform: translateX(50%);
}

.nav-group-head .icon-chev {
  margin-inline-start: auto;
  width: 14px;
  height: 14px;
  transition: transform 0.18s ease;
  flex: none;
}

.nav-group.open > .nav-group-head .icon-chev {
  transform: rotate(180deg);
}

.nav-sub {
  display: none;
  padding: 2px 0 5px;
  margin-inline-start: 19px;
  border-inline-start: 1.5px solid var(--sb-sub-border);
}

.nav-group.open .nav-sub {
  display: block;
}

.nav-sub .nav-item {
  padding: 6px 9px;
  font-size: 12.5px;
}

.sidebar-foot {
  padding: 9px 10px 11px;
  border-top: 1px solid var(--sb-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--sb-text);
  text-align: start;
  padding: 5px 3px;
  border-radius: 9px;
}

.sidebar-user:hover {
  background: var(--sb-hover);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-500);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex: none;
  font-size: 13px;
}

.sidebar-user .u-name {
  font-weight: 600;
  font-size: 13px;
  display: block;
  line-height: 1.3;
  white-space: nowrap;
}

.sidebar-user .u-role {
  font-size: var(--fs-cap);
  color: var(--sb-dim);
  display: block;
  line-height: 1.3;
  white-space: nowrap;
}

.app-shell.sb-collapsed .sidebar {
  width: var(--sidebar-w-mini);
}

.app-shell.sb-collapsed .sidebar-brand-text,
.app-shell.sb-collapsed .nav-label,
.app-shell.sb-collapsed .nav-section-label,
.app-shell.sb-collapsed .nav-group-head .icon-chev,
.app-shell.sb-collapsed .sidebar-user .u-text,
.app-shell.sb-collapsed .sidebar-pin {
  display: none;
}

.app-shell.sb-collapsed .sidebar-head {
  justify-content: center;
  padding-inline: 8px;
}

.app-shell.sb-collapsed .nav-item,
.app-shell.sb-collapsed .nav-group-head {
  justify-content: center;
  padding-inline: 6px;
}

.app-shell.sb-collapsed .nav-sub {
  margin-inline-start: 0;
  border-inline-start: none;
}

.app-shell.sb-collapsed .nav-sub .nav-item {
  justify-content: center;
}

.app-shell.sb-collapsed.sb-hover .sidebar {
  width: var(--sidebar-w);
  box-shadow: var(--shadow-pop);
}

.app-shell.sb-collapsed.sb-hover .sidebar-brand-text,
.app-shell.sb-collapsed.sb-hover .nav-label,
.app-shell.sb-collapsed.sb-hover .nav-section-label,
.app-shell.sb-collapsed.sb-hover .nav-group-head .icon-chev,
.app-shell.sb-collapsed.sb-hover .sidebar-user .u-text,
.app-shell.sb-collapsed.sb-hover .sidebar-pin {
  display: block;
}

.app-shell.sb-collapsed.sb-hover .sidebar-head {
  justify-content: flex-start;
  padding-inline: 12px;
}

.app-shell.sb-collapsed.sb-hover .nav-item,
.app-shell.sb-collapsed.sb-hover .nav-group-head {
  justify-content: flex-start;
  padding-inline: 9px;
}

.app-shell.sb-collapsed.sb-hover .nav-sub {
  margin-inline-start: 19px;
  border-inline-start: 1.5px solid var(--sb-sub-border);
}

.app-shell.sb-collapsed.sb-hover .nav-sub .nav-item {
  justify-content: flex-start;
}

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 150;
}

.topbar .page-title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .spacer {
  flex: 1;
}

.topbar-search {
  position: relative;
  width: min(320px, 38vw);
}

.topbar-search .input {
  padding-inline-start: 40px;
  padding-top: 9px;
  padding-bottom: 9px;
}

.topbar-search .s-icon {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: inline-flex;
}

.topbar-search .s-icon .icon {
  width: 18px;
  height: 18px;
}

.content {
  padding: 22px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 17px 18px;
  display: flex;
  gap: 13px;
  align-items: center;
}

.stat-card .s-ico {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: var(--brand-50);
  color: var(--brand-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

html[data-theme="dark"] .stat-card .s-ico {
  background: var(--brand-900);
  color: var(--brand-300);
}

.stat-card .s-ico .icon {
  width: 24px;
  height: 24px;
}

.stat-card .s-val {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  display: block;
}

.stat-card .s-lbl {
  color: var(--muted);
  font-size: var(--fs-cap);
  display: block;
  line-height: 1.4;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 20px;
  margin-top: 16px;
}

.panel h3 {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  margin: 0 0 8px;
  line-height: var(--lh-head);
}

.panel p {
  color: var(--muted);
  font-size: var(--fs-small);
  margin: 0;
}

.empty-state {
  text-align: center;
  padding: 42px 18px;
  color: var(--muted);
}

.empty-state .icon {
  width: 52px;
  height: 52px;
  color: var(--brand-300);
  margin-bottom: 10px;
}

.empty-state h3 {
  font-family: var(--font-display);
  color: var(--text);
  margin: 0 0 6px;
}

.mobile-nav {
  display: none;
}

.drawer-backdrop {
  display: none;
}

@media (max-width: 1023px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-side {
    padding: 30px 24px 22px;
  }

  .auth-side h1 {
    font-size: 28px;
  }

  .auth-side p {
    display: none;
  }
}

@media (max-width: 820px) {
  .sidebar {
    position: fixed;
    inset-inline-start: 0;
    top: 0;
    transform: translateX(-110%);
    transition: transform 0.24s ease, width 0.22s ease;
    box-shadow: var(--shadow-pop);
  }

  html[dir="rtl"] .sidebar {
    transform: translateX(110%);
  }

  .app-shell.sb-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.sb-collapsed .sidebar {
    width: var(--sidebar-w);
  }

  .app-shell.sb-collapsed .sidebar-brand-text,
  .app-shell.sb-collapsed .nav-label,
  .app-shell.sb-collapsed .nav-section-label,
  .app-shell.sb-collapsed .nav-group-head .icon-chev,
  .app-shell.sb-collapsed .sidebar-user .u-text,
  .app-shell.sb-collapsed .sidebar-pin {
    display: block;
  }

  .app-shell.sb-collapsed .sidebar-head {
    justify-content: flex-start;
    padding-inline: 12px;
  }

  .app-shell.sb-collapsed .nav-item,
  .app-shell.sb-collapsed .nav-group-head {
    justify-content: flex-start;
    padding-inline: 9px;
  }

  .app-shell.sb-collapsed .nav-sub {
    margin-inline-start: 19px;
    border-inline-start: 1.5px solid var(--sb-sub-border);
  }

  .drawer-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(3, 26, 20, 0.5);
    z-index: 190;
  }

  .content {
    padding: 16px 14px 96px;
  }

  .topbar {
    padding: 0 14px;
  }

  .topbar-search {
    display: none;
  }

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    inset-inline: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 180;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 24px rgba(3, 26, 20, 0.08);
  }

  .mobile-nav button {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 2px;
    border-radius: 10px;
    line-height: 1.3;
  }

  .mobile-nav button .icon {
    width: 22px;
    height: 22px;
  }

  .mobile-nav button.active {
    color: var(--brand-700);
    background: var(--brand-50);
  }

  html[data-theme="dark"] .mobile-nav button.active {
    color: var(--brand-300);
    background: var(--brand-900);
  }

  .toast-wrap {
    bottom: 84px;
  }

  .auth-card,
  .branch-card {
    padding: 24px 20px;
  }
}
