.brand-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-row.compact {
  min-height: 58px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px;
  background: var(--surface-nav);
}

body[data-shell="platform"] .brand-row.compact {
  display: grid;
  grid-template-columns: 46px 1fr;
  min-height: 68px;
  margin-bottom: 18px;
  border-width: 0 0 1px;
  border-radius: 0;
  padding: 6px 0 16px;
  background: transparent;
}

body[data-shell="platform"] .brand-row.compact strong {
  font-size: 17px;
  font-weight: 850;
  line-height: 1.25;
}

body[data-shell="platform"] .brand-row.compact span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--ink-inverse);
  background: var(--brand-gradient);
  font-weight: 900;
}

body[data-shell="platform"] .brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(145deg, #20d4c1, #2674ff);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14) inset, 0 12px 28px rgba(36, 124, 255, 0.36);
}

.brand-row strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.brand-row span,
.breadcrumb,
.form-message {
  color: var(--muted);
  font-size: 11px;
}

.login-proof,
.side-nav {
  display: grid;
  gap: 12px;
}

.login-proof {
  grid-template-columns: repeat(3, max-content);
  margin-top: 28px;
}

.login-proof span,
.version-pill,
.user-pill {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--text-soft);
  background: var(--surface-pill);
  font-size: 12px;
}

.login-panel {
  display: grid;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--login-panel-background);
  box-shadow: var(--shadow);
}

.login-panel h2 {
  margin: 0 0 8px;
}

.login-panel input,
.topbar select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  background: var(--surface-input);
}

.login-panel input {
  height: 42px;
  padding: 0 12px;
}

.topbar select {
  min-width: 260px;
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

body[data-shell="platform"] .topbar select,
body[data-shell="platform"] .ghost-button,
body[data-shell="platform"] .user-pill {
  height: 38px;
  border: 1px solid rgba(84, 137, 210, 0.34);
  border-radius: 8px;
  color: #e8f3ff;
  background: rgba(13, 30, 55, 0.86);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

body[data-shell="platform"] .topbar select {
  appearance: none;
  min-width: 190px;
  padding-right: 34px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5 5 6.5 8 3.5' fill='none' stroke='%23e8f3ff' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 14px center / 10px 10px no-repeat,
    rgba(13, 30, 55, 0.86);
  box-shadow: 0 0 0 1px rgba(50, 128, 255, 0.12) inset;
}

body[data-shell="platform"] .ghost-button {
  min-height: 38px;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

body[data-shell="platform"] .user-pill {
  border-color: rgba(22, 215, 160, 0.22);
  color: #70f0c8;
  background: rgba(9, 42, 48, 0.66);
}

body[data-shell="platform"] .version-pill,
body[data-shell="platform"] .theme-label,
body[data-shell="platform"] .theme-dots {
  display: none;
}

.primary-button,
.ghost-button,
.side-nav button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
}

.primary-button {
  min-height: 40px;
  margin-top: 8px;
  background: linear-gradient(90deg, var(--accent), var(--accent-blue));
  font-weight: 800;
}

.ghost-button,
.gate-link {
  background: var(--surface-action);
}

.ghost-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
}

body[data-shell="business"] .ghost-button,
body[data-shell="business"] .topbar select {
  border-color: var(--line);
  border-radius: 8px;
  color: var(--txt);
  background: #12203c;
}

body[data-shell="business"] .ghost-button {
  min-height: 33px;
  font-weight: 400;
}

body[data-shell="business"] .topbar select {
  width: 158px;
  min-width: 158px;
  height: 32px;
}

body[data-shell="business"] .version-pill,
body[data-shell="business"] .user-pill {
  border-radius: 20px;
  padding: 5px 9px;
  color: #b9c9e8;
  background: rgba(8, 16, 32, 0.55);
  font-size: 11px;
}

body[data-shell="business"] .brand-row.compact {
  min-height: 58px;
  gap: 10px;
  margin-bottom: 8px;
  border: 1px solid rgba(70, 140, 235, 0.16);
  border-radius: 12px;
  padding: 9px 9px 10px;
  background: linear-gradient(180deg, rgba(20, 42, 80, 0.46), rgba(8, 16, 32, 0.38));
}

body[data-shell="business"] .brand-row.compact strong {
  font-size: 14px;
}

body[data-shell="business"] .brand-row.compact span {
  color: var(--mut);
  font-size: 10px;
}

body[data-shell="business"] .brand-mark {
  border-radius: 11px;
  color: var(--txt);
  box-shadow: 0 0 16px rgba(25, 230, 160, 0.16);
}

.nav-group {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--border-muted-faint);
  border-radius: var(--radius);
  background: var(--surface-panel-deep);
}

