:root {
  color-scheme: light;
  --bg-app: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f3f8fb;
  --surface-muted: #eef2f7;
  --border: #dfe7ee;
  --border-soft: #eef3f7;
  --text: #111827;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --primary: #14b8a6;
  --primary-strong: #0f766e;
  --primary-soft: #ecfeff;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 16px 34px rgba(15, 23, 42, 0.05);
  --focus: 0 0 0 3px rgba(20, 184, 166, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-width: 0;
  overflow-x: hidden;
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.58), transparent 280px), var(--bg-app);
  color: var(--text);
  font-family:
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

code {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.auth-view {
  --auth-pointer-x: 50%;
  --auth-pointer-y: 30%;
  display: grid;
  position: relative;
  min-height: 100dvh;
  align-items: start;
  justify-items: center;
  overflow-x: hidden;
  padding: clamp(22px, 5.2vh, 56px) 24px 24px;
  background:
    linear-gradient(90deg, rgba(226, 232, 240, 0.45) 1px, transparent 1px),
    linear-gradient(180deg, rgba(226, 232, 240, 0.42) 1px, transparent 1px),
    linear-gradient(135deg, transparent 0%, transparent 68%, rgba(20, 184, 166, 0.18) 100%),
    linear-gradient(315deg, rgba(20, 184, 166, 0.12) 0%, transparent 30%),
    radial-gradient(circle at var(--auth-pointer-x) var(--auth-pointer-y), rgba(20, 184, 166, 0.18), transparent 260px),
    linear-gradient(180deg, rgba(236, 254, 255, 0.78), rgba(248, 250, 252, 0.36) 340px),
    var(--bg-app);
  background-size: 88px 88px, 88px 88px, auto, auto, auto, auto, auto;
  isolation: isolate;
}

.auth-motion-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-motion-layer span {
  position: absolute;
  display: block;
}

.motion-orbit {
  width: 280px;
  height: 280px;
  border: 1px solid rgba(20, 184, 166, 0.18);
  border-radius: 50%;
  opacity: 0.56;
}

.motion-orbit::before,
.motion-orbit::after {
  position: absolute;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.55);
  content: "";
}

.motion-orbit::before {
  width: 9px;
  height: 9px;
  left: 36px;
  top: 54px;
  box-shadow: 0 0 20px rgba(20, 184, 166, 0.42);
}

.motion-orbit::after {
  width: 6px;
  height: 6px;
  right: 56px;
  bottom: 48px;
  background: rgba(37, 99, 235, 0.36);
}

.motion-orbit-one {
  left: max(28px, 8vw);
  top: 18%;
  animation: authFloatA 14s ease-in-out infinite;
}

.motion-orbit-two {
  right: max(36px, 10vw);
  bottom: 10%;
  width: 220px;
  height: 220px;
  border-color: rgba(37, 99, 235, 0.14);
  animation: authFloatB 16s ease-in-out infinite;
}

.motion-pulse {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 8px rgba(20, 184, 166, 0.08), 0 0 26px rgba(20, 184, 166, 0.36);
  opacity: 0.72;
}

.motion-pulse-one {
  left: 21%;
  bottom: 22%;
  animation: authPulse 3.8s ease-in-out infinite;
}

.motion-pulse-two {
  right: 24%;
  top: 17%;
  background: #2563eb;
  box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.08), 0 0 24px rgba(37, 99, 235, 0.26);
  animation: authPulse 4.6s ease-in-out infinite 0.7s;
}

.motion-scanline {
  inset: 0 auto auto 0;
  width: 100%;
  height: 120px;
  background: linear-gradient(180deg, transparent, rgba(20, 184, 166, 0.07), transparent);
  opacity: 0.75;
  transform: translateY(-140px);
  animation: authScan 8s linear infinite;
}

.auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(520px, 100%);
  justify-items: center;
  gap: clamp(14px, 2.4vh, 24px);
}

