/* Standalone stylesheet for the public CDK redemption frontend.
   Keep this separate from static/style.css, which belongs to the internal card frontend. */
:root {
  --bg: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.45);
  --glass: rgba(255, 255, 255, 0.35);
  --border: rgba(148, 163, 184, 0.12);
  --border-light: rgba(255, 255, 255, 0.6);
  --bh: rgba(88, 86, 214, 0.22);
  --t1: #0f172a;
  --t2: #475569;
  --t3: #94a3b8;
  --blue: #007aff;
  --indigo: #5856d6;
  --purple: #af52de;
  --pink: #ff2d55;
  --orange: #ff9500;
  --yellow: #ffcc00;
  --green: #34c759;
  --mint: #00c7be;
  --acc: var(--blue);
  --acc2: var(--purple);
  --glow: rgba(0, 122, 255, 0.16);
  --ok: var(--green);
  --warn: var(--orange);
  --err: #ff3b30;
  --grad: linear-gradient(135deg, var(--blue), var(--purple) 52%, var(--pink));
  --grad-action: linear-gradient(135deg, var(--blue) 0%, var(--indigo) 48%, var(--pink) 100%);
}

html[data-theme="dark"] {
  --bg: #030712;
  --card-bg: rgba(15, 23, 42, 0.45);
  --glass: rgba(15, 23, 42, 0.35);
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.05);
  --bh: rgba(10, 132, 255, 0.28);
  --t1: #f8fafc;
  --t2: #94a3b8;
  --t3: #475569;
  --blue: #0a84ff;
  --indigo: #5e5ce6;
  --purple: #bf5af2;
  --pink: #ff375f;
  --orange: #ff9f0a;
  --yellow: #ffd60a;
  --green: #30d158;
  --mint: #63e6e2;
  --glow: rgba(10, 132, 255, 0.23);
  --grad: linear-gradient(135deg, var(--blue), var(--purple) 52%, var(--pink));
  --grad-action: linear-gradient(135deg, #0a84ff 0%, #bf5af2 50%, #ff375f 100%);
}

*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--t1);
  height: 100vh;
  overflow: hidden;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* Noise & Glow overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0.035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .noise-overlay {
  opacity: 0.045;
}

.bg-glow-blobs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
  filter: blur(130px);
  opacity: 0.65;
}
html[data-theme="dark"] .bg-glow-blobs {
  opacity: 0.55;
}

.blob {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  animation: drift 25s infinite alternate ease-in-out;
  will-change: transform;
}
html:not([data-theme="dark"]) .blob {
  mix-blend-mode: multiply;
}

.blob-1 {
  top: -10%;
  left: -5%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, rgba(99, 102, 241, 0) 70%);
}
.blob-2 {
  bottom: -15%;
  right: -5%;
  width: 48vw;
  height: 48vw;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.22) 0%, rgba(236, 72, 153, 0) 70%);
  animation-duration: 30s;
  animation-delay: -7s;
}
.blob-3 {
  top: 35%;
  left: 45%;
  width: 38vw;
  height: 38vw;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.18) 0%, rgba(14, 165, 233, 0) 70%);
  animation-duration: 20s;
  animation-delay: -3s;
}

@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4vw, 7vh) scale(1.08); }
  100% { transform: translate(-3vw, -4vh) scale(0.92); }
}
.cdk-page {
  min-height: 100vh;
  overflow: auto;
}
.cdk-page.modal-open {
  overflow: hidden;
}
.cdk-page .app {
  height: auto;
  min-height: 100vh;
}

/* BG */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(0, 122, 255, 0.16) 0%, rgba(0, 122, 255, 0) 36%),
    linear-gradient(245deg, rgba(255, 45, 85, 0.12) 0%, rgba(255, 45, 85, 0) 34%),
    linear-gradient(25deg, rgba(255, 204, 0, 0) 34%, rgba(255, 204, 0, 0.12) 56%, rgba(255, 204, 0, 0) 78%),
    linear-gradient(155deg, rgba(0, 199, 190, 0) 38%, rgba(0, 199, 190, 0.12) 72%, rgba(0, 199, 190, 0) 100%),
    linear-gradient(180deg, rgba(175, 82, 222, 0.10) 0%, rgba(175, 82, 222, 0) 42%),
    linear-gradient(180deg, #f8fbff 0%, #fbfcff 48%, #f5f8ff 100%);
}