body[data-shell="business"] .side-nav {
  gap: 9px;
}

body[data-shell="platform"] .side-nav {
  display: block;
  gap: 0;
}

body[data-shell="business"] .nav-group {
  gap: 3px;
  margin: 0 3px -1px;
  border: 1px solid rgba(70, 140, 235, 0.08);
  border-radius: 12px;
  padding: 4px;
  background: rgba(8, 16, 32, 0.24);
}

body[data-shell="platform"] .nav-group {
  gap: 0;
  margin: 16px 0 18px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

body[data-shell="platform"] #platformNavGroup {
  margin-top: 0;
}

body[data-shell="platform"] .nav-box {
  border: 1px solid rgba(72, 114, 176, 0.18);
  border-radius: 8px;
  padding: 7px;
  background: rgba(7, 17, 32, 0.72);
}

body[data-shell="platform"] .gate-box {
  display: grid;
  gap: 8px;
}

#platformNavGroup,
#businessPlatformEntry {
  display: none;
}

body[data-shell="business"] .platform-return-group {
  display: none;
}

body[data-shell="business"][data-platform-admin="true"] #businessPlatformEntry {
  display: none;
}

body[data-shell="platform"] .side-nav .nav-group:not(#platformNavGroup):not(.platform-return-group) {
  display: none;
}

body[data-shell="platform"][data-platform-admin="true"] #platformNavGroup,
body[data-shell="platform"][data-platform-admin="true"] .platform-return-group {
  display: grid;
}

.nav-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

body[data-shell="platform"] .nav-group-title {
  margin: 0 0 8px;
  color: #b6c8df;
  font-size: 14px;
  font-weight: 750;
}

body[data-shell="business"] .nav-group-title {
  margin: 0 7px 9px 0;
  color: #9ab0d3;
  font-size: 12px;
}

.nav-group-title::before {
  width: 3px;
  height: 12px;
  content: "";
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-blue));
}

body[data-shell="platform"] .nav-group-title::before {
  width: 4px;
  height: 18px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--teal), var(--blue));
  box-shadow: 0 0 14px rgba(22, 215, 160, 0.5);
}

.nav-group-title::after {
  height: 1px;
  flex: 1;
  content: "";
  background: var(--line);
}

body[data-shell="platform"] .nav-group-title::after {
  display: none;
}

.theme-label {
  color: var(--muted);
  font-size: 12px;
}

.side-nav button {
  width: 100%;
  min-height: 32px;
  padding: 0 9px 0 10px;
  position: relative;
  text-align: left;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-soft);
  background: transparent;
  border-color: transparent;
}

body[data-shell="platform"] .side-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  color: #d8e6f8;
  background: transparent;
  font-size: 15px;
  font-weight: 650;
}

body[data-shell="platform"] .side-nav button + button {
  margin-top: 4px;
}

body[data-shell="platform"] .side-nav button.active {
  border-color: rgba(22, 215, 160, 0.56);
  background: linear-gradient(90deg, rgba(16, 184, 143, 0.28), rgba(37, 106, 236, 0.18));
  box-shadow: 0 0 0 1px rgba(22, 215, 160, 0.1) inset, 0 0 24px rgba(20, 187, 153, 0.14);
}

body[data-shell="platform"] .side-nav button.active::before,
body[data-shell="platform"] .side-nav button.active::after {
  display: none;
}

body[data-shell="platform"] .nav-icon {
  width: 18px;
  color: #b8c9df;
  font-size: 15px;
  text-align: center;
}

body[data-shell="platform"] .nav-badge {
  margin-left: auto;
  height: 20px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  color: #ffb1bc;
  background: rgba(255, 88, 108, 0.16);
  font-size: 11px;
  font-weight: 850;
}

body[data-shell="business"] .side-nav button {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 7px 10px;
  color: #b9c9e8;
  background: transparent;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
}

body[data-shell="business"] .side-nav button.active {
  border-color: rgba(25, 230, 160, 0.38);
  color: #fff;
  background: linear-gradient(90deg, rgba(22, 163, 74, 0.26), rgba(37, 99, 235, 0.12));
  box-shadow: inset 3px 0 0 var(--ac), 0 0 18px rgba(25, 230, 160, 0.08);
}

