:root {
  color-scheme: dark;
  --bg: #040608;
  --window: #080c10;
  --surface: #0f151c;
  --surface-2: #0a0f15;
  --panel: #131b24;
  --line: #2b3745;
  --line-soft: #1b2430;
  --ink: #f3f7fb;
  --muted: #aeb9c8;
  --blue: #5f8df7;
  --blue-2: #8fb0ff;
  --green: #4fd08a;
  --red: #ff6b5f;
  --amber: #f0c65a;
  --teal: #4da5a1;
  --shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.72);
}

/* The locale switcher is intentionally visible and large enough for touch use. */
.language-picker {
  display: inline-flex;
  align-items: center;
}

.language-picker select {
  min-width: 112px;
  min-height: 40px;
  padding: 8px 30px 8px 12px;
  border: 1px solid var(--line, #2a3446);
  border-radius: 9px;
  background: var(--panel, #121722);
  color: var(--text, #eef2f8);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.language-picker select:focus-visible {
  outline: 3px solid rgba(104, 164, 255, 0.55);
  outline-offset: 2px;
}

.auth-language-picker {
  justify-content: flex-end;
  margin-bottom: 18px;
}

.app-language-picker {
  margin-left: 8px;
}

.public-language-picker {
  margin-left: 14px;
}

.legal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.legal-toolbar .public-language-picker {
  margin-left: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.54), rgba(4, 6, 8, 0) 180px),
    var(--bg);
  color: var(--ink);
  font-family: Pretendard, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #081018;
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #6d7a8d;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
}

textarea {
  min-height: 104px;
  resize: vertical;
  line-height: 1.55;
}

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

label > span,
.field-title {
  color: #d7e2f0;
  font-size: 14px;
  font-weight: 820;
}

small {
  color: var(--muted);
  line-height: 1.45;
}

a {
  color: #9fc2ff;
  text-decoration: none;
}

a:hover {
  color: #c7dbff;
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(460px, 100%);
  padding: 36px 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 16, 22, 0.97);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: white;
  font-weight: 900;
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  font-size: 13px;
}

.eyebrow {
  margin: 18px 0 6px;
  color: var(--blue-2);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

.auth-shell h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.12;
}

.auth-copy {
  margin: 12px 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-purpose {
  display: grid;
  gap: 6px;
  margin: -8px 0 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(13, 23, 38, 0.82);
  color: #dbeafe;
  line-height: 1.55;
}

.auth-purpose strong {
  color: var(--ink);
  font-size: 14px;
}

.auth-purpose span,
.auth-purpose a {
  font-size: 13px;
}

.auth-tabs,
.provider-tabs,
.segmented {
  display: flex;
  gap: 6px;
}

.auth-tabs {
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.auth-tabs button,
.provider-tabs button,
.segmented button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 9px 13px;
  font-weight: 820;
}

.auth-tabs button.active,
.provider-tabs button.active,
.segmented button.active {
  border-color: #405777;
  background: #172235;
  color: white;
}

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

.form-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: #ff9b91;
  font-size: 15px;
  font-weight: 820;
  line-height: 1.45;
}

.form-message.info {
  color: #9fc2ff;
}

.legal-links,
.app-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.legal-links {
  margin-top: 22px;
}

.app-legal-links {
  justify-content: center;
  flex: 0 0 auto;
  padding: 8px 16px 10px;
  gap: 8px 14px;
  font-size: 12px;
}

.legal-page {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(32, 45, 63, 0.68), rgba(4, 6, 8, 0) 260px),
    var(--bg);
}

.legal-shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 72px;
}

.legal-back {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-bottom: 18px;
  color: #b7c7dc;
  font-weight: 840;
}

.legal-shell h1 {
  margin: 0;
  color: var(--ink);
  font-size: 42px;
  line-height: 1.12;
}

.legal-updated {
  margin: 12px 0 28px;
  color: var(--muted);
  font-weight: 760;
}

.legal-shell section {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(12, 17, 24, 0.84);
}

.legal-shell h2 {
  margin: 0 0 12px;
  color: #f5f9ff;
  font-size: 22px;
  line-height: 1.25;
}

.legal-shell h3 {
  margin: 18px 0 8px;
  color: #dce7f5;
  font-size: 18px;
}

.legal-shell p,
.legal-shell li {
  color: #c8d4e4;
  line-height: 1.74;
}

.legal-shell p {
  margin: 0 0 12px;
}

.legal-shell p:last-child {
  margin-bottom: 0;
}

.legal-shell ul {
  margin: 0;
  padding-left: 20px;
}

.legal-shell li + li {
  margin-top: 8px;
}

.guide-callout {
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(95, 141, 247, 0.58);
  border-radius: 10px;
  background: rgba(30, 52, 86, 0.42);
  color: #edf4ff;
  font-size: 18px;
  font-weight: 760;
  line-height: 1.65;
}

.guide-section {
  margin-top: 16px !important;
}

.guide-list {
  margin: 0;
  padding-left: 26px;
}

.guide-list li {
  padding-left: 5px;
  font-size: 17px;
}

.guide-note {
  color: #9fc2ff !important;
  font-weight: 760;
}

[dir="rtl"] .legal-shell ul,
[dir="rtl"] .guide-list {
  padding-right: 26px;
  padding-left: 0;
}

.public-home-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(59, 130, 246, 0.22), transparent 32%),
    linear-gradient(180deg, #05070b 0%, var(--bg) 54%, #020304 100%);
}

.public-home-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.public-home-nav,
.public-home-nav nav,
.public-brand,
.public-footer,
.public-footer span {
  display: flex;
  align-items: center;
}

