:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --ink: #172033;
  --muted: #657083;
  --line: #d9e1ea;
  --line-strong: #b8c4d3;
  --brand: #2563eb;
  --brand-2: #d97706;
  --brand-3: #2563eb;
  --danger: #b3261e;
  --warn: #996a00;
  --ok: #146c43;
  --sidebar: #101827;
  --sidebar-2: #1b2b48;
  --sidebar-text: #dbeafe;
  --shadow: 0 14px 35px rgba(43, 48, 45, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0)),
    var(--bg);
}

.app-shell.theme-blue {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --ink: #172033;
  --muted: #657083;
  --line: #d9e1ea;
  --line-strong: #b8c4d3;
  --brand: #2563eb;
  --brand-2: #d97706;
  --brand-3: #2563eb;
  --sidebar: #101827;
  --sidebar-2: #1b2b48;
  --sidebar-text: #dbeafe;
  --shadow: 0 14px 35px rgba(23, 32, 51, 0.12);
}

.app-shell.theme-green {
  --bg: #f5f3ee;
  --panel: #ffffff;
  --panel-2: #f9faf7;
  --ink: #1f2528;
  --muted: #687076;
  --line: #d9ddd4;
  --line-strong: #b8c1b5;
  --brand: #116b5c;
  --brand-2: #8a4b18;
  --brand-3: #116b5c;
  --sidebar: #17231f;
  --sidebar-2: #20342e;
  --sidebar-text: #d8e7dd;
  --shadow: 0 14px 35px rgba(43, 48, 45, 0.12);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  padding: 0 8px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand small {
  display: block;
  margin-bottom: 6px;
  color: #95c7b7;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 24px;
  line-height: 1.25;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.nav button {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #b8c8bf;
  text-align: left;
}

.nav button.active {
  background: var(--sidebar-2);
  border-color: rgba(149, 199, 183, 0.36);
  color: #fff;
}

.nav button span {
  display: block;
  font-size: 14px;
  font-weight: 850;
}

.nav button em {
  display: block;
  margin-top: 3px;
  color: #87a297;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.sidebar-foot {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #9ab7aa;
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: blur(6px);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent, #2563eb) 0%, var(--accent-2, #d97706) 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.5px;
}

.user-avatar.brand {
  background: linear-gradient(135deg, #116b5c 0, #8a4b18 100%);
}

.user-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.user-email {
  font-size: 13px;
  font-weight: 600;
  color: #e8f1ec;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.user-role {
  display: flex;
  align-items: center;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #cfe6dc;
}

.role-badge.role-owner {
  background: rgba(217, 119, 6, 0.18);
  border-color: rgba(245, 158, 11, 0.4);
  color: #f6c264;
}

.role-badge.role-admin {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(96, 165, 250, 0.4);
  color: #a9c7ff;
}

.role-badge.role-operator {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(52, 211, 153, 0.4);
  color: #8ee8c4;
}

.role-badge.role-viewer {
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(203, 213, 225, 0.35);
  color: #cbd5e1;
}

.role-badge.role-local {
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(203, 213, 225, 0.3);
  color: #b8c4cf;
}

.conn-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 2px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.conn-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
  position: relative;
}

.conn-line.ok {
  color: #9ee0bd;
}

.conn-line.ok .conn-dot {
  box-shadow: 0 0 0 3px rgba(158, 224, 189, 0.15);
  animation: conn-pulse 2.4s ease-in-out infinite;
}

.conn-line.warn {
  color: #f6d58a;
}

.conn-line.danger {
  color: #ffb4ab;
}

@keyframes conn-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(158, 224, 189, 0.15); }
  50% { box-shadow: 0 0 0 5px rgba(158, 224, 189, 0.05); }
}

.logout-btn {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #cfe6dc;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.logout-btn:hover {
  background: rgba(255, 80, 80, 0.12);
  border-color: rgba(255, 120, 120, 0.4);
  color: #ffd9d9;
}

.logout-btn:active {
  transform: translateY(1px);
}

.theme-switcher {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 180px;
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.theme-swatch {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.12);
}

