:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-soft: #eef3fa;
  --bg-elevated: rgba(255, 255, 255, 0.85);
  --bg-panel: rgba(255, 255, 255, 0.96);
  --line: rgba(120, 146, 191, 0.22);
  --line-strong: rgba(84, 120, 186, 0.34);
  --text: #122033;
  --text-soft: #506179;
  --text-faint: #7f8ba1;
  --primary: #2588ff;
  --primary-strong: #0f6ee9;
  --accent: #10b7aa;
  --success: #27ae60;
  --warning: #d98c18;
  --danger: #df5b74;
  --shadow: 0 20px 56px rgba(31, 55, 94, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --content-width: min(1380px, calc(100vw - 28px));
  --font: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(72, 139, 255, 0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(16, 183, 170, 0.1), transparent 24%),
    linear-gradient(180deg, #f7f9fd 0%, #edf2f8 100%);
  color: var(--text);
  font-family: var(--font);
}

body {
  min-height: 100vh;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

button {
  cursor: pointer;
}

textarea {
  resize: vertical;
}

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

::-webkit-scrollbar-track {
  background: rgba(92, 118, 160, 0.08);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(37, 136, 255, 0.62), rgba(16, 183, 170, 0.5));
  border-radius: 999px;
}

.app-shell {
  width: var(--content-width);
  margin: 0 auto;
  padding: 18px 0 40px;
}

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

.auth-card {
  width: min(560px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.96)),
    rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.auth-card p {
  margin: 12px 0 0;
  color: var(--text-soft);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-note {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text-soft);
}

.session-chip {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  font-weight: 600;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 20px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.95)),
    rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero__glow {
  position: absolute;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.32;
  pointer-events: none;
}

.hero__glow--left {
  top: -180px;
  left: -80px;
  background: rgba(37, 136, 255, 0.16);
}

.hero__glow--right {
  right: -120px;
  bottom: -220px;
  background: rgba(16, 183, 170, 0.12);
}

.hero__copy,
.hero__panel,
.surface,
.tabbar {
  position: relative;
  z-index: 1;
}

.eyebrow,
.panel-label {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary-strong);
}

.hero h1,
.section-head h2,
.surface h3 {
  margin: 0;
  line-height: 1.03;
}

.hero h1 {
  max-width: 14ch;
  font-size: clamp(2.45rem, 5vw, 4.2rem);
  letter-spacing: -0.04em;
}

.hero p {
  max-width: 60ch;
  margin: 12px 0 0;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.65;
}

.hero__actions,
.form-actions,
.section-actions,
.surface__head,
.section-head,
.hero__meta,
.surface__meta,
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero__actions {
  margin-top: 22px;
}

.hero__panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: stretch;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.97), rgba(241, 246, 253, 0.95));
}

.access-list,
.stack-list,
.log-list,
.toggle-grid,
.info-stack {
  display: grid;
  gap: 12px;
}

.access-item,
.summary-card,
.list-card,
.toggle-card,
.info-card,
.log-item {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(248, 251, 255, 0.98));
}

.access-item {
  padding: 14px 16px;
}

.access-item code {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: var(--text);
}

.hero__meta {
  margin-top: auto;
  color: var(--text-soft);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(39, 174, 96, 0.12);
}

.button {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.84rem 1.18rem;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(65, 95, 145, 0.06);
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.96);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(65, 95, 145, 0.1);
}

.button--primary {
  background: linear-gradient(135deg, var(--primary), #57b9ff);
  border-color: transparent;
  color: #ffffff;
  font-weight: 700;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.9);
}

.button--danger {
  background: rgba(223, 91, 116, 0.08);
  border-color: rgba(223, 91, 116, 0.22);
  color: #b23f59;
}

.button--small {
  padding: 0.62rem 0.92rem;
  font-size: 0.88rem;
}

.tabbar {
  position: sticky;
  top: 16px;
  z-index: 4;
  display: flex;
  gap: 8px;
  margin: 14px 0 22px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  box-shadow: 0 14px 32px rgba(37, 57, 90, 0.08);
}

.tab {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 0.72rem 1rem;
  background: transparent;
  color: var(--text-soft);
  font-weight: 600;
}

.tab.is-active {
  background: linear-gradient(135deg, rgba(37, 136, 255, 0.14), rgba(87, 185, 255, 0.18));
  color: var(--primary-strong);
  box-shadow: inset 0 0 0 1px rgba(37, 136, 255, 0.22);
}

.workspace {
  display: grid;
}

.view {
  display: none;
  gap: 22px;
}

.view.is-active {
  display: grid;
}

.section-head {
  justify-content: space-between;
}

.inline-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-soft);
  font-size: 0.88rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.summary-card {
  padding: 18px 18px 17px;
}

.summary-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(1.7rem, 3.4vw, 2.35rem);
  letter-spacing: -0.03em;
}

.summary-card span {
  display: block;
  color: var(--text-soft);
}

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

.editor-grid--wide {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}

.surface {
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.98)),
    var(--bg-panel);
  box-shadow: var(--shadow);
}

.surface__head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.surface__meta {
  justify-content: flex-end;
}

.toolbar {
  margin: 0 0 16px;
}

.live-console {
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(248, 251, 255, 0.72);
}

.surface h3 {
  margin-top: 2px;
  font-size: 1.38rem;
  letter-spacing: -0.03em;
}

.section-head h2 {
  font-size: clamp(1.75rem, 3vw, 2.45rem);
  letter-spacing: -0.035em;
}

.search-input,
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  padding: 0.9rem 1rem;
  outline: none;
}

.search-input {
  min-width: min(320px, 100%);
  min-height: 48px;
}