html[data-theme="dark"] .bg-gradient {
  background:
    linear-gradient(115deg, rgba(10, 132, 255, 0.24) 0%, rgba(10, 132, 255, 0) 35%),
    linear-gradient(245deg, rgba(255, 55, 95, 0.20) 0%, rgba(255, 55, 95, 0) 36%),
    linear-gradient(25deg, rgba(255, 214, 10, 0) 38%, rgba(255, 214, 10, 0.13) 58%, rgba(255, 214, 10, 0) 80%),
    linear-gradient(155deg, rgba(99, 230, 226, 0) 36%, rgba(99, 230, 226, 0.16) 72%, rgba(99, 230, 226, 0) 100%),
    linear-gradient(180deg, #0a0f1e 0%, #101827 54%, #0b1020 100%);
}

.top-controls {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 20;
  display: flex;
  gap: 8px;
}

.top-control {
  height: 34px;
  min-width: 74px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--t1);
  font: 800 12px/1 'Inter', -apple-system, sans-serif;
  cursor: pointer;
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.08),
              inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.top-control:hover {
  transform: translateY(-1px);
  border-color: rgba(10, 132, 255, 0.32);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 16px 34px rgba(10, 132, 255, 0.12),
              inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.top-control svg {
  width: 15px;
  height: 15px;
  color: var(--blue);
  stroke-width: 2.4;
}

html[data-theme="dark"] .top-control {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.58);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.26),
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .top-control:hover {
  border-color: rgba(191, 90, 242, 0.36);
  background: rgba(30, 41, 59, 0.74);
  box-shadow: 0 18px 38px rgba(191, 90, 242, 0.16),
              inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* App Shell */
.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 34px 32px 42px;
  max-width: 1080px;
  margin: 0 auto;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 24px;
  flex-shrink: 0;
}
.header h1 {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 0;
  background: linear-gradient(135deg, #111827 12%, var(--blue) 42%, var(--purple) 70%, var(--pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 12px 30px rgba(88, 86, 214, 0.12);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(0, 199, 190, 0.18);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  color: var(--mint);
  text-transform: uppercase;
  letter-spacing: .5px;
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.06);
}
.badge .dot {
  width: 6px;height: 6px;
  background: var(--mint);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.4}}

/* ── Main: 2-panel ── */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  min-height: 0;
}

.cdk-main {
  grid-template-columns: minmax(300px, 0.76fr) minmax(450px, 1.24fr);
  align-items: start;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

.guide-side,
.redeem-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.guide-side {
  justify-content: stretch;
}

.redeem-side .form-side {
  flex: none;
}

.redeem-side .sess-card {
  flex: none;
  height: var(--session-card-height, 300px);
  min-height: 180px;
}

.redeem-heading .card-title {
  margin-bottom: 8px;
}

.redeem-heading p {
  color: var(--t2);
  font-size: 13px;
  line-height: 1.6;
}

.stock-card {
  padding: 14px;
}

.stock-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.stock-plan {
  position: relative;
  --plan-color: var(--blue);
  --plan-glow: rgba(0, 122, 255, 0.2);
  flex: 1 1 0;
  min-width: 0;
  min-height: 64px;
  padding: 9px 10px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-top: 3px solid var(--plan-color);
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.02),
              0 1px 0 rgba(255, 255, 255, 0.6) inset;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  overflow: hidden;
}

.stock-plan[data-plan="plus"] {
  --plan-color: var(--blue);
  --plan-glow: rgba(0, 122, 255, 0.25);
}

.stock-plan[data-plan="go"] {
  --plan-color: var(--green);
  --plan-glow: rgba(52, 199, 89, 0.25);
}

.stock-plan[data-plan="pro_5x"] {
  --plan-color: var(--purple);
  --plan-glow: rgba(175, 82, 222, 0.25);
}

.stock-plan[data-plan="pro_20x"] {
  --plan-color: var(--pink);
  --plan-glow: rgba(255, 45, 85, 0.25);
}

