:root {
  color-scheme: light;
  --canvas: #eef2ed;
  --surface: #fbfcfa;
  --surface-strong: #ffffff;
  --ink: #17231c;
  --ink-soft: #405047;
  --muted: #7a8780;
  --line: #d8e0da;
  --line-strong: #c7d1c9;
  --nav: #18271f;
  --nav-soft: #243a2f;
  --primary: #197451;
  --primary-dark: #12543a;
  --mint: #cce8d7;
  --mint-strong: #a9d9bc;
  --amber: #c78228;
  --amber-soft: #f4e7ca;
  --danger: #b9514a;
  --danger-soft: #f8e1de;
  --shadow: 0 18px 50px rgba(27, 45, 35, 0.08);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --font-body: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --font-display: "Bahnschrift SemiCondensed", "DIN Alternate", "Arial Narrow", var(--font-body);
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0d1410;
  --surface: #121b16;
  --surface-strong: #18231d;
  --ink: #eef6f0;
  --ink-soft: #c1cec6;
  --muted: #8fa096;
  --line: #2a3931;
  --line-strong: #3a4b41;
  --nav: #090f0b;
  --nav-soft: #1b2f24;
  --primary: #67cf93;
  --primary-dark: #a1e4bd;
  --mint: #233f30;
  --mint-strong: #4f936b;
  --amber: #e6aa4d;
  --amber-soft: #392b17;
  --danger: #e27d75;
  --danger-soft: #3a2220;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.26);
}

:root[data-theme="dark"] .topbar {
  background: rgba(18, 27, 22, 0.92);
}

:root[data-theme="dark"] .button.primary {
  color: #09150e;
  background: var(--primary);
  box-shadow: 0 8px 20px rgba(103, 207, 147, 0.14);
}

:root[data-theme="dark"] .button.primary:hover:not(:disabled) {
  color: #09150e;
  background: #82daa7;
  box-shadow: 0 11px 24px rgba(103, 207, 147, 0.2);
}

:root[data-theme="dark"] .button.secondary:hover:not(:disabled),
:root[data-theme="dark"] .icon-button:hover:not(:disabled) {
  background: #203128;
}

:root[data-theme="dark"] .stack-form input::placeholder,
:root[data-theme="dark"] .form-row input::placeholder {
  color: #708178;
}

:root[data-theme="dark"] .stack-form input:hover,
:root[data-theme="dark"] .stack-form select:hover,
:root[data-theme="dark"] .form-row input:hover {
  border-color: #587064;
}

:root[data-theme="dark"] .data-frame thead {
  background: #131e18;
}

:root[data-theme="dark"] .data-frame th,
:root[data-theme="dark"] .summary-band small {
  color: #83958b;
}

:root[data-theme="dark"] .data-frame td {
  border-bottom-color: #26342c;
}

:root[data-theme="dark"] .data-frame tbody tr[data-account-id]:hover,
:root[data-theme="dark"] .data-frame tbody tr[data-run-id]:hover {
  background: #1d2b24;
}

:root[data-theme="dark"] .account-avatar {
  border-color: #3e6a50;
}

:root[data-theme="dark"] .status-pill {
  background: #26332c;
  border-color: #35443b;
}

:root[data-theme="dark"] .status-pill::before {
  background: #73867b;
}

:root[data-theme="dark"] .status-success,
:root[data-theme="dark"] .status-already {
  color: #8cdda9;
  background: #1c3928;
  border-color: #315d43;
}

:root[data-theme="dark"] .status-running,
:root[data-theme="dark"] .status-queued {
  color: #efc06b;
  background: var(--amber-soft);
  border-color: #5b4524;
}

:root[data-theme="dark"] .status-failed {
  color: #f0a09a;
  background: var(--danger-soft);
  border-color: #68403d;
}

:root[data-theme="dark"] .status-disabled {
  color: #899a90;
  background: #222d27;
}

:root[data-theme="dark"] .run-detail td {
  background: #152019;
}