.public-home-nav {
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
  margin-bottom: 42px;
}

.public-home-nav nav,
.public-footer span {
  flex-wrap: wrap;
  gap: 10px 16px;
}

.public-brand {
  gap: 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
}

.public-brand:hover {
  text-decoration: none;
}

.public-home-nav a {
  color: #c6d1df;
  font-size: 14px;
  font-weight: 820;
}

.public-nav-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--btn);
}

.public-hero {
  max-width: 900px;
  padding: 26px 0 34px;
}

.public-hero h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.08;
  letter-spacing: 0;
}

.public-hero p {
  max-width: 760px;
  margin: 20px 0 0;
  color: #c9d5e4;
  font-size: 18px;
  line-height: 1.72;
}

.public-hero .public-note,
.public-section .public-note {
  max-width: 760px;
  color: #96a6ba;
  font-size: 14px;
  line-height: 1.62;
}

.public-section .public-note {
  margin-top: 10px;
}

.public-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.public-cta {
  min-width: 172px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.public-cta:hover {
  text-decoration: none;
}

.public-section,
.public-grid article {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(17, 22, 30, 0.92);
  box-shadow: 0 18px 44px -30px rgba(0, 0, 0, 0.95);
}

.public-section {
  margin-top: 16px;
  padding: 24px;
}

.public-section h2,
.public-grid h3 {
  margin: 0 0 12px;
  color: var(--ink);
  line-height: 1.25;
}

.public-section h2 {
  font-size: 24px;
}

.public-grid h3 {
  font-size: 19px;
}

.public-section p,
.public-section li,
.public-grid p {
  color: #c8d4e4;
  line-height: 1.72;
}

.public-section p {
  margin: 0 0 12px;
}

.public-section p:last-child,
.public-grid p {
  margin-bottom: 0;
}

.public-section ul {
  margin: 0;
  padding-left: 20px;
}

.public-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.public-grid article {
  padding: 22px;
}

.public-grid .step {
  margin-bottom: 16px;
}

.public-footer {
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.primary,
.secondary,
.ghost {
  min-height: 46px;
  border-radius: 8px;
  padding: 10px 15px;
  font-weight: 850;
}

.primary {
  border: 0;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: white;
  box-shadow: 0 14px 30px -18px rgba(59, 130, 246, 0.95);
}

.primary:hover {
  filter: brightness(1.06);
}

.secondary {
  border: 1px solid #34465e;
  background: #151f2d;
  color: var(--ink);
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: #c6d1df;
}

.app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 12px max(18px, calc((100vw - 1440px) / 2 + 18px));
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 12, 0.97);
  backdrop-filter: blur(12px);
}

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

.brand div {
  display: grid;
  gap: 2px;
}

.brand strong {
  font-size: 17px;
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.top-actions > span {
  color: var(--muted);
  font-size: 14px;
}

.notice {
  max-width: 1440px;
  margin: 14px auto 0;
  padding: 15px 18px;
  border: 1px solid #31536b;
  border-radius: 8px;
  background: #0b1822;
  color: #dcecff;
  font-size: 16px;
  font-weight: 820;
  line-height: 1.45;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(350px, 0.92fr) minmax(430px, 1.24fr) minmax(390px, 1fr);
  grid-template-areas:
    "setup language run"
    "channel language history";
  grid-template-rows: minmax(0, 1fr) 188px;
  gap: 12px;
  max-width: 1440px;
  height: calc(100vh - 164px);
  min-height: 620px;
  margin: 14px auto 28px;
  padding: 0 18px;
  overflow: hidden;
}

.section {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(18, 25, 34, 0.99), rgba(10, 15, 21, 0.99));
  padding: 18px;
  box-shadow: 0 18px 44px -30px rgba(0, 0, 0, 0.95);
}

.section:hover {
  border-color: #3a4a5c;
}

.setup-section,
.language-section,
.run-section,
.history-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.setup-section {
  grid-area: setup;
}

.channel-section {
  grid-area: channel;
  overflow: hidden;
}

.language-section {
  grid-area: language;
}

.run-section {
  grid-area: run;
}

.history-section {
  grid-area: history;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.setup-section .section-heading {
  align-items: stretch;
}

.section-heading > div {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.section-heading p,
.helper-note {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.step {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #112946;
  color: var(--blue-2);
  font-weight: 900;
}

.settings-actions {
  display: grid;
  justify-items: stretch;
  gap: 8px;
  flex: 0 0 172px;
}

.save-state {
  min-height: 34px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid #34465e;
  border-radius: 8px;
  background: #0c131c;
  color: var(--amber);
  font-size: 14px;
  font-weight: 850;
}

.save-state.dirty {
  border-color: #765b1d;
  background: #241c0b;
  color: var(--amber);
}

.save-state.saved {
  border-color: #255b38;
  background: #102319;
  color: var(--green);
}

.save-state.error {
  border-color: #63302d;
  background: #2b1414;
  color: #ff9b91;
}

.provider-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  border-radius: 8px;
  background: #080d13;
}

.provider-tabs button {
  width: 100%;
}

.settings-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.input-action {
  display: grid;
  grid-template-columns: 1fr 108px;
  gap: 8px;
}

.segmented {
  padding: 4px;
  border-radius: 8px;
  background: #080d13;
}

.segmented button {
  flex: 1 1 0;
}

.source-language-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.source-language-segmented button {
  min-width: 0;
  padding-inline: 8px;
  white-space: normal;
  line-height: 1.25;
}

.save-button,
.run-button {
  width: 100%;
  min-height: 56px;
  margin-top: 12px;
  font-size: 18px;
}

.settings-actions .save-button {
  min-height: 48px;
  margin-top: 0;
  font-size: 16px;
}

.save-button.attention {
  box-shadow:
    0 0 0 2px rgba(240, 198, 90, 0.28),
    0 16px 34px -18px rgba(95, 141, 247, 1);
}

.helper-note {
  display: none;
  margin-top: 8px;
}

.connect-button {
  flex: 0 0 auto;
  min-width: 112px;
}

.channel-list,
.job-list,
.result {
  display: grid;
  gap: 8px;
}

.channel-list {
  max-height: 150px;
  overflow: auto;
  padding-right: 3px;
}

.channel-item,
.job-item,
.result-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.channel-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
}

.channel-item img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #202a38;
}

