:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --ink: #22252b;
  --muted: #6e7480;
  --soft: #e7e2d8;
  --line: rgba(47, 54, 66, 0.12);
  --brand: #2e7d6f;
  --brand-dark: #205d55;
  --accent: #d9884a;
  --danger: #b73749;
  --shadow: 0 22px 70px rgba(43, 48, 57, 0.12);
  --radius: 8px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(46, 125, 111, 0.10), transparent 34%),
    linear-gradient(225deg, rgba(217, 136, 74, 0.14), transparent 30%),
    var(--bg);
}

body:has(#appView:not([hidden])) {
  background:
    linear-gradient(180deg, rgba(31, 47, 56, .08), transparent 260px),
    linear-gradient(135deg, rgba(46, 125, 111, .10), transparent 34%),
    #f7f8f5;
}

button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: wait; opacity: .7; }
h1, h2, h3, p { margin: 0; }

.login-shell {
  min-height: 100vh;
  background: #0f1117;
}

.login-panel {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1fr) 520px;
  align-items: stretch;
}

.character-stage {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  color: #f8fafc;
  background:
    radial-gradient(circle at 70% 24%, rgba(255,255,255,.16), transparent 26%),
    radial-gradient(circle at 24% 74%, rgba(255,255,255,.08), transparent 30%),
    linear-gradient(135deg, #6848f5 0%, #5d36d8 52%, #4f2dbf 100%);
}

.character-stage:before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .12;
  background-image:
    linear-gradient(rgba(255,255,255,.36) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.36) 1px, transparent 1px);
  background-size: 22px 22px;
}

.stage-brand, .stage-copy, .stage-links, .character-scene {
  position: relative;
  z-index: 1;
}

.stage-brand, .mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 850;
}

.stage-logo {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255,255,255,.14);
  color: inherit;
  font-size: 13px;
  font-weight: 950;
  backdrop-filter: blur(10px);
}

.character-scene {
  align-self: center;
  width: min(560px, 100%);
  height: 430px;
  margin: auto 0;
}

.character {
  position: absolute;
  bottom: 0;
  transform-origin: bottom center;
  transition: transform .7s ease, height .7s ease;
}

.purple-character {
  left: 70px;
  z-index: 1;
  width: 180px;
  height: 400px;
  border-radius: 10px 10px 0 0;
  background: #6c3ff5;
}

.black-character {
  left: 240px;
  z-index: 2;
  width: 120px;
  height: 310px;
  border-radius: 8px 8px 0 0;
  background: #2d2d2d;
}

.orange-character {
  left: 0;
  z-index: 3;
  width: 240px;
  height: 200px;
  border-radius: 120px 120px 0 0;
  background: #ff9b6b;
}

.yellow-character {
  left: 310px;
  z-index: 4;
  width: 140px;
  height: 230px;
  border-radius: 70px 70px 0 0;
  background: #e8d754;
}

.eye-row {
  position: absolute;
  left: var(--eye-left, 45px);
  top: var(--eye-top, 40px);
  display: flex;
  gap: var(--eye-gap, 32px);
  transition: left .7s ease, top .7s ease;
}

.black-character .eye-row {
  --eye-left: 26px;
  --eye-top: 32px;
  --eye-gap: 24px;
}

.orange-character .eye-row {
  --eye-left: 82px;
  --eye-top: 90px;
}

.yellow-character .eye-row {
  --eye-left: 52px;
  --eye-top: 40px;
  --eye-gap: 24px;
}

.eye {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  overflow: hidden;
  border-radius: 999px;
  background: #fff;
  transition: height .15s ease;
}

.eye.small {
  width: 16px;
  height: 16px;
}

.eye i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #2d2d2d;
  transform: translate(var(--pupil-x, 0), var(--pupil-y, 0));
  transition: transform .1s ease-out;
}

.eye.small i {
  width: 6px;
  height: 6px;
}

.dot-eye {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #2d2d2d;
  transform: translate(var(--pupil-x, 0), var(--pupil-y, 0));
  transition: transform .1s ease-out;
}

.character.blinking .eye {
  height: 2px;
}

.mouth-line {
  position: absolute;
  left: var(--mouth-left, 40px);
  top: var(--mouth-top, 88px);
  width: 80px;
  height: 4px;
  border-radius: 999px;
  background: #2d2d2d;
  transition: left .2s ease, top .2s ease;
}

.character-stage.typing .purple-character {
  height: 440px;
  transform: skewX(var(--purple-skew-typing, -12deg)) translateX(40px);
}

.character-stage.typing .black-character {
  transform: skewX(var(--black-skew-typing, 0deg));
}

.character-stage.looking .purple-character .eye-row {
  left: 55px;
  top: 65px;
}

.character-stage.looking .black-character {
  transform: skewX(var(--black-skew-looking, 10deg)) translateX(20px);
}

.character-stage.looking .black-character .eye-row {
  left: 32px;
  top: 12px;
}

.character-stage.password-visible .character {
  transform: skewX(0deg);
}

.character-stage.password-visible .purple-character .eye-row {
  left: 20px;
  top: 35px;
}

.character-stage.password-visible .black-character .eye-row {
  left: 10px;
  top: 28px;
}

.character-stage.password-visible .orange-character .eye-row {
  left: 50px;
  top: 85px;
}

.character-stage.password-visible .yellow-character .eye-row {
  left: 20px;
  top: 35px;
}

.character-stage.password-visible .mouth-line {
  left: 10px;
  top: 88px;
}

.stage-copy h1 {
  font-size: clamp(40px, 5vw, 62px);
  line-height: 1;
  letter-spacing: 0;
}

.stage-copy p {
  max-width: 560px;
  margin-top: 14px;
  color: rgba(255,255,255,.74);
  font-size: 17px;
  line-height: 1.75;
}

.stage-links {
  display: flex;
  gap: 28px;
}

.stage-links a {
  color: rgba(255,255,255,.58);
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.stage-links a:hover { color: #fff; }

.login-card, .panel, .metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.login-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.login-notes span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f2ed;
  color: #59616c;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.login-card {
  display: grid;
  align-content: center;
  min-height: 100vh;
  gap: 16px;
  border: 0;
  border-radius: 0;
  padding: 48px 56px;
  background: #fff;
  box-shadow: none;
}

.mobile-brand {
  display: none;
  justify-content: center;
  margin-bottom: 26px;
  color: #252a32;
}

.mobile-brand .stage-logo {
  background: rgba(46, 125, 111, .12);
  color: var(--brand-dark);
}

.login-card h2 {
  margin-top: 2px;
  font-size: 32px;
  letter-spacing: 0;
  text-align: center;
}
.login-card p { margin-top: 6px; color: var(--muted); }
.login-card > div:first-child p { text-align: center; }

label {
  display: grid;
  gap: 8px;
}

label span, .quick-style > span {
  color: #555d68;
  font-size: 13px;
  font-weight: 850;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.88);
  color: var(--ink);
  outline: none;
  padding: 13px 14px;
}

textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.75;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(46, 125, 111, .55);
  box-shadow: 0 0 0 4px rgba(46, 125, 111, .12);
  background: #fff;
}

.login-card button, #generateButton, .section-head button, .package-card button, .admin-user-actions button, .top-actions button {
  min-height: 42px;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 850;
}

.login-card button, #generateButton {
  min-height: 54px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

.password-field {
  position: relative;
}

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

.password-field button {
  position: absolute;
  right: 8px;
  top: 50%;
  display: grid;
  width: 36px;
  height: 36px;
  min-height: 36px;
  place-items: center;
  transform: translateY(-50%);
  background: transparent;
  color: #6b7280;
  padding: 0;
  font-size: 16px;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.remember-row input {
  width: 16px;
  height: 16px;
}

.remember-row span {
  color: var(--muted);
  font-size: 13px;
}

.login-options a, .signup-row a {
  color: var(--brand-dark);
  font-weight: 850;
  text-decoration: none;
}

.secondary-login {
  border: 1px solid var(--line);
  background: #fff !important;
  color: #252a32 !important;
}

.signup-row {
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.dialog-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.dialog-layer[hidden] {
  display: none !important;
}

.dialog-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .72);
}

.register-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(420px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  gap: 18px;
  border: 1px solid rgba(31,47,56,.12);
  border-radius: 16px;
  background: #fff;
  padding: 28px;
  box-shadow: 0 28px 80px rgba(0,0,0,.28);
}

.dialog-close {
  position: absolute;
  right: 12px;
  top: 12px;
  display: grid;
  width: 32px;
  height: 32px;
  min-height: 32px;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.dialog-close:hover {
  background: #f2f3f2;
  color: #1f2933;
}

.register-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 24px;
  font-weight: 900;
}

.dialog-header {
  text-align: center;
}

.dialog-header h2 {
  font-size: 24px;
  letter-spacing: 0;
}

.dialog-header p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.register-form {
  display: grid;
  gap: 14px;
}

.register-form button[type="submit"] {
  min-height: 44px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 850;
}

.form-status {
  min-height: 22px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 750;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px 28px 52px;
}

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

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius);
  background: #1f2f38;
  color: #dff8f0;
  font-weight: 950;
}

.brand h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
  letter-spacing: 0;
}

.brand p {
  overflow: hidden;
  max-width: 820px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.top-actions button {
  background: rgba(255,255,255,.75);
  color: #39404a;
  box-shadow: none;
}

.top-actions button.active {
  background: var(--brand);
  color: #fff;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  display: grid;
  min-height: 118px;
  align-content: center;
  gap: 9px;
  padding: 22px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.metric-card strong {
  overflow: hidden;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 22px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin-top: 4px;
  font-size: 24px;
  letter-spacing: 0;
}

.section-head h3 { font-size: 18px; }

.ghost-button, .section-head .ghost-button {
  background: #edf3f1;
  color: var(--brand-dark);
  box-shadow: none;
}

.quick-style { margin-top: 18px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chips button {
  min-height: 36px;
  border-radius: 999px;
  background: #edf3f1;
  color: var(--brand-dark);
  padding: 0 13px;
  font-size: 13px;
  font-weight: 850;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.settings-grid .full { grid-column: 1 / -1; }

.advanced {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}

.advanced summary {
  display: flex;
  justify-content: space-between;
  color: #39404a;
  cursor: pointer;
  font-weight: 900;
}

.advanced summary small { color: var(--muted); }

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.submit-zone {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 20px;
}

#generateButton {
  min-width: 170px;
  padding: 0 22px;
}

.run-state {
  flex: 1;
  display: grid;
  min-width: 220px;
  gap: 10px;
}

#status {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.55;
  word-break: break-word;
}

#status.error { color: var(--danger); }

.progress-head {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.progress-shell {
  overflow: hidden;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e6e1d7;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #77b9a7, var(--accent));
  transition: width .45s ease;
}

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

.task-panel span, .task-panel button {
  min-height: 30px;
  border-radius: 999px;
  background: #f0eee8;
  color: #4e5661;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
}

.task-panel button { color: var(--danger); background: #f8e9eb; }

.side-panel {
  position: sticky;
  top: 18px;
}

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

.history-item {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.62);
  padding: 10px;
  cursor: pointer;
}

.history-item time { color: var(--muted); font-size: 12px; font-weight: 800; }
.history-item p {
  display: -webkit-box;
  overflow: hidden;
  margin: 5px 0 8px;
  color: #454b55;
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.history-tags span {
  border-radius: 999px;
  background: #edf3f1;
  color: var(--brand-dark);
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 900;
}

.thumbs img {
  display: block;
  width: 78px;
  height: 78px;
  border-radius: var(--radius);
  object-fit: cover;
  background: linear-gradient(135deg, #e8eee8, #f7e6d5);
}

.gallery-section {
  margin-top: 18px;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.empty-state {
  display: grid;
  min-height: 210px;
  place-items: center;
  border: 1px dashed rgba(47, 54, 66, .25);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255,255,255,.46);
  font-weight: 850;
}

.image-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
}

.image-card img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.image-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}

.image-meta a {
  color: var(--brand-dark);
  text-decoration: none;
  font-weight: 900;
}

.image-meta span { color: var(--muted); font-size: 12px; font-weight: 800; }

.account-grid, .admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 18px;
  align-items: start;
}

.package-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.package-card {
  display: grid;
  min-height: 170px;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.68);
  padding: 18px;
}

.package-card strong {
  display: block;
  font-size: 19px;
}

.package-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

.package-card b {
  display: block;
  margin-bottom: 10px;
  font-size: 26px;
}

.hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.profile-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.profile-list span { color: var(--muted); font-weight: 800; }
.profile-list strong { text-align: right; }

.packages-editor {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.packages-editor h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.packages-editor-list {
  display: grid;
  gap: 8px;
}

.package-edit-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr .7fr .7fr;
  gap: 8px;
}

.admin-users {
  display: grid;
  gap: 10px;
}

.admin-user {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.66);
  padding: 14px;
}

.admin-user strong { display: block; font-size: 16px; }
.admin-user span { color: var(--muted); font-size: 13px; font-weight: 800; }

.admin-user-metrics, .admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-user-metrics span {
  border-radius: 999px;
  background: #f0eee8;
  padding: 5px 9px;
}

.admin-user-actions button {
  min-height: 34px;
  background: #edf3f1;
  color: var(--brand-dark);
}