.auth-topbar {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.auth-language-switch,
.portal-language-switch {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  padding: 3px;
}

.auth-language-switch button,
.portal-language-switch button {
  min-width: 54px;
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
}

.auth-language-switch button.is-active,
.portal-language-switch button.is-active {
  background: var(--primary);
  color: #ffffff;
}

.motion-toggle {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--primary-strong);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.motion-toggle span {
  position: relative;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 999px;
}

.motion-toggle span::after {
  position: absolute;
  left: 50%;
  top: -5px;
  width: 2px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  transform: translateX(-50%);
}

.motion-toggle:hover,
.motion-toggle[aria-pressed="true"] {
  background: var(--primary-soft);
}

.auth-motion-paused .auth-motion-layer span {
  animation-play-state: paused;
}

.auth-motion-paused {
  --auth-pointer-x: 50%;
  --auth-pointer-y: 30%;
}

.portal-language-switch {
  background: #ffffff;
}

.portal-language-switch button {
  min-width: 46px;
  min-height: 28px;
  font-size: 11px;
}

.auth-brand,
.portal-brand,
.identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.portal-brand img {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(59, 130, 246, 0.24);
  border-radius: 12px;
  object-fit: contain;
  background: #ffffff;
}

.auth-brand p,
.portal-brand span,
.summary-strip span,
.summary-strip small,
.panel-toolbar span,
.field span,
.toolbar-search span,
.secret-box span,
.muted {
  color: var(--text-muted);
  font-size: 12px;
}

.auth-hero {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.auth-hero-logo {
  width: clamp(52px, 8vh, 68px);
  height: clamp(52px, 8vh, 68px);
  border: 1px solid rgba(20, 184, 166, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 32px rgba(20, 184, 166, 0.15);
  object-fit: contain;
}

.auth-hero strong {
  color: var(--primary-strong);
  font-size: clamp(26px, 4vh, 32px);
  font-weight: 820;
  line-height: 1;
}

.auth-hero span {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 650;
}

.auth-panel {
  display: grid;
  min-width: 0;
  width: 100%;
  gap: clamp(10px, 1.5vh, 14px);
  border: 1px solid rgba(226, 232, 240, 0.86);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  padding: clamp(24px, 4.2vh, 36px);
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(16px);
  transition: box-shadow 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.auth-panel:focus-within {
  border-color: rgba(20, 184, 166, 0.28);
  box-shadow: 0 24px 58px rgba(15, 23, 42, 0.1), 0 0 0 4px rgba(20, 184, 166, 0.08);
  transform: translateY(-1px);
}

.auth-mode-panel[hidden] {
  display: none !important;
}

.auth-form-head {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-bottom: 2px;
  text-align: center;
}

.auth-form-head h1 {
  color: #0f172a;
  font-size: clamp(22px, 3.4vh, 26px);
  line-height: 1.2;
}

.auth-form-head p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.input-shell {
  position: relative;
  display: grid;
  min-width: 0;
  align-items: center;
}

.input-shell input {
  height: clamp(44px, 6.4vh, 50px);
  border-radius: 13px;
  padding: 10px 48px 10px 48px;
  font-size: 15px;
}

.input-icon {
  position: absolute;
  left: 18px;
  z-index: 1;
  width: 22px;
  height: 22px;
  color: #94a3b8;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.password-field input {
  padding-right: 72px;
}

.field-icon-button {
  position: absolute;
  inset: 8px 10px 8px auto;
  min-width: 50px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 720;
}

.field-icon-button:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.auth-submit {
  min-height: clamp(44px, 6.2vh, 50px);
  margin-top: 4px;
  border-radius: 12px;
  font-size: 15px;
  box-shadow: 0 12px 22px rgba(20, 184, 166, 0.2);
}

.submit-icon {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-left: 0;
  border-radius: 3px;
}

.submit-icon::before {
  position: absolute;
  left: -7px;
  top: 6px;
  width: 9px;
  height: 2px;
  background: currentColor;
  content: "";
}

.submit-icon::after {
  position: absolute;
  left: -1px;
  top: 3px;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: rotate(-45deg);
}

.auth-form-links {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -6px;
}

.link-action {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--primary-strong);
  padding: 4px 6px;
  font-size: 13px;
  font-weight: 760;
  line-height: 1;
}

.link-action:hover {
  background: var(--primary-soft);
}

.terms-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.terms-row input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.terms-row a {
  color: var(--primary-strong);
  font-weight: 650;
  text-decoration: none;
}

.terms-row a:hover {
  text-decoration: underline;
}

.auth-register-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-register-row span {
  min-width: 0;
}

.auth-inline-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 30px;
}

.auth-inline-switch span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  line-height: 1;
}

.forgot-contact,
.forgot-result {
  display: grid;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfdff;
  padding: 12px 14px;
}

.forgot-result {
  border-color: rgba(22, 163, 74, 0.26);
  background: var(--green-soft);
}

.forgot-contact span {
  color: var(--text-muted);
  font-size: 12px;
}

.forgot-contact strong,
.forgot-result strong {
  overflow-wrap: anywhere;
  color: #0f172a;
  font-size: 14px;
}

.forgot-result p {
  color: #166534;
  font-size: 13px;
  line-height: 1.55;
}

.forgot-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.forgot-actions .auth-submit {
  margin-top: 0;
  text-decoration: none;
}

.auth-footer {
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

@keyframes authFloatA {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }

  50% {
    transform: translate3d(18px, -22px, 0) rotate(12deg);
  }
}

@keyframes authFloatB {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }

  50% {
    transform: translate3d(-22px, 18px, 0) rotate(-10deg);
  }
}