.stock-plan span {
  display: block;
  color: var(--t2);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-plan strong {
  display: block;
  color: var(--plan-color);
  font-size: 16px;
  line-height: 1.05;
  margin-top: 7px;
  letter-spacing: 0;
  white-space: nowrap;
}

.stock-plan[data-stock-tier="ready"] strong {
  color: var(--plan-color);
}

.stock-plan[data-stock-tier="low"] strong {
  color: var(--warn);
}

.stock-plan[data-stock-tier="empty"] strong {
  color: var(--t2);
}

.stock-empty {
  flex: 1 0 100%;
  min-height: 72px;
  display: grid;
  place-items: center;
  color: var(--t2);
  font-weight: 800;
  border: 1px dashed rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.25);
}

.stock-plan:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 10px 20px -8px var(--plan-glow),
              0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.stock-plan.selected {
  border-color: var(--plan-color);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 12px 28px -6px var(--plan-glow),
              0 0 0 1px var(--plan-color),
              0 1px 0 rgba(255, 255, 255, 0.9) inset;
  transform: translateY(-3px) scale(1.02);
}

.stock-plan.selected::after {
  content: attr(data-selected-label);
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 1px 5px;
  border-radius: 99px;
  background: var(--plan-color);
  color: #ffffff;
  font-size: 8px;
  font-weight: 800;
  transform: scale(0.9);
}

.stock-plan.selected.warn {
  border-color: rgba(245, 158, 11, 0.58);
  background: rgba(255, 251, 235, 0.82);
}

.stock-plan.selected.warn::after {
  background: var(--warn);
}

.guide-card {
  padding: 14px;
}

.step-item p {
  color: var(--t2);
  font-size: 12px;
  line-height: 1.45;
}

.step-list {
  display: grid;
  gap: 14px;
  position: relative;
}

.step-list::before {
  content: '';
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 27px;
  width: 2px;
  background: linear-gradient(to bottom, var(--blue), var(--green), var(--purple), var(--orange));
  opacity: 0.22;
  z-index: 0;
}

.step-item {
  --step-color: var(--green);
  --step-soft: rgba(52, 199, 89, 0.08);
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.1);
  box-shadow: 0 4px 10px rgba(17, 24, 39, 0.01),
              0 1px 0 rgba(255, 255, 255, 0.6) inset;
  position: relative;
  z-index: 1;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-item:hover {
  transform: translateX(3px);
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 6px 16px rgba(17, 24, 39, 0.04);
}

.step-item.step-blue {
  --step-color: var(--blue);
  --step-soft: rgba(0, 122, 255, 0.08);
}

.step-item:nth-child(3) {
  --step-color: var(--purple);
  --step-soft: rgba(175, 82, 222, 0.08);
}

.step-item.step-warn {
  --step-color: var(--orange);
  --step-soft: rgba(255, 149, 0, 0.08);
}

.step-no {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: var(--step-color);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 0 0 4px var(--step-soft), 0 2px 4px rgba(0,0,0,0.06);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
}

.step-item:hover .step-no {
  transform: scale(1.1);
  box-shadow: 0 0 0 6px var(--step-soft), 0 4px 8px rgba(0,0,0,0.1);
}

.step-item b {
  display: block;
  color: var(--t1);
  font-size: 14px;
  margin-bottom: 4px;
  letter-spacing: 0;
}

.step-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  height: 30px;
  margin-top: 7px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--step-color);
  background: var(--step-soft);
  border: 1px solid color-mix(in srgb, var(--step-color) 26%, transparent);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.step-link:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--step-color) 13%, rgba(255, 255, 255, 0.82));
  border-color: color-mix(in srgb, var(--step-color) 42%, transparent);
}

/* ── Left: Form ── */
.form-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  flex: 1;
}

/* ── Right: Log ── */
.log-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── Card ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 22px;
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  box-shadow: 0 10px 30px -10px rgba(17, 24, 39, 0.05),
              0 1px 1px 0 rgba(255, 255, 255, 0.5) inset;
  transition: all .4s cubic-bezier(0.16, 1, 0.3, 1);
}
.card:hover {
  transform: translateY(-2.5px);
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow: 0 20px 40px -15px rgba(17, 24, 39, 0.08),
              0 1px 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  margin-bottom: 14px; /* Tighter padding alignment */
  color: var(--t1);
}
.card-title .ico {
  color: var(--blue);
}