/* Dashboard refinement */
.app-shell {
  padding: 24px 28px 52px;
}

.topbar {
  margin-bottom: 16px;
  border: 1px solid rgba(31, 47, 56, .08);
  border-radius: 12px;
  background: rgba(255,255,255,.80);
  padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(31,47,56,.06);
  backdrop-filter: blur(16px);
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 10px;
}

.brand h1 {
  font-size: clamp(24px, 3vw, 34px);
}

.top-actions button {
  border: 1px solid rgba(31,47,56,.08);
}

.top-actions button.active {
  border-color: transparent;
}

.workspace-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 16px;
  border: 1px solid rgba(31,47,56,.10);
  border-radius: 14px;
  background:
    radial-gradient(circle at 84% 18%, rgba(255,255,255,.18), transparent 28%),
    linear-gradient(135deg, rgba(31,47,56,.96), rgba(46,125,111,.90));
  color: #fff;
  padding: 26px 28px;
  box-shadow: 0 24px 70px rgba(31,47,56,.16);
}

.workspace-hero h2 {
  margin-top: 8px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.02;
  letter-spacing: 0;
}

.workspace-hero p {
  max-width: 680px;
  margin-top: 10px;
  color: rgba(255,255,255,.72);
  font-size: 15px;
  line-height: 1.7;
}

.workspace-hero .eyebrow {
  color: #aee8db;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.hero-actions button {
  min-height: 42px;
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 8px;
  background: #fff;
  color: #20313a;
  padding: 0 16px;
  font-weight: 850;
}

.hero-actions .ghost-button {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.metrics-grid {
  gap: 12px;
}

.metric-card {
  display: flex;
  min-height: 112px;
  align-items: center;
  gap: 14px;
  border-radius: 12px;
  background: rgba(255,255,255,.88);
  padding: 18px;
  box-shadow: 0 14px 40px rgba(31,47,56,.07);
}

.metric-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: rgba(46,125,111,.12);
  color: var(--brand-dark);
  font-size: 22px;
  font-weight: 900;
}

.metric-icon.warm {
  background: rgba(217,136,74,.16);
  color: #9c5a24;
}

.metric-icon.blue {
  background: rgba(62,95,145,.13);
  color: #385987;
}

.metric-icon.neutral {
  background: rgba(31,47,56,.10);
  color: #34434c;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(24px, 3vw, 34px);
}

.studio-layout,
.account-grid,
.admin-grid {
  grid-template-columns: minmax(0, 1fr) 440px;
}

.panel {
  border-radius: 12px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 16px 44px rgba(31,47,56,.08);
}

.section-head {
  align-items: flex-start;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(31,47,56,.08);
  padding-bottom: 16px;
}

.section-head p {
  max-width: 640px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.form-panel textarea {
  min-height: 260px;
  background: #fbfcfa;
}

.chips button {
  border: 1px solid rgba(46,125,111,.12);
}

.submit-zone {
  border-top: 1px solid rgba(31,47,56,.08);
  padding-top: 18px;
}

.side-panel {
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.history-item {
  border-radius: 10px;
  background: #fbfcfa;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.history-item:hover {
  transform: translateY(-1px);
  border-color: rgba(46,125,111,.28);
  box-shadow: 0 12px 28px rgba(31,47,56,.08);
}

.image-card {
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(31,47,56,.08);
}

.package-card {
  min-height: 190px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #fbfcfa);
  box-shadow: 0 14px 34px rgba(31,47,56,.07);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.package-card:hover {
  transform: translateY(-2px);
  border-color: rgba(46,125,111,.28);
  box-shadow: 0 18px 44px rgba(31,47,56,.11);
}

.package-card.featured {
  border-color: rgba(46,125,111,.34);
  background:
    linear-gradient(180deg, rgba(237,243,241,.95), #ffffff);
}

.package-card em {
  display: inline-flex;
  margin-bottom: 12px;
  border-radius: 999px;
  background: rgba(46,125,111,.10);
  color: var(--brand-dark);
  padding: 5px 9px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.package-card.featured em {
  background: var(--brand);
  color: #fff;
}

.package-card strong {
  font-size: 20px;
}

.package-card b {
  font-size: 30px;
  color: #20313a;
}

.profile-list {
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(31,47,56,.08);
  border-radius: 12px;
}

.profile-list div {
  background: #fbfcfa;
  padding: 15px 16px;
}

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

/* Output directory save section */
.account-save-body {
  padding: 18px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.account-save-body label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.account-save-body label span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.account-save-body input {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fbfcfa;
}
.account-save-body input:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(46,125,111,.12);
}
.account-save-body button {
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.account-save-body button:hover { background: #f5f7f4; }
.account-save-body > span {
  font-size: 12px;
  color: var(--muted);
}

/* Profile list polish */
.profile-list div {
  padding: 14px 0;
}
.profile-list strong {
  font-size: 15px;
  color: #0f172a;
}
.profile-list span {
  font-size: 14px;
}

/* Redeem form polish */
.redeem-form input {
  border-radius: 10px;
}
.redeem-form button {
  border-radius: 9px;
  font-weight: 700;
}

/* Package card polish */
.package-card button {
  border: 0;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
}
.package-card button:hover { background: var(--brand-dark); }
.package-card.featured button {
  background: var(--brand);
}

/* Trial card */
.package-card.trial-card {
  border-color: rgba(245,158,11,.35);
  background: linear-gradient(135deg, #fffbeb, #fff7ed);
}
.package-card.trial-card em {
  background: #f59e0b;
  color: #fff;
}
.package-card.trial-card b {
  color: #f59e0b;
}
.package-card.trial-card button {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
.package-card.trial-card button:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
}

.package-edit-row {
  border: 1px solid rgba(31,47,56,.08);
  border-radius: 10px;
  background: #fbfcfa;
  padding: 10px;
}

.admin-users {
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(31,47,56,.08);
  border-radius: 12px;
}

.admin-user {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fbfcfa;
}

.admin-user:last-child {
  border-bottom: 0;
}

.admin-user-main {
  min-width: 0;
}

.admin-user-metrics,
.admin-user-actions {
  justify-content: flex-end;
}

.admin-user-metrics span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

.admin-user-metrics b {
  color: #20313a;
  font-size: 16px;
}

.admin-user-actions button {
  padding: 0 10px;
}

.admin-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.config-test-result {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.config-test-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 10px;
  padding: 12px 14px;
}

.config-test-summary.ok {
  background: rgba(46, 125, 111, .10);
  color: var(--brand-dark);
}

.config-test-summary.warning {
  background: rgba(217, 136, 74, .14);
  color: #8a541f;
}

.config-test-summary.failed {
  background: rgba(183, 55, 73, .10);
  color: var(--danger);
}

.config-test-summary span {
  color: inherit;
  font-size: 12px;
  opacity: .78;
}

.config-test-list {
  display: grid;
  gap: 8px;
}

.config-test-item {
  border: 1px solid rgba(31,47,56,.08);
  border-left-width: 4px;
  border-radius: 10px;
  background: #fbfcfa;
  padding: 12px 14px;
}

.config-test-item.ok {
  border-left-color: var(--brand);
}

.config-test-item.warn {
  border-left-color: var(--accent);
}

.config-test-item.error {
  border-left-color: var(--danger);
}

.config-test-item strong {
  display: block;
  font-size: 14px;
}

.config-test-item p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.config-test-item pre {
  overflow: auto;
  max-height: 160px;
  margin: 10px 0 0;
  border-radius: 8px;
  background: #20252d;
  color: #eef3f0;
  padding: 10px;
  font-size: 12px;
  white-space: pre-wrap;
}

.legacy-admin-grid {
  display: none !important;
}

.admin-console {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 720px;
  overflow: hidden;
  border: 1px solid rgba(40, 54, 72, .14);
  border-radius: 18px;
  background: #f5f7f7;
  box-shadow: 0 22px 60px rgba(20, 32, 44, .12);
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 12px;
  background: #0d1726;
  color: #dce7f6;
}

.admin-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.admin-logo-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #13d5c2, #3d63ff);
  color: #fff;
  font-weight: 900;
}

.admin-logo strong,
.admin-logo span {
  display: block;
}

.admin-logo span {
  margin-top: 2px;
  color: #8fa0b7;
  font-size: 12px;
}

.admin-menu {
  display: grid;
  gap: 6px;
}

.admin-menu button,
.quick-admin-actions button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.admin-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  color: #c8d5e7;
  text-align: left;
  transition: background .18s ease, color .18s ease;
}

.admin-menu button:hover,
.admin-menu button.active {
  background: rgba(28, 210, 192, .12);
  color: #25e6d3;
}

.admin-menu small {
  color: #7889a2;
  font-size: 11px;
}

.admin-sidebar-card {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
}

.admin-sidebar-card span {
  color: #8fa0b7;
  font-size: 12px;
}

.admin-sidebar-card strong {
  color: #fff;
}

.admin-sidebar-card .ghost-button {
  color: #dce7f6;
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
}

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

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

.admin-toolbar h2 {
  margin: 3px 0 6px;
  font-size: 26px;
}

.admin-toolbar p {
  margin: 0;
  color: var(--muted);
}

.admin-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-view {
  display: none;
}

.admin-view.active {
  display: block;
}

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

.admin-stat-grid article {
  min-height: 128px;
  padding: 18px;
  border: 1px solid rgba(40, 54, 72, .12);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(28, 42, 56, .07);
}

.admin-stat-grid span,
.admin-stat-grid small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.admin-stat-grid strong {
  display: block;
  margin: 12px 0 8px;
  color: #152033;
  font-size: 30px;
}

.admin-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.admin-dashboard-panel {
  min-height: 260px;
}

.admin-mini-list {
  display: grid;
  gap: 10px;
}

.admin-mini-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(40, 54, 72, .10);
  border-radius: 12px;
  background: #fbfcfa;
}

.admin-mini-list span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.quick-admin-actions {
  display: grid;
  gap: 10px;
}

.quick-admin-actions button {
  min-height: 44px;
  border-radius: 10px;
  background: #eef4f3;
  color: #20313f;
  font-weight: 800;
}

.quick-admin-actions button:hover {
  background: #dff1ef;
}

.admin-form-block {
  display: grid;
  gap: 16px;
}

.admin-user-table {
  max-height: 560px;
  overflow: auto;
  padding-right: 6px;
}

.app-shell.admin-mode {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  padding: 0;
  margin: 0;
  background: #f3f6f6;
}

.app-shell.admin-mode .topbar,
.app-shell.admin-mode .workspace-hero,
.app-shell.admin-mode .metrics-grid {
  display: none;
}

.app-shell.admin-mode #adminTab {
  padding: 0;
}

.app-shell.admin-mode .admin-console {
  width: 100%;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.app-shell.admin-mode .admin-sidebar {
  min-height: 100vh;
}

.app-shell.admin-mode .admin-main {
  min-height: 100vh;
  overflow: auto;
}

.admin-create-form,
.redeem-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.admin-create-form input,
.admin-create-form select,
.redeem-form input,
.admin-form-block input,
.admin-form-block textarea {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfa;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
}

.admin-create-form button,
.redeem-form button,
.danger-button {
  white-space: nowrap;
}

.admin-user.is-disabled,
.redeem-code-item.is-disabled {
  opacity: .62;
}

.danger-button {
  border-color: rgba(183, 55, 73, .24) !important;
  background: rgba(183, 55, 73, .08) !important;
  color: var(--danger) !important;
}

.admin-hidden-field {
  display: none !important;
}

.redeem-form {
  grid-template-columns: minmax(0, 1fr) 130px;
  margin-top: 16px;
}

.redeem-code-list {
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
  padding-right: 6px;
}

.redeem-table-head {
  display: grid;
  grid-template-columns: 2.2fr .7fr .7fr .8fr 1fr 1fr 1.1fr .9fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: #eef2f7;
  color: #5f6c7b;
  font-size: 13px;
  font-weight: 600;
}

.redeem-code-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(40, 54, 72, .10);
  border-radius: 12px;
  background: #fff;
}

.redeem-code-item strong,
.redeem-code-item span {
  display: block;
}

.redeem-code-item strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .04em;
}

.redeem-code-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.redeem-toolbar {
  display: grid;
  grid-template-columns: 1.2fr .8fr auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.redeem-toolbar label {
  display: grid;
  gap: 6px;
}

.redeem-toolbar span {
  font-size: 12px;
  color: var(--muted);
}

.redeem-toolbar input,
.redeem-toolbar select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfa;
  padding: 10px 12px;
  font: inherit;
}

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

.redeem-summary {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 4px 10px;
  align-items: center;
  justify-content: end;
  text-align: right;
}

.redeem-summary span {
  font-size: 18px;
  font-weight: 700;
}

.redeem-summary small {
  color: var(--muted);
  font-size: 12px;
}

.redeem-code-row {
  display: grid;
  grid-template-columns: 2.2fr .7fr .7fr .8fr 1fr 1fr 1.1fr .9fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(40, 54, 72, .10);
  border-radius: 12px;
  background: #fff;
}

.redeem-code-value {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.redeem-code-value strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-copy {
  min-width: 34px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(40, 54, 72, .10);
  background: #f5f7fb;
  color: #415063;
}

.redeem-badge,
.redeem-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.redeem-badge {
  background: rgba(34, 197, 94, .12);
  color: #0f8a47;
}

.redeem-status {
  background: rgba(59, 130, 246, .12);
  color: #2563eb;
}

.redeem-code-row.is-used { border-color: rgba(59, 130, 246, .18); }
.redeem-code-row.is-disabled { opacity: .62; }

.redeem-code-main strong {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .04em;
}

.redeem-code-main span,
.redeem-code-meta span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.redeem-code-meta {
  text-align: right;
}

.redeem-code-meta span:first-child {
  margin-top: 0;
}

/* ===== Redeem Codes V2 Redesign ===== */

.redeem-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Stats Bar */
.redeem-stats-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.redeem-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .07);
  transition: box-shadow .2s, transform .15s;
}
.redeem-stat-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
  transform: translateY(-1px);
}

.redeem-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}
.redeem-stat-icon.total    { background: #eef2ff; color: #4f46e5; }
.redeem-stat-icon.unused   { background: #ecfdf5; color: #059669; }
.redeem-stat-icon.used     { background: #eff6ff; color: #2563eb; }
.redeem-stat-icon.disabled { background: #fef2f2; color: #dc2626; }
.redeem-stat-icon.credits  { background: #fffbeb; color: #d97706; }

.redeem-stat-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.redeem-stat-body strong {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}
.redeem-stat-body span {
  font-size: 13px;
  color: #64748b;
}

/* Toolbar V2 */
.redeem-toolbar-v2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.redeem-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 280px;
}

.redeem-search-wrap {
  position: relative;
  flex: 1;
  max-width: 360px;
}
.redeem-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 18px;
  pointer-events: none;
}
.redeem-search-wrap input {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px 10px 40px;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: #0f172a;
}
.redeem-search-wrap input:focus {
  border-color: rgba(15, 118, 110, .55);
  outline: 3px solid rgba(20, 184, 166, .14);
}
.redeem-toolbar-left select {
  min-height: 42px;
  min-width: 130px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}

.redeem-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.redeem-selected-hint {
  font-size: 13px;
  color: #64748b;
  padding: 0 4px;
}
.redeem-selected-hint b {
  color: #0f766e;
  font-weight: 700;
}

.redeem-export-group {
  display: flex;
  gap: 6px;
  padding-left: 12px;
  border-left: 1px solid rgba(15, 23, 42, .10);
  margin-left: 4px;
}

/* Table V2 */
.redeem-table-wrap {
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.redeem-table-head-v2 {
  display: grid;
  grid-template-columns: 48px 2fr .8fr .8fr 1fr 1fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(15, 23, 42, .08);
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}
.redeem-table-head-v2 .col-check {
  display: flex;
  justify-content: center;
}
.redeem-table-head-v2 input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #0f766e;
  cursor: pointer;
}

.redeem-code-list-v2 {
  max-height: calc(100vh - 380px);
  overflow-y: auto;
}
.redeem-code-list-v2::-webkit-scrollbar {
  width: 6px;
}
.redeem-code-list-v2::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, .15);
  border-radius: 3px;
}

.redeem-code-row-v2 {
  display: grid;
  grid-template-columns: 48px 2fr .8fr .8fr 1fr 1fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, .05);
  transition: background .15s;
  font-size: 14px;
}
.redeem-code-row-v2:last-child {
  border-bottom: 0;
}
.redeem-code-row-v2:hover {
  background: #fafbfc;
}
.redeem-code-row-v2.is-disabled {
  opacity: .55;
}
.redeem-code-row-v2.is-used {
  background: #f8faff;
}