.channel-item strong,
.job-item strong {
  display: block;
}

.channel-item small,
.job-item small {
  display: block;
  margin-top: 4px;
}

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

.channel-actions button {
  min-height: 36px;
  padding: 7px 10px;
}

.channel-item.active {
  border-color: #255b38;
  background: #102319;
}

.empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.language-toolbar {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) repeat(5, auto);
  gap: 7px;
  margin-bottom: 10px;
}

.language-toolbar button {
  min-width: 62px;
  white-space: nowrap;
}

.language-list {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 6px;
  overflow: auto;
  padding-right: 4px;
}

.language-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.language-option:hover {
  border-color: #3b82f6;
}

.language-option input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--blue);
}

.language-option span {
  min-width: 0;
  overflow: hidden;
  color: #dbe5f2;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}

#languageCount {
  color: var(--blue-2);
  font-size: 14px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d7e2f0;
  font-size: 13.5px;
  font-weight: 780;
}

.switch input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--blue);
}

.video-paste-button {
  width: 100%;
  margin-top: 10px;
}

.progress-area {
  margin-top: 14px;
}

.progress-area > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.progress-area strong,
.progress-area span {
  font-size: 14px;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #202a38;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4d9f9c, var(--blue));
  transition: width 0.25s;
}

.result {
  flex: 1 1 auto;
  min-height: 112px;
  max-height: none;
  margin-top: 12px;
  overflow: auto;
}

.result-item .error {
  color: #ff9b91;
}

.result-item .success {
  color: var(--green);
}

.history-section .job-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.status-completed {
  color: var(--green);
}

.status-failed {
  color: #ff9b91;
}

.status-partial_failed {
  color: #fbbf24;
}

.status-running,
.status-queued {
  color: var(--amber);
}

.admin-workspace {
  max-width: 1440px;
  margin: 20px auto 40px;
  padding: 0 18px;
}

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

.admin-header h1 {
  margin: 0 0 5px;
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 16px;
}

.metric strong {
  display: block;
  margin-bottom: 4px;
  font-size: 28px;
}

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

.admin-workspace .section {
  margin-bottom: 12px;
}

.admin-operations-section {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
}

.admin-billing-section {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
}

.admin-operation-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 22, 0.46);
  padding: 16px;
}

.admin-operation-panel .section-heading {
  margin-bottom: 14px;
}

.admin-operation-panel .section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.admin-notice-form,
.maintenance-form,
.admin-billing-plan-form,
.admin-billing-grant-form {
  display: grid;
  gap: 12px;
}

.admin-notice-form > button,
.maintenance-form > button,
.admin-billing-plan-form > button,
.admin-billing-grant-form > button {
  justify-self: start;
  min-width: 150px;
}

.admin-billing-plan-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.admin-billing-plan-form .billing-description {
  grid-column: 1 / -1;
}

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

.billing-readiness span,
.billing-plan-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #081018;
}

.billing-readiness span {
  padding: 7px 10px;
  color: #b7f1bd;
  font-size: 12px;
  font-weight: 800;
}

.billing-readiness span.is-muted {
  color: var(--muted);
}

.billing-plan-list {
  display: grid;
  gap: 8px;
  max-height: 180px;
  margin-top: 14px;
  overflow: auto;
}

.billing-plan-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  padding: 10px 12px;
}

.billing-plan-item strong,
.billing-plan-item small {
  min-width: 0;
}

.billing-plan-item small {
  color: var(--muted);
}

.billing-plan-item .billing-plan-meta {
  grid-column: 1 / -1;
  color: #b6c7da;
  font-size: 12px;
}

.billing-order-panel {
  grid-column: 1 / -1;
}

.billing-order-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 430px;
  overflow: auto;
}

.billing-order-summary {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 24, 36, 0.9);
  padding: 11px 14px;
}

.billing-order-summary.has-review {
  border-color: rgba(240, 198, 90, 0.72);
  background: rgba(240, 198, 90, 0.1);
}