.ico {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 122, 255, 0.09);
  border: 1px solid rgba(0, 122, 255, 0.15);
  border-radius: 9px;
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  flex-shrink: 0;
  transition: all 0.3s;
}

.redeem-heading .ico {
  color: var(--blue);
  background: rgba(0, 122, 255, 0.09);
  border-color: rgba(0, 122, 255, 0.16);
}

.form-side > .card:first-child .ico {
  color: var(--purple);
  background: rgba(175, 82, 222, 0.10);
  border-color: rgba(175, 82, 222, 0.18);
}

.sess-card .ico {
  color: var(--indigo);
  background: rgba(88, 86, 214, 0.10);
  border-color: rgba(88, 86, 214, 0.18);
}

.stock-card .ico {
  color: var(--pink);
  background: rgba(255, 45, 85, 0.09);
  border-color: rgba(255, 45, 85, 0.16);
}

.guide-card .ico {
  color: var(--green);
  background: rgba(52, 199, 89, 0.10);
  border-color: rgba(52, 199, 89, 0.18);
}
.ico svg, .ico i {
  width: 15px;
  height: 15px;
  stroke-width: 2.5;
}

/* ── Grid helpers ── */
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.row-grow {
  flex: 1;
  min-height: 0;
}

/* ── Inputs ── */
.inp {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--t1);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  outline: none;
  transition: all .25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
}
.inp:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(175, 82, 222, 0.12),
              inset 0 1.5px 2px rgba(15, 23, 42, 0.02);
  background: rgba(255, 255, 255, 0.85);
}
.inp::placeholder { color: var(--t3); }

.ta-wrapper {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
  overflow: hidden;
  flex: 1;
  display: flex;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
  transition: all .25s cubic-bezier(0.16, 1, 0.3, 1);
}
.ta-wrapper:focus-within {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(88, 86, 214, 0.12),
              inset 0 1.5px 2px rgba(15, 23, 42, 0.02);
  background: rgba(255, 255, 255, 0.85);
}

/* Monospace font settings for data input fields */
.ta, .query-input, .query-code {
  font-family: 'JetBrains Mono', 'SF Mono', monospace !important;
}

/* Input Wrapper & Action Buttons */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-action-btn {
  position: absolute;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: rgba(148, 163, 184, 0.12);
  border: none;
  border-radius: 50%;
  color: var(--t2);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 5;
}

.input-action-btn:hover {
  background: rgba(148, 163, 184, 0.24);
  color: var(--t1);
  transform: scale(1.05);
}

.input-action-btn svg {
  width: 12px;
  height: 12px;
  stroke-width: 3px;
}

/* CDK Card Specific style */
.cdk-card-wrapper .inp {
  padding-right: 44px; /* Make space for clear button */
}

/* Session Actions Group */
.card-title-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.sess-actions {
  display: flex;
  gap: 6px;
}

.sess-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.08);
  color: var(--t2);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.sess-action-btn:hover {
  background: rgba(88, 86, 214, 0.08);
  border-color: rgba(88, 86, 214, 0.2);
  color: var(--indigo);
  transform: translateY(-0.5px);
}

.sess-action-btn svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.5px;
}

html[data-theme="dark"] .sess-action-btn {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.05);
}

.ta {
  width: 100%;
  height: 100%;
  padding: 11px 14px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--t1);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  line-height: 1.45;
  resize: none;
  outline: none;
}
.ta::placeholder { color: var(--t3); }

.card-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.sess-card {
  display: flex;
  flex-direction: column;
}
.sess-card .ta {
  flex: 1;
  min-height: 0;
}

.sess-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.sess-card-header .card-title {
  margin-bottom: 0;
}
.sess-card-header .session-info {
  margin-bottom: 0;
}

.session-info {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  flex-wrap: wrap;
}

.info-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(118, 132, 156, 0.14);
  border-radius: 20px;
  color: var(--t1);
  font-weight: 500;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.info-label {
  color: var(--t2);
  font-weight: 500;
}

.badge-icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
  color: var(--t2);
  flex-shrink: 0;
}
.plan-badge .badge-icon {
  color: inherit;
}