.theme-swatch.blue {
  background: linear-gradient(135deg, #2563eb 0 50%, #d97706 50% 100%);
}

.theme-swatch.green {
  background: linear-gradient(135deg, #116b5c 0 50%, #8a4b18 50% 100%);
}

.theme-swatch.active {
  border-color: #ffffff;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.2),
    inset 0 0 0 3px rgba(0, 0, 0, 0.12);
}

.main {
  min-width: 0;
  padding: 26px;
}

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 247, 214, 0.96), rgba(255, 252, 240, 0.98)),
    radial-gradient(circle at 18% 16%, rgba(245, 158, 11, 0.15), transparent 34%),
    radial-gradient(circle at 82% 76%, rgba(217, 119, 6, 0.12), transparent 36%);
}

.app-shell.login-shell {
  display: block;
}

.login-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 460px;
  padding: 38px 38px 34px;
  border: 1px solid rgba(231, 184, 72, 0.44);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 251, 235, 0.96));
  box-shadow:
    0 24px 70px rgba(146, 94, 8, 0.18),
    0 2px 10px rgba(146, 94, 8, 0.08);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, #fbbf24, #f59e0b, #fcd34d);
}

.app-shell.theme-green .login-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 251, 235, 0.96));
}

.login-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #5f3708;
  background:
    linear-gradient(135deg, #fef3c7 0%, #fbbf24 100%);
  border: 1px solid rgba(180, 83, 9, 0.2);
  box-shadow: 0 10px 24px rgba(217, 119, 6, 0.22);
  letter-spacing: 0;
  margin-bottom: 4px;
}