.billing-order-summary > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.billing-order-summary span,
.admin-billing-status {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.billing-order-summary span {
  background: #f0c65a;
  color: #14100a;
}

.billing-order-summary button {
  min-height: 36px;
  padding: 7px 11px;
}

.billing-readiness .is-warning {
  flex-basis: 100%;
  border: 1px solid rgba(240, 198, 90, 0.45);
  border-radius: 8px;
  background: rgba(240, 198, 90, 0.09);
  color: #f3d77f;
  line-height: 1.45;
  padding: 8px 10px;
}

.admin-billing-order {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #081018;
  padding: 14px;
}

.admin-billing-order.status-review_requested {
  border-width: 2px;
  border-color: rgba(240, 198, 90, 0.82);
  background: linear-gradient(180deg, rgba(240, 198, 90, 0.1), #081018 46%);
  box-shadow: 0 10px 26px rgba(240, 198, 90, 0.08);
}

.admin-billing-order.status-review_requested .admin-billing-status {
  background: rgba(240, 198, 90, 0.18);
  color: #f8d978;
}

.admin-billing-order.status-pending_payment .admin-billing-status {
  background: rgba(122, 162, 206, 0.14);
  color: #a9c7e8;
}

.admin-billing-order-heading,
.admin-billing-order-heading > div {
  display: flex;
  gap: 6px 12px;
}

.admin-billing-order-heading {
  align-items: flex-start;
  justify-content: space-between;
}

.admin-billing-order-heading > div {
  min-width: 0;
  flex-direction: column;
}

.admin-billing-order-heading small,
.admin-billing-order-heading > span {
  color: var(--muted);
}

.admin-billing-order dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.admin-billing-order dl > div {
  min-width: 0;
}

.admin-billing-order dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.admin-billing-order dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.admin-billing-order-hint {
  margin: 0;
  border-left: 3px solid #6f9bc8;
  color: #a9c7e8;
  line-height: 1.5;
  padding-left: 10px;
}

.admin-billing-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-billing-order-actions:empty {
  display: none;
}

.admin-billing-delete {
  margin-left: auto;
}

button.danger {
  color: #ffaaa2;
}

.maintenance-toggle {
  justify-self: start;
  min-height: 42px;
}

.admin-notice-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  margin-top: 16px;
  overflow: auto;
}

.admin-notice-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #081018;
  padding: 12px;
}

.admin-notice-item > div {
  display: grid;
  gap: 3px;
}

.admin-notice-item small {
  color: var(--muted);
}

.admin-notice-item p {
  grid-column: 1 / -1;
  margin: 0;
  color: #d7e2f0;
  line-height: 1.55;
}

.admin-notice-item button {
  grid-column: 2;
  grid-row: 1;
}

.admin-chart-section .section-heading {
  align-items: flex-end;
}

.admin-chart-section .section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.admin-chart-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 22, 0.46);
  padding: 14px;
}

.admin-chart-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.admin-chart-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
}

.admin-chart-scale {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.admin-chart-svg-wrap {
  min-width: 0;
  overflow: hidden;
}

.admin-chart-svg {
  display: block;
  width: 100%;
  height: 190px;
}

.admin-chart-svg-track {
  fill: rgba(12, 19, 31, 0.92);
  stroke: rgba(120, 144, 168, 0.3);
  stroke-width: 1.2;
}

.admin-chart-svg-bar {
  filter: drop-shadow(0 -5px 10px rgba(99, 123, 242, 0.35));
}

.admin-chart-svg-marker {
  stroke: rgba(255, 255, 255, 0.72);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.admin-chart-svg-value {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.admin-chart-svg-weekday {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.admin-chart-svg-date {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

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

.user-billing-state {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(122, 162, 206, 0.1);
  color: #bdd3ea;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.user-billing-state.status-active {
  border-color: rgba(107, 208, 129, 0.36);
  background: rgba(107, 208, 129, 0.1);
  color: #9de3ad;
}

.user-billing-state.status-expired,
.user-billing-state.status-paused {
  border-color: rgba(255, 126, 115, 0.34);
  background: rgba(255, 126, 115, 0.08);
  color: #ffaaa2;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: min(560px, calc(100vw - 40px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  color: #0f172a;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s;
  font-size: 15px;
  font-weight: 820;
  line-height: 1.45;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.46);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #dc3d33;
  color: white;
}

body.modal-open {
  overflow: hidden;
}

.open-chat-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 12, 0.74);
  backdrop-filter: blur(10px);
}

.open-chat-card {
  position: relative;
  width: min(520px, 100%);
  border: 1px solid #36506b;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(27, 39, 54, 0.98), rgba(10, 15, 22, 0.98)),
    var(--surface);
  padding: 28px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
}

.open-chat-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 16, 24, 0.82);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.open-chat-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(79, 208, 138, 0.34);
  border-radius: 999px;
  background: rgba(79, 208, 138, 0.12);
  color: #91f0b5;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 900;
}

.open-chat-card h2 {
  margin: 18px 0 10px;
  font-size: 28px;
  line-height: 1.22;
}

.open-chat-card p {
  margin: 0;
  color: #d7e2f0;
  line-height: 1.7;
}

.open-chat-url {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #081018;
  color: #b9c8dc;
  padding: 12px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.open-chat-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.open-chat-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.open-chat-link:hover {
  color: white;
  text-decoration: none;
}

.referral-event-card {
  width: min(680px, 100%);
  border-color: rgba(116, 150, 255, 0.55);
  background:
    linear-gradient(145deg, rgba(22, 38, 54, 0.99), rgba(10, 15, 23, 0.99)),
    var(--surface);
}

.referral-event-card .open-chat-badge {
  border-color: rgba(132, 163, 255, 0.46);
  background: rgba(90, 126, 235, 0.16);
  color: #b9cbff;
}

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

.referral-event-benefits article {
  display: grid;
  gap: 8px;
  min-height: 148px;
  border: 1px solid #2c4259;
  border-radius: 8px;
  background: rgba(7, 14, 22, 0.74);
  padding: 17px;
}

.referral-event-benefits article:last-child {
  border-color: rgba(87, 209, 153, 0.42);
}

.referral-event-benefits strong {
  color: #8fb0ff;
  font-size: 24px;
  line-height: 1;
}

.referral-event-benefits article:last-child strong {
  color: #70dda9;
}

.referral-event-benefits span {
  color: #edf4ff;
  font-weight: 800;
  line-height: 1.45;
}

.referral-event-benefits small,
.referral-event-note {
  color: var(--muted);
  line-height: 1.5;
}

.referral-event-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 12px;
  border: 1px solid #344d68;
  border-radius: 8px;
  background: #081018;
  padding: 13px 15px;
}