/* Plan badges */
.plan-badge[data-plan="free"] {
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--t2);
  background: rgba(248, 250, 252, 0.84);
}
.plan-badge[data-plan="plus"] {
  border-color: rgba(0, 122, 255, 0.26);
  color: var(--blue);
  background: rgba(0, 122, 255, 0.08);
}
.plan-badge[data-plan="go"] {
  border-color: rgba(52, 199, 89, 0.26);
  color: var(--green);
  background: rgba(52, 199, 89, 0.08);
}
.plan-badge[data-plan="pro"] {
  border-color: rgba(175, 82, 222, 0.26);
  color: var(--purple);
  background: rgba(175, 82, 222, 0.09);
}

.plan-badge[data-plan="pro_5x"],
.plan-badge[data-plan="pro_20x"] {
  border-color: rgba(255, 45, 85, 0.24);
  color: var(--pink);
  background: rgba(255, 45, 85, 0.08);
}

.plan-badge[data-plan="legacy-pro"] {
  border-color: rgba(255, 149, 0, 0.28);
  color: var(--warn);
  background: rgba(255, 149, 0, 0.10);
}

/* All cards in row-2 stretch */
.row-2 .card {
  display: flex;
  flex-direction: column;
}
.row-2 .card .card-title {
  flex-shrink: 0;
}

/* ── Plan ── */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.plan {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 24px; /* Unified roundness */
  cursor: pointer;
  transition: all .35s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.plan:hover { border-color: var(--bh); background: #ffffff; transform: scale(1.02); }
.plan.active {
  border-color: rgba(175, 82, 222, 0.34);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(175, 82, 222, 0.10));
  box-shadow: 0 12px 26px rgba(175, 82, 222, 0.12),
              inset 0 1px 1px rgba(255, 255, 255, 0.8);
}
.plan strong { font-size: 14px; color: var(--t1); font-weight: 600; }
.plan input, .region input { display: none; }

/* ── Region ── */
.region-grid { display: flex; flex-direction: column; gap: 8px; }
.region {
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 24px; /* Unified roundness */
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all .35s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.region:hover { border-color: var(--bh); background: #ffffff; transform: scale(1.01); }
.region.active {
  border-color: rgba(0, 199, 190, 0.34);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(0, 199, 190, 0.10));
  box-shadow: 0 12px 26px rgba(0, 199, 190, 0.12),
              inset 0 1px 1px rgba(255, 255, 255, 0.8);
}
.region .flag { font-size: 18px; line-height: 1; }
.region b { font-size: 13px; color: var(--t1); font-weight: 600; }
.region small { font-size: 10px; color: var(--t2); margin-left: auto; font-weight: 500; background: rgba(255,255,255,0.58); padding: 2px 6px; border-radius: 6px; border: 1px solid rgba(118,132,156,0.14); }

/* ── Submit ── */
.btn {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grad-action);
  backdrop-filter: blur(25px) saturate(220%);
  -webkit-backdrop-filter: blur(25px) saturate(220%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 24px;
  color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  box-shadow: 0 16px 36px rgba(88, 86, 214, 0.20),
              inset 0 1px 0 rgba(255, 255, 255, 0.34);
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 20%;
  height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  transition: none;
}
.btn:hover {
  transform: translateY(-2px) scale(1.01);
  background: linear-gradient(135deg, #0a84ff 0%, #5856d6 44%, #ff375f 100%);
  box-shadow: 0 18px 42px rgba(175, 82, 222, 0.28),
              inset 0 1px 0 rgba(255, 255, 255, 0.34);
}
.btn:hover::after {
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  100% {
    left: 150%;
  }
}
.btn:active {
  transform: translateY(0.5px) scale(0.99);
  box-shadow: 0 8px 20px rgba(88, 86, 214, 0.18),
              inset 0 1px 0 rgba(255, 255, 255, 0.26);
}
.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none!important;
  box-shadow: none!important;
}
.btn-icon {
  width: 15px;
  height: 15px;
  stroke-width: 2.5;
  margin-right: 6px;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn.loading .btn-icon {
  display: none !important;
}

.btn .spinner {
  display: none;
  width: 16px;height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-right: 6px;
}
.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-text { opacity: .8; }
@keyframes spin{to{transform:rotate(360deg)}}

textarea::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
textarea::-webkit-scrollbar-track {
  background: transparent;
}
textarea::-webkit-scrollbar-thumb {
  background: rgba(88, 86, 214, 0.22);
  border-radius: 10px;
  background-clip: padding-box;
  border: 3px solid transparent;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
}
textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(175, 82, 222, 0.30);
  background-clip: padding-box;
}
textarea {
  scrollbar-width: thin;
  scrollbar-color: rgba(88, 86, 214, 0.22) transparent;
}

/* ── Toast ── */
.toast {
  position: fixed;
  top: 68px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px; /* Rounded iOS capsule style */
  backdrop-filter: blur(30px) saturate(210%);
  -webkit-backdrop-filter: blur(30px) saturate(210%);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  z-index: 1000;
  transform: translateX(140%) scale(0.95);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 340px;
  box-shadow: 0 20px 40px rgba(17, 24, 39, 0.08),
              0 8px 22px rgba(15, 23, 42, 0.06),
              inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.toast.show {
  transform: translateX(0) scale(1);
  opacity: 1;
}
.toast.error {
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 20px 40px rgba(239, 68, 68, 0.08),
              0 8px 22px rgba(15, 23, 42, 0.06),
              inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.toast.success {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 20px 40px rgba(16, 185, 129, 0.08),
              0 8px 22px rgba(15, 23, 42, 0.06),
              inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.toast-msg {
  line-height: 1.4;
  word-break: break-all;
}

/* ── Query Modal ── */
.query-modal,
.status-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.query-modal.show,
.status-modal.show {
  pointer-events: auto;
}

.status-modal {
  z-index: 920;
}

.query-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  opacity: 0.001;
  transform: translateZ(0);
  will-change: opacity, backdrop-filter;
  transition: opacity .2s ease;
}

.query-modal.show .query-backdrop,
.status-modal.show .query-backdrop {
  opacity: 1;
}

.query-dialog {
  position: relative;
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.62));
  border: 1px solid rgba(255, 255, 255, 0.70);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.20),
              inset 0 1px 0 rgba(255, 255, 255, 0.90);
  opacity: 0;
  transform: translateY(18px) scale(.96) translateZ(0);
  will-change: opacity, transform;
  transition: opacity .22s cubic-bezier(0.16, 1, 0.3, 1), transform .38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.query-modal.show .query-dialog,
.status-modal.show .query-dialog {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.query-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(118, 132, 156, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.60);
  color: var(--t1);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.query-close:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 45, 85, 0.30);
  background: rgba(255, 255, 255, 0.82);
}

.query-close svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.query-title {
  margin-right: 42px;
  margin-bottom: 8px;
}

.query-desc {
  color: var(--t2);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 14px;
}

.query-input {
  width: 100%;
  min-height: 132px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--t1);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04),
              0 1px 0 rgba(255, 255, 255, 0.72);
  transition: border-color .25s ease, background .25s ease, box-shadow .25s ease;
}