.field input:focus,
.field textarea:focus,
.search-input:focus {
  border-color: rgba(83, 164, 255, 0.46);
  box-shadow: 0 0 0 4px rgba(83, 164, 255, 0.12);
}

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

.mini-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 2px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span,
.switch-field > span {
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 600;
}

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

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

.switch-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(248, 251, 255, 0.9);
}

.switch-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.chip {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  padding: 0.64rem 0.88rem;
  min-width: 0;
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #142236;
  box-shadow: inset 0 0 0 1px rgba(110, 140, 188, 0.06);
}

.chip input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.chip__label,
.chip span {
  color: #142236 !important;
  -webkit-text-fill-color: #142236 !important;
  display: block;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 600;
  opacity: 1;
  text-shadow: none;
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip:has(input:checked) {
  background: linear-gradient(135deg, rgba(37, 136, 255, 0.14), rgba(16, 183, 170, 0.12));
  border-color: rgba(37, 136, 255, 0.32);
}

.stack-list {
  max-height: 760px;
  overflow: auto;
  padding-right: 10px;
  scrollbar-gutter: stable both-edges;
}

.list-card {
  padding: 15px;
  overflow: hidden;
}

.list-card__select {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.list-card__checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-indicator[data-state="RUNNING"],
.status-indicator[data-state="SENDING"] {
  background: rgba(39, 174, 96, 0.12);
  color: #1f8a4c;
}

.status-indicator[data-state="RATE_LIMIT"],
.status-indicator[data-state="OFF_HOUR"] {
  background: rgba(217, 140, 24, 0.12);
  color: #9b6206;
}

.status-indicator[data-state="INVALID"],
.status-indicator[data-state="ERROR"] {
  background: rgba(223, 91, 116, 0.12);
  color: #b23f59;
}

.status-indicator[data-state="IDLE"],
.status-indicator[data-state="STOPPED"],
.status-indicator[data-state="QUEUED"] {
  background: rgba(37, 136, 255, 0.1);
  color: #0e67d8;
}

.list-card__head,
.list-card__meta,
.log-item__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.list-card__head > :first-child {
  min-width: 0;
  flex: 1 1 240px;
}

.list-card__head > .pill-row {
  justify-content: flex-end;
  flex: 1 1 220px;
}

.list-card__title {
  font-size: 0.98rem;
  font-weight: 700;
}

.list-card__subtitle,
.list-card__body,
.info-card p,
.log-item p {
  color: var(--text-soft);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.list-card__body {
  margin: 10px 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.list-card__body--clamp {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.list-card__meta--stack {
  display: grid;
  justify-content: stretch;
  gap: 8px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
  min-width: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(237, 243, 250, 0.95);
  color: var(--text-soft);
  font-size: 0.82rem;
}

.pill[data-tone="good"] {
  background: rgba(39, 174, 96, 0.12);
  color: #1f8a4c;
}

.pill[data-tone="warn"] {
  background: rgba(217, 140, 24, 0.12);
  color: #9b6206;
}

.pill[data-tone="info"] {
  background: rgba(37, 136, 255, 0.12);
  color: #0e67d8;
}

.list-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.list-card__actions .button {
  flex: 0 0 auto;
}

.worker-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.worker-row {
  display: grid;
  gap: 8px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.worker-row__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.worker-row__user {
  font-weight: 700;
  color: var(--text);
}

.worker-row__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.worker-row__detail {
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.countdown-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(37, 136, 255, 0.1);
  color: #0e67d8;
  font-size: 0.78rem;
  font-weight: 700;
}

.info-card,
.toggle-card {
  padding: 16px;
}

.info-card strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 8px;
}

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

.toggle-card label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toggle-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.log-list {
  max-height: 680px;
  overflow: auto;
  padding-right: 10px;
  scrollbar-gutter: stable both-edges;
}

.log-list--full {
  max-height: none;
}

.log-list--compact {
  max-height: 220px;
}

.log-item {
  padding: 15px;
}

.log-item__meta {
  margin-bottom: 10px;
}

.log-level {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.log-level[data-level="SUCCESS"] {
  background: rgba(39, 174, 96, 0.12);
  color: #1f8a4c;
}

.log-level[data-level="WARNING"] {
  background: rgba(217, 140, 24, 0.12);
  color: #9b6206;
}

.log-level[data-level="ERROR"] {
  background: rgba(223, 91, 116, 0.12);
  color: #b23f59;
}

.log-level[data-level="DEBUG"] {
  background: rgba(122, 108, 224, 0.12);
  color: #5d50c2;
}

.log-level[data-level="INFO"] {
  background: rgba(37, 136, 255, 0.12);
  color: #0e67d8;
}

.empty-state {
  padding: 28px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.68);
}

.toast-zone {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 8;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.toast--error {
  border-color: rgba(223, 91, 116, 0.26);
}

.toast strong {
  display: block;
  margin-bottom: 4px;
}

@media (max-width: 1180px) {
  .hero,
  .split-grid,
  .editor-grid,
  .editor-grid--wide {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  :root {
    --content-width: calc(100vw - 16px);
    --radius-xl: 24px;
    --radius-lg: 18px;
  }

  .app-shell {
    padding: 8px 0 24px;
  }

  .hero,
  .surface {
    padding: 17px;
  }

  .hero h1 {
    max-width: none;
    font-size: clamp(2rem, 12vw, 2.65rem);
  }

  .summary-grid,
  .toggle-grid,
  .form-grid,
  .form-grid--compact {
    grid-template-columns: 1fr;
  }

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

  .search-input {
    min-width: 100%;
  }

  .tabbar {
    top: 10px;
  }
}