.referral-event-code span {
  color: #b8c8db;
  font-weight: 800;
}

.referral-event-code code {
  color: #dce7ff;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0;
}

.referral-event-note {
  display: block;
  margin-bottom: 18px;
}

.referral-event-actions {
  grid-template-columns: 1fr 1fr auto;
}

.billing-card {
  width: min(940px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
}

.billing-modal-content,
.billing-customer-plans,
.billing-history-list,
.billing-claim-form {
  display: grid;
  gap: 10px;
}

.billing-modal-content > h3 {
  margin: 12px 0 0;
  font-size: 17px;
}

.billing-current-access,
.billing-payment-step,
.billing-customer-plan,
.billing-history-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 16, 24, 0.82);
  padding: 14px;
}

.billing-trial-note,
.billing-referral-panel {
  margin: 10px 0 0;
}

.billing-trial-note {
  color: var(--accent-strong, #2f8f83);
  font-weight: 700;
}

.billing-referral-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: var(--panel-2, var(--panel));
}

.billing-referral-panel p,
.billing-referral-panel small {
  margin: 0;
  color: var(--muted);
}

.billing-referral-code-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.billing-referral-code-row code {
  padding: 8px 10px;
  border: 1px dashed var(--line-strong, var(--line));
  border-radius: 7px;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.billing-referral-reward {
  color: var(--success, #3e9c57);
}

.billing-current-access {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
}

.billing-current-access > span,
.billing-current-access small,
.billing-customer-plan small,
.billing-history-item small {
  color: var(--muted);
}

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

.billing-customer-plan {
  position: relative;
  display: grid;
  gap: 10px;
  align-content: start;
}

.billing-customer-plan > button {
  width: 100%;
  margin-top: auto;
}

.billing-customer-plan.is-recommended {
  border-color: rgba(99, 145, 255, 0.78);
  background: linear-gradient(180deg, rgba(80, 125, 238, 0.14), rgba(8, 16, 24, 0.9));
}

.billing-recommended-badge {
  justify-self: start;
  border-radius: 999px;
  background: #6d8ff6;
  padding: 4px 8px;
  color: #07101c;
  font-size: 11px;
  font-weight: 900;
}

.billing-customer-plan > div,
.billing-history-item > div,
.billing-order-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.billing-customer-plan p,
.billing-payment-step p,
.billing-history-item p {
  margin: 0;
  font-size: 14px;
}

.billing-plan-savings {
  color: #8de3b0;
  font-size: 13px;
}

.billing-payment-step {
  display: grid;
  gap: 12px;
  border-color: rgba(82, 143, 243, 0.68);
}

.billing-payment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.billing-payment-heading > div {
  display: grid;
  gap: 4px;
}

.billing-payment-heading span,
.billing-claim-form small {
  color: var(--muted);
  font-size: 12px;
}

.billing-payment-heading > strong {
  color: #a9d9ff;
  font-size: 20px;
}

.billing-order-code-row strong {
  color: #9fd7ff;
  font-size: 19px;
  letter-spacing: 0;
}

.billing-checkout-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  text-decoration: none;
}

.billing-claim-form {
  grid-template-columns: 1fr;
  text-align: center;
}

.billing-claim-form .primary {
  width: 100%;
  min-height: 50px;
  font-size: 16px;
}

.billing-history-list {
  max-height: 190px;
  overflow: auto;
}

.billing-history-item {
  display: grid;
  gap: 7px;
}

.billing-history-item.status-paid {
  border-color: rgba(79, 208, 138, 0.4);
}

.billing-history-item.status-rejected {
  border-color: rgba(255, 107, 95, 0.45);
}

.job-result-card {
  width: min(620px, 100%);
}

.job-result-modal.success .open-chat-badge {
  border-color: rgba(79, 208, 138, 0.4);
  background: rgba(79, 208, 138, 0.14);
  color: #91f0b5;
}

.job-result-modal.partial .open-chat-badge {
  border-color: rgba(240, 198, 90, 0.42);
  background: rgba(240, 198, 90, 0.14);
  color: #fde68a;
}

.job-result-modal.failed .open-chat-badge {
  border-color: rgba(255, 107, 95, 0.45);
  background: rgba(255, 107, 95, 0.14);
  color: #ffb4ae;
}

.job-result-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.job-result-stats div {
  display: grid;
  gap: 4px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #081018;
  padding: 12px;
}

.job-result-stats strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.job-result-stats span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 820;
}

.job-result-reasons {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 16, 24, 0.72);
  color: #d7e2f0;
  padding: 14px;
  line-height: 1.6;
}

.job-result-reasons strong {
  display: block;
  margin-bottom: 8px;
  color: #ffd0cb;
  font-size: 15px;
}

.job-result-reasons ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.job-result-reasons p {
  margin: 0;
}

.job-result-actions {
  margin-top: 16px;
}

.notice-board-card {
  width: min(700px, 100%);
}

.notice-board-intro {
  margin-bottom: 16px !important;
}

.notice-board-list {
  display: grid;
  gap: 10px;
  max-height: min(56vh, 520px);
  overflow: auto;
  padding-right: 4px;
}

.notice-board-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #081018;
  padding: 15px;
}