.app-shell.theme-green .login-logo {
  background:
    linear-gradient(135deg, #fef3c7 0%, #fbbf24 100%);
  box-shadow: 0 10px 24px rgba(217, 119, 6, 0.22);
}

.login-brand h1 {
  margin: 2px 0 0;
  color: #3b2a13;
  font-size: 23px;
}

.login-brand .hint {
  margin: 0;
  color: #7a5a21;
  font-size: 13px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form .label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #5f3708;
}

.login-setup {
  margin: 0 0 4px;
  text-align: center;
  color: #8a651f;
}

.login-submit {
  width: 100%;
  margin-top: 4px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 700;
}

@media (max-width: 480px) {
  .login-card {
    padding: 28px 22px 24px;
  }
  .login-brand h1 {
    font-size: 19px;
  }
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
}

h2 {
  font-size: 21px;
  line-height: 1.24;
}

h3 {
  font-size: 16px;
}

.hint {
  margin-top: 9px;
  max-width: 850px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-body {
  padding: 18px;
}

.section {
  margin-top: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.section-head h2 {
  margin: 0;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 15px;
}

.card.hoverable:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 22px rgba(37, 43, 40, 0.08);
}

.metric {
  min-height: 74px;
  border-left: 4px solid var(--brand);
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 26px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
  line-height: 1.5;
}

.label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 850;
  color: #353b3d;
}

.field-group {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 850;
  color: #353b3d;
}

.field,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field,
.select {
  height: 42px;
  padding: 0 12px;
}

.textarea {
  min-height: 120px;
  resize: vertical;
  padding: 11px 12px;
  line-height: 1.62;
}

.outline-textarea {
  min-height: 260px;
}

.field:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(17, 107, 92, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
}

.btn.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.btn.accent {
  border-color: var(--brand-2);
  background: #fff7ed;
  color: var(--brand-2);
}

.btn.violet {
  border-color: var(--brand-3);
  background: #f5f3ff;
  color: var(--brand-3);
}

.btn.danger {
  border-color: rgba(179, 38, 30, 0.35);
  background: #fff1f0;
  color: var(--danger);
}

.btn.ghost {
  background: transparent;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.segmented button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 800;
}

.segmented button.active {
  border-color: var(--brand);
  background: rgba(17, 107, 92, 0.08);
  color: var(--brand);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.badge.ok {
  border-color: rgba(20, 108, 67, 0.24);
  background: #eaf6ef;
  color: var(--ok);
}

.badge.warn {
  border-color: rgba(153, 106, 0, 0.24);
  background: #fff6db;
  color: var(--warn);
}

.badge.danger {
  border-color: rgba(179, 38, 30, 0.24);
  background: #fff1f0;
  color: var(--danger);
}

.list {
  display: grid;
  gap: 10px;
}

.project-card {
  display: grid;
  gap: 12px;
  min-height: 188px;
  cursor: pointer;
}

.project-card .toolbar {
  cursor: default;
}

.project-card .title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  font-weight: 900;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-progress {
  display: grid;
  gap: 7px;
  padding: 10px 0 2px;
  border-top: 1px solid var(--line);
}

.project-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.project-progress-head strong {
  color: var(--ink);
}

.project-progress-track {
  height: 8px;
}

.project-progress-step {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.project-progress-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-progress-details span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.two-pane {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.sticky-col {
  position: sticky;
  top: 16px;
}

.output {
  min-height: 260px;
  max-height: 58vh;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  white-space: pre-wrap;
  line-height: 1.72;
}

.progress-box {
  margin-bottom: 12px;
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.progress-row strong {
  color: var(--brand);
  font-size: 16px;
}

.progress-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

#live-duration-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 180ms ease;
}

.sequence-progress {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sequence-row {
  margin-bottom: 7px;
}

.sequence-track {
  height: 8px;
}

.episode-progress-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 92px;
  margin-top: 10px;
  overflow: auto;
}

.episode-step {
  min-width: 30px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.episode-step.done {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #ffffff;
}

.episode-step.current {
  border-color: var(--brand);
  background: var(--panel-2);
  color: var(--brand);
  box-shadow: 0 0 0 2px rgba(47, 100, 242, 0.1);
}

.episode {
  display: grid;
  gap: 10px;
}

.episode-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.episode-toggle {
  flex: 0 0 auto;
  min-width: 92px;
}

.episode .content {
  white-space: pre-wrap;
  line-height: 1.72;
}

.episode-preview {
  width: 100%;
  min-height: 92px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  line-height: 1.58;
  text-align: left;
  white-space: pre-wrap;
  cursor: pointer;
}

.episode-preview:hover {
  border-color: var(--brand);
  background: var(--panel);
}

.module-preview {
  width: 100%;
  min-height: 98px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  line-height: 1.65;
  text-align: left;
  white-space: pre-wrap;
  cursor: pointer;
}

.module-preview:hover {
  border-color: var(--brand);
  background: var(--panel);
}

.episode-check {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-2);
}

.scheme {
  display: grid;
  gap: 10px;
}

.scheme.compact {
  min-height: auto;
}

.scheme.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(17, 107, 92, 0.11);
}

.log {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.log div {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.5;
}

.log div:last-child {
  border-bottom: 0;
}

.empty {
  padding: 44px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(23, 35, 31, 0.62);
}

.modal {
  width: min(920px, 100%);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}

.modal .panel-head {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: min(460px, calc(100vw - 44px));
  padding: 13px 15px;
  border: 1px solid rgba(179, 38, 30, 0.28);
  border-radius: 8px;
  background: #fff8f7;
  color: var(--danger);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar-foot {
    position: static;
    margin-top: 14px;
  }

  .theme-switcher {
    position: static;
    margin-top: 14px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-pane {
    grid-template-columns: 1fr;
  }

  .sticky-col {
    position: static;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 18px;
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .nav {
    grid-template-columns: 1fr;
  }

  .toolbar {
    width: 100%;
  }

  .btn {
    flex: 1 1 auto;
  }
}

/* ===== SSO 登录模态 + 登录入口 ===== */
.auth-entry {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.app-shell.login-landing {
  display: block;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(255, 247, 214, 0.96), rgba(255, 253, 244, 0.98)),
    radial-gradient(circle at 14% 16%, rgba(245, 158, 11, 0.14), transparent 35%),
    radial-gradient(circle at 88% 20%, rgba(252, 211, 77, 0.2), transparent 30%),
    radial-gradient(circle at 72% 84%, rgba(217, 119, 6, 0.1), transparent 34%);
}

.login-landing .main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.login-landing .topbar {
  flex-wrap: wrap;
}

.login-landing-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.login-landing-panel {
  width: min(760px, 100%);
  min-height: 360px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 28px;
  padding: 44px 38px 40px;
  border: 1px solid rgba(231, 184, 72, 0.46);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 251, 235, 0.92));
  box-shadow:
    0 28px 80px rgba(146, 94, 8, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.login-landing-copy {
  max-width: 560px;
  text-align: center;
}

.login-landing-copy .eyebrow {
  margin: 10px 0 8px;
  color: #b45309;
}

.login-landing-copy h1 {
  margin: 0;
  color: #3b2a13;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.12;
}

.login-landing-copy .hint {
  max-width: 520px;
  margin: 14px auto 0;
  color: #76551c;
  font-size: 15px;
}

.login-landing-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  font-size: 28px;
}

.login-landing-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0;
}

.login-choice {
  min-width: 148px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 8px;
  font-size: 16px;
}

.login-shell .field {
  border-color: rgba(180, 83, 9, 0.3);
  background: #fffdf7;
}

.login-shell .field:focus {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.login-shell .toolbar {
  gap: 10px;
}

.login-shell .btn.primary,
.login-landing .btn.primary {
  border-color: #d97706;
  background: linear-gradient(180deg, #f59e0b, #d97706);
  color: #fffdf7;
  box-shadow: 0 10px 22px rgba(217, 119, 6, 0.24);
}

.login-shell .btn.ghost,
.login-landing .btn.ghost {
  border-color: rgba(180, 83, 9, 0.34);
  background: rgba(255, 255, 255, 0.7);
  color: #5f3708;
}

.login-shell .btn:hover,
.login-landing .btn:hover {
  transform: translateY(-1px);
}

@media (max-width: 620px) {
  .login-landing-hero {
    padding: 18px;
  }

  .login-landing-panel {
    min-height: auto;
    padding: 34px 22px 28px;
  }

  .login-choice {
    width: 100%;
  }
}

.sso-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.sso-modal.open {
  display: flex;
}

.sso-modal__panel {
  position: relative;
  width: min(420px, 92vw);
  height: min(640px, 88vh);
  background: var(--surface, #ffffff);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sso-modal__close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.45);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sso-modal__close:hover {
  background: rgba(15, 23, 42, 0.7);
}

.sso-modal__error {
  margin: 12px 16px 0;
}

.sso-modal__frame {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.charge-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.charge-modal.open {
  display: flex;
}

.charge-modal__panel {
  position: relative;
  width: min(420px, 92vw);
  background: var(--surface, #ffffff);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  padding: 28px 28px 22px;
  text-align: center;
}

.charge-modal__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.45);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.charge-modal__close:hover {
  background: rgba(15, 23, 42, 0.7);
}

.charge-modal__title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text, #0f1b2d);
}

.charge-modal__amount {
  font-size: 38px;
  font-weight: 800;
  color: #2563eb;
  line-height: 1.1;
  margin: 6px 0 12px;
  letter-spacing: 0.5px;
}

.charge-modal__detail {
  margin: 0 0 8px;
  color: #5d6b82;
  font-size: 13px;
}

.charge-modal__message {
  margin: 0 0 18px;
  color: var(--text, #0f1b2d);
  line-height: 1.6;
}

.charge-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== 项目列表页 ===== */
.user-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}
.user-pill:hover { border-color: var(--brand); color: var(--brand); }
.user-pill.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.user-pill.disabled { opacity: .6; }
.user-pill-email { font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pill-count {
  background: rgba(255,255,255,.2);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  min-width: 22px;
  text-align: center;
}
.user-pill:not(.active) .user-pill-count {
  background: var(--panel-2);
  color: var(--muted);
}
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th,
.data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border, #e6ebf2); vertical-align: middle; }
.data-table th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.data-table tr.row-disabled { opacity: .55; }
.data-table td.col-actions,
.data-table th.col-actions { text-align: right; white-space: nowrap; }
.data-table td.col-actions .btn + .btn { margin-left: 6px; }
.small-muted { color: var(--muted); font-size: 12px; }
.mini-input { width: 90px; padding: 4px 8px; font-size: 13px; }
.mini-btn { padding: 4px 10px; font-size: 12px; }
.inline-edit { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.quota-cell { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