.query-input:focus {
  border-color: rgba(10, 132, 255, 0.42);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.12),
              inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.query-input::placeholder {
  color: var(--t3);
}

.query-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 14px 0;
}

.query-secondary,
.query-submit {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  border-radius: 18px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.query-secondary {
  color: var(--blue);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(10, 132, 255, 0.24);
}

.query-submit {
  min-width: 126px;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: var(--grad-action);
  box-shadow: 0 12px 28px rgba(88, 86, 214, 0.18),
              inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.query-secondary:hover,
.query-submit:hover {
  transform: translateY(-1px);
}

.query-submit:disabled {
  opacity: .52;
  cursor: not-allowed;
  transform: none;
}

.query-submit .spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255,255,255,.32);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

.query-submit.loading .spinner {
  display: inline-block;
}

.query-submit.loading .btn-icon {
  display: none;
}

.query-results {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  padding-right: 2px;
}

.query-empty {
  padding: 16px;
  border: 1px dashed rgba(118, 132, 156, 0.24);
  border-radius: 18px;
  color: var(--t3);
  font-size: 13px;
  text-align: center;
}

.query-result-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(118, 132, 156, 0.16);
  border-left: 4px solid var(--err);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.query-result-item.ok {
  border-left-color: var(--ok);
}

.query-result-head {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.query-code {
  min-width: 0;
  color: var(--t1);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  font-weight: 800;
  word-break: break-all;
}

.query-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.query-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(118, 132, 156, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
}

.query-detail b {
  flex-shrink: 0;
  color: var(--t3);
  font-size: 11px;
  font-weight: 800;
}

.query-detail em {
  min-width: 0;
  color: var(--t1);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.query-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.query-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(118, 132, 156, 0.16);
  color: var(--t2);
  font-size: 11px;
  font-weight: 800;
}

.query-chip.ok {
  color: var(--ok);
  border-color: rgba(52, 199, 89, 0.26);
}

.query-chip.bad {
  color: var(--err);
  border-color: rgba(255, 59, 48, 0.24);
}

.replace-copy-btn {
  height: 28px;
  min-width: auto;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
}

.status-dialog {
  width: min(520px, 100%);
  gap: 18px;
}

.status-hero {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px 14px 8px;
  text-align: center;
}

.status-icon {
  width: 62px;
  height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  color: var(--blue);
  background: linear-gradient(145deg, rgba(10, 132, 255, 0.16), rgba(175, 82, 222, 0.10));
  border: 1px solid rgba(10, 132, 255, 0.20);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.status-icon svg {
  width: 31px;
  height: 31px;
  stroke-width: 2.4;
}

.status-hero.pending .status-icon svg {
  animation: spin 1s linear infinite;
}

.status-hero.success .status-icon {
  color: var(--ok);
  background: linear-gradient(145deg, rgba(52, 199, 89, 0.18), rgba(0, 199, 190, 0.10));
  border-color: rgba(52, 199, 89, 0.24);
}

.status-hero.error .status-icon {
  color: var(--err);
  background: linear-gradient(145deg, rgba(255, 59, 48, 0.16), rgba(255, 149, 0, 0.08));
  border-color: rgba(255, 59, 48, 0.24);
}

.status-hero h2 {
  color: var(--t1);
  font-size: 24px;
  font-weight: 850;
  letter-spacing: 0;
}

.status-hero p {
  max-width: 420px;
  color: var(--t2);
  font-size: 13px;
  line-height: 1.65;
}

.status-meta {
  display: grid;
  gap: 8px;
}

.status-meta span {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 12px;
  border: 1px solid rgba(118, 132, 156, 0.14);
  border-radius: 16px;
  color: var(--t2);
  background: rgba(255, 255, 255, 0.48);
  font-size: 12px;
  font-weight: 750;
}

.status-meta b {
  min-width: 0;
  color: var(--t1);
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 12px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-actions {
  display: flex;
  justify-content: flex-end;
}

.status-done {
  min-width: 104px;
}

html[data-theme="dark"] .card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.72), rgba(15, 23, 42, 0.52));
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.28),
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 26px 64px rgba(0, 0, 0, 0.34),
              inset 0 1px 0 rgba(255, 255, 255, 0.11);
}