.notice-board-item > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.notice-board-item strong {
  color: var(--ink);
  font-size: 17px;
}

.notice-board-item time,
.maintenance-card small {
  color: var(--muted);
  font-size: 12px;
}

.notice-board-item p {
  margin-top: 10px;
  color: #d7e2f0;
  white-space: normal;
}

.notice-board-actions {
  grid-template-columns: 1fr;
  margin-top: 18px;
}

.maintenance-card {
  border-color: rgba(240, 198, 90, 0.54);
}

.maintenance-card .open-chat-badge {
  border-color: rgba(240, 198, 90, 0.5);
  background: rgba(240, 198, 90, 0.14);
  color: #fde68a;
}

.maintenance-card > small {
  display: block;
  margin-top: 14px;
}

.language-list,
.channel-list,
.job-list,
.result,
.table-wrap {
  scrollbar-color: rgba(106, 122, 144, 0.95) rgba(13, 18, 25, 0.8);
}

@media (max-width: 1180px) {
  .admin-operations-section,
  .admin-billing-section {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
    grid-template-areas:
      "setup run"
      "channel run"
      "language language"
      "history history";
    grid-template-rows: auto auto minmax(360px, 1fr) auto;
    height: auto;
    overflow: visible;
  }

  .language-list {
    max-height: 430px;
  }

  .settings-actions {
    flex-basis: 190px;
  }
}

@media (max-width: 620px) {
  .admin-billing-plan-form {
    grid-template-columns: 1fr;
  }

  .admin-billing-plan-form .billing-description {
    grid-column: auto;
  }

  .billing-order-list,
  .billing-customer-plans,
  .billing-claim-form,
  .admin-billing-order dl {
    grid-template-columns: 1fr;
  }

  .billing-current-access {
    grid-template-columns: 1fr;
  }

  .billing-card {
    padding: 22px 16px;
  }
}

@media (min-width: 621px) and (max-width: 820px) {
  .billing-customer-plans {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1181px) and (max-width: 1320px) {
  .workspace {
    grid-template-columns: minmax(338px, 0.88fr) minmax(506px, 1.32fr) minmax(374px, 0.98fr);
  }

  .section {
    padding: 17px;
  }

  .setup-section .section-heading p,
  .setup-section #apiKeyStatus,
  .setup-section #modelHelp {
    display: none;
  }

  .settings-grid {
    gap: 10px;
    margin-top: 10px;
  }

  .provider-tabs button,
  .segmented button {
    min-height: 38px;
  }

  input,
  select,
  textarea {
    min-height: 42px;
  }

  .input-action {
    grid-template-columns: 1fr 108px;
  }

  .save-button {
    min-height: 48px;
  }

  .language-toolbar {
    grid-template-columns: repeat(5, 1fr);
  }

  .language-toolbar input {
    grid-column: 1 / -1;
  }

  .language-toolbar button {
    min-width: 0;
    padding-left: 7px;
    padding-right: 7px;
    font-size: 14px;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
  }

  .auth-view {
    padding: 14px;
  }

  .auth-shell {
    padding: 28px 22px;
  }

  .topbar {
    position: static;
    padding: 10px 12px;
  }

  .top-actions > span {
    display: none;
  }

  .notice {
    margin: 10px 10px 0;
  }

  .workspace {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: "setup" "channel" "language" "run" "history";
    min-height: 0;
    height: auto;
    overflow: visible;
    padding: 0 10px;
  }

  .section {
    padding: 16px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .setup-section .section-heading {
    display: grid;
  }

  .settings-actions {
    grid-template-columns: 1fr;
    width: 100%;
    flex-basis: auto;
  }

  .language-toolbar {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .language-toolbar input {
    grid-column: 1 / -1;
  }

  .language-list {
    grid-template-columns: 1fr;
    max-height: 340px;
  }

  .input-action {
    grid-template-columns: 1fr;
  }

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

  .admin-charts {
    grid-template-columns: 1fr;
  }
}

/* Reference UI pass: based on the provided standalone HTML mockup. */
:root {
  --bg: #04060a;
  --window: #0b0f15;
  --surface: #11161e;
  --surface-2: #0d1219;
  --panel: #11161e;
  --panel-2: #0d1219;
  --line: #222c39;
  --line-soft: #1a2230;
  --ink: #e7edf4;
  --muted: #7f8b9b;
  --blue: #3b82f6;
  --blue-2: #60a5fa;
  --green: #3fb950;
  --red: #ff6b5f;
  --amber: #e3b341;
  --teal: #4da5a1;
  --input: #0d131b;
  --btn: #1a2230;
  --btn-hover: #222c39;
  --seg-bg: #0d1219;
  --success-bg: #0e2417;
  --success-border: #1d4429;
  --titlebar: #0d1219;
  --shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.55);
}

html,
body {
  background: var(--bg);
}

body {
  min-height: 100vh;
  overflow: auto;
  background:
    radial-gradient(circle at 18% 0%, rgba(37, 99, 235, 0.18), transparent 34%),
    linear-gradient(180deg, #05070b 0%, var(--bg) 42%, #020304 100%);
  color: var(--ink);
  font-family: Pretendard, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 9px;
  background: #2a3543;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #7f8b9b;
  background-clip: content-box;
}

input,
select,
textarea {
  min-height: 44px;
  border-color: var(--line);
  border-radius: 10px;
  background: var(--input);
  color: var(--ink);
  padding: 11px 13px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

label > span,
.field-title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

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

.primary,
.secondary,
.ghost {
  min-height: 44px;
  border-radius: 10px;
  font-weight: 800;
}

.primary {
  background: linear-gradient(135deg, #5db4bd 0%, #4c78ea 100%);
  box-shadow: 0 18px 36px -22px rgba(76, 120, 234, 0.9);
}

.secondary {
  border-color: var(--line);
  background: var(--btn);
  color: var(--ink);
}

.secondary:hover,
.ghost:hover {
  background: var(--btn-hover);
}

.ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.auth-view {
  min-height: 100vh;
  padding: 26px;
  background: var(--bg);
}

.auth-shell {
  width: min(520px, 100%);
  border-color: var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 42px;
  box-shadow: var(--shadow);
}

.app {
  width: min(1680px, calc(100vw - 8px));
  height: calc(100vh - 8px);
  min-height: min(740px, calc(100vh - 8px));
  margin: 4px auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--window);
  box-shadow: var(--shadow);
}

.window-titlebar {
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--titlebar);
}

.window-titlebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}

.brand-mark.titlebar-mark {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  font-size: 7px;
  line-height: 1;
}

.topbar {
  position: static;
  flex: 0 0 auto;
  min-height: 60px;
  padding: 10px 16px 9px;
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
}

.brand .brand-mark {
  color: #fff;
}

.brand strong {
  color: var(--ink);
  font-size: 21px;
  font-weight: 850;
  letter-spacing: 0;
}

.brand span {
  color: var(--muted);
  font-size: 12.5px;
}

.status-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-left: auto;
  margin-right: 14px;
}