.redeem-code-row-v2 .col-check {
  display: flex;
  justify-content: center;
}
.redeem-code-row-v2 .col-check input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #0f766e;
  cursor: pointer;
}

.redeem-code-row-v2 .col-code {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.redeem-code-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: .03em;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.redeem-copy-btn {
  min-width: 30px;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid rgba(15, 23, 42, .10);
  background: #f8fafc;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s;
}
.redeem-copy-btn:hover {
  background: #eef2ff;
  border-color: rgba(79, 70, 229, .25);
  color: #4f46e5;
}

.redeem-code-row-v2 .col-credits b {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.redeem-code-row-v2 .col-credits {
  color: #64748b;
  font-size: 12px;
}

.redeem-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.redeem-status-pill.is-unused {
  background: #ecfdf5;
  color: #059669;
}
.redeem-status-pill.is-used {
  background: #eff6ff;
  color: #2563eb;
}
.redeem-status-pill.is-disabled {
  background: #fef2f2;
  color: #dc2626;
}

.redeem-code-row-v2 .col-user,
.redeem-code-row-v2 .col-time,
.redeem-code-row-v2 .col-created {
  color: #64748b;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.redeem-code-row-v2 .col-actions {
  display: flex;
  gap: 6px;
}
.redeem-code-row-v2 .col-actions button {
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid rgba(15, 23, 42, .10);
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.redeem-code-row-v2 .col-actions button:hover {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, .18);
}
.redeem-code-row-v2 .col-actions .danger-button {
  border-color: rgba(220, 38, 38, .18);
  background: #fff1f2;
  color: #be123c;
}
.redeem-code-row-v2 .col-actions .danger-button:hover {
  background: #fef2f2;
  border-color: rgba(220, 38, 38, .35);
}

/* Empty state */
.redeem-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}
.redeem-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}
.redeem-empty-state strong {
  font-size: 16px;
  color: #475569;
  margin-bottom: 6px;
}
.redeem-empty-state p {
  font-size: 14px;
  color: #94a3b8;
}