html[data-theme="dark"] .header h1 {
  background: linear-gradient(135deg, #f8fafc 4%, var(--blue) 38%, var(--purple) 68%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

html[data-theme="dark"] .badge,
html[data-theme="dark"] .info-badge {
  background: rgba(15, 23, 42, 0.58);
  border-color: rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

html[data-theme="dark"] .ico,
html[data-theme="dark"] .stock-plan,
html[data-theme="dark"] .step-item,
html[data-theme="dark"] .inp,
html[data-theme="dark"] .ta-wrapper,
html[data-theme="dark"] .plan,
html[data-theme="dark"] .region {
  background-color: rgba(15, 23, 42, 0.54);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .stock-plan {
  background: rgba(15, 23, 42, 0.54);
  border-top-color: color-mix(in srgb, var(--plan-color) 76%, transparent);
}

html[data-theme="dark"] .stock-plan.selected {
  background: rgba(30, 41, 59, 0.66);
  border-top-color: var(--plan-color);
}

html[data-theme="dark"] .step-item {
  background: rgba(15, 23, 42, 0.54);
  border-left-color: var(--step-color);
}

html[data-theme="dark"] .inp,
html[data-theme="dark"] .ta-wrapper {
  background: rgba(10, 15, 30, 0.58);
}

html[data-theme="dark"] .inp:focus,
html[data-theme="dark"] .ta-wrapper:focus-within {
  background: rgba(15, 23, 42, 0.78);
}

html[data-theme="dark"] .toast {
  background: rgba(15, 23, 42, 0.90);
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.32),
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .query-backdrop {
  background: rgba(0, 0, 0, 0.36);
}

html[data-theme="dark"] .query-dialog {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.84), rgba(15, 23, 42, 0.66));
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.42),
              inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

html[data-theme="dark"] .query-close,
html[data-theme="dark"] .query-input,
html[data-theme="dark"] .query-secondary,
html[data-theme="dark"] .query-result-item,
html[data-theme="dark"] .query-detail,
html[data-theme="dark"] .query-chip,
html[data-theme="dark"] .query-empty {
  background: rgba(15, 23, 42, 0.56);
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .query-input:focus {
  background: rgba(15, 23, 42, 0.76);
}

html[data-theme="dark"] .status-icon,
html[data-theme="dark"] .status-meta span {
  background: rgba(15, 23, 42, 0.56);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* ── Action Row & Switch ── */
.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex-shrink: 0;
}
.action-row .btn {
  flex: 1;
  width: auto;
}
.switch-container {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--t2);
  font-weight: 500;
  padding: 0 18px;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.54));
  border: 1px solid rgba(118, 132, 156, 0.18);
  border-radius: 24px;
  backdrop-filter: blur(25px) saturate(220%);
  -webkit-backdrop-filter: blur(25px) saturate(220%);
  transition: all .3s cubic-bezier(0.16, 1, 0.3, 1);
  height: 48px;
  flex-shrink: 0;
  box-shadow: inset 0 4px 8px rgba(255, 255, 255, 0.65),
              inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.switch-container:hover {
  border-color: rgba(88, 86, 214, 0.24);
  background: #ffffff;
  color: var(--t1);
  transform: translateY(-0.5px);
  box-shadow: inset 0 4px 8px rgba(255, 255, 255, 0.72),
              inset 0 1px 0 rgba(255, 255, 255, 0.86);
}
.switch-container input {
  display: none !important;
}
.switch-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background: rgba(148, 163, 184, 0.24);
  border-radius: 100px;
  transition: all .3s;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform .3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.16);
}
.switch-container input:checked + .switch-slider {
  background: #30d158;
  box-shadow: 0 0 12px rgba(48, 209, 88, 0.35);
}
.switch-container input:checked + .switch-slider::before {
  transform: translateX(16px);
}
.switch-container input:checked ~ .switch-label {
  color: var(--t1);
}