@keyframes authPulse {
  0%,
  100% {
    opacity: 0.42;
    transform: scale(0.86);
  }

  50% {
    opacity: 0.86;
    transform: scale(1.08);
  }
}

@keyframes authScan {
  0% {
    transform: translateY(-140px);
  }

  100% {
    transform: translateY(100vh);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-motion-layer span,
  .auth-panel {
    animation: none !important;
    transition: none !important;
  }

  .auth-motion-layer {
    opacity: 0.42;
  }
}

@media (max-height: 780px) and (min-width: 561px) {
  .auth-view {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .auth-shell {
    gap: 12px;
  }

  .auth-language-switch button {
    min-height: 26px;
    font-size: 11px;
  }

  .motion-toggle {
    width: 32px;
    height: 32px;
  }

  .auth-hero {
    gap: 5px;
  }

  .auth-hero-logo {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    box-shadow: 0 10px 22px rgba(20, 184, 166, 0.12);
  }

  .auth-hero strong {
    font-size: 24px;
  }

  .auth-hero span {
    font-size: 13px;
  }

  .auth-panel {
    gap: 10px;
    padding: 22px 32px;
  }

  .auth-form-head h1 {
    font-size: 22px;
  }

  .input-shell input {
    height: 44px;
  }

  .auth-submit {
    min-height: 44px;
  }

  .terms-row {
    font-size: 12px;
    line-height: 1.35;
  }

  .auth-footer {
    font-size: 12px;
  }

  .motion-orbit-one {
    top: 8%;
  }
}

.field,
.toolbar-search {
  display: grid;
  min-width: 0;
  gap: 7px;
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  outline: none;
  padding: 8px 11px;
}

input:focus,
select:focus,
button:focus-visible {
  border-color: var(--primary);
  box-shadow: var(--focus);
  outline: none;
}

.auth-actions,
.workspace-actions,
.table-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.primary-action,
.secondary-action,
.ghost-action {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 680;
  white-space: nowrap;
}

.primary-action {
  border: 1px solid var(--primary-strong);
  background: var(--primary);
  color: #ffffff;
}

.secondary-action {
  border: 1px solid var(--border);
  background: #ffffff;
  color: #334155;
}

.ghost-action {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
}

.secondary-action:hover,
.ghost-action:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.danger-text {
  color: var(--red);
}

.error-text {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
}

.feedback-text {
  min-height: 18px;
  color: var(--primary-strong);
  font-size: 12px;
}

.feedback-text.is-error {
  color: var(--red);
}

.primary-action[aria-disabled="true"],
.primary-action:disabled,
.secondary-action:disabled,
.ghost-action:disabled,
.link-action:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.portal-view {
  min-height: 100dvh;
}

.portal-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 240px;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 12px;
}

.portal-brand {
  align-items: center;
  padding: 0 6px 16px;
}

.portal-brand strong,
.session-copy strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-brand strong {
  margin-top: 0;
  font-size: 16px;
  font-weight: 820;
}

.portal-brand span {
  display: block;
  margin-top: 3px;
  font-weight: 700;
}

.portal-nav {
  display: grid;
  gap: 4px;
}

.portal-nav button {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #475569;
  padding: 10px 12px;
  text-align: left;
  font-weight: 620;
}

.portal-nav button:hover {
  background: var(--surface-muted);
}

.portal-nav button.is-active {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.portal-nav button.is-active::before {
  position: absolute;
  inset: 10px auto 10px 0;
  width: 3px;
  border-radius: 999px;
  background: var(--primary);
  content: "";
}

.portal-session {
  display: grid;
  min-width: 0;
  gap: 10px;
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 14px 2px 2px;
}

.portal-session-card {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfdff;
  padding: 10px;
}

.session-state-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.14);
}