.status-pills span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--success-border);
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pills i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.top-actions > span {
  color: var(--muted);
  font-size: 13px;
}

.notice {
  max-width: none;
  margin: 0 12px 8px;
  padding: 9px 12px;
  border-color: #2b4264;
  border-radius: 12px;
  background: #0d1726;
  color: #dbeafe;
  font-size: 14px;
  font-weight: 750;
}

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(440px, 0.82fr) minmax(430px, 1.05fr);
  grid-template-areas:
    "setup language run"
    "channel language history";
  grid-template-rows: minmax(330px, 1fr) minmax(220px, 0.72fr);
  gap: 12px;
  width: 100%;
  max-width: none;
  height: auto;
  margin: 0;
  padding: 2px 12px 10px;
  overflow: auto;
  scrollbar-color: #526175 var(--window);
  scrollbar-gutter: stable;
}

.section {
  min-width: 0;
  min-height: 0;
  border-color: var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 18px;
  box-shadow: none;
  scrollbar-color: #526175 var(--panel);
  scrollbar-gutter: stable;
}

.section:hover {
  border-color: #2e3b4c;
}

.section-heading {
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  color: var(--ink);
  font-size: 17px;
  font-weight: 850;
  letter-spacing: 0;
}

.section-heading p,
.helper-note {
  color: var(--muted);
  font-size: 12px;
}

.step {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--btn);
  color: var(--blue-2);
  font-size: 14px;
}

.settings-actions {
  flex: 0 0 166px;
  gap: 7px;
}

.save-state {
  min-height: 31px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12px;
  text-align: center;
}

.save-state.saving {
  border-color: #3e5f92;
  background: #14233a;
  color: #bfdbfe;
}

.settings-actions .save-button {
  min-height: 42px;
  border-radius: 10px;
  padding-left: 8px;
  padding-right: 8px;
  font-size: 13px;
  white-space: nowrap;
  word-break: keep-all;
}

.provider-tabs,
.segmented {
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  background: var(--seg-bg);
}

.provider-tabs button,
.segmented button {
  min-height: 38px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
}