body[data-shell="business"] .side-nav button.active::before {
  display: none;
}

body[data-shell="business"] .side-nav button.active::after {
  right: 10px;
  top: 50%;
  width: 6px;
  height: 6px;
  background: var(--ac);
  box-shadow: 0 0 10px var(--ac);
  transform: translateY(-50%);
}

.side-nav button.active {
  border-color: var(--border-blue-strong);
  color: var(--text);
  background: linear-gradient(90deg, var(--overlay-blue-strong), var(--overlay-blue-faint));
}

.side-nav button.active::before {
  position: absolute;
  left: 0;
  top: 7px;
  width: 3px;
  height: 18px;
  content: "";
  border-radius: 999px;
  background: var(--accent);
}

.side-nav button.active::after {
  position: absolute;
  right: 9px;
  top: 12px;
  width: 6px;
  height: 6px;
  content: "";
  border-radius: 999px;
  background: var(--accent);
}

.gate-link {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
}

.gate-link span {
  font-size: 13px;
  font-weight: 900;
}

.gate-link small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.gate-link.sensitive {
  border-color: var(--border-danger-subtle);
}

.gate-link:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.side-nav .gate-link {
  border-color: var(--line);
  background: var(--surface-panel-deep);
}

body[data-shell="platform"] .side-nav .gate-link {
  width: 100%;
  min-height: 0;
  display: block;
  border: 1px solid rgba(72, 114, 176, 0.22);
  border-radius: 8px;
  padding: 12px;
  color: #e4efff;
  background: rgba(7, 18, 34, 0.7);
  text-align: left;
}

body[data-shell="platform"] .side-nav .gate-link + .gate-link {
  margin-top: 0;
}

body[data-shell="platform"] .gate-top {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 850;
}

body[data-shell="platform"] .gate-link .gate-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  color: #bfe4ff;
  background: rgba(46, 134, 255, 0.18);
}

body[data-shell="platform"] .gate-link .gate-tag {
  margin-left: auto;
  height: 20px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  border-radius: 7px;
  color: #9dc7ff;
  background: rgba(46, 134, 255, 0.16);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

body[data-shell="platform"] .gate-link .gate-tag.red {
  color: #ffbfca;
  background: rgba(255, 88, 108, 0.18);
}

body[data-shell="platform"] .gate-link small {
  display: block;
  margin: 8px 0 0 32px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

body[data-shell="platform"] .gate-link.sensitive {
  border-color: rgba(255, 88, 108, 0.38);
  background: linear-gradient(135deg, rgba(255, 88, 108, 0.15), rgba(7, 18, 34, 0.72));
}

.sidebar-platform-card {
  display: none;
}

body[data-shell="platform"] .sidebar-platform-card {
  display: block;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(11, 25, 46, 0.82);
}

body[data-shell="platform"] .sidebar-platform-card .status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 850;
}

body[data-shell="platform"] .sidebar-platform-card .status-light {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 18px rgba(22, 215, 160, 0.9);
}

body[data-shell="platform"] .sidebar-platform-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--surface-panel-deeper);
}

.modal-panel {
  width: min(560px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--login-panel-background);
  box-shadow: var(--shadow);
}

.modal-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-title h2,
.modal-title p {
  margin: 0;
}

.modal-title p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
}

.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  background: var(--surface-input);
}

.field select {
  min-height: 38px;
  padding: 0 10px;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
  padding: 10px 12px;
}

.impersonation-modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 12px;
}

body[data-impersonating="true"] [data-group-delete],
body[data-impersonating="true"] [data-member-remove],
body[data-impersonating="true"] [data-env-rule-delete],
body[data-impersonating="true"] [data-schedule-delete],
body[data-impersonating="true"] [data-ledger-disabled*="删除"] {
  display: none !important;
}

.form-message.error {
  color: var(--danger);
}

.theme-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

body[data-shell="business"] .theme-dots {
  gap: 12px;
}

.theme-dot {
  width: 15px;
  height: 15px;
  min-height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  cursor: pointer;
}

.theme-dot-green {
  background: var(--green);
}

.theme-dot-cyan {
  background: var(--cyan);
}

.theme-dot-purple {
  background: var(--purple);
}

body[data-theme="green"] {
  --accent: var(--green);
  --accent-blue: var(--blue);
}

body[data-theme="cyan"] {
  --accent: var(--cyan);
  --accent-blue: var(--blue);
}

body[data-theme="purple"] {
  --accent: var(--purple);
  --accent-blue: var(--cyan);
}