.session-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.session-copy span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-copy strong {
  margin-top: 0;
  min-width: 0;
  font-weight: 760;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-session .ghost-action {
  width: 100%;
  min-height: 34px;
  padding-inline: 10px;
  border-color: var(--border);
  background: #ffffff;
  color: #475569;
}

.portal-session .ghost-action:hover {
  border-color: rgba(20, 184, 166, 0.28);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.portal-workspace {
  min-width: 0;
  margin-left: 240px;
}

.workspace-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(223, 231, 238, 0.86);
  background: rgba(255, 255, 255, 0.88);
  padding: 12px 28px;
  backdrop-filter: blur(14px);
}

.workspace-header h2 {
  font-size: 20px;
}

.workspace-header p {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.status {
  max-width: 320px;
  min-width: 0;
  overflow: hidden;
  border-radius: 9px;
  color: var(--text-muted);
  padding: 7px 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status.error {
  background: var(--red-soft);
  color: var(--red);
}

.portal-section {
  display: grid;
  gap: 18px;
  padding: 24px 28px 32px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-strip article {
  min-width: 0;
  border-right: 1px solid var(--border);
  padding: 16px;
}

.summary-strip article:last-child {
  border-right: 0;
}

.summary-strip strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  margin-top: 6px;
  font-size: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-strip small {
  display: block;
  margin-top: 5px;
}

.desktop-account-panel {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(20, 184, 166, 0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f5fffd);
  padding: 15px 16px;
  box-shadow: var(--shadow);
}

.desktop-account-panel div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.desktop-account-panel strong {
  color: #0f172a;
  font-size: 15px;
}

.desktop-account-panel p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.management-panel {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-toolbar {
  display: flex;
  min-width: 0;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f8fbfc);
  padding: 14px 16px;
}

.panel-toolbar strong {
  display: block;
  color: #0f172a;
  font-size: 15px;
}

.panel-toolbar span {
  display: block;
  margin-top: 3px;
}

.toolbar-search {
  flex: 0 1 260px;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 16px;
}

.model-grid article,
.activity-list article {
  display: grid;
  align-content: start;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfdff;
  padding: 14px 16px;
}

.model-grid strong,
.activity-list strong {
  overflow-wrap: anywhere;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.35;
}

.model-grid span,
.model-grid small,
.activity-list span,
.activity-list small {
  color: var(--text-muted);
  font-size: 12px;
}

.activity-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  padding: 16px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 11px 13px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fbfc;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 720;
}

td {
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(236, 254, 255, 0.56);
}

.table-actions .secondary-action,
.table-actions .ghost-action {
  min-height: 30px;
  border-radius: 9px;
  padding: 5px 9px;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 720;
}

.badge.active,
.badge.success,
.badge.paid,
.badge.issued {
  background: var(--green-soft);
  color: var(--green);
}

.badge.pending,
.badge.mock_fallback,
.badge.rate_limited {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.disabled,
.badge.revoked,
.badge.error,
.badge.timeout,
.badge.policy_blocked,
.badge.refunded,
.badge.canceled {
  background: var(--red-soft);
  color: var(--red);
}

.management-footer {
  border-top: 1px solid var(--border);
  background: #fbfdff;
  color: var(--text-muted);
  padding: 10px 14px;
  font-size: 12px;
}

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

.portal-drawer {
  width: min(500px, calc(100vw - 24px));
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  border: 0;
  border-left: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  padding: 0;
  box-shadow: -18px 0 42px rgba(15, 23, 42, 0.14);
}

.portal-drawer::backdrop {
  background: rgba(15, 23, 42, 0.28);
}

.drawer-shell {
  display: grid;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f8fbfc);
  padding: 18px 20px;
}

.drawer-head h2 {
  margin: 0;
  font-size: 18px;
}

.drawer-head p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.drawer-body {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  padding: 18px 20px 24px;
}

.drawer-form {
  display: grid;
  gap: 13px;
}

.drawer-form .primary-action {
  margin-top: 4px;
}

.secret-box {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(20, 184, 166, 0.22);
  border-radius: 14px;
  background: var(--primary-soft);
  padding: 14px;
}

.secret-box code {
  border: 1px solid rgba(20, 184, 166, 0.24);
  border-radius: 10px;
  background: #ffffff;
  color: var(--primary-strong);
  padding: 10px;
  font-weight: 760;
}

@media (max-width: 860px) {
  .auth-view {
    align-items: start;
    padding: 48px 18px 28px;
  }

  .auth-panel {
    padding: 32px;
  }

  .auth-form-links {
    flex-wrap: wrap;
  }

  .portal-sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .portal-session {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding: 12px 4px 0;
  }

  .portal-session .ghost-action {
    width: auto;
    min-width: 72px;
  }

  .portal-workspace {
    margin-left: 0;
  }

  .workspace-header {
    position: static;
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }

  .workspace-actions {
    justify-content: flex-start;
  }

  .portal-section {
    padding: 16px;
  }

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

  .summary-strip article:nth-child(2) {
    border-right: 0;
  }

  .summary-strip article:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 560px) {
  .auth-view {
    padding: 26px 12px 22px;
  }

  .auth-shell {
    gap: 22px;
  }

  .auth-hero-logo {
    width: 58px;
    height: 58px;
    border-radius: 15px;
  }

  .auth-hero strong {
    font-size: 28px;
  }

  .auth-hero span {
    font-size: 14px;
  }

  .auth-form-head h1 {
    font-size: 22px;
  }

  .auth-panel {
    gap: 13px;
    padding: 24px 18px;
    border-radius: 16px;
  }

  .auth-submit {
    width: 100%;
  }

  .input-shell input {
    height: 48px;
  }

  .terms-row {
    font-size: 12px;
  }

  .forgot-actions {
    grid-template-columns: 1fr;
  }

  .auth-inline-switch {
    flex-wrap: wrap;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .summary-strip article {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .summary-strip article:last-child {
    border-bottom: 0;
  }

  .panel-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .desktop-account-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .workspace-actions > .primary-action,
  .workspace-actions > .secondary-action {
    flex: 1 1 120px;
  }
}