/* ── Responsive ── */
@media(max-width:900px){
  .top-controls{top:10px;right:12px}
  .top-control{height:32px;min-width:58px;padding:0 9px;font-size:11px}
  .toast{top:56px;right:12px;max-width:calc(100vw - 24px)}
  .app{padding:54px 12px 10px}
  .main,.cdk-main{grid-template-columns:1fr;grid-template-rows:auto}
  .header{gap:10px;margin-bottom:16px}
  .header h1{font-size:28px}
  .stock-grid{gap:4px}
  .stock-plan{min-height:58px;padding:8px 7px;border-radius:14px}
  .stock-plan span{font-size:8px}
  .stock-plan strong{font-size:14px;margin-top:6px}
  .redeem-side .sess-card{height:auto;min-height:220px}
  .row-2{grid-template-columns:1fr}
  .plan-grid{grid-template-columns:1fr}
  .card-row{grid-template-columns:1fr}
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }
  .switch-container {
    justify-content: center;
  }
  .query-modal{padding:12px}
  .query-dialog{max-height:calc(100vh - 24px);padding:18px;border-radius:24px}
  .query-actions{flex-direction:column}
  .query-secondary,.query-submit{width:100%}
  .query-result-item{grid-template-columns:1fr}
  .query-result-head{grid-template-columns:1fr}
  .query-detail-grid{grid-template-columns:1fr}
  .query-meta{justify-content:flex-start}
}


.validation-notice {
  min-height: 24px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.validation-notice:empty {
  display: none;
}

.validation-notice::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  flex: 0 0 auto;
}

.validation-notice[data-state="checking"] {
  color: var(--acc);
}

.validation-notice[data-state="checking"]::before {
  width: 11px;
  height: 11px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  background: transparent;
  animation: spin .8s linear infinite;
}

.validation-notice[data-state="success"] {
  color: var(--ok);
}

.validation-notice[data-state="danger"] {
  color: var(--err);
}