:root[data-theme="dark"] .run-detail pre {
  background: #101813;
}

:root[data-theme="dark"] .setting-preview {
  color: #9dddb6;
  background: #192d21;
  border-color: #31523d;
}

:root[data-theme="dark"] .featured-check,
:root[data-theme="dark"] .toggle-field {
  background: #1b2921;
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .compact-check {
  border-bottom-color: #2a3931;
}

:root[data-theme="dark"] .credential-ledger {
  background: #141f19;
  border-color: #2d3d34;
}

:root[data-theme="dark"] .credential-ledger > div + div {
  border-top-color: #2a3931;
}

:root[data-theme="dark"] .credential-status::before,
:root[data-theme="dark"] .toggle {
  background: #5b6b62;
}

:root[data-theme="dark"] .credential-status.is-missing {
  color: #e6958f;
}

:root[data-theme="dark"] .credential-status.is-optional {
  color: #91a197;
}

:root[data-theme="dark"] .toast {
  color: #9fdfb8;
  background: #192d21;
  border-color: #31523d;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

:root[data-theme="dark"] .toast.error {
  color: #f0a09a;
  background: #35201e;
  border-color: #68403d;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
dialog:focus-visible {
  outline: 3px solid rgba(25, 116, 81, 0.28);
  outline-offset: 3px;
}

.icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

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

.eyebrow,
.section-code,
.empty-code,
.service-state small,
.admin-chip small,
.summary-band small,
.channel-card legend small,
.toggle-field small {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  line-height: 1;
}

.signal-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #62c48b;
  box-shadow: 0 0 0 4px rgba(98, 196, 139, 0.14);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.button.primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(25, 116, 81, 0.17);
}

.button.primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: 0 11px 22px rgba(25, 116, 81, 0.22);
}

.button.secondary {
  color: var(--ink-soft);
  background: var(--surface-strong);
  border-color: var(--line-strong);
}

.button.secondary:hover:not(:disabled) {
  color: var(--primary-dark);
  border-color: var(--mint-strong);
  background: #f5faf6;
}

.button.danger {
  color: #fff;
  background: var(--danger);
  box-shadow: 0 8px 18px rgba(185, 81, 74, 0.18);
}

.button.wide {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  color: var(--ink-soft);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.icon-button:hover:not(:disabled) {
  color: var(--primary);
  border-color: var(--mint-strong);
  background: #f3faf5;
  transform: translateY(-1px);
}

.icon-button.quiet {
  color: inherit;
  background: transparent;
  border-color: transparent;
}

.icon-button.quiet:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: transparent;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  color: var(--danger);
  background: var(--danger-soft);
  border-left: 3px solid var(--danger);
  border-radius: 5px;
  font-size: 12px;
}

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

.stack-form label,
.form-row label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.stack-form input,
.stack-form select,
.form-row input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.stack-form input::placeholder,
.form-row input::placeholder {
  color: #a0aba4;
}

.stack-form input:hover,
.stack-form select:hover,
.form-row input:hover {
  border-color: #a8b8ad;
}

.stack-form input:focus,
.stack-form select:focus,
.form-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(25, 116, 81, 0.11);
}