/* Toast notification */
.redeem-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.redeem-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Generate section collapsible */
.redeem-generate-section {
  margin-top: 18px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 12px;
  overflow: hidden;
}
.redeem-generate-section summary {
  padding: 14px 18px;
  background: #f8fafc;
  font-weight: 600;
  font-size: 14px;
  color: #475569;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.redeem-generate-section summary:hover {
  background: #f1f5f9;
}
.redeem-generate-section[open] summary {
  border-bottom: 1px solid rgba(15, 23, 42, .08);
}
.redeem-create-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  padding: 18px;
  align-items: end;
}
.redeem-create-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.redeem-create-form label span {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}
.redeem-create-form input {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: #0f172a;
}
.redeem-create-form input:focus {
  border-color: rgba(15, 118, 110, .55);
  outline: 3px solid rgba(20, 184, 166, .14);
}
.redeem-create-form button {
  min-height: 42px;
  padding: 10px 24px;
  border-radius: 10px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.redeem-create-form button:hover {
  background: #115e59;
}
.redeem-create-form button:disabled {
  opacity: .6;
  cursor: wait;
}

/* Responsive for redeem v2 */
@media (max-width: 1200px) {
  .redeem-stats-bar {
    grid-template-columns: repeat(3, 1fr);
  }
  .redeem-table-head-v2,
  .redeem-code-row-v2 {
    grid-template-columns: 48px 2fr .7fr .8fr 1fr 1fr;
  }
  .redeem-code-row-v2 .col-created { display: none; }
  .redeem-table-head-v2 .col-created { display: none; }
}
@media (max-width: 860px) {
  .redeem-stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .redeem-toolbar-v2 {
    flex-direction: column;
    align-items: stretch;
  }
  .redeem-toolbar-right {
    justify-content: flex-start;
  }
  .redeem-table-head-v2,
  .redeem-code-row-v2 {
    grid-template-columns: 40px 1.5fr .7fr .7fr 1fr;
  }
  .redeem-code-row-v2 .col-user,
  .redeem-code-row-v2 .col-time { display: none; }
  .redeem-table-head-v2 .col-user,
  .redeem-table-head-v2 .col-time { display: none; }
  .redeem-export-group {
    border-left: 0;
    padding-left: 0;
    margin-left: 0;
  }
}

/* ===== Admin Panel V2 Global Styles ===== */

.admin-panel-card {
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: 14px;
  background: #fff;
  padding: 0;
  overflow: hidden;
}
.admin-panel-card .section-head {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(15, 23, 42, .05);
}

/* Dashboard Stat Cards V2 */
.admin-stat-grid-v2 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.admin-stat-card-v2 {
  position: relative;
  padding: 22px 24px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .06);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow .2s, transform .15s;
}
.admin-stat-card-v2:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.07);
  transform: translateY(-2px);
}
.asc-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.asc-icon.users     { background: #eef2ff; }
.asc-icon.credits   { background: #fffbeb; }
.asc-icon.generated { background: #ecfdf5; }
.asc-icon.model     { background: #fef2f2; }
.asc-body {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.asc-body strong {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
}
.asc-body span {
  font-size: 14px;
  color: #64748b;
}
.asc-sub {
  font-size: 12px;
  color: #94a3b8;
}

/* Admin Split V2 */
.admin-split-v2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}
@media (max-width: 960px) {
  .admin-stat-grid-v2 { grid-template-columns: repeat(2, 1fr); }
  .admin-split-v2 { grid-template-columns: 1fr; }
}

/* Health Checks */
.health-checks {
  padding: 16px 22px;
  display: grid;
  gap: 12px;
}
.health-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 9px;
  background: #f8fafc;
}
.health-item span { font-size: 14px; color: #475569; }
.health-item strong { font-size: 13px; font-weight: 700; }
.health-pending { color: #94a3b8; }
.health-ok { color: #059669; }
.health-error { color: #dc2626; }
.health-test-btn {
  margin: 0 22px 18px;
  padding: 10px 20px;
  border-radius: 9px;
  border: 1px solid rgba(15, 118, 110, .3);
  background: #f0fdfa;
  color: #0f766e;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.health-test-btn:hover { background: #e6f4f2; }

/* Quick Actions V2 */
.quick-admin-actions-v2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 16px 22px;
}
.quick-admin-actions-v2 button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, .06);
  background: #fafbfc;
  text-align: left;
  cursor: pointer;
  transition: all .15s;
}
.quick-admin-actions-v2 button:hover {
  background: #f0fdfa;
  border-color: rgba(15, 118, 110, .2);
}
.quick-admin-actions-v2 .qa-icon { font-size: 22px; flex-shrink: 0; }
.quick-admin-actions-v2 strong { display: block; font-size: 14px; color: #0f172a; }
.quick-admin-actions-v2 small { font-size: 12px; color: #94a3b8; }

/* Recent Users */
.admin-recent-list {
  padding: 12px 22px 18px;
  display: grid;
  gap: 6px;
}
.recent-user-row {
  display: grid;
  grid-template-columns: 40px 1fr auto 120px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 10px;
  transition: background .15s;
}
.recent-user-row:hover { background: #f8fafc; }
.ru-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #eef2ff;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}
.ru-info strong { display: block; font-size: 14px; color: #0f172a; }
.ru-info span { font-size: 12px; color: #94a3b8; }
.ru-stats { display: flex; gap: 14px; font-size: 13px; color: #64748b; }
.ru-stats b { color: #0f172a; }
.ru-time { font-size: 12px; color: #94a3b8; text-align: right; }
.empty-state-sm { padding: 24px; text-align: center; color: #94a3b8; font-size: 14px; }

/* ===== Admin Table Toolbar ===== */
.admin-table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(15, 23, 42, .05);
  flex-wrap: wrap;
}
.admin-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.admin-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 17px;
  pointer-events: none;
}
.admin-search-wrap input {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px 8px 36px;
  border: 1px solid rgba(15, 23, 42, .10);
  border-radius: 9px;
  font: inherit;
  color: #0f172a;
  background: #fafbfc;
}
.admin-search-wrap input:focus {
  border-color: rgba(15, 118, 110, .55);
  outline: 3px solid rgba(20, 184, 166, .14);
  background: #fff;
}
.admin-table-toolbar select {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(15, 23, 42, .10);
  border-radius: 9px;
  background: #fafbfc;
  font: inherit;
  color: #0f172a;
}
.admin-selected-hint {
  font-size: 13px;
  color: #64748b;
  padding: 0 6px;
}
.admin-selected-hint b { color: #0f766e; font-weight: 700; }

/* ===== Admin Table V2 ===== */
.admin-table-wrap {
  border-top: 0;
}
.admin-table-head {
  display: grid;
  grid-template-columns: 44px 1.5fr .8fr .8fr .7fr .7fr 1fr 1.3fr;
  gap: 8px;
  align-items: center;
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(15, 23, 42, .06);
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.admin-table-head .ath-check { display: flex; justify-content: center; }
.admin-table-head input[type="checkbox"] { width: 16px; height: 16px; accent-color: #0f766e; cursor: pointer; }

.admin-user-table-v2 {
  max-height: calc(100vh - 380px);
  overflow-y: auto;
}

.admin-user-row-v2 {
  display: grid;
  grid-template-columns: 44px 1.5fr .8fr .8fr .7fr .7fr 1fr 1.3fr;
  gap: 8px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(15, 23, 42, .04);
  transition: background .1s;
  font-size: 14px;
}
.admin-user-row-v2:hover { background: #fafcfb; }
.admin-user-row-v2.is-disabled { opacity: .5; }
.admin-user-row-v2:last-child { border-bottom: 0; }
.admin-user-row-v2 .ath-check { display: flex; justify-content: center; }
.admin-user-row-v2 .ath-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: #0f766e; cursor: pointer; }

.au-user strong { display: block; font-size: 14px; color: #0f172a; }
.au-user small { font-size: 12px; color: #94a3b8; }
.au-role { display: inline-flex; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.au-role.admin { background: #fef2f2; color: #be123c; }
.au-role.user  { background: #f1f5f9; color: #475569; }
.au-credits b { font-size: 15px; font-weight: 700; color: #0f766e; }
.au-status { display: inline-flex; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.au-status.active   { background: #ecfdf5; color: #059669; }
.au-status.disabled { background: #fef2f2; color: #dc2626; }
.au-time { font-size: 13px; color: #94a3b8; }
.au-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.au-actions button {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, .08);
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .12s;
}
.au-actions button:hover { background: #f1f5f9; border-color: rgba(15, 23, 42, .15); }
.au-actions .danger-button { border-color: rgba(220, 38, 38, .18); background: #fff1f2; color: #be123c; }
.au-actions .danger-button:hover { background: #fef2f2; }

/* Admin collapse section */
.admin-collapse-section {
  border-top: 1px solid rgba(15, 23, 42, .06);
}
.admin-collapse-section summary {
  padding: 14px 22px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}
.admin-collapse-section summary:hover { color: #0f766e; }
.admin-inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr auto;
  gap: 10px;
  padding: 4px 22px 18px;
  align-items: end;
}
.admin-inline-form label { display: flex; flex-direction: column; gap: 4px; }
.admin-inline-form label span { font-size: 12px; color: #64748b; font-weight: 500; }
.admin-inline-form input,
.admin-inline-form select {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(15, 23, 42, .10);
  border-radius: 9px;
  background: #fafbfc;
  font: inherit;
  color: #0f172a;
}
.admin-inline-form input:focus,
.admin-inline-form select:focus {
  border-color: rgba(15, 118, 110, .55);
  outline: 3px solid rgba(20, 184, 166, .14);
  background: #fff;
}
.admin-inline-form button {
  min-height: 38px;
  padding: 8px 20px;
  border-radius: 9px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.admin-inline-form button:hover { background: #115e59; }

/* ===== Settings Grid Stacked ===== */
.settings-grid-stacked {
  padding: 16px 22px;
  display: grid;
  gap: 14px;
}
.settings-grid-stacked label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.settings-grid-stacked label span {
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}
.settings-grid-stacked input,
.settings-grid-stacked textarea {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, .10);
  border-radius: 10px;
  font: inherit;
  color: #0f172a;
  background: #fafbfc;
}
.settings-grid-stacked input:focus,
.settings-grid-stacked textarea:focus {
  border-color: rgba(15, 118, 110, .55);
  outline: 3px solid rgba(20, 184, 166, .14);
  background: #fff;
}
.settings-grid-stacked textarea { resize: vertical; min-height: 80px; }

.form-submit-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 0 0;
}
.form-submit-bar button {
  padding: 12px 32px;
  border-radius: 10px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: background .15s;
}
.form-submit-bar button:hover { background: #115e59; }
.form-hint { font-size: 13px; color: #94a3b8; }

/* ===== Packages Editor V2 ===== */
.packages-editor-v2 {
  padding: 18px 22px;
}
.packages-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.api-admin-shell {
  padding: 0;
  overflow: hidden;
}
.api-admin-shell-compact {
  border: 1px solid rgba(15, 23, 42, .08);
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, .08), transparent 22%),
    linear-gradient(180deg, #fbfdff 0%, #f4f7fb 100%);
}
.api-admin-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid rgba(15, 23, 42, .06);
  background: linear-gradient(180deg, rgba(15,118,110,.05), rgba(255,255,255,.95));
}
.api-admin-hero h2 {
  margin: 6px 0 8px;
  font-size: 28px;
  color: #0f172a;
}
.api-admin-hero p {
  margin: 0;
  color: #64748b;
  line-height: 1.65;
}
.api-admin-hero-compact {
  align-items: center;
  padding-bottom: 16px;
}
.api-admin-hero-compact h2 {
  margin-bottom: 6px;
}
.api-admin-hero-compact p {
  max-width: 720px;
}
.api-admin-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.primary-inline {
  min-height: 42px;
  padding: 0 18px;
  border: none;
  border-radius: 10px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
}
.api-admin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 26px;
}
.api-admin-summary-compact {
  padding-top: 0;
}
.api-summary-card {
  padding: 16px 18px;
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: 12px;
  background: #fafcfb;
  display: grid;
  gap: 6px;
}
.api-summary-card span,
.api-summary-card small {
  color: #64748b;
}
.api-summary-card strong {
  font-size: 24px;
  color: #0f172a;
}
.api-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, .8fr);
  gap: 18px;
  padding: 0 26px 24px;
}
.api-admin-main,
.api-admin-side {
  display: grid;
  gap: 18px;
  align-content: start;
}
.api-admin-block {
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: 14px;
  background: #fff;
}
.api-base-strip {
  margin: 0 26px 18px;
  border-color: rgba(148, 163, 184, .16);
  background: rgba(255, 255, 255, .82);
}
.api-base-strip-secondary {
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.92));
}
.api-base-collapse {
  padding-top: 0;
  overflow: hidden;
}
.api-base-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  margin: 0;
  cursor: pointer;
}
.api-base-summary::-webkit-details-marker {
  display: none;
}
.api-base-summary h3 {
  margin: 4px 0 0;
  font-size: 17px;
  color: #0f172a;
}
.api-base-summary-meta {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}
.api-base-collapse[open] .api-base-summary {
  border-bottom: 1px solid rgba(148, 163, 184, .16);
}
.api-base-collapse .api-base-strip-note,
.api-base-collapse .api-base-grid {
  margin-left: 18px;
  margin-right: 18px;
}
.api-base-collapse .api-base-grid {
  padding-bottom: 18px;
}
.api-base-strip-note {
  margin: -2px 0 14px;
  font-size: 13px;
  line-height: 1.65;
  color: #64748b;
}
.api-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.api-block-head h3 {
  margin: 5px 0 0;
  font-size: 18px;
  color: #0f172a;
}
.api-base-grid {
  padding: 0;
}
.api-base-grid-compact {
  grid-template-columns: 1.2fr 1.2fr .8fr;
}
.relay-admin-block {
  margin: 0 26px;
  padding-top: 18px;
  border-color: rgba(15, 23, 42, .08);
  background: linear-gradient(180deg, rgba(15, 23, 42, .02), rgba(15, 23, 42, .03));
}
.api-guide-card {
  background: linear-gradient(180deg, #fbfffd, #f8fafc);
}
.api-guide-list {
  margin: 0;
  padding-left: 18px;
  color: #475569;
  line-height: 1.7;
}
.api-guide-list li + li {
  margin-top: 8px;
}
.relay-pool-editor-wrap {
  display: grid;
  gap: 12px;
}
.relay-pool-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.relay-pool-editor-head > div {
  display: grid;
  gap: 4px;
}
.relay-pool-editor-head small {
  color: #64748b;
  line-height: 1.5;
}
.relay-admin-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.relay-admin-toolbar-list {
  padding: 0 4px;
}
.relay-toolbar-left,
.relay-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.relay-toolbar-left {
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: stretch;
}
.relay-toolbar-right {
  justify-content: flex-end;
}
.relay-toolbar-left > div:first-child {
  display: grid;
  gap: 4px;
}
.relay-section-copy p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #64748b;
}
.relay-admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.relay-view-toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .06);
  gap: 4px;
}
.relay-view-toggle button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #475569;
  font: inherit;
  cursor: pointer;
}
.relay-view-toggle button.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}
.relay-search-field {
  position: relative;
  min-width: 280px;
}
.relay-search-field input,
.relay-admin-filters select {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, .10);
  border-radius: 12px;
  background: #fafbfc;
  color: #0f172a;
  font: inherit;
}
.relay-search-field input {
  width: 100%;
  padding-left: 38px;
}
.relay-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
}
.relay-selected-hint {
  color: #0f766e;
  font-weight: 700;
}
.relay-stats-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.relay-stats-bar-compact {
  padding: 0 4px;
}
.relay-stat-card {
  padding: 16px 18px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 14px;
  background: #f8fafc;
  display: grid;
  gap: 6px;
}
.relay-stat-card span,
.relay-stat-card small {
  color: #64748b;
}
.relay-stat-card strong {
  font-size: 24px;
  color: #0f172a;
}
.relay-table-wrap {
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}
.relay-table-wrap-list {
  margin-top: 6px;
  background: #f8fbfd;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.relay-table-head,
.relay-row-main {
  display: grid;
  grid-template-columns: 56px minmax(180px, 1.2fr) minmax(240px, 1.6fr) minmax(160px, 1fr) 90px 110px minmax(180px, 1fr) 180px;
  gap: 12px;
  align-items: center;
}
.relay-table-head {
  padding: 16px 18px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid rgba(15, 23, 42, .06);
}
.relay-sort-head {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.relay-sort-head:hover {
  color: #0f766e;
}
.relay-table-body {
  display: grid;
  gap: 0;
}
.relay-card-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}
.relay-table-wrap.card-mode {
  background: transparent;
  border: 0;
}
.relay-table-wrap.card-mode .relay-table-head {
  display: none;
}
.relay-table-row {
  border-bottom: 1px solid rgba(15, 23, 42, .06);
  display: grid;
  gap: 0;
}
.relay-table-row:last-child {
  border-bottom: 0;
}
.relay-table-row:hover {
  background: rgba(15, 23, 42, .02);
}
.relay-row-main {
  padding: 16px 18px;
}
.relay-row-main strong {
  display: block;
  color: #0f172a;
}
.relay-row-main .col-name strong {
  margin-bottom: 5px;
  font-size: 15px;
  color: #10233f;
}
.relay-row-main small,
.relay-row-main code {
  color: #64748b;
  font-size: 12px;
}
.relay-row-main code {
  background: rgba(15, 23, 42, .04);
  padding: 4px 8px;
  border-radius: 8px;
  word-break: break-all;
}
.relay-row-main .col-url {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.relay-row-main .col-url code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 10px;
  background: #eff5fb;
  color: #27425f;
}
.relay-mini-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.relay-mini-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .05);
  color: #475569;
  font-size: 12px;
}
.relay-card-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.relay-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, .10);
  color: #0f766e;
  font-size: 12px;
  max-width: 100%;
}
.relay-chip.muted {
  background: rgba(15, 23, 42, .05);
  color: #64748b;
}
.relay-status,
.relay-runtime-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.relay-status.ok,
.relay-runtime-badge.ok {
  background: rgba(5, 150, 105, .10);
  color: #047857;
}
.relay-status.off {
  background: rgba(100, 116, 139, .10);
  color: #475569;
}
.relay-runtime-badge.error {
  background: rgba(220, 38, 38, .10);
  color: #b91c1c;
}
.relay-table-row .col-actions {
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.relay-table-row .col-actions .ghost-button {
  min-width: 56px;
  padding: 8px 10px;
  border-radius: 10px;
}
.api-admin-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 26px 22px;
}
.api-admin-inline-note {
  display: grid;
  gap: 4px;
}
.api-admin-inline-note strong {
  font-size: 13px;
  color: #0f172a;
}
.api-admin-inline-note span {
  font-size: 12px;
  color: #64748b;
}
.config-test-result-inline {
  margin: 0 26px 22px;
  border-radius: 14px;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(148, 163, 184, .18);
}
.relay-editor-dialog {
  width: min(720px, calc(100vw - 32px));
}
.relay-editor-form {
  display: grid;
  gap: 14px;
}
.relay-editor-form label {
  display: grid;
  gap: 8px;
}
.relay-editor-form input,
.relay-editor-form select {
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid rgba(15, 23, 42, .10);
  border-radius: 12px;
  background: #f8fafc;
  color: #0f172a;
  font: inherit;
}
.relay-editor-form input:focus,
.relay-editor-form select:focus {
  outline: none;
  border-color: rgba(15, 118, 110, .45);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .10);
  background: #fff;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.relay-row-editor {
  padding: 0 18px 16px;
}
.relay-row-editor summary {
  cursor: pointer;
  color: #0f766e;
  font-size: 13px;
  padding-bottom: 12px;
}
.relay-row-editor-body {
  padding: 16px;
  border-radius: 14px;
  background: #f8fafc;
  display: grid;
  gap: 14px;
}
.relay-row-actions,
.col-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.relay-runtime {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.relay-runtime span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .05);
  color: #475569;
  font-size: 12px;
}
.relay-runtime.ok span:first-child {
  background: rgba(5, 150, 105, .10);
  color: #047857;
}
.relay-runtime.error span:first-child {
  background: rgba(220, 38, 38, .10);
  color: #b91c1c;
}
.relay-runtime-detail {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(220, 38, 38, .05);
  color: #991b1b;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}
.relay-row-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.relay-row-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.relay-row-grid select {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, .10);
  border-radius: 10px;
  font: inherit;
  color: #0f172a;
  background: #fafbfc;
}
.relay-row-grid select:focus {
  border-color: rgba(15, 118, 110, .55);
  outline: 3px solid rgba(20, 184, 166, .14);
  background: #fff;
}
.relay-enabled-field {
  max-width: 180px;
}
.package-edit-card {
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, .08);
  background: #fafcfb;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.package-edit-card.featured {
  border-color: rgba(15, 118, 110, .25);
  background: #f0fdfa;
  box-shadow: 0 2px 12px rgba(15, 118, 110, .08);
}
.pec-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pec-name {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.pec-name:focus {
  outline: none;
  border-bottom-color: #0f766e;
}
.pec-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: #0f766e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.pec-body {
  display: grid;
  gap: 10px;
}
.pec-body label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pec-body label span { font-size: 13px; color: #64748b; }
.pec-body input {
  width: 120px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(15, 23, 42, .10);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  text-align: right;
  background: #fff;
}
.pec-body input:focus {
  border-color: rgba(15, 118, 110, .55);
  outline: 3px solid rgba(20, 184, 166, .14);
}

/* ===== Config Test Result V2 ===== */
.config-test-summary-v2 {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 14px;
}
.config-test-summary-v2.ok      { background: #ecfdf5; }
.config-test-summary-v2.warning { background: #fffbeb; }
.config-test-summary-v2.failed  { background: #fef2f2; }
.ct-summary-icon { font-size: 28px; }
.config-test-summary-v2 strong { display: block; font-size: 15px; color: #0f172a; }
.config-test-summary-v2 span { font-size: 12px; color: #64748b; }
.config-test-item-v2 {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 9px;
  margin-bottom: 6px;
}
.config-test-item-v2.ok    { background: #f8fafc; }
.config-test-item-v2.warn  { background: #fffbeb; }
.config-test-item-v2.error { background: #fef2f2; }
.ct-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.config-test-item-v2 strong { display: block; font-size: 14px; color: #0f172a; }
.config-test-item-v2 p { font-size: 13px; color: #64748b; margin-top: 2px; }
.config-test-item-v2 pre {
  margin: 6px 0 0;
  padding: 8px 12px;
  border-radius: 7px;
  background: rgba(0,0,0,.04);
  font-size: 12px;
  max-height: 100px;
  overflow: auto;
  white-space: pre-wrap;
}

/* ===== Announcement Preview ===== */
.announcement-preview {
  padding: 18px 22px;
}
.preview-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #eef2ff, #f0fdfa);
  border: 1px solid rgba(15, 118, 110, .15);
  font-size: 14px;
  color: #0f172a;
  margin-bottom: 10px;
}
.preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0f766e;
  flex-shrink: 0;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.announcement-preview small { font-size: 12px; color: #94a3b8; }

/* ===== Card Shop Preview ===== */
.cardshop-preview {
  padding: 18px 22px;
}
.preview-card {
  padding: 24px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, .08);
  background: #fafcfb;
  text-align: center;
}
.preview-card strong { display: block; font-size: 18px; color: #0f172a; margin-bottom: 10px; }
.preview-card p { font-size: 14px; color: #64748b; margin-bottom: 16px; line-height: 1.6; }
.preview-btn {
  padding: 10px 28px;
  border-radius: 9px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  border: none;
  opacity: .6;
}

/* ===== Announcement V2 ===== */
.announcement-editor-body {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.announcement-quick-templates {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.announcement-quick-templates > span {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
}
.announcement-quick-templates button {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, .10);
  background: #fafbfc;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
}
.announcement-quick-templates button:hover {
  background: #eef2ff;
  border-color: rgba(79, 70, 229, .25);
  color: #4f46e5;
}
.announcement-editor-body textarea {
  width: 100%;
  min-height: 130px;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, .10);
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.7;
  color: #0f172a;
  background: #fafbfc;
  resize: vertical;
}
.announcement-editor-body textarea:focus {
  border-color: rgba(15, 118, 110, .55);
  outline: 3px solid rgba(20, 184, 166, .14);
  background: #fff;
}
.announcement-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.announcement-meta span {
  font-size: 13px;
  color: #94a3b8;
}
.announcement-meta button {
  padding: 10px 24px;
  border-radius: 10px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: background .15s;
}
.announcement-meta button:hover { background: #115e59; }

/* Announcement Preview V2 */
.announcement-preview-v2 {
  padding: 0;
  border-radius: 0 0 14px 14px;
  overflow: hidden;
}
.apv-browser-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: #1e293b;
  border-radius: 0;
}
.apv-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.apv-dot.red    { background: #ef4444; }
.apv-dot.yellow { background: #eab308; }
.apv-dot.green  { background: #22c55e; }
.apv-url {
  margin-left: 8px;
  font-size: 11px;
  color: #94a3b8;
}
.apv-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
}
.apv-brand { display: flex; align-items: center; gap: 10px; }
.apv-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}
.apv-appname { font-size: 14px; font-weight: 700; color: #0f172a; }
.apv-nav { display: flex; gap: 14px; font-size: 12px; color: #94a3b8; }
.apv-announcement-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  margin: 0;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  color: #94a3b8;
  transition: all .2s;
}
.apv-announcement-bar.has-announcement {
  background: linear-gradient(135deg, #eef2ff, #f0fdfa);
  color: #0f172a;
  font-weight: 600;
}
.apv-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.has-announcement .apv-dot-pulse {
  background: #0f766e;
  animation: pulse-dot 2s infinite;
}
.apv-content-placeholder {
  padding: 24px 18px;
  background: #fafcfb;
  display: grid;
  gap: 10px;
}
.apv-card {
  height: 52px;
  border-radius: 10px;
  background: #f1f5f9;
}
.apv-card.short { width: 60%; }
.announcement-preview-v2 > small {
  display: block;
  padding: 12px 18px;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}

/* ===== Config Page ===== */
.config-page-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}
.config-page-grid > .panel:last-child {
  grid-column: 1 / -1;
}
@media (min-width: 1200px) {
  .config-page-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .config-page-grid > .panel:last-child {
    grid-column: auto;
  }
}
.settings-grid-stacked label small {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}
.settings-grid-stacked label span em {
  font-style: normal;
  color: #94a3b8;
  font-weight: 400;
  font-size: 11px;
}
.field-hint { font-size: 12px; margin-top: 2px; }
.field-hint.ok   { color: #059669; }
.field-hint.warn { color: #d97706; }

.config-test-result {
  margin: 12px 22px 18px;
  padding: 0;
}
.config-test-result:not([hidden]) {
  display: block;
}

/* ===== Card Shop Preview V2 ===== */
.cardshop-preview-v2 {
  padding: 0;
  border-radius: 0 0 14px 14px;
  overflow: hidden;
}
.csp-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
}
.csp-icon { font-size: 28px; flex-shrink: 0; }
.csp-header strong { display: block; font-size: 16px; color: #0f172a; margin-bottom: 2px; }
.csp-header span { font-size: 13px; color: #94a3b8; }
.csp-packages {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 18px;
  background: #fafcfb;
}
.csp-package {
  padding: 16px 12px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, .08);
  background: #fff;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.csp-package.featured {
  border-color: rgba(15, 118, 110, .25);
  background: #f0fdfa;
}
.csp-package > span { font-size: 12px; color: #64748b; }
.csp-package b { font-size: 18px; color: #0f172a; font-weight: 800; }
.csp-package em { font-size: 20px; font-weight: 800; color: #0f766e; font-style: normal; }
.csp-package.featured em { color: #0d9488; }
.csp-note {
  margin: 0 18px;
  border-radius: 10px;
  background: #f0fdfa;
  border: 1px solid rgba(15, 118, 110, .15);
  overflow: hidden;
}
.csp-note[hidden] { display: none; }
.csp-note-inner {
  padding: 14px 16px;
  font-size: 13px;
  color: #0f766e;
  line-height: 1.7;
}
.csp-buy-btn {
  display: block;
  width: calc(100% - 36px);
  margin: 16px 18px 20px;
  padding: 12px;
  border-radius: 10px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
  text-align: center;
  transition: background .15s;
}
.csp-buy-btn:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
}

/* ===== Admin Panel Responsive ===== */
@media (max-width: 1100px) {
  .admin-inline-form { grid-template-columns: 1fr 1fr 1fr; }
  .packages-editor-grid { grid-template-columns: 1fr 1fr; }
  .relay-row-grid { grid-template-columns: 1fr; }
  .config-page-grid { grid-template-columns: 1fr; }
  .api-admin-summary { grid-template-columns: 1fr 1fr; }
  .api-base-grid-compact { grid-template-columns: 1fr 1fr; }
  .api-admin-grid { grid-template-columns: 1fr; }
  .api-admin-side { grid-template-columns: 1fr; }
  .relay-stats-bar { grid-template-columns: 1fr 1fr; }
  .relay-admin-toolbar { flex-direction: column; }
  .relay-toolbar-left,
  .relay-toolbar-right,
  .relay-admin-filters { width: 100%; }
  .api-admin-footer { flex-direction: column; align-items: stretch; }
  .relay-table-head,
  .relay-row-main { grid-template-columns: 52px minmax(180px, 1fr) minmax(220px, 1.2fr) minmax(150px, 1fr) 80px 100px minmax(160px, 1fr) 160px; }
  .csp-packages { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1120px) {
  .login-panel, .studio-layout, .account-grid, .admin-grid, .admin-console, .admin-split { grid-template-columns: 1fr; }
  .character-stage { display: none; }
  .mobile-brand { display: flex; }
  .side-panel { position: static; }
  .metrics-grid, .admin-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-sidebar { border-radius: 0; }
}

@media (max-width: 760px) {
  .login-shell, .app-shell { padding: 16px; }
  .login-shell { background: #fff; }
  .login-card { min-height: calc(100vh - 32px); padding: 24px; }
  .topbar, .submit-zone { align-items: stretch; flex-direction: column; }
  .top-actions { justify-content: stretch; }
  .top-actions button { flex: 1; }
  .brand p { white-space: normal; }
  .metrics-grid, .settings-grid, .advanced-grid, .package-list, .admin-stat-grid { grid-template-columns: 1fr; }
  .panel, .login-card { padding: 18px; }
  .package-edit-row { grid-template-columns: 1fr 1fr; }
  #generateButton { width: 100%; }
  .admin-main { padding: 16px; }
  .admin-toolbar { flex-direction: column; }
  .api-admin-summary { grid-template-columns: 1fr; }
  .api-admin-hero { padding: 20px 18px 16px; }
  .api-base-strip,
  .relay-admin-block,
  .config-test-result-inline { margin-left: 18px; margin-right: 18px; }
  .api-base-grid-compact { grid-template-columns: 1fr; }
  .relay-stats-bar { grid-template-columns: 1fr; }
  .relay-table-wrap { overflow-x: auto; }
  .relay-table-head,
  .relay-row-main { min-width: 1180px; }
}

/* Admin console visual refresh */
.app-shell.admin-mode {
  color: #111827;
  background: #eef2f6;
}

.app-shell.admin-mode .admin-console {
  grid-template-columns: 272px minmax(0, 1fr);
  background: #eef2f6;
}

.app-shell.admin-mode .admin-sidebar {
  position: sticky;
  top: 0;
  gap: 18px;
  padding: 22px 14px;
  background:
    linear-gradient(180deg, rgba(24, 224, 204, .08), rgba(24, 224, 204, 0) 28%),
    #0b1220;
  border-right: 1px solid rgba(255,255,255,.08);
}

.app-shell.admin-mode .admin-logo {
  min-height: 70px;
  padding: 8px 10px 18px;
}

.app-shell.admin-mode .admin-logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(20, 184, 166, .28);
}

.app-shell.admin-mode .admin-logo strong {
  color: #f8fafc;
  font-size: 18px;
  letter-spacing: 0;
}

.app-shell.admin-mode .admin-logo span {
  color: #93a4b8;
}

.app-shell.admin-mode .admin-menu {
  gap: 8px;
}

.app-shell.admin-mode .admin-menu button {
  min-height: 50px;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #cbd5e1;
}

.app-shell.admin-mode .admin-menu button span {
  font-weight: 850;
}

.app-shell.admin-mode .admin-menu button:hover {
  background: rgba(148, 163, 184, .10);
}

.app-shell.admin-mode .admin-menu button.active {
  border-color: rgba(45, 212, 191, .22);
  background: rgba(20, 184, 166, .16);
  color: #2dd4bf;
}

.app-shell.admin-mode .admin-sidebar-card {
  padding: 16px;
  border-radius: 14px;
  background: rgba(15, 23, 42, .92);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .12);
}

.app-shell.admin-mode .admin-main {
  padding: 28px;
  background:
    radial-gradient(circle at 70% 0%, rgba(20, 184, 166, .10), transparent 34%),
    #eef2f6;
}

.app-shell.admin-mode .admin-toolbar {
  align-items: center;
  margin-bottom: 22px;
  padding: 18px 20px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 16px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 14px 36px rgba(15, 23, 42, .06);
}

.app-shell.admin-mode .admin-toolbar .eyebrow {
  color: #0f766e;
}

.app-shell.admin-mode .admin-toolbar h2 {
  color: #0f172a;
  font-size: 28px;
  letter-spacing: 0;
}

.app-shell.admin-mode .admin-toolbar p {
  color: #64748b;
}

.app-shell.admin-mode .admin-toolbar-actions button,
.app-shell.admin-mode .admin-create-form button,
.app-shell.admin-mode .redeem-form button,
.app-shell.admin-mode .form-actions button {
  min-height: 40px;
  border-radius: 10px;
  padding: 0 14px;
  background: #0f766e;
  color: #fff;
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(15, 118, 110, .18);
}

.app-shell.admin-mode .admin-toolbar-actions .ghost-button,
.app-shell.admin-mode .admin-sidebar-card .ghost-button {
  border: 1px solid rgba(15, 23, 42, .10);
  background: #fff;
  color: #0f172a;
  box-shadow: none;
}

.app-shell.admin-mode .admin-sidebar-card .ghost-button {
  background: rgba(255,255,255,.08);
  color: #e2e8f0;
  border-color: rgba(255,255,255,.12);
}

.app-shell.admin-mode .admin-stat-grid {
  gap: 16px;
  margin-bottom: 18px;
}

.app-shell.admin-mode .admin-stat-grid article,
.app-shell.admin-mode .panel {
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .07);
  backdrop-filter: none;
}

.app-shell.admin-mode .admin-stat-grid article {
  position: relative;
  overflow: hidden;
  min-height: 138px;
  padding: 20px;
}

.app-shell.admin-mode .admin-stat-grid article::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 18px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(20, 184, 166, .12);
}

.app-shell.admin-mode .admin-stat-grid span,
.app-shell.admin-mode .admin-stat-grid small {
  color: #64748b;
}

.app-shell.admin-mode .admin-stat-grid strong {
  color: #0f172a;
  font-size: 32px;
}

.app-shell.admin-mode .section-head {
  margin-bottom: 16px;
}

.app-shell.admin-mode .section-head h2 {
  color: #0f172a;
  font-size: 20px;
}

.app-shell.admin-mode .section-head p {
  color: #64748b;
}

.app-shell.admin-mode .admin-split {
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
}

.app-shell.admin-mode .admin-mini-list div,
.app-shell.admin-mode .admin-user,
.app-shell.admin-mode .redeem-code-item,
.app-shell.admin-mode .package-edit-row {
  border: 1px solid rgba(15, 23, 42, .07);
  border-radius: 12px;
  background: #f8fafc;
}

.app-shell.admin-mode .admin-user {
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, .8fr) auto;
  padding: 14px;
  margin-bottom: 10px;
}

.app-shell.admin-mode .admin-user strong,
.app-shell.admin-mode .redeem-code-item strong {
  color: #0f172a;
}

.app-shell.admin-mode .admin-user span,
.app-shell.admin-mode .redeem-code-item span {
  color: #64748b;
}

.app-shell.admin-mode .admin-user-metrics span {
  background: #e6f4f2;
  color: #0f766e;
}

.app-shell.admin-mode .admin-user-actions button {
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 9px;
  background: #fff;
  color: #0f172a;
  font-weight: 800;
}

.app-shell.admin-mode .admin-user-actions button:hover {
  border-color: rgba(15, 118, 110, .35);
  color: #0f766e;
}

.app-shell.admin-mode .danger-button {
  border-color: rgba(220, 38, 38, .18) !important;
  background: #fff1f2 !important;
  color: #be123c !important;
}

.app-shell.admin-mode .admin-create-form {
  grid-template-columns: minmax(170px, 1fr) minmax(140px, .9fr) minmax(140px, .8fr) 120px 120px 120px;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, .07);
  border-radius: 14px;
  background: #f8fafc;
}

.app-shell.admin-mode .settings-grid {
  gap: 14px;
}

.app-shell.admin-mode input,
.app-shell.admin-mode select,
.app-shell.admin-mode textarea {
  border-color: rgba(15, 23, 42, .12);
  background: #fff;
  color: #0f172a;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, .02);
}

.app-shell.admin-mode input:focus,
.app-shell.admin-mode select:focus,
.app-shell.admin-mode textarea:focus {
  border-color: rgba(15, 118, 110, .55);
  outline: 3px solid rgba(20, 184, 166, .14);
}

.app-shell.admin-mode .admin-form-block label,
.app-shell.admin-mode .settings-grid label {
  color: #334155;
}

.app-shell.admin-mode .redeem-code-list,
.app-shell.admin-mode .admin-user-table {
  max-height: calc(100vh - 260px);
}

/* Admin-mode redeem v2 overrides */
.app-shell.admin-mode .redeem-code-list-v2 {
  max-height: calc(100vh - 420px);
}
.app-shell.admin-mode .redeem-stat-card {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, .06);
}
.app-shell.admin-mode .redeem-table-wrap {
  background: #fff;
  border-color: rgba(15, 23, 42, .06);
}
.app-shell.admin-mode .redeem-table-head-v2 {
  background: #f1f5f9;
}
.app-shell.admin-mode .redeem-code-row-v2:hover {
  background: #f8fafc;
}
.app-shell.admin-mode .redeem-search-wrap input,
.app-shell.admin-mode .redeem-toolbar-left select,
.app-shell.admin-mode .redeem-create-form input {
  border-color: rgba(15, 23, 42, .10);
  background: #fff;
}
.app-shell.admin-mode .redeem-generate-section {
  border-color: rgba(15, 23, 42, .06);
}
.app-shell.admin-mode .redeem-generate-section summary {
  background: #f8fafc;
}

/* Admin-mode V2 overrides */
.app-shell.admin-mode .admin-stat-card-v2 {
  background: #fff;
  border-color: rgba(15, 23, 42, .06);
}
.app-shell.admin-mode .admin-panel-card {
  background: #fff;
  border-color: rgba(15, 23, 42, .05);
}
.app-shell.admin-mode .admin-panel-card .section-head {
  border-bottom-color: rgba(15, 23, 42, .04);
}
.app-shell.admin-mode .admin-table-head {
  background: #f8fafc;
}
.app-shell.admin-mode .admin-search-wrap input,
.app-shell.admin-mode .admin-table-toolbar select,
.app-shell.admin-mode .admin-inline-form input,
.app-shell.admin-mode .admin-inline-form select {
  border-color: rgba(15, 23, 42, .08);
  background: #fafbfc;
}
.app-shell.admin-mode .admin-search-wrap input:focus,
.app-shell.admin-mode .admin-table-toolbar select:focus,
.app-shell.admin-mode .admin-inline-form input:focus {
  background: #fff;
}
.app-shell.admin-mode .health-item {
  background: #f8fafc;
}
.app-shell.admin-mode .quick-admin-actions-v2 button {
  background: #f8fafc;
}
.app-shell.admin-mode .quick-admin-actions-v2 button:hover {
  background: #f0fdfa;
}
.app-shell.admin-mode .admin-table-wrap {
  background: #fff;
}
.app-shell.admin-mode .admin-user-row-v2:hover {
  background: #fafdfb;
}
.app-shell.admin-mode .package-edit-card {
  background: #f8fafc;
}
.app-shell.admin-mode .package-edit-card.featured {
  background: #f0fdfa;
}
.app-shell.admin-mode .relay-row-card {
  background: #f8fafc;
}
.app-shell.admin-mode .api-summary-card,
.app-shell.admin-mode .api-admin-block {
  background: #f8fafc;
}
.app-shell.admin-mode .settings-grid-stacked input,
.app-shell.admin-mode .settings-grid-stacked textarea,
.app-shell.admin-mode .relay-row-grid select {
  background: #fafbfc;
}
.app-shell.admin-mode .settings-grid-stacked input:focus,
.app-shell.admin-mode .settings-grid-stacked textarea:focus,
.app-shell.admin-mode .relay-row-grid select:focus {
  background: #fff;
}
.app-shell.admin-mode .preview-card {
  background: #f8fafc;
}
.app-shell.admin-mode .preview-bar {
  background: linear-gradient(135deg, #eef2ff, #f0fdfa);
}
.app-shell.admin-mode .config-test-item-v2.ok {
  background: #f8fafc;
}
.app-shell.admin-mode .announcement-preview small,
.app-shell.admin-mode .cardshop-preview small {
  color: #94a3b8;
}
.app-shell.admin-mode .announcement-editor-body textarea {
  border-color: rgba(15, 23, 42, .08);
  background: #fafbfc;
}
.app-shell.admin-mode .announcement-editor-body textarea:focus {
  background: #fff;
}
.app-shell.admin-mode .csp-packages {
  background: #f8fafc;
}
.app-shell.admin-mode .apv-topbar,
.app-shell.admin-mode .csp-header {
  background: #fff;
}
.app-shell.admin-mode .config-test-result {
  margin: 12px 18px;
}
.app-shell.admin-mode .settings-grid-stacked label small,
.app-shell.admin-mode .announcement-preview-v2 > small {
  color: #94a3b8;
}

@media (max-width: 1120px) {
  .app-shell.admin-mode .admin-console {
    grid-template-columns: 1fr;
  }
  .app-shell.admin-mode .admin-sidebar {
    position: static;
    min-height: auto;
  }
  .app-shell.admin-mode .admin-split,
  .app-shell.admin-mode .admin-user,
  .app-shell.admin-mode .admin-create-form {
    grid-template-columns: 1fr;
  }
}

/* User workspace polish */
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

.app-shell:not(.admin-mode) {
  width: min(1560px, 100%);
}

.app-shell:not(.admin-mode) .workspace-hero {
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, .94), rgba(64, 117, 109, .88)),
    #0f766e;
  box-shadow: 0 22px 50px rgba(15, 118, 110, .18);
}

.app-shell:not(.admin-mode) .panel,
.app-shell:not(.admin-mode) .metric-card {
  border-radius: 14px;
  border-color: rgba(31, 47, 56, .08);
  background: rgba(255,255,255,.94);
  box-shadow: 0 18px 42px rgba(31, 47, 56, .08);
}

.app-shell:not(.admin-mode) .section-head h2,
.app-shell:not(.admin-mode) .brand h1 {
  letter-spacing: 0;
}

.creation-mode-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) 220px minmax(240px, .95fr);
  gap: 14px;
  margin: 16px 0 18px;
}

.upload-card,
.output-folder-field {
  display: grid;
  gap: 8px;
  min-height: 124px;
  padding: 16px;
  border: 1px dashed rgba(15, 118, 110, .35);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(20,184,166,.08), rgba(255,255,255,.96));
}

.upload-card span,
.output-folder-field span {
  color: #0f766e;
  font-weight: 900;
  font-size: 13px;
}

.upload-card strong {
  color: #0f172a;
  font-size: 15px;
}

.upload-card small,
.output-folder-field small {
  color: #64748b;
  line-height: 1.45;
}

.upload-card input[type="file"] {
  width: 100%;
  border: 1px solid rgba(15, 118, 110, .16);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.reference-preview {
  position: relative;
  overflow: hidden;
  min-height: 124px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 14px;
  background: #0f172a;
}

.reference-preview img {
  width: 100%;
  height: 100%;
  min-height: 124px;
  object-fit: cover;
  display: block;
}

.reference-preview button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-height: 32px;
  border-radius: 9px;
  background: rgba(15, 23, 42, .82);
  color: #fff;
  padding: 0 10px;
  font-weight: 800;
}

.output-folder-field input {
  min-height: 42px;
  border: 1px solid rgba(15, 118, 110, .16);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
}

.image-meta {
  gap: 8px;
}

.image-meta span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .creation-mode-grid {
    grid-template-columns: 1fr;
  }
}

/* User workspace refinement v2 */
.app-shell:not(.admin-mode) {
  padding: 22px 26px 56px;
}

.app-shell:not(.admin-mode) .topbar {
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 14px 42px rgba(32, 48, 56, .08);
}

.app-shell:not(.admin-mode) .studio-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.app-shell:not(.admin-mode) .form-panel {
  padding: 26px;
}

.app-shell:not(.admin-mode) .form-panel .section-head {
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(31, 47, 56, .10);
}

.app-shell:not(.admin-mode) .form-panel .section-head h2 {
  color: #18222f;
  font-size: 30px;
  line-height: 1.15;
}

.app-shell:not(.admin-mode) .form-panel .section-head p {
  margin-top: 6px;
  color: #647280;
  font-size: 14px;
}

.app-shell:not(.admin-mode) .field > span,
.app-shell:not(.admin-mode) .settings-grid label > span,
.app-shell:not(.admin-mode) .advanced-grid label > span {
  color: #344052;
  font-size: 13px;
  font-weight: 850;
}

.app-shell:not(.admin-mode) textarea#prompt {
  min-height: 250px;
  border-radius: 14px;
  border-color: rgba(38, 53, 65, .14);
  background: #fcfdfb;
  font-size: 16px;
  line-height: 1.7;
  resize: vertical;
}

.app-shell:not(.admin-mode) textarea#prompt:focus,
.app-shell:not(.admin-mode) input:focus,
.app-shell:not(.admin-mode) select:focus {
  border-color: rgba(15, 118, 110, .55);
  outline: 3px solid rgba(20, 184, 166, .14);
}

.creation-mode-grid {
  grid-template-columns: minmax(300px, 1fr) 210px minmax(280px, .85fr);
  align-items: stretch;
}

.upload-card,
.output-folder-field {
  min-height: 150px;
  border-style: solid;
  background:
    linear-gradient(180deg, rgba(20,184,166,.10), rgba(255,255,255,.98)),
    #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}

.upload-card input[type="file"] {
  min-height: 46px;
  color: #344052;
}

.output-folder-field {
  grid-template-columns: 1fr;
}

.output-folder-field button {
  min-height: 42px;
  border-radius: 10px;
  background: #0f766e;
  color: #fff;
  font-weight: 850;
  box-shadow: 0 12px 22px rgba(15, 118, 110, .18);
}

.output-folder-field strong {
  display: block;
  overflow: hidden;
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-preview {
  min-height: 150px;
  box-shadow: 0 18px 34px rgba(15, 23, 42, .12);
}

.reference-preview img {
  min-height: 150px;
}

.quick-style {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(31, 47, 56, .08);
  border-radius: 14px;
  background: #f8fbfa;
}

.quick-style > span {
  display: block;
  margin-bottom: 10px;
  color: #344052;
  font-weight: 850;
}

.quick-style .chips {
  gap: 10px;
}

.quick-style button {
  min-height: 38px;
  border: 1px solid rgba(15, 118, 110, .14);
  border-radius: 999px;
  background: #eff8f6;
  color: #0f766e;
  padding: 0 16px;
  font-weight: 850;
}

.app-shell:not(.admin-mode) .settings-grid {
  gap: 14px;
  margin-top: 18px;
}

.app-shell:not(.admin-mode) .settings-grid input,
.app-shell:not(.admin-mode) .settings-grid select,
.app-shell:not(.admin-mode) .advanced-grid input {
  min-height: 48px;
  border-radius: 12px;
  background: #fff;
}

.submit-zone {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(31, 47, 56, .10);
}

#generateButton {
  min-height: 58px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0f766e, #248f82);
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 18px 34px rgba(15, 118, 110, .22);
}

.side-panel {
  border-radius: 16px;
}

.history-list {
  max-height: calc(100vh - 230px);
  overflow: auto;
  padding-right: 4px;
}

.gallery-section {
  margin-top: 18px;
}

.results {
  gap: 16px;
}

.image-card {
  border-radius: 14px;
  overflow: hidden;
}

@media (max-width: 1180px) {
  .app-shell:not(.admin-mode) .studio-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell:not(.admin-mode) {
    padding: 14px;
  }
  .app-shell:not(.admin-mode) .form-panel {
    padding: 18px;
  }
  .creation-mode-grid {
    grid-template-columns: 1fr;
  }
}

/* Beginner-friendly creation flow */
.app-shell:not(.admin-mode) .form-panel {
  max-width: none;
}

.app-shell:not(.admin-mode) .form-panel .section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.app-shell:not(.admin-mode) .field {
  margin-top: 20px;
}

.app-shell:not(.admin-mode) .field > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: #0f766e;
  font-size: 15px;
}

.app-shell:not(.admin-mode) textarea#prompt {
  min-height: 230px;
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, .03);
}

.creation-mode-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, .85fr);
  grid-template-areas:
    "upload output"
    "preview output";
  gap: 16px;
}

.upload-card {
  grid-area: upload;
  min-height: 142px;
}

.reference-preview {
  grid-area: preview;
  min-height: 190px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, .92), rgba(15, 118, 110, .82));
}

.reference-preview[hidden] {
  display: none;
}

.reference-preview img {
  min-height: 190px;
}

.output-folder-field {
  grid-area: output;
  align-content: start;
  min-height: 100%;
}

.upload-card,
.output-folder-field {
  padding: 18px;
  border: 1px solid rgba(15, 118, 110, .18);
  border-radius: 16px;
}

.upload-card span,
.output-folder-field span {
  font-size: 15px;
}

.upload-card strong,
.output-folder-field strong {
  font-size: 14px;
  line-height: 1.45;
}

.upload-card input[type="file"] {
  cursor: pointer;
}

.output-folder-field input {
  display: none;
}

.output-folder-field button {
  margin-top: 4px;
  min-height: 48px;
  font-size: 15px;
}

.output-folder-field small {
  margin-top: 8px;
}

.quick-style {
  margin-top: 20px;
}

.app-shell:not(.admin-mode) .settings-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.app-shell:not(.admin-mode) .settings-grid .full {
  grid-column: 1 / -1;
}

.submit-zone {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.run-state {
  min-width: 0;
}

@media (max-width: 980px) {
  .creation-mode-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "upload"
      "preview"
      "output";
  }
  .app-shell:not(.admin-mode) .settings-grid,
  .submit-zone {
    grid-template-columns: 1fr;
  }
}

/* User creation form final polish */
.app-shell:not(.admin-mode) .creation-mode-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "upload output"
    "preview preview";
  align-items: stretch;
  gap: 18px;
}

.app-shell:not(.admin-mode) .upload-card,
.app-shell:not(.admin-mode) .output-folder-field {
  margin-top: 0;
  min-height: 184px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  padding: 22px;
  border: 1px solid rgba(20, 184, 166, .2);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(240, 253, 250, .95), rgba(255, 255, 255, .98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
}

.app-shell:not(.admin-mode) .upload-card span,
.app-shell:not(.admin-mode) .output-folder-field span {
  margin: 0;
  color: #0f766e;
  font-size: 17px;
  font-weight: 900;
}

.app-shell:not(.admin-mode) .upload-card strong,
.app-shell:not(.admin-mode) .output-folder-field strong {
  font-size: 14px;
  line-height: 1.6;
}

.app-shell:not(.admin-mode) .upload-card small,
.app-shell:not(.admin-mode) .output-folder-field small {
  margin-top: auto;
  color: #64748b;
  font-size: 13px;
  line-height: 1.55;
}

.app-shell:not(.admin-mode) .upload-card input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 12px;
  background: #fff;
  color: #64748b;
  font-size: 14px;
}

.app-shell:not(.admin-mode) .upload-card input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: #0f766e;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.app-shell:not(.admin-mode) .reference-preview {
  grid-area: preview;
  min-height: 260px;
  border-radius: 18px;
  background: #0f172a;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .16);
}

.app-shell:not(.admin-mode) .reference-preview-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 18px 0;
  color: #d8f3ef;
}

.app-shell:not(.admin-mode) .reference-preview-head strong {
  color: #fff;
  font-size: 16px;
  font-weight: 850;
}

.app-shell:not(.admin-mode) .reference-preview-head span {
  color: rgba(255,255,255,.72);
  font-size: 12px;
}

.app-shell:not(.admin-mode) .reference-preview img {
  width: 100%;
  min-height: 260px;
  max-height: 420px;
  object-fit: contain;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, .06) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, .06) 25%, transparent 25%),
    #111827;
  background-size: 20px 20px;
}

.app-shell:not(.admin-mode) .reference-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  padding: 18px;
}

.app-shell:not(.admin-mode) .reference-preview-grid figure {
  margin: 0;
  position: relative;
  display: grid;
  gap: 8px;
}

.app-shell:not(.admin-mode) .reference-preview-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 0;
  max-height: none;
  object-fit: cover;
  border-radius: 14px;
  background: #111827;
}

.app-shell:not(.admin-mode) .reference-preview-grid figcaption {
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
}

.app-shell:not(.admin-mode) .reference-preview button {
  top: 18px;
  right: 18px;
  bottom: auto;
  border-radius: 999px;
}

.app-shell:not(.admin-mode) .reference-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, .82);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.app-shell:not(.admin-mode) .reference-preview-note {
  padding: 0 18px 12px;
  color: rgba(255,255,255,.72);
  font-size: 12px;
}

.app-shell:not(.admin-mode) .output-folder-field input {
  display: none !important;
}

.app-shell:not(.admin-mode) .output-folder-field button {
  width: 100%;
  min-height: 54px;
  margin: 4px 0 0;
  border-radius: 13px;
  background: #0f766e;
  box-shadow: 0 14px 28px rgba(15, 118, 110, .18);
  font-size: 16px;
}

.app-shell:not(.admin-mode) .output-folder-field strong {
  display: block;
  padding: 10px 12px;
  border: 1px solid rgba(15, 118, 110, .12);
  border-radius: 12px;
  background: rgba(240, 253, 250, .9);
  color: #0f766e;
}

.app-shell:not(.admin-mode) .settings-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.app-shell:not(.admin-mode) .settings-grid .full,
.app-shell:not(.admin-mode) .advanced {
  display: none;
}

.app-shell:not(.admin-mode) .settings-grid [data-ratio-picker] {
  display: grid !important;
}

.app-shell:not(.admin-mode) .quick-style {
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 16px;
  background: #fbfdfc;
}

.app-shell:not(.admin-mode) .submit-zone {
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 18px;
  background: #fbfdfc;
}

.app-shell:not(.admin-mode) .submit-zone .primary-button {
  min-height: 64px;
  border-radius: 16px;
  font-size: 18px;
  box-shadow: 0 18px 34px rgba(15, 118, 110, .2);
}

.app-shell:not(.admin-mode) .run-state {
  padding: 4px 0;
}

@media (max-width: 980px) {
  .app-shell:not(.admin-mode) .creation-mode-grid,
  .app-shell:not(.admin-mode) .settings-grid,
  .app-shell:not(.admin-mode) .submit-zone {
    grid-template-columns: 1fr;
  }

  .app-shell:not(.admin-mode) .creation-mode-grid {
    grid-template-areas:
      "upload"
      "output"
      "preview";
  }
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.segmented-control button {
  min-height: 58px;
  border: 1px solid rgba(15, 118, 110, .16);
  border-radius: 14px;
  background: #fff;
  color: #1f2937;
  padding: 10px;
  text-align: left;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
}

.segmented-control button strong,
.segmented-control button small {
  display: block;
}

.segmented-control button strong {
  font-size: 14px;
}

.segmented-control button small {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}

.segmented-control button.active {
  border-color: rgba(15, 118, 110, .5);
  background: linear-gradient(180deg, #ecfdf5, #fff);
  color: #0f766e;
  box-shadow: 0 12px 28px rgba(15, 118, 110, .14);
}

.task-queue-panel {
  margin-top: 18px;
}

.task-queue-list {
  display: grid;
  gap: 12px;
}

.task-queue-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 14px;
  align-items: start;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 16px;
  background: #fff;
  padding: 16px;
}

.task-queue-main strong {
  display: block;
  color: #0f766e;
  font-size: 14px;
}

.task-queue-main p {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 6px;
  color: #475569;
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-mini-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.task-mini-gallery img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
}

.task-mini-gallery span {
  border: 1px dashed rgba(15, 23, 42, .14);
  border-radius: 999px;
  color: #64748b;
  padding: 8px 10px;
  font-size: 12px;
}

.task-queue-side {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.status-pill {
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.running,
.status-pill.queued {
  background: #e0f2fe;
  color: #0369a1;
}

.status-pill.succeeded {
  background: #dcfce7;
  color: #166534;
}

.status-pill.failed,
.status-pill.partial_failed {
  background: #fee2e2;
  color: #b91c1c;
}

.task-queue-side button {
  min-height: 34px;
  border-radius: 10px;
  background: #edf3f1;
  color: #0f766e;
  padding: 0 12px;
  font-weight: 850;
}

.task-error {
  margin-top: 10px;
  border-radius: 12px;
  background: #fff1f2;
  color: #be123c;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
}

@media (max-width: 980px) {
  .segmented-control {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-queue-item {
    grid-template-columns: 1fr;
  }

  .task-queue-side {
    justify-items: start;
  }
}

/* AI Image Generate inspired user workspace */
.app-shell:not(.admin-mode) {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 28px 30px 44px;
  background:
    radial-gradient(circle at 16% 8%, rgba(79, 120, 255, .12), transparent 28%),
    linear-gradient(90deg, #f4f8ff 0%, #ffffff 50%, #eefdf4 100%);
}

.app-shell:not(.admin-mode) .workspace-hero,
.app-shell:not(.admin-mode) .metrics-grid {
  display: none;
}

.app-shell:not(.admin-mode) .topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin-bottom: 22px;
  border: 0;
  border-radius: 0;
  background: rgba(247, 250, 255, .88);
  box-shadow: none;
  backdrop-filter: blur(18px);
}

.app-shell:not(.admin-mode) .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, #4f7cff, #6f7cff);
  color: #fff;
  box-shadow: 0 14px 28px rgba(79, 124, 255, .26);
}

.app-shell:not(.admin-mode) .brand h1 {
  color: #172033;
  font-size: 24px;
  font-weight: 900;
}

.app-shell:not(.admin-mode) .brand p {
  color: #73819a;
  font-size: 14px;
}

.app-shell:not(.admin-mode) .top-actions {
  gap: 10px;
}

.app-shell:not(.admin-mode) .top-actions button {
  min-height: 46px;
  border: 1px solid #e5ebf5;
  border-radius: 18px;
  background: rgba(255,255,255,.82);
  color: #4f6df8;
  padding: 0 18px;
  box-shadow: 0 10px 22px rgba(53, 76, 124, .06);
  font-size: 15px;
  font-weight: 900;
}

.app-shell:not(.admin-mode) .top-actions button.active {
  border-color: #d8e2ff;
  background: #eef4ff;
  color: #345cf4;
}

.app-shell:not(.admin-mode) .studio-layout {
  display: grid;
  grid-template-columns: 360px minmax(520px, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

.app-shell:not(.admin-mode) .form-panel,
.app-shell:not(.admin-mode) .gallery-section,
.app-shell:not(.admin-mode) .side-panel {
  margin: 0;
  border: 1px solid #e7edf6;
  border-radius: 22px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 20px 60px rgba(53, 76, 124, .08);
  backdrop-filter: blur(18px);
}

.app-shell:not(.admin-mode) .form-panel,
.app-shell:not(.admin-mode) .side-panel {
  position: sticky;
  top: 94px;
  max-height: calc(100vh - 116px);
  overflow: auto;
}

.app-shell:not(.admin-mode) .form-panel {
  padding: 20px;
}

.app-shell:not(.admin-mode) .gallery-section {
  min-height: calc(100vh - 118px);
  padding: 24px;
}

.app-shell:not(.admin-mode) .side-panel {
  padding: 20px;
}

.app-shell:not(.admin-mode) .section-head {
  align-items: start;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.app-shell:not(.admin-mode) .section-head .eyebrow {
  color: #6d7c96;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

.app-shell:not(.admin-mode) .section-head h2 {
  color: #172033;
  font-size: 24px;
  line-height: 1.18;
  font-weight: 950;
}

.app-shell:not(.admin-mode) .section-head p {
  color: #7a879c;
  font-size: 14px;
  line-height: 1.5;
}

.app-shell:not(.admin-mode) .form-panel .section-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.app-shell:not(.admin-mode) #copyPrompt {
  justify-self: stretch;
  min-height: 40px;
  border-radius: 14px;
  background: #eef4ff;
  color: #4f6df8;
}

.app-shell:not(.admin-mode) .mode-switch {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  border: 1px solid #e4ebf4;
  border-radius: 18px;
  background: #f1f5fb;
  padding: 6px;
}

.app-shell:not(.admin-mode) #generateForm .output-folder-field {
  display: none !important;
}

.app-shell:not(.admin-mode) .account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
}

.app-shell:not(.admin-mode) .account-save-panel {
  grid-column: 1 / -1;
}

.app-shell:not(.admin-mode) .account-output-folder {
  display: grid;
  gap: 12px;
}

.app-shell:not(.admin-mode) .account-output-folder input {
  display: block !important;
  min-height: 48px;
  border: 1px solid #e4ebf4;
  border-radius: 16px;
  background: #fff;
  padding: 0 14px;
}

.app-shell:not(.admin-mode) #accountTab[hidden] {
  display: none !important;
}

.app-shell:not(.admin-mode) #studioTab[hidden] {
  display: none !important;
}

.app-shell:not(.admin-mode) .mode-switch button {
  min-height: 48px;
  border-radius: 14px;
  background: transparent;
  color: #6d7c96;
  font-size: 16px;
  font-weight: 950;
}

.app-shell:not(.admin-mode) .mode-switch button.active {
  background: #fff;
  color: #172033;
  box-shadow: 0 10px 24px rgba(53, 76, 124, .10);
}

.app-shell:not(.admin-mode) .field {
  margin-top: 14px;
}

.app-shell:not(.admin-mode) .field > span,
.app-shell:not(.admin-mode) .settings-grid label > span {
  margin-bottom: 8px;
  color: #6d7c96;
  font-size: 13px;
  font-weight: 900;
}

.app-shell:not(.admin-mode) textarea#prompt {
  min-height: 170px;
  border: 1px solid #e4ebf4;
  border-radius: 18px;
  background: #fff;
  padding: 16px;
  color: #202a3b;
  font-size: 15px;
  line-height: 1.65;
  box-shadow: inset 0 1px 0 rgba(53, 76, 124, .03);
}

.app-shell:not(.admin-mode) textarea#prompt::placeholder {
  color: #9aa6b8;
}

.app-shell:not(.admin-mode) .creation-mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "upload"
    "preview";
  gap: 12px;
  margin-top: 14px;
}

.app-shell:not(.admin-mode) .upload-card,
.app-shell:not(.admin-mode) .output-folder-field {
  min-height: auto;
  border: 1px solid #e4ebf4;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  padding: 14px;
  box-shadow: none;
}

.app-shell:not(.admin-mode) .upload-card span,
.app-shell:not(.admin-mode) .output-folder-field span {
  color: #172033;
  font-size: 14px;
  font-weight: 950;
}

.app-shell:not(.admin-mode) .upload-card strong,
.app-shell:not(.admin-mode) .output-folder-field strong {
  color: #39465b;
  font-size: 13px;
  line-height: 1.5;
}

.app-shell:not(.admin-mode) .upload-card small,
.app-shell:not(.admin-mode) .output-folder-field small {
  color: #8390a6;
  font-size: 12px;
}

.app-shell:not(.admin-mode) .upload-card input[type="file"] {
  border: 1px solid #e4ebf4;
  border-radius: 14px;
  background: #fff;
  padding: 10px;
}

.app-shell:not(.admin-mode) .upload-card input[type="file"]::file-selector-button {
  border-radius: 12px;
  background: #4f7cff;
}

.app-shell:not(.admin-mode) .reference-preview {
  min-height: 0;
  border: 1px solid #e4ebf4;
  border-radius: 18px;
  background: #f8fbff;
  padding: 12px;
  box-shadow: none;
}

.app-shell:not(.admin-mode) .reference-preview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.app-shell:not(.admin-mode) .reference-preview-grid img {
  border-radius: 14px;
}

.app-shell:not(.admin-mode) .reference-preview button {
  top: 10px;
  right: 10px;
  background: rgba(23, 32, 51, .78);
}

.app-shell:not(.admin-mode) .output-folder-field button {
  min-height: 44px;
  border-radius: 14px;
  background: #4f7cff;
  box-shadow: 0 14px 28px rgba(79, 124, 255, .18);
}

.app-shell:not(.admin-mode) .output-folder-field strong {
  border-color: #e4ebf4;
  background: #f8fbff;
  color: #60708a;
}

.app-shell:not(.admin-mode) .quick-style {
  margin-top: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.app-shell:not(.admin-mode) .quick-style > span {
  color: #6d7c96;
  font-size: 13px;
  font-weight: 900;
}

.app-shell:not(.admin-mode) .chips {
  margin-top: 8px;
  gap: 8px;
}

.app-shell:not(.admin-mode) .chips button {
  min-height: 34px;
  border: 1px solid #e0e7f2;
  border-radius: 999px;
  background: #f8fbff;
  color: #4f6df8;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 900;
}

.app-shell:not(.admin-mode) .settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.app-shell:not(.admin-mode) .settings-grid [data-ratio-picker] {
  grid-column: 1 / -1;
}

.app-shell:not(.admin-mode) .settings-grid label:has(select[name="size"]),
.app-shell:not(.admin-mode) .settings-grid label:has(select[name="quality"]) {
  display: none !important;
}

.app-shell:not(.admin-mode) .segmented-control {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.app-shell:not(.admin-mode) .segmented-control button {
  min-height: 62px;
  border-color: #e4ebf4;
  border-radius: 16px;
  background: #fff;
  text-align: center;
  box-shadow: none;
}

.app-shell:not(.admin-mode) .segmented-control button.active {
  border-color: #4f7cff;
  background: #4f7cff;
  color: #fff;
  box-shadow: 0 12px 26px rgba(79, 124, 255, .24);
}

.app-shell:not(.admin-mode) .segmented-control button.active small {
  color: rgba(255,255,255,.86);
}

.app-shell:not(.admin-mode) .settings-grid input,
.app-shell:not(.admin-mode) .settings-grid select {
  min-height: 48px;
  border-color: #e4ebf4;
  border-radius: 16px;
  background: #fff;
}

.app-shell:not(.admin-mode) .submit-zone {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.app-shell:not(.admin-mode) .submit-zone #generateButton {
  width: 100%;
  min-height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, #4f7cff, #6f7cff);
  color: #fff;
  box-shadow: 0 18px 36px rgba(79, 124, 255, .26);
  font-size: 17px;
  font-weight: 950;
}

.app-shell:not(.admin-mode) .run-state {
  gap: 9px;
}

.app-shell:not(.admin-mode) .run-state .progress-head,
.app-shell:not(.admin-mode) .run-state .progress-shell,
.app-shell:not(.admin-mode) #taskPanel {
  display: none !important;
}

.app-shell:not(.admin-mode) #status {
  color: #5f6f87;
  font-size: 13px;
}

.app-shell:not(.admin-mode) .progress-shell {
  height: 8px;
  background: #edf2f8;
}

.app-shell:not(.admin-mode) .progress-bar {
  background: linear-gradient(90deg, #4f7cff, #7b8cff);
}

.app-shell:not(.admin-mode) .gallery-section .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-shell:not(.admin-mode) .gallery-section .section-head::after {
  content: "任务会按提交顺序显示，一张完成就先展示一张";
  display: block;
  color: #8b98ad;
  font-size: 13px;
  font-weight: 800;
}

.app-shell:not(.admin-mode) .results {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.app-shell:not(.admin-mode) .image-card {
  width: min(760px, 100%);
  border: 1px solid #e7edf6;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(53, 76, 124, .08);
  overflow: hidden;
}

.app-shell:not(.admin-mode) .image-preview-button {
  display: block;
  width: 100%;
  border: 0;
  background: #f7faff;
  padding: 0;
  cursor: zoom-in;
}

.app-shell:not(.admin-mode) .image-card img {
  width: 100%;
  max-height: 680px;
  object-fit: contain;
  background: #f7faff;
}

.app-shell:not(.admin-mode) .image-meta {
  border-top: 1px solid #eef2f7;
  padding: 11px 14px;
}

.app-shell:not(.admin-mode) .task-queue-panel {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.app-shell:not(.admin-mode) .task-queue-panel .section-head {
  display: none;
}

.app-shell:not(.admin-mode) .task-queue-list {
  gap: 14px;
}

.app-shell:not(.admin-mode) .task-queue-item {
  grid-template-columns: minmax(0, 1fr) auto;
  border: 1px solid #e7edf6;
  border-radius: 22px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 14px 38px rgba(53, 76, 124, .06);
}

.app-shell:not(.admin-mode) .task-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-shell:not(.admin-mode) .task-queue-side {
  min-width: 118px;
}

.app-shell:not(.admin-mode) .task-queue-side small {
  color: #7b879a;
  font-size: 12px;
  font-weight: 800;
}

.app-shell:not(.admin-mode) .task-queue-side strong {
  color: #172033;
  font-size: 13px;
  font-weight: 950;
}

.app-shell:not(.admin-mode) .task-queue-main strong {
  color: #172033;
  font-size: 16px;
}

.app-shell:not(.admin-mode) .task-card-progress {
  margin-top: 14px;
}

.app-shell:not(.admin-mode) .task-card-progress div {
  display: flex;
  justify-content: space-between;
  color: #7b879a;
  font-size: 12px;
  font-weight: 900;
}

.app-shell:not(.admin-mode) .task-card-progress i {
  position: relative;
  z-index: 1;
  display: block;
  height: 9px;
  margin-top: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f7cff, #7b8cff);
  box-shadow: 0 8px 18px rgba(79, 124, 255, .22);
  transition: width .35s ease;
}

.app-shell:not(.admin-mode) .task-card-progress {
  position: relative;
  overflow: hidden;
}

.app-shell:not(.admin-mode) .task-card-progress::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: block;
  height: 9px;
  border-radius: 999px;
  background: #edf2f8;
}

.app-shell:not(.admin-mode) .task-mini-gallery img {
  width: 160px;
  height: 160px;
  border-radius: 18px;
  object-fit: cover;
}

.app-shell:not(.admin-mode) .task-mini-gallery button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
}

.app-shell:not(.admin-mode) .status-pill {
  background: #e5f8e9;
  color: #237b43;
  font-size: 13px;
}

.app-shell:not(.admin-mode) .side-panel .section-head {
  display: grid;
  grid-template-columns: 1fr auto;
}

.app-shell:not(.admin-mode) .history-list {
  max-height: calc(100vh - 210px);
  gap: 14px;
}

.app-shell:not(.admin-mode) .history-item {
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 14px;
  border-color: #e7edf6;
  border-radius: 18px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 12px 30px rgba(53, 76, 124, .05);
}

.app-shell:not(.admin-mode) .history-item .thumbs,
.app-shell:not(.admin-mode) .history-item .thumbs img {
  width: 104px;
  height: 104px;
  border-radius: 16px;
  object-fit: cover;
}

.app-shell:not(.admin-mode) .history-tags span {
  background: #f0f5ff;
  color: #4f6df8;
}

.image-preview-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(10, 16, 28, .86);
  padding: 32px;
}

.image-preview-layer[hidden] {
  display: none;
}

.image-preview-layer img {
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0,0,0,.38);
  object-fit: contain;
}

.image-preview-close {
  position: fixed;
  top: 22px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 30px;
  line-height: 1;
}

@media (max-width: 1280px) {
  .app-shell:not(.admin-mode) .studio-layout {
    grid-template-columns: 340px minmax(0, 1fr);
  }

  .app-shell:not(.admin-mode) .side-panel {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
  }
}

@media (max-width: 920px) {
  .app-shell:not(.admin-mode) {
    padding: 16px;
  }

  .app-shell:not(.admin-mode) .studio-layout {
    grid-template-columns: 1fr;
  }

  .app-shell:not(.admin-mode) .form-panel,
  .app-shell:not(.admin-mode) .side-panel {
    position: static;
    max-height: none;
  }

  .app-shell:not(.admin-mode) .segmented-control {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