.provider-tabs button.active,
.segmented button.active,
.auth-tabs button.active {
  border-color: var(--line);
  background: linear-gradient(135deg, #1d3152, #1b293e);
  color: #fff;
}

.settings-grid {
  gap: 10px;
  margin-top: 10px;
}

.setup-section,
.run-section,
.channel-section,
.history-section {
  overflow-y: auto;
  padding-right: 12px;
}

.input-action {
  grid-template-columns: minmax(0, 1fr) 104px;
}

.connect-button {
  min-width: 102px;
}

.channel-list {
  min-height: 0;
  max-height: none;
  overflow: auto;
  scrollbar-color: #526175 var(--panel-2);
  scrollbar-gutter: stable;
}

.channel-section .empty,
.history-section .empty {
  font-size: 13px;
  line-height: 1.35;
}

.channel-section,
.history-section {
  min-height: 220px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.channel-section .section-heading,
.history-section .section-heading {
  margin-bottom: 8px;
}

.channel-section .section-heading p,
.history-section .section-heading p {
  display: none;
}

.oauth-help {
  flex: 0 0 auto;
  margin-top: 10px;
  color: #aebacd;
  font-size: 12px;
  line-height: 1.45;
}

.channel-item,
.job-item,
.result-item,
.language-option,
.metric {
  border-color: var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}

.channel-item.active {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.channel-actions button {
  min-height: 34px;
  border-radius: 9px;
  font-size: 12px;
}

.language-toolbar {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.language-toolbar input {
  grid-column: 1 / -1;
  min-height: 40px;
}

.language-toolbar button {
  min-width: 0;
  min-height: 40px;
  padding: 8px 7px;
  font-size: 12.5px;
}

.language-list {
  gap: 6px;
  padding-right: 5px;
  scrollbar-color: #718096 var(--panel-2);
  scrollbar-gutter: stable;
}

.language-option {
  min-height: 40px;
  padding: 8px 10px;
}

.language-option span {
  color: #dbe5f2;
  font-size: 13px;
}

.switch {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}

.switch input {
  width: 19px;
  height: 19px;
  min-height: 19px;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.video-paste-button {
  min-height: 43px;
  margin-top: 9px;
}

.run-button {
  min-height: 56px;
  margin-top: 10px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 900;
}

.progress-area {
  margin-top: 12px;
}

.progress-track {
  height: 8px;
  background: var(--seg-bg);
}

.result {
  flex: 1 1 auto;
  min-height: 96px;
  max-height: none;
  margin-top: 8px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 12px;
  scrollbar-color: #718096 var(--panel-2);
  scrollbar-gutter: stable;
}

.result-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--ink);
}

.result-heading strong {
  font-size: 14px;
  font-weight: 850;
}

.result-heading span {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
  text-align: right;
}

.result .empty {
  font-size: 13px;
  line-height: 1.45;
}

.history-section .job-list {
  min-height: 0;
  padding-right: 4px;
  scrollbar-color: #526175 var(--panel-2);
  scrollbar-gutter: stable;
}

.admin-workspace {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 2px 12px 10px;
  overflow: auto;
}

.admin-header {
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
}

.toast {
  border-radius: 12px;
}

@media (max-width: 1320px) {
  .app {
    width: calc(100vw - 8px);
    height: calc(100vh - 8px);
    margin: 4px auto;
  }

  .workspace {
    grid-template-columns: minmax(280px, 1fr) minmax(360px, 0.82fr) minmax(320px, 1fr);
    grid-template-rows: minmax(320px, 1fr) minmax(210px, 0.72fr);
    gap: 12px;
    padding: 0 10px 10px;
  }

  .notice {
    margin-left: 10px;
    margin-right: 10px;
  }

  .status-pills {
    display: none;
  }
}

@media (max-width: 980px) {
  .public-home-nav,
  .public-footer {
    display: grid;
    justify-items: start;
  }

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

  .app {
    width: calc(100vw - 18px);
    height: auto;
    min-height: calc(100vh - 18px);
    overflow: visible;
  }

  .window-titlebar {
    display: none;
  }

  .topbar {
    padding: 14px 16px;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "setup"
      "channel"
      "language"
      "run"
      "history";
    grid-template-rows: auto;
    overflow: visible;
  }

  .setup-section,
  .language-section,
  .run-section,
  .history-section {
    overflow: visible;
  }

  .language-list {
    max-height: 360px;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 16px;
  }

  .public-home-shell {
    width: min(100% - 24px, 1120px);
    padding-top: 16px;
  }

  .public-home-nav {
    margin-bottom: 28px;
  }

  .public-home-nav nav {
    width: 100%;
  }

  .public-nav-button,
  .public-cta {
    width: 100%;
    justify-content: center;
  }

  .public-hero {
    padding-top: 12px;
  }

  .public-hero h1 {
    font-size: 30px;
    line-height: 1.14;
  }

  .public-hero p {
    font-size: 15px;
  }

  .public-hero .public-note,
  .public-section .public-note {
    font-size: 13px;
  }

  .public-section,
  .public-grid article {
    padding: 18px;
  }

  .auth-view {
    min-height: 100svh;
    align-items: flex-start;
    padding: 14px;
  }

  .auth-shell {
    width: 100%;
    padding: 28px 22px;
  }

  .app {
    width: 100%;
    min-height: 100svh;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .topbar {
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
  }

  .brand {
    min-width: 0;
  }

  .brand strong {
    font-size: 18px;
  }

  .brand span {
    font-size: 12px;
  }

  .top-actions {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

  .notice {
    margin: 0 12px 10px;
    font-size: 13px;
    line-height: 1.45;
  }

  .workspace {
    gap: 12px;
    padding: 0 12px 18px;
  }

  .section {
    padding: 14px;
    border-radius: 12px;
  }

  .section-heading {
    display: grid;
    gap: 12px;
  }

  .section-heading h2 {
    font-size: 18px;
  }

  .section-heading > div {
    width: 100%;
  }

  .settings-actions {
    flex-basis: auto;
    width: 100%;
  }

  .input-action {
    grid-template-columns: 1fr;
  }

  .provider-tabs {
    grid-template-columns: 1fr;
  }

  .provider-tabs button,
  .segmented button,
  .language-toolbar button,
  .video-paste-button,
  .connect-button,
  .save-button {
    min-height: 48px;
  }

  .language-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .language-toolbar input {
    grid-column: 1 / -1;
  }

  .language-list {
    grid-template-columns: 1fr;
    max-height: 420px;
  }

  .switch {
    justify-content: flex-start;
  }

  textarea {
    min-height: 104px;
  }

  .run-button {
    min-height: 64px;
    font-size: 17px;
    line-height: 1.3;
  }

  .result-heading {
    display: grid;
    gap: 4px;
  }

  .result-heading span {
    text-align: left;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }

  .open-chat-card {
    padding: 24px 18px;
  }

  .open-chat-card h2 {
    font-size: 24px;
  }

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

  .referral-event-benefits {
    grid-template-columns: 1fr;
  }

  .referral-event-code {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .job-result-stats {
    grid-template-columns: 1fr 1fr;
  }

  .job-result-reasons {
    max-height: 180px;
  }

  .language-picker select {
    min-width: 104px;
    min-height: 46px;
    font-size: 14px;
  }

  .app-language-picker {
    margin-left: 0;
  }

  .public-language-picker {
    margin-left: 0;
  }

  .legal-toolbar {
    align-items: flex-start;
    flex-direction: column-reverse;
  }

  .legal-toolbar .public-language-picker {
    margin-left: 0;
    align-self: flex-end;
  }
}