.field-note {
  margin: -5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

/* Login */

.login-view {
  display: grid;
  min-height: 100vh;
  padding: 32px;
  place-items: center;
  background: var(--canvas);
}

.login-stage {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 0.72fr);
  width: min(980px, 100%);
  min-height: min(620px, calc(100vh - 64px));
  margin: 0 auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.login-story {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 540px;
  padding: clamp(40px, 6vw, 72px);
  color: #eaf5ee;
  background: linear-gradient(145deg, #18271f, #21392d);
}

.login-story .brand-lockup {
  color: #effaf2;
}

.login-story .brand-mark {
  color: #72c994;
}

.login-story .brand-mark i {
  border-color: #1a2c22;
}

.login-story .brand-lockup div > span {
  color: #8da697;
}

.story-heading {
  max-width: 430px;
}

.story-label {
  margin: 0 0 16px;
  color: #a6d9b8;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.story-heading h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(48px, 5vw, 68px);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1.02;
}

.story-heading h1 strong {
  display: inline-block;
  color: #c4f0d1;
  font-weight: 700;
}

.story-description {
  margin: 22px 0 0;
  color: #b7cbbd;
  font-size: 14px;
  line-height: 1.7;
}

.story-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #a9bfaf;
  font-size: 12px;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(40px, 6vw, 68px);
  background: var(--surface);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

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

.brand-lockup strong {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.06em;
  line-height: 1;
}

.brand-lockup div > span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.brand-mark {
  position: relative;
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--primary);
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: -0.07em;
}

.brand-mark::after {
  position: absolute;
  inset: 4px;
  border: 1px dashed currentColor;
  border-radius: 50%;
  content: "";
  opacity: 0.35;
}

.brand-mark i {
  position: absolute;
  right: -3px;
  bottom: 5px;
  width: 7px;
  height: 7px;
  background: #63c58c;
  border: 2px solid var(--surface);
  border-radius: 50%;
}

.login-header {
  margin: 0 0 30px;
}

.login-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(36px, 4vw, 46px);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
}

.login-header > p:last-child {
  margin: 15px 0 0;
  color: var(--muted);
}

.login-theme-control {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px 0 0;
  padding-top: 20px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.login-theme-switcher {
  width: 150px;
  background: var(--surface-strong);
  border-color: var(--line);
  box-shadow: none;
}

.login-theme-switcher .theme-option {
  color: var(--muted);
}

.login-theme-switcher .theme-option:hover {
  color: var(--ink);
}

.login-theme-switcher .theme-option[aria-pressed="true"] {
  color: #d9f4e1;
}

/* App shell */

.app-shell {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--canvas);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;
  padding: 28px 18px 20px;
  overflow-y: auto;
  color: #dbe9df;
  background: var(--nav);
}

.sidebar .brand-lockup {
  padding: 0 10px;
  color: #effaf2;
}

.sidebar .brand-mark {
  color: #72c994;
}

.sidebar .brand-mark i {
  border-color: var(--nav);
}

.brand-lockup.compact .brand-mark {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

.sidebar .brand-lockup div > span {
  color: #8da697;
}

.service-state {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 54px 10px 24px;
  padding: 12px 13px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(208, 237, 217, 0.1);
  border-radius: 10px;
}

.service-state > div,
.admin-chip > div {
  display: grid;
  gap: 2px;
}

.service-state small,
.admin-chip small {
  color: #759081;
}

.service-state strong {
  color: #cae6d2;
  font-size: 11px;
  font-weight: 600;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 10px;
  color: #8fa598;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.nav-item:hover {
  color: #e4f1e7;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #f1fff4;
  background: var(--nav-soft);
  border-color: rgba(132, 205, 157, 0.12);
  box-shadow: inset 3px 0 0 #67c58a;
}

.nav-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #78a489;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.nav-item.active .nav-icon {
  color: #bdedca;
  background: rgba(102, 195, 137, 0.14);
}

.nav-copy {
  display: grid;
  gap: 1px;
}

.nav-copy strong {
  color: inherit;
  font-size: 13px;
  font-weight: 700;
}

.nav-copy small {
  color: #6e887a;
  font-size: 10px;
}

.nav-item.active .nav-copy small {
  color: #99b9a4;
}

.nav-count {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  place-items: center;
  color: #bfe4c9;
  background: rgba(100, 194, 136, 0.14);
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 10px;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-footer {
  display: grid;
  gap: 14px;
  padding: 14px 8px 0;
}

.theme-switcher {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  padding: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(208, 237, 217, 0.1);
  border-radius: 10px;
  box-shadow: inset 0 1px 5px rgba(4, 13, 8, 0.18);
  isolation: isolate;
}

.theme-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  z-index: -1;
  width: calc((100% - 14px) / 3);
  overflow: hidden;
  background: linear-gradient(145deg, #315843, #264a38);
  border: 1px solid rgba(157, 215, 175, 0.18);
  border-radius: 7px;
  box-shadow:
    0 5px 14px rgba(4, 13, 8, 0.25),
    inset 0 1px 0 rgba(235, 255, 240, 0.08);
  transform: translateX(0);
  transition: transform 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.theme-indicator::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(235, 255, 240, 0.08), transparent 80%);
  content: "";
}

.theme-switcher[data-theme-position="light"] .theme-indicator {
  transform: translateX(calc(100% + 3px));
}

.theme-switcher[data-theme-position="dark"] .theme-indicator {
  transform: translateX(calc(200% + 6px));
}

.theme-option {
  position: relative;
  z-index: 1;
  display: inline-grid;
  height: 34px;
  place-items: center;
  padding: 0;
  color: #759081;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition:
    color 180ms ease,
    transform 180ms ease;
}

.theme-option:hover {
  color: #d4ebdc;
}

.theme-option:active {
  transform: scale(0.92);
}

.theme-option[aria-pressed="true"] {
  color: #d9f4e1;
}

.theme-option .icon {
  width: 16px;
  height: 16px;
}

.theme-option:focus-visible {
  outline: 2px solid rgba(157, 215, 175, 0.48);
  outline-offset: -2px;
}

.sidebar-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid rgba(222, 241, 228, 0.1);
}

.admin-chip {
  display: flex;
  align-items: center;
  gap: 9px;
}

.admin-chip > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #ccebd4;
  background: #315843;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.admin-chip strong {
  color: #e0eee3;
  font-size: 11px;
  font-weight: 600;
}

.workspace {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 126px;
  padding: 32px clamp(24px, 4vw, 68px) 28px;
  background: rgba(251, 252, 250, 0.92);
  border-bottom: 1px solid var(--line);
}

.title-block h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 3vw, 44px);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1;
}

.title-block > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-health {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content {
  width: min(1440px, 100%);
  padding: 36px clamp(24px, 4vw, 68px) 72px;
}

.tab-panel:not([hidden]) {
  animation: panel-in 280ms ease both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.account-overview {
  display: grid;
  grid-template-columns: minmax(230px, 0.76fr) minmax(0, 1.7fr);
  gap: 1px;
  min-height: 144px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 22px rgba(27, 45, 35, 0.035);
}

.overview-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 23px 28px;
  background: var(--nav);
  isolation: isolate;
}

.overview-copy::after {
  position: absolute;
  right: 24px;
  bottom: -35px;
  z-index: -1;
  width: 120px;
  height: 120px;
  border: 1px solid rgba(181, 231, 195, 0.18);
  border-radius: 50%;
  content: "";
  box-shadow:
    0 0 0 16px rgba(181, 231, 195, 0.04),
    0 0 0 32px rgba(181, 231, 195, 0.025);
}

.overview-copy .eyebrow {
  color: #91c7a1;
}

.overview-copy > strong {
  color: #effbf1;
  font-family: var(--font-display);
  font-size: 25px;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.overview-copy > p:last-child {
  margin: 8px 0 0;
  color: #9db7a6;
  font-size: 12px;
}

.summary-band {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  background: var(--surface-strong);
  isolation: isolate;
}

.summary-band::after {
  position: absolute;
  right: -30px;
  bottom: -33px;
  z-index: -1;
  width: 170px;
  height: 170px;
  border: 1px solid rgba(25, 116, 81, 0.1);
  border-radius: 50%;
  content: "";
  box-shadow:
    0 0 0 13px rgba(25, 116, 81, 0.03),
    0 0 0 27px rgba(25, 116, 81, 0.025);
}

.summary-band > div {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 20px 22px;
  border-left: 1px solid var(--line);
}

.summary-band > div:first-child {
  border-left: 0;
}

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

.summary-band strong {
  margin-top: 6px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}

.summary-band small {
  margin-top: 7px;
  color: #9daa9f;
  font-size: 9px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 40px 0 15px;
}

.section-title-group {
  display: grid;
  align-items: start;
  gap: 7px;
}

.section-title-group > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.section-code {
  display: inline-flex;
  width: max-content;
  padding-bottom: 5px;
  color: var(--primary);
  border-bottom: 2px solid var(--mint-strong);
  line-height: 1;
  white-space: nowrap;
}

.section-heading h2,
.settings-lead h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.data-frame {
  overflow: hidden;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 22px rgba(27, 45, 35, 0.035);
}

.data-frame table {
  width: 100%;
  border-collapse: collapse;
}

.data-frame thead {
  background: #f6f9f6;
}

.data-frame th {
  padding: 14px 18px;
  color: #8a968e;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.data-frame td {
  padding: 17px 18px;
  border-bottom: 1px solid #e8eee9;
  vertical-align: middle;
}

.data-frame tbody tr:last-child td {
  border-bottom: 0;
}

.data-frame tbody tr[data-account-id] {
  transition: background 160ms ease;
}

.data-frame tbody tr[data-account-id]:hover,
.data-frame tbody tr[data-run-id]:hover {
  background: #f8fbf8;
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 170px;
}

.account-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--primary-dark);
  background: var(--mint);
  border: 1px solid #b9ddc5;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}

.account-copy,
.run-result,
.schedule-time {
  display: grid;
  gap: 3px;
}

.account-copy strong,
.run-result strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.account-copy span,
.secondary-text,
.run-result p {
  max-width: 220px;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-time strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 25px;
  letter-spacing: -0.03em;
  line-height: 1;
}

.schedule-time span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.run-result p {
  max-width: 250px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 25px;
  padding: 0 10px;
  color: var(--ink-soft);
  background: #edf1ee;
  border: 1px solid #dce4dd;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill::before {
  width: 6px;
  height: 6px;
  background: #9baaa0;
  border-radius: 50%;
  content: "";
}

.status-success,
.status-already {
  color: var(--primary-dark);
  background: #e3f4e8;
  border-color: #c9e8d2;
}

.status-success::before,
.status-already::before {
  background: var(--primary);
}

.status-running,
.status-queued {
  color: #8b5a18;
  background: var(--amber-soft);
  border-color: #ebd9b3;
}

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

.status-failed {
  color: #9c3f3a;
  background: var(--danger-soft);
  border-color: #efc8c3;
}

.status-failed::before {
  background: var(--danger);
}

.status-disabled {
  color: #7a817d;
  background: #eff1ef;
}

.status-disabled::before {
  background: #aeb8b0;
}

.action-group {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.action-group .icon-button {
  width: 32px;
  height: 32px;
  border-color: transparent;
}

.action-group .danger-action:hover:not(:disabled) {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efc8c3;
}

.empty-state {
  display: grid;
  min-height: 330px;
  padding: 55px 24px;
  place-items: center;
  align-content: center;
  gap: 9px;
  text-align: center;
}

.empty-code {
  color: var(--primary);
}

.empty-icon {
  width: 34px;
  height: 34px;
  margin: 6px 0;
  color: var(--mint-strong);
  stroke: currentColor;
}

.empty-state strong {
  font-size: 15px;
}

.empty-state p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

/* Run log */

.runs-table th:first-child,
.runs-table td:first-child {
  width: 160px;
}

.runs-table th:nth-child(3),
.runs-table td:nth-child(3),
.runs-table th:nth-child(4),
.runs-table td:nth-child(4) {
  width: 110px;
}

.runs-table td:first-child,
.runs-table td:nth-child(3),
.runs-table td:nth-child(4) {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.run-detail td {
  padding-top: 0;
  background: #f8fbf8;
}

.run-detail pre {
  max-height: 230px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: var(--ink-soft);
  background: #f1f5f1;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* Settings */

.settings-lead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  padding-bottom: 23px;
  border-bottom: 1px solid var(--line);
}

.settings-lead > p {
  max-width: 410px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: right;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr);
  gap: 18px;
}

.settings-card {
  min-width: 0;
  padding: 25px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 22px rgba(27, 45, 35, 0.03);
}

.settings-card-wide {
  grid-column: span 2;
}

.general-settings {
  grid-column: 1;
  grid-row: 1;
}

.security-card {
  grid-column: 2;
  grid-row: 1;
}

.notification-card {
  grid-column: 1 / -1;
  grid-row: 2;
}

.settings-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 25px;
}

.settings-theme-fallback {
  display: none;
}

.settings-card > header > div {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 11px;
}

.settings-card .card-number {
  grid-row: span 2;
  padding-top: 2px;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.settings-card .eyebrow {
  margin: 0;
}

.settings-card h2 {
  grid-column: 2;
  margin: 4px 0 0;
  font-size: 20px;
  letter-spacing: -0.04em;
}

.section-icon {
  width: 22px;
  height: 22px;
  color: var(--mint-strong);
  stroke: currentColor;
  stroke-width: 1.6;
}

.setting-preview {
  padding: 13px 14px;
  color: var(--primary-dark);
  background: #edf7ef;
  border: 1px solid #d5ebda;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
}

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

.featured-check,
.check-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.featured-check {
  padding: 14px 16px;
  background: #f4faf5;
  border: 1px solid #d9ecdd;
  border-radius: var(--radius-sm);
}

.check-row > span:first-child {
  display: grid;
  gap: 4px;
}

.check-row strong {
  color: var(--ink);
  font-size: 13px;
}

.check-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
}

.check-row input,
.compact-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

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

.channel-card {
  display: grid;
  gap: 13px;
  min-width: 0;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.channel-card legend {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 0 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.channel-card legend small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
}

.compact-check {
  min-height: 31px;
  padding-bottom: 11px;
  border-bottom: 1px solid #e7eee8;
}

.credential-ledger {
  display: grid;
  overflow: hidden;
  background: #f6faf7;
  border: 1px solid #dfe9e1;
  border-radius: 9px;
}

.credential-ledger > div {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 11px;
}

.credential-ledger > div + div {
  border-top: 1px solid #e2ebe4;
}

.credential-ledger span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.credential-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.credential-status::before {
  width: 7px;
  height: 7px;
  background: #a8b1ab;
  border-radius: 50%;
  content: "";
}

.credential-status.is-saved {
  color: var(--primary);
}

.credential-status.is-saved::before {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(47, 157, 94, 0.1);
}

.credential-status.is-missing {
  color: #9c3f3a;
}

.credential-status.is-missing::before {
  background: var(--danger);
}

.credential-status.is-optional {
  color: #7b837e;
}

.credential-help {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.channel-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.credential-clear {
  color: var(--danger);
}

.credential-clear:hover:not(:disabled) {
  color: #9c3f3a;
  border-color: #e2b8b5;
  background: #fff7f6;
}

.security-note {
  margin-top: -5px;
}

/* Dialogs and toast */

dialog.modal {
  width: min(610px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 90px rgba(15, 29, 20, 0.25);
}

dialog.modal::backdrop {
  background: rgba(16, 28, 20, 0.53);
  backdrop-filter: blur(5px);
}

.modal > form {
  display: grid;
  max-height: calc(100vh - 32px);
  grid-template-rows: auto 1fr auto;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 27px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.045em;
}

.modal-header p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-body {
  overflow: auto;
  padding: 23px 27px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 17px 27px 23px;
  border-top: 1px solid var(--line);
}

.schedule-row {
  align-items: end;
}

.schedule-row.random-mode {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.account-enabled-field {
  margin-top: 13px;
}

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

.toggle-field {
  position: relative;
  display: flex !important;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f4f8f4;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.toggle-field > span:first-child {
  display: grid;
  gap: 2px;
}

.toggle-field strong {
  font-size: 12px;
}

.toggle-field small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.toggle-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle {
  position: relative;
  width: 35px;
  height: 20px;
  flex: 0 0 auto;
  background: #c8d1ca;
  border-radius: 99px;
  transition: background 160ms ease;
}

.toggle::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 35, 21, 0.2);
  content: "";
  transition: transform 160ms ease;
}

.toggle-field input:checked + .toggle {
  background: var(--primary);
}

.toggle-field input:checked + .toggle::after {
  transform: translateX(15px);
}

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

.confirm-modal {
  width: min(480px, calc(100vw - 32px)) !important;
}

.toast-region {
  position: fixed;
  z-index: 30;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 48px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  color: var(--primary-dark);
  background: #eff9f1;
  border: 1px solid #cce8d4;
  border-radius: 9px;
  box-shadow: 0 14px 34px rgba(27, 45, 35, 0.14);
  font-size: 12px;
  animation: toast-in 220ms ease both;
}

.toast .icon {
  color: var(--primary);
}

.toast.error {
  color: #923d38;
  background: #fff1ef;
  border-color: #f0c9c4;
}

.toast.error .icon {
  color: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .topbar {
    padding-inline: 32px;
  }

  .content {
    padding-inline: 32px;
  }

  .account-overview {
    grid-template-columns: 1fr;
  }

  .overview-copy {
    min-height: 118px;
  }

  .summary-band > div:first-child {
    border-left: 0;
  }
}

@media (max-width: 820px) {
  .login-view {
    padding: 16px;
  }

  .login-stage {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-story {
    min-height: 300px;
    padding: 42px 32px;
  }

  .login-panel {
    min-height: 480px;
    padding: 42px 32px;
  }

  .sidebar {
    padding-inline: 13px;
  }

  .sidebar .brand-lockup {
    padding-inline: 5px;
  }

  .service-state {
    margin-inline: 5px;
  }

  .nav-copy {
    display: none;
  }

  .nav-item {
    grid-template-columns: 1fr auto;
  }

  .nav-icon {
    width: 40px;
    height: 40px;
  }

  .content,
  .topbar {
    padding-inline: 24px;
  }

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

  .settings-card-wide {
    grid-column: auto;
  }

  .general-settings,
  .security-card,
  .notification-card {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 650px) {
  html,
  body {
    min-width: 0;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    min-height: 0;
    height: 70px;
    padding: 7px 10px;
    overflow: visible;
    border-top: 1px solid rgba(201, 231, 211, 0.16);
    box-shadow: 0 -10px 30px rgba(12, 24, 17, 0.18);
  }

  .sidebar .brand-lockup,
  .service-state,
  .sidebar-spacer {
    display: none;
  }

  .sidebar-footer {
    position: fixed;
    z-index: 21;
    top: 0;
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: minmax(126px, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
    gap: 10px;
    height: 58px;
    padding: 7px 10px;
    color: #dbe9df;
    background: var(--nav);
    border-bottom: 1px solid rgba(201, 231, 211, 0.16);
    box-shadow: 0 10px 30px rgba(12, 24, 17, 0.16);
  }

  .sidebar-account-row {
    min-width: 0;
    padding: 0 0 0 10px;
    border-top: 0;
    border-left: 1px solid rgba(222, 241, 228, 0.12);
  }

  .admin-chip {
    min-width: 0;
    gap: 7px;
  }

  .admin-chip > span {
    width: 28px;
    height: 28px;
  }

  .admin-chip small {
    display: none;
  }

  .admin-chip strong {
    display: block;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .side-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    height: 100%;
  }

  .nav-item {
    display: flex;
    min-height: 0;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 5px;
    border-radius: 8px;
    text-align: center;
  }

  .nav-item.active {
    box-shadow: inset 0 3px 0 #67c58a;
  }

  .nav-icon {
    width: 27px;
    height: 25px;
    background: transparent;
  }

  .nav-item.active .nav-icon {
    background: transparent;
  }

  .nav-count {
    position: absolute;
    top: 5px;
    margin-left: 32px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 8px;
  }

  .nav-copy {
    display: block;
  }

  .nav-copy strong {
    font-size: 10px;
  }

  .nav-copy small {
    display: none;
  }

  .workspace {
    padding-top: 58px;
    padding-bottom: 82px;
  }

  .topbar {
    min-height: 112px;
    align-items: flex-start;
    padding: 25px 17px 20px;
  }

  .title-block h1 {
    font-size: 31px;
  }

  .title-block > p:last-child,
  .topbar-health {
    display: none;
  }

  .topbar-actions {
    gap: 0;
  }

  .topbar-actions .button {
    min-height: 38px;
    padding-inline: 12px;
  }

  .topbar-actions .button span {
    display: none;
  }

  .content {
    padding: 22px 17px 35px;
  }

  .account-overview {
    border-radius: 12px;
  }

  .overview-copy {
    min-height: 126px;
    padding: 20px;
  }

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

  .summary-band > div:nth-child(3) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .summary-band > div:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .summary-band strong {
    font-size: 29px;
  }

  .summary-band > div {
    padding: 17px 18px;
  }

  .section-heading {
    align-items: center;
    margin-top: 30px;
  }

  .section-title-group {
    gap: 6px;
  }

  .section-title-group > div {
    display: grid;
    gap: 3px;
  }

  .section-code {
    padding-bottom: 4px;
    font-size: 9px;
  }

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

  .section-heading p {
    max-width: 210px;
    line-height: 1.45;
  }

  .data-frame {
    border-radius: 11px;
  }

  .data-frame table,
  .data-frame thead,
  .data-frame tbody,
  .data-frame th,
  .data-frame td,
  .data-frame tr {
    display: block;
  }

  .data-frame thead {
    display: none;
  }

  .data-frame tbody tr[data-account-id],
  .data-frame tbody tr[data-run-id] {
    position: relative;
    padding: 17px;
    border-bottom: 1px solid var(--line);
  }

  .data-frame tbody tr[data-account-id]:last-child,
  .data-frame tbody tr[data-run-id]:last-child {
    border-bottom: 0;
  }

  .data-frame tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 7px 0;
    border: 0;
  }

  .data-frame tbody td::before {
    color: var(--muted);
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .data-frame tbody td:first-child {
    display: block;
    padding-top: 0;
  }

  .data-frame tbody td:first-child::before,
  .data-frame tbody td:last-child::before {
    display: none;
  }

  .account-identity {
    min-width: 0;
  }

  .account-copy {
    min-width: 0;
  }

  .account-copy strong,
  .account-copy span,
  .secondary-text,
  .run-result p {
    max-width: 190px;
  }

  .action-group {
    width: 100%;
    justify-content: flex-end;
    padding-top: 7px;
    border-top: 1px dashed var(--line);
  }

  .runs-table tbody tr[data-run-id] td:first-child {
    display: flex;
  }

  .runs-table tbody tr[data-run-id] td:first-child::before {
    display: block;
  }

  .run-detail td {
    display: block !important;
  }

  .run-detail td::before {
    display: none !important;
  }

  .settings-lead {
    display: block;
    margin-bottom: 20px;
    padding-bottom: 18px;
  }

  .settings-lead > p {
    margin-top: 10px;
    text-align: left;
  }

  .settings-card {
    padding: 20px 17px;
    border-radius: 11px;
  }

  .channel-grid,
  .channel-actions,
  .form-row,
  .schedule-row.random-mode {
    grid-template-columns: 1fr;
  }

  .settings-actions .button {
    width: 100%;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-inline: 19px;
  }

  .modal-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .modal-footer .button {
    width: 100%;
  }

  .toast-region {
    right: 16px;
    bottom: 84px;
    width: calc(100vw - 32px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
