:root {
  --bg-primary: #090a0c;
  --bg-secondary: #111318;
  --bg-tertiary: #181b21;
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --accent-color: #f97316;
  --accent-hover: #fb923c;
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --glass-bg: rgba(17, 19, 24, 0.65);
  --glass-border: rgba(249, 115, 22, 0.12);
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

body.auth-locked {
  overflow: hidden;
  background:
    radial-gradient(960px 540px at 14% 10%, rgba(249, 115, 22, 0.14), transparent 58%),
    radial-gradient(920px 520px at 88% 16%, rgba(251, 146, 60, 0.10), transparent 55%),
    linear-gradient(180deg, #0b0d11, #050608);
}

body.auth-locked .app,
body.auth-locked .settings-save-fab {
  display: none;
}

.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(11, 11, 12, 0.98), rgba(8, 8, 9, 0.98));
  border-right: 1px solid rgba(249, 115, 22, 0.14);
  padding: 22px 16px 18px;
}

.brand {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.sidebar-brand-image {
  display: block;
  width: min(100%, 224px);
  height: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-muted);
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid transparent;
  transition: var(--transition);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  transition: var(--transition);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-secondary);
  border-color: rgba(249, 115, 22, 0.08);
}

.nav-item:hover svg {
  opacity: 1;
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.16), rgba(249, 115, 22, 0.03));
  border-color: rgba(249, 115, 22, 0.16);
  box-shadow:
    inset 3px 0 0 var(--accent-color),
    0 8px 18px rgba(0, 0, 0, 0.18);
}

.nav-item.active svg {
  color: var(--accent-color);
  opacity: 1;
}

.sidebar-badges {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(249, 115, 22, 0.14);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
}

.sidebar-nav-bottom {
  margin-top: auto;
  padding-top: 14px;
}

.sidebar-badge {
  display: inline-block;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(15, 23, 42, 0.45);
}

.sidebar-badge:hover {
  border-color: rgba(249, 115, 22, 0.35);
  color: #fff;
}

.sidebar-badge.update {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.14);
  color: rgba(253, 230, 138, 0.98);
}

.sidebar-badge.update:hover {
  border-color: rgba(245, 158, 11, 0.55);
}

.sidebar-badge-support {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-color: rgba(255, 94, 91, 0.28);
  background: rgba(255, 94, 91, 0.10);
  color: rgba(255, 229, 229, 0.96);
}

.sidebar-badge-support svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.92;
}

.sidebar-badge-support:hover {
  border-color: rgba(255, 94, 91, 0.45);
  background: rgba(255, 94, 91, 0.16);
}

.sidebar-version {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.6;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-version a {
  color: rgba(253, 230, 138, 0.95);
  text-decoration: none;
  font-weight: 700;
  font-size: 10px;
  transition: var(--transition);
}

.sidebar-version a:hover {
  color: #fde68a;
  opacity: 1;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.hero-banner {
  padding: 10px 16px 0 16px;
}

.hero-banner img {
  width: min(100%, 468px);
  height: auto;
  border-radius: 12px;
  border: 1px solid rgba(249, 115, 22, 0.16);
  display: block;
}

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  padding: 4px 10px;
}

.content-section {
  display: none;
  padding: 16px;
}

.content-section.active {
  display: block;
}

.actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  padding: 9px 16px;
  font-weight: 600;
  color: #fff;
  transition: var(--transition);
}

button:active {
  transform: scale(0.97);
}

#run {
  background: var(--accent-color);
}

#run:hover {
  background: var(--accent-hover);
}

#runforce {
  background: var(--warning-color);
  color: #121212;
}

#runforce:hover {
  filter: brightness(1.08);
}

#msg {
  color: var(--text-muted);
  font-size: 13px;
}

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

.cards-grid[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards-grid[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
}

.instance-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 12px;
}

.instance-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(71, 85, 105, 0.35);
}

.instance-main {
  min-width: 0;
  flex: 1;
}

.instance-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 10px;
}

.instance-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 14px;
  min-width: 0;
}

.instance-name {
  color: var(--text-primary);
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.instance-id {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.instance-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.instance-link,
.settings-instance-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.instance-link:hover,
.settings-instance-link:hover {
  color: #ffd7b0;
  border-color: rgba(255, 215, 176, 0.45);
}

.instance-meta .dot {
  opacity: 0.5;
}

.instance-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.instance-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.big-countdown {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  margin: 6px 0 10px 0;
}

.subline {
  color: var(--text-muted);
  font-size: 12px;
}

.kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.kv .k {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kv .v {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 3px;
}

.stat {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 10px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-secondary);
}

.field {
  display: block;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  vertical-align: middle;
  color: var(--accent-color);
  cursor: help;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}

.info-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-bottom: 12px;
}

.card h3 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

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

.section-head h3 {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.section-head .subline {
  font-size: 12px;
}

.section-kicker {
  margin-bottom: 6px;
  color: var(--accent-color);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tips-page {
  display: grid;
  gap: 12px;
}

.tips-board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(15, 18, 24, 0.72);
}

.tips-board-head h2 {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-size: 24px;
  line-height: 1.15;
}

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

.tips-thread {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 8px;
  background: rgba(15, 18, 24, 0.66);
}

.tips-thread-index {
  display: flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
  color: rgba(226, 232, 240, 0.72);
  font-size: 12px;
  font-weight: 850;
}

.tips-thread-title {
  margin-bottom: 5px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
}

.tips-thread-path {
  width: fit-content;
  max-width: 100%;
  margin-bottom: 10px;
  padding: 6px 8px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 6px;
  background: rgba(2, 6, 12, 0.50);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.tips-thread-reply {
  margin-top: 7px;
  padding-left: 10px;
  border-left: 2px solid rgba(249, 115, 22, 0.28);
  color: rgba(226, 232, 240, 0.90);
  font-size: 13px;
  line-height: 1.55;
}

.tips-thread-reply strong {
  color: var(--text-primary);
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  white-space: nowrap;
  transition: background 0.2s;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

th {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

td {
  color: var(--text-secondary);
}

.mono {
  font-family: Consolas, monospace;
}

table.history {
  table-layout: fixed;
}

table.history col.col-time {
  width: 156px;
}

table.history td.time {
  white-space: nowrap;
  vertical-align: top;
}

table.history td.title {
  white-space: normal;
  overflow-wrap: anywhere;
}

.history-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-list-note {
  padding: 0 2px 2px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

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

.history-list-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

.history-entry-stamp {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.history-time-date,
.history-time-clock {
  display: block;
}

.history-time-date {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.15;
}

.history-time-clock {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.15;
}

.history-entry {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px 12px;
  align-items: center;
  min-width: 0;
}

.history-entry.no-cover {
  grid-template-columns: minmax(0, 1fr);
}

.history-entry-cover-wrap {
  width: 56px;
  height: 78px;
  border-radius: 10px;
  overflow: hidden;
  contain: layout paint;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    radial-gradient(80px 60px at 20% 10%, rgba(249, 115, 22, 0.14), transparent 70%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.history-entry-cover-wrap.is-empty {
  display: none;
}

.history-entry-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  backface-visibility: hidden;
}

.history-entry-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-entry-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  white-space: normal;
  overflow: hidden;
  word-break: break-word;
}

.history-entry-link {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.history-entry-link:hover {
  color: #ffd7b0;
}

.history-entry-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.ok {
  background: rgba(34, 197, 94, 0.18);
  color: var(--success-color);
}

.off {
  background: rgba(239, 68, 68, 0.18);
  color: var(--error-color);
}

.warn {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning-color);
}

body {
  background:
    radial-gradient(900px 520px at 12% 10%, rgba(249, 115, 22, 0.12), transparent 60%),
    radial-gradient(900px 520px at 86% 18%, rgba(34, 197, 94, 0.08), transparent 55%),
    linear-gradient(180deg, var(--bg-primary), #050505);
}

.sidebar {
  background: linear-gradient(180deg, rgba(14, 16, 20, 0.8), rgba(9, 10, 12, 0.9));
  backdrop-filter: blur(16px);
}

.topbar {
  background: linear-gradient(180deg, rgba(16, 17, 19, 0.82), rgba(10, 10, 11, 0.92));
  backdrop-filter: blur(10px);
}

.stat,
.card,
.instance-card {
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.instance-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-color: rgba(255, 255, 255, 0.04);
  background:
    radial-gradient(520px 220px at 12% 8%, rgba(255, 255, 255, 0.04), transparent 55%),
    var(--glass-bg);
  backdrop-filter: blur(12px);
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.instance-card:hover {
  transform: translateY(-3px);
  border-color: rgba(249, 115, 22, 0.3);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 15px rgba(249, 115, 22, 0.1);
}

.instance-card[data-app="radarr"] {
  --accent-app: rgba(249, 115, 22, 0.92);
}

.instance-card[data-app="sonarr"] {
  --accent-app: rgba(251, 146, 60, 0.92);
}

.instance-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-app, rgba(249, 115, 22, 0.85)), transparent 70%);
  opacity: 0.9;
}

.big-countdown {
  font-size: 34px;
  margin: 10px 0 8px 0;
  font-variant-numeric: tabular-nums;
}

.big-countdown.due {
  color: #fca5a5;
  text-shadow: 0 0 18px rgba(239, 68, 68, 0.2);
}

.subline.warn {
  color: rgba(251, 191, 36, 0.95);
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress > .bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent-app, rgba(249, 115, 22, 0.9));
  transition: width 120ms ease;
}

.progress > .bar.cap {
  background: rgba(239, 68, 68, 0.92);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(148, 163, 184, 0.12);
  color: rgba(226, 232, 240, 0.95);
}

.status.running {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.18);
  color: rgba(253, 230, 138, 0.98);
}

.status.due {
  border-color: rgba(239, 68, 68, 0.30);
  background: rgba(239, 68, 68, 0.16);
  color: rgba(254, 202, 202, 0.98);
}

.status.off {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.10);
  color: rgba(254, 202, 202, 0.90);
}

#recent-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 2px;
}

.recent-actions-empty {
  padding: 6px 0 2px;
  color: var(--text-muted);
}

.recent-action-row {
  display: grid;
  grid-template-columns: 58px 80px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.recent-action-row.no-cover {
  grid-template-columns: 80px minmax(0, 1fr);
}

.recent-action-cover-wrap {
  width: 58px;
  height: 82px;
  border-radius: 10px;
  overflow: hidden;
  contain: layout paint;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    radial-gradient(80px 60px at 20% 10%, rgba(249, 115, 22, 0.14), transparent 70%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.recent-action-cover-wrap.is-empty {
  display: none;
}

.recent-action-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  backface-visibility: hidden;
}

.recent-action-time {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.2;
  padding-top: 1px;
}

.recent-action-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.recent-action-title {
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.22;
  color: var(--text-primary);
  white-space: normal;
  overflow: hidden;
  word-break: break-word;
}

.recent-action-link {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.recent-action-link:hover {
  color: #ffd7b0;
}

.recent-action-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.recent-action-kind {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.recent-action-kind-download {
  border-color: rgba(34, 197, 94, 0.22);
  background: rgba(34, 197, 94, 0.10);
  color: rgba(220, 252, 231, 0.96);
}

.recent-action-kind-upgrade {
  border-color: rgba(249, 115, 22, 0.24);
  background: rgba(249, 115, 22, 0.10);
  color: rgba(255, 216, 179, 0.98);
}

.recent-action-kind-library {
  border-color: rgba(96, 165, 250, 0.22);
  background: rgba(96, 165, 250, 0.10);
  color: rgba(219, 234, 254, 0.98);
}

.recent-action-kind-type {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.recent-action-source {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(249, 115, 22, 0.14);
  background: rgba(249, 115, 22, 0.07);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

@media (min-width: 1500px) {
  #recent-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.btn-mini {
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.28);
  color: rgba(254, 202, 202, 0.98);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.btn-mini:hover {
  border-color: rgba(239, 68, 68, 0.52);
  background: rgba(239, 68, 68, 0.22);
}

.btn-mini:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-mini.force {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.28);
  color: rgba(254, 202, 202, 0.98);
}

.btn-mini.force:hover {
  border-color: rgba(239, 68, 68, 0.52);
  background: rgba(239, 68, 68, 0.22);
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(340px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.field:first-child {
  margin-top: 0;
}

.field .label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

input.cfg,
select.cfg {
  width: 100%;
  padding: 9px 10px;
  height: 38px;
  line-height: 18px;
  font: inherit;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text-secondary);
  outline: none;
}

input.cfg:focus,
select.cfg:focus {
  border-color: rgba(249, 115, 22, 0.45);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
}

.inline-input {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-input > input.cfg {
  flex: 1;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(15, 23, 42, 0.55);
  color: rgba(226, 232, 240, 0.95);
  padding: 0;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: rgba(249, 115, 22, 0.35);
}

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

.icon-btn.danger {
  border-color: rgba(239, 68, 68, 0.30);
  background: rgba(239, 68, 68, 0.12);
  color: rgba(254, 202, 202, 0.98);
}

.icon-btn.danger:hover {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.18);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.tog {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  user-select: none;
}

.tog input[type="checkbox"] {
  transform: translateY(1px);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}

.two-col .field {
  margin-top: 0;
}

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

@media (max-width: 1150px) {
  .instance-head {
    flex-direction: column;
  }

  .instance-actions {
    width: 100%;
    align-items: flex-start;
  }

  .instance-actions-row {
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .cards-grid,
  .cards-grid[data-count="2"],
  .cards-grid[data-count="1"] {
    grid-template-columns: 1fr;
  }

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

  .two-col {
    grid-template-columns: 1fr;
  }

  .auth-splash {
    padding: 20px 16px;
  }

  .auth-splash-card {
    width: 100%;
  }

  .auth-splash-brand {
    width: 100%;
    max-width: 100%;
    padding: 0 0 14px;
    margin-bottom: 16px;
  }

  .auth-splash-brand img {
    width: 100%;
  }

  .auth-panel {
    width: 100%;
    padding: 16px;
  }

  .auth-panel-title {
    font-size: 28px;
  }

  .auth-inline {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .auth-submit {
    width: 100%;
  }

  .settings-save-fab {
    left: 16px;
    right: 16px;
    bottom: 16px;
    justify-content: space-between;
  }
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1000;
  padding: 18px;
}

.modal.show {
  display: flex;
}

.auth-splash {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(860px 480px at 50% 0%, rgba(249, 115, 22, 0.14), transparent 60%),
    radial-gradient(680px 340px at 50% 14%, rgba(255, 255, 255, 0.03), transparent 70%),
    linear-gradient(180deg, rgba(8, 9, 11, 0.985), rgba(4, 5, 7, 0.995));
  padding: 32px 20px;
}

.modal-card {
  width: min(520px, 100%);
  background: linear-gradient(180deg, rgba(20, 22, 27, 0.985), rgba(10, 11, 14, 0.995));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  padding: 14px;
}

.modal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-title {
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-size: 13px;
}

.modal-body {
  margin-top: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.auth-splash-card {
  width: min(560px, 100%);
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.auth-splash-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 0 14px;
  margin-bottom: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-top: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-splash-brand img {
  width: min(100%, 432px);
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.18));
}

.auth-panel {
  width: 100%;
  padding: 20px 22px 18px;
  border-radius: 24px;
  border: 1px solid rgba(249, 115, 22, 0.12);
  background:
    radial-gradient(560px 220px at 12% 0%, rgba(255, 255, 255, 0.04), transparent 58%),
    linear-gradient(180deg, rgba(14, 16, 20, 0.97), rgba(8, 10, 14, 0.99));
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.auth-panel-head {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: flex-start;
  max-width: 360px;
  margin: 0 auto;
  width: 100%;
}

.auth-panel-copy {
  max-width: 42ch;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.auth-panel .modal-body {
  margin-top: 16px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.auth-panel .subline {
  font-size: 13px;
  line-height: 1.5;
}

.auth-field {
  gap: 6px;
  max-width: none;
}

.auth-choice[hidden],
.auth-field[hidden] {
  display: none !important;
}

#delete-instance-password-field[hidden] {
  display: none !important;
}

.auth-choice .modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
  gap: 10px;
}

.auth-choice .modal-actions button {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.2;
}

.auth-choice-note {
  margin-top: 12px;
  text-align: center;
  color: var(--text-muted);
}

.auth-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.auth-panel input.cfg {
  height: 42px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 11px;
}

.auth-field-hint {
  color: var(--text-muted);
}

.auth-field-hint:empty {
  display: none;
}

.auth-error {
  margin-top: 8px;
  color: rgba(254, 202, 202, 0.98);
}

.auth-error:empty {
  display: none;
}

.auth-submit {
  width: auto;
  min-width: 118px;
  min-height: 42px;
  padding-inline: 16px;
  font-size: 12px;
  border-radius: 11px;
}

.btn-primary {
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.95), rgba(234, 88, 12, 0.88));
  color: #0b0d12;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-secondary:hover {
  border-color: rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.08);
}

.btn-danger {
  border: 1px solid rgba(239, 68, 68, 0.32);
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.95), rgba(153, 27, 27, 0.9));
  color: #fee2e2;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.btn-danger:hover {
  border-color: rgba(248, 113, 113, 0.45);
  background: linear-gradient(180deg, rgba(153, 27, 27, 0.98), rgba(185, 28, 28, 0.92));
}

.btn-danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(16, 18, 22, 0.94), rgba(10, 11, 14, 0.98)),
    radial-gradient(420px 180px at 0% 0%, rgba(249, 115, 22, 0.08), transparent 72%);
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.settings-head-block {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.settings-tabs-block {
  flex: 1 1 auto;
  padding: 10px;
}

.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

#settings-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-save-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 950;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(9, 10, 12, 0.92);
  border: 1px solid rgba(249, 115, 22, 0.18);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(420px, calc(100vw - 32px));
}

.settings-save-fab.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.settings-save-fab .subline {
  margin: 0;
  min-width: 0;
}

.toast-stack {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 980;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  min-width: 240px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(249, 115, 22, 0.16);
  background: linear-gradient(180deg, rgba(16, 18, 24, 0.98), rgba(9, 10, 12, 0.995));
  color: var(--text-primary);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  transform: translateY(10px);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

.toast.success {
  border-color: rgba(34, 197, 94, 0.26);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(34, 197, 94, 0.06) inset;
}

.toast-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.toast-text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
}

:root {
  --page-max-width: 1440px;
  --panel-bg: linear-gradient(180deg, rgba(15, 18, 24, 0.94), rgba(9, 11, 15, 0.98));
  --panel-border: rgba(255, 255, 255, 0.07);
  --panel-border-strong: rgba(249, 115, 22, 0.2);
  --panel-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

body {
  position: relative;
}

.app {
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-size: 18px;
}

.brand-mark {
  flex-shrink: 0;
}

.main {
  padding: 18px 22px 40px 0;
}

.topbar,
.content-canvas {
  width: min(100%, var(--page-max-width));
  margin: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 20px;
  padding: 18px 22px 16px;
  border: 1px solid rgba(249, 115, 22, 0.14);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background:
    linear-gradient(180deg, rgba(17, 18, 21, 0.94), rgba(10, 11, 14, 0.98)),
    radial-gradient(520px 220px at 0% 0%, rgba(249, 115, 22, 0.12), transparent 70%);
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(18px);
}

.topbar-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.topbar-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.topbar-title-wrap h1 {
  margin: 0;
  font-size: 31px;
  line-height: 1;
  letter-spacing: 0;
}

.topbar-title-wrap p {
  margin: 0;
  max-width: 680px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-message {
  display: inline-flex;
  position: relative;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px 12px;
  padding-left: 28px;
  border: 1px solid rgba(82, 82, 91, 0.88);
  border-radius: 8px;
  background: rgba(39, 39, 42, 0.86);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.topbar-message.running {
  border-color: rgba(249, 115, 22, 0.36);
  background: rgba(67, 43, 24, 0.72);
  color: #fed7aa;
  animation: runStatusGlow 2.4s ease-in-out infinite;
}

.topbar-message.running::before {
  content: '';
  display: block;
  position: absolute;
  left: 12px;
  top: 50%;
  margin-top: -4px;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #fb923c;
  box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.45);
  animation: runStatusPulse 1.35s ease-out infinite;
}

.topbar-message.error {
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(69, 10, 10, 0.72);
  color: #fecaca;
}

.topbar-message.error::before {
  content: '';
  display: block;
  position: absolute;
  left: 12px;
  top: 50%;
  margin-top: -4px;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #ef4444;
}

.topbar-message:empty {
  display: none;
}

@keyframes runStatusPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.46);
    transform: scale(0.9);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(251, 146, 60, 0);
    transform: scale(1);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(251, 146, 60, 0);
    transform: scale(0.9);
  }
}

@keyframes runStatusGlow {
  0%, 100% {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  }
  50% {
    box-shadow:
      0 10px 24px rgba(0, 0, 0, 0.18),
      0 0 22px rgba(249, 115, 22, 0.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar-message.running,
  .topbar-message.running::before {
    animation: none;
  }
}


.content-canvas {
  padding: 18px 18px 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 0 28px 28px;
  background:
    linear-gradient(180deg, rgba(12, 14, 18, 0.98), rgba(7, 8, 10, 1)),
    radial-gradient(920px 420px at 0% 0%, rgba(249, 115, 22, 0.05), transparent 62%);
  box-shadow:
    0 22px 44px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.dashboard-header {
  display: none;
}

.dashboard-brand {
  display: none;
  align-items: center;
  gap: 14px;
}

.dashboard-brand-logo {
  width: 76px;
  height: 76px;
  display: block;
  flex-shrink: 0;
  border-radius: 18px;
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.dashboard-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dashboard-brand-copy h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.dashboard-brand-tagline {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.dashboard-actions {
  margin-bottom: 0;
  min-height: 0;
  justify-content: flex-end;
  flex: none;
  width: auto;
}

.content-section {
  width: 100%;
  margin: 0;
  padding: 0;
}

.mobile-nav {
  display: none;
  width: 100%;
  margin: 0 0 14px;
}

.toggle-chip {
  gap: 8px;
  cursor: pointer;
}

.toggle-chip input[type="checkbox"],
.settings-toggle-chip input[type="checkbox"] {
  accent-color: var(--accent-color);
}

.settings-tabs,
.history-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(249, 115, 22, 0.35) transparent;
}

.settings-tabs::-webkit-scrollbar,
.history-tabs::-webkit-scrollbar {
  height: 6px;
}

.settings-tabs::-webkit-scrollbar-thumb,
.history-tabs::-webkit-scrollbar-thumb {
  background: rgba(249, 115, 22, 0.28);
  border-radius: 999px;
}

.tab-btn {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  flex: 0 0 auto;
  white-space: nowrap;
}

.tab-btn:hover {
  border-color: rgba(249, 115, 22, 0.28);
  background: rgba(249, 115, 22, 0.1);
  color: #fff;
}

.tab-btn.active {
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.96), rgba(234, 88, 12, 0.9));
  border-color: transparent;
  color: #0b0d12;
  box-shadow: 0 12px 24px rgba(249, 115, 22, 0.18);
}

.settings-tab-btn {
  min-height: 34px;
}

.settings-add-btn {
  min-height: 36px;
  padding-inline: 14px;
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  font-weight: 800;
}

.settings-add-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.9;
}

.settings-add-btn:hover {
  border-color: rgba(249, 115, 22, 0.3);
  background: rgba(249, 115, 22, 0.08);
}

.actions {
  justify-content: space-between;
  gap: 12px 18px;
}

#msg {
  min-height: 0;
}

.empty-state-card {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 18px 20px;
}

.empty-state-card .section-head {
  margin-bottom: 0;
}

.empty-state-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dashboard-add-instance-grid {
  display: grid;
  max-width: 720px;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
}

.instance-card-shell {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
}

.instance-head {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.instance-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.instance-eyebrow-icon {
  opacity: 0.9;
  flex-shrink: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.status.waiting {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(148, 163, 184, 0.09);
  color: rgba(226, 232, 240, 0.95);
}

.btn-mini.force {
  padding: 5px 14px;
}

.btn-mini-neutral {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-mini-neutral:hover {
  border-color: rgba(249, 115, 22, 0.3);
  background: rgba(249, 115, 22, 0.08);
}

.instance-utility {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.instance-control-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.card-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  line-height: 0;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.card-icon-btn svg {
  display: block;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.card-icon-btn:hover:not(:disabled) {
  border-color: rgba(249, 115, 22, 0.28);
  background: rgba(249, 115, 22, 0.08);
  color: #fff;
}

.card-icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card-icon-btn-run {
  border-color: rgba(239, 68, 68, 0.26);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.card-icon-btn-run svg {
  width: 16px;
  height: 16px;
}

.card-icon-btn-run:hover:not(:disabled) {
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(239, 68, 68, 0.18);
  color: #fee2e2;
}

.countdown-block {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 14px;
}

.big-countdown {
  margin: 0 0 4px 0;
}

.countdown-meta {
  opacity: 0.8;
}

.countdown-note {
  margin-top: 2px;
}

.rate-panel {
  margin-bottom: 16px;
}

.rate-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}

.rate-value {
  color: var(--text-primary);
}

.progress-slim {
  margin-top: 8px;
  height: 6px;
  background: rgba(0, 0, 0, 0.3);
}

.instance-metrics {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 12px;
}

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

.text-strong {
  font-weight: 600;
}

.text-success {
  color: var(--success-color);
}

.k-nowrap {
  white-space: nowrap;
}

.metric-time {
  font-size: 11px;
}

.history-card,
.settings-global-card,
.settings-instance-card,
#settings-tab-empty {
  margin-top: 0;
}

.sidebar-badges {
  margin-top: 16px;
}

.history-empty {
  color: var(--text-muted);
  padding: 16px;
}

.history-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.history-pagination-info {
  font-size: 12px;
  color: var(--text-muted);
}

.history-pagination-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.history-load-panel {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.history-load-status {
  font-size: 12px;
  color: var(--text-muted);
}

.history-scroll-sentinel {
  height: 1px;
}

.page-status {
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  padding: 0 8px;
}

.settings-global-card {
  padding: 20px;
  margin-bottom: 0;
}

.settings-global-section {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.settings-global-actions-wrap {
  margin-top: 0;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 16px 18px;
  flex-wrap: wrap;
}

.settings-global-actions-copy {
  min-width: 0;
  flex: 0 1 280px;
}

.settings-global-actions-copy h4,
.settings-global-preferences-copy h4 {
  margin: 0 0 6px;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.settings-global-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.settings-global-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.settings-global-head h3 {
  margin: 0;
  font-size: 16px;
}

.settings-global-icon {
  width: 20px;
  height: 20px;
}

.settings-global-copy {
  font-size: 13px;
  margin-bottom: 24px;
}

.settings-global-preferences {
  margin-top: 16px;
  padding: 16px 18px 18px;
}

.settings-global-preferences-copy {
  margin-bottom: 14px;
}

.settings-global-field {
  margin-top: 0;
  max-width: 400px;
}

.settings-global-preferences-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px 16px;
  align-items: start;
}

.settings-global-field-wide {
  max-width: none;
  grid-column: 1 / -1;
}

.settings-slider-card {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.settings-slider-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.settings-slider-value {
  color: rgba(226, 232, 240, 0.95);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.settings-range {
  appearance: none;
  width: 100%;
  height: 24px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.settings-range::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  border: 1px solid rgba(249, 115, 22, 0.22);
  border-radius: 999px;
  background: linear-gradient(90deg, #f97316 0%, #fb923c var(--range-fill, 4.2%), rgba(30, 36, 48, 0.96) var(--range-fill, 4.2%), rgba(30, 36, 48, 0.96) 100%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.settings-range::-moz-range-track {
  width: 100%;
  height: 8px;
  border: 1px solid rgba(249, 115, 22, 0.22);
  border-radius: 999px;
  background: rgba(30, 36, 48, 0.96);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.settings-range::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f97316, #fb923c);
}

.settings-range::-webkit-slider-thumb {
  appearance: none;
  margin-top: -6px;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 247, 237, 0.98);
  border-radius: 999px;
  background: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18), 0 4px 14px rgba(0, 0, 0, 0.42);
}

.settings-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 247, 237, 0.98);
  border-radius: 999px;
  background: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18), 0 4px 14px rgba(0, 0, 0, 0.42);
}

.settings-range:focus-visible {
  outline: 2px solid rgba(249, 115, 22, 0.7);
  outline-offset: 5px;
}

.settings-range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: rgba(148, 163, 184, 0.82);
  font-size: 11px;
  font-weight: 800;
}

.settings-cache-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-mini-cache-clear {
  width: auto;
  min-width: 0;
  padding: 5px 12px;
  background: rgba(249, 115, 22, 0.16);
  color: rgba(255, 237, 213, 0.98);
  border-color: rgba(249, 115, 22, 0.42);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.08) inset;
}

.btn-mini-cache-clear:hover {
  background: rgba(249, 115, 22, 0.24);
  border-color: rgba(251, 146, 60, 0.7);
}

.settings-global-help {
  margin-top: 6px;
}

.save-button {
  min-height: 34px;
  padding: 7px 14px;
  font-size: 12px;
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.14);
}

.settings-instance-card {
  padding: 24px;
  display: none;
  margin-bottom: 0;
}

.settings-instance-head {
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 20px;
}

.settings-instance-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}

.settings-instance-icon {
  flex-shrink: 0;
}

.settings-instance-badge {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.settings-instance-url {
  margin-top: 8px;
  opacity: 0.8;
}

.settings-toggle-group {
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.36);
  justify-content: flex-start;
}

.settings-toggle-chip {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.settings-toggle-chip input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.settings-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  width: fit-content;
}

.settings-switch-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
}

.settings-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.settings-switch-slider {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
  flex: 0 0 auto;
}

.settings-switch-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff7ed;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  transition: transform 140ms ease;
}

.settings-switch input[type="checkbox"]:checked + .settings-switch-slider {
  background: rgba(249, 115, 22, 0.9);
  border-color: rgba(251, 146, 60, 0.9);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
}

.settings-switch input[type="checkbox"]:checked + .settings-switch-slider::after {
  transform: translateX(20px);
}

.settings-switch input[type="checkbox"]:focus-visible + .settings-switch-slider {
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.22);
}

.settings-switch-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.sleep-window-fields {
  transition: opacity 140ms ease, filter 140ms ease;
}

.sleep-window-fields.is-disabled {
  opacity: 0.48;
}

.settings-seconds-between-field.is-disabled {
  opacity: 0.48;
}

.sleep-window-fields.is-disabled .label,
.sleep-window-fields.is-disabled .cfg,
.settings-seconds-between-field.is-disabled .label,
.settings-seconds-between-field.is-disabled .cfg {
  color: var(--text-secondary);
}

.sleep-window-fields.is-disabled .cfg,
.settings-seconds-between-field.is-disabled .cfg {
  cursor: not-allowed;
}

.settings-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow:
    var(--panel-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.settings-panel-title {
  margin: 0 0 16px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 16px;
  letter-spacing: 0.02em;
}

.settings-grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  align-items: end;
}

.settings-grid-wide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  align-items: end;
}

.settings-grid-spaced {
  margin-bottom: 20px;
}

.field-stack-gap {
  margin-top: 20px;
}

.settings-api-key-row {
  width: 100%;
  gap: 10px;
}

.settings-api-key-row > .cfg {
  flex: 1;
}

.settings-test-connection-btn {
  border-color: rgba(249, 115, 22, 0.32);
  background: rgba(249, 115, 22, 0.14);
  color: rgba(255, 237, 213, 0.98);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.settings-test-connection-btn:hover {
  border-color: rgba(249, 115, 22, 0.55);
  background: rgba(249, 115, 22, 0.20);
}

.danger-panel {
  border-color: rgba(239, 68, 68, 0.22);
  background: linear-gradient(180deg, rgba(55, 18, 22, 0.72), rgba(33, 10, 14, 0.92));
}

.danger-title {
  color: #fecaca;
  border-bottom-color: rgba(239, 68, 68, 0.18);
}

.danger-copy {
  margin-bottom: 16px;
  color: rgba(254, 202, 202, 0.88);
}

.danger-soft {
  border-color: rgba(239, 68, 68, 0.38);
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
}

.danger-soft:hover {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(239, 68, 68, 0.18);
}

@media (max-width: 1150px) {
  .main {
    padding: 16px 16px 36px 0;
  }

  .topbar {
    padding-inline: 18px;
  }

  .topbar-title-wrap h1 {
    font-size: 28px;
  }

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

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none !important;
  }

  .main {
    padding: 0 14px 96px;
  }

  .topbar,
  .content-canvas,
  .mobile-nav,
  .content-section {
    width: 100%;
  }

  .topbar {
    padding: 16px 16px 14px;
    border-radius: 20px 20px 0 0;
    gap: 14px;
  }

  .topbar-copy,
  .topbar-actions {
    width: 100%;
  }

  .topbar-title-wrap h1 {
    font-size: 24px;
  }

  .topbar-title-wrap p {
    font-size: 12px;
  }

  .topbar-actions {
    justify-content: flex-start;
    align-items: center;
  }

  .recent-action-row {
    grid-template-columns: 44px 1fr;
    gap: 8px;
    align-items: flex-start;
    padding-block: 9px;
  }

  .recent-action-row.no-cover {
    grid-template-columns: 1fr;
  }

  .recent-action-cover-wrap {
    width: 48px;
    height: 68px;
    grid-row: 1 / span 2;
  }

  .recent-action-time {
    font-size: 11px;
  }

  .recent-action-main {
    gap: 6px;
  }

  .recent-action-title {
    white-space: normal;
  }

  .recent-action-meta {
    justify-content: flex-start;
  }

  table.history col.col-time {
    width: 132px;
  }

  .history-list-item {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    padding: 11px 12px;
  }

  .history-entry {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 8px 10px;
  }

  .history-entry-cover-wrap {
    width: 50px;
    height: 70px;
  }

  .history-entry-main {
    gap: 6px;
  }

  .history-entry-title {
    font-size: 13px;
  }

  .content-canvas {
    padding: 14px 14px 20px;
    border-radius: 0 0 20px 20px;
    overflow: hidden;
  }

  .dashboard-brand,
  .dashboard-header {
    display: none;
  }

  .mobile-nav {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    position: relative !important;
    top: auto !important;
    z-index: 2;
    margin: 0 0 12px;
    padding: 2px;
    border-radius: 14px;
    background: rgba(10, 12, 16, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: none !important;
  }

  .mobile-nav-item {
    flex: 1 1 0;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-secondary);
    padding: 9px 10px;
    min-height: 38px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .content-section {
    position: relative;
    z-index: 1;
  }

  .mobile-nav-item.active {
    background: linear-gradient(180deg, rgba(249, 115, 22, 0.96), rgba(234, 88, 12, 0.9));
    border-color: transparent;
    color: #0b0d12;
  }

  .mobile-nav-item:hover {
    border-color: rgba(249, 115, 22, 0.32);
  }

  .history-pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .history-pagination-controls {
    justify-content: space-between;
    width: 100%;
  }

  .settings-head {
    padding: 12px;
  }

  .settings-head-block {
    width: 100%;
  }

  .settings-tabs {
    flex-wrap: wrap;
    overflow: visible;
  }

  .settings-actions {
    width: 100%;
    justify-content: stretch;
  }

  .settings-actions > button {
    flex: 1 1 calc(50% - 5px);
  }

  .settings-instance-card,
  .settings-global-card,
  .settings-panel {
    padding: 18px;
  }

  .settings-global-actions-wrap {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }

  .settings-global-actions-copy {
    flex: 0 1 auto;
  }

  .settings-global-preferences {
    padding: 16px;
  }

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

  .settings-global-actions {
    justify-content: stretch;
    width: 100%;
  }

  .settings-tab-btn {
    flex: 1 1 calc(50% - 4px);
    text-align: center;
  }

  .settings-global-actions > button {
    flex: 1 1 calc(50% - 4px);
  }

  .settings-instance-head {
    gap: 16px;
  }

  .toast-stack {
    left: 14px;
    right: 14px;
    bottom: 90px;
  }
}

@media (max-width: 640px) {
  .actions {
    align-items: stretch;
  }

  .topbar {
    padding-inline: 14px;
  }

  .topbar-actions {
    gap: 8px;
    align-items: flex-start;
  }


  .topbar-message {
    width: 100%;
  }

  .tips-board-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .tips-thread {
    grid-template-columns: 1fr;
  }

  .dashboard-add-instance-grid {
    max-width: none;
    grid-template-columns: 1fr;
  }

  .topbar-title-wrap p {
    display: none;
  }

  .mobile-nav {
    gap: 6px;
  }

  .mobile-nav-item {
    flex: 1 1 0;
    font-size: 11px;
    letter-spacing: 0.02em;
    padding-inline: 8px;
  }

  .settings-tabs .tab-btn,
  .history-tabs .tab-btn {
    justify-content: center;
  }

  .history-list {
    grid-template-columns: 1fr;
  }

  .history-list-item {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 11px 12px;
  }

  .history-entry-stamp {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
  }

  table.history col.col-time {
    width: 114px;
  }

  table.history th,
  table.history td {
    padding-inline: 8px;
  }

  .history-time-date,
  .history-time-clock {
    font-size: 10px;
  }

  .history-entry {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .history-entry.no-cover {
    grid-template-columns: 1fr;
  }

  .history-entry-cover-wrap {
    display: none;
  }

  .history-entry-main {
    gap: 5px;
  }

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

  .settings-actions > button {
    flex-basis: 100%;
  }

  .settings-tab-btn {
    flex-basis: 100%;
  }

  .settings-global-actions > button {
    flex-basis: 100%;
  }

  .settings-save-fab {
    left: 12px;
    right: 12px;
    bottom: 12px;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
  }

  .settings-save-fab .subline,
  .save-button {
    width: 100%;
  }

  .settings-toggle-group {
    gap: 8px 12px;
  }

  .countdown-block,
  .rate-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .instance-utility {
    width: 100%;
    justify-content: flex-start;
  }

  .instance-control-row {
    justify-content: flex-start;
  }

  .settings-save-fab {
    gap: 10px;
  }
}
/* Modern app pass */
:root {
  --bg-primary: #07090d;
  --bg-secondary: #0d1118;
  --bg-tertiary: #151b25;
  --text-primary: #f8fafc;
  --text-secondary: #dbe5ef;
  --text-muted: #8b98aa;
  --accent-color: #f97316;
  --accent-hover: #fb923c;
  --panel-bg: rgba(14, 18, 27, 0.72);
  --panel-border: rgba(148, 163, 184, 0.12);
  --glass-bg: rgba(13, 17, 26, 0.68);
  --glass-border: rgba(148, 163, 184, 0.12);
  --page-max-width: 1540px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

html,
body {
  min-height: 100%;
  background:
    radial-gradient(900px 460px at 18% 0%, rgba(249, 115, 22, 0.10), transparent 58%),
    radial-gradient(760px 380px at 100% 12%, rgba(20, 184, 166, 0.08), transparent 56%),
    linear-gradient(180deg, #07090d 0%, #080b10 48%, #050609 100%);
}

.app {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  padding: 20px 14px;
  background: rgba(6, 8, 12, 0.78);
  border-right-color: rgba(148, 163, 184, 0.10);
  box-shadow: 18px 0 38px rgba(0, 0, 0, 0.24);
}

.brand {
  justify-content: flex-start;
  padding: 0 10px;
  margin-bottom: 22px;
}

.sidebar-brand-image {
  width: 188px;
}

.nav-item {
  min-height: 44px;
  margin-bottom: 5px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(219, 229, 239, 0.74);
  background: transparent;
  border-color: transparent;
  font-size: 14px;
  font-weight: 700;
}

.nav-item:hover {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(249, 115, 22, 0.14);
  border-color: rgba(249, 115, 22, 0.22);
  box-shadow: inset 3px 0 0 var(--accent-color);
}

.sidebar-badges,
.sidebar-version {
  border-top-color: rgba(148, 163, 184, 0.10);
}

.sidebar-badge {
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.58);
}

.main {
  padding: 20px 24px 44px;
}

.topbar,
.content-canvas {
  width: min(100%, var(--page-max-width));
}

.topbar {
  align-items: center;
  padding: 20px 22px;
  border: 1px solid rgba(148, 163, 184, 0.10);
  border-radius: 14px;
  background: rgba(11, 15, 23, 0.78);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}

.content-canvas {
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#msg {
  display: block;
  margin: 0 0 12px;
}

#msg:empty {
  display: none;
}

.content-section {
  padding: 0;
}








.cards-grid {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.cards-grid[data-count="1"],
.cards-grid[data-count="2"] {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.card,
.instance-card {
  border-radius: 12px;
  border-color: rgba(148, 163, 184, 0.12);
  background: rgba(13, 17, 26, 0.76);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.instance-card {
  padding: 16px;
  transform: none;
}

.instance-card:hover {
  transform: translateY(-1px);
  border-color: rgba(249, 115, 22, 0.24);
}

.instance-card::before {
  height: 2px;
}

.instance-head {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom-color: rgba(148, 163, 184, 0.10);
}

.instance-eyebrow {
  margin-bottom: 8px;
  letter-spacing: 0;
}

.instance-name {
  font-size: 22px;
  letter-spacing: 0;
}

.big-countdown {
  font-size: 28px;
  letter-spacing: 0;
}

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

.kv .k {
  letter-spacing: 0;
}

.recent-actions-card,
.history-card,
.settings-global-card,
.settings-instance-card {
  background: rgba(13, 17, 26, 0.76);
}

#recent-actions {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.recent-action-row,
.history-list-item {
  border-radius: 10px;
  border-color: rgba(148, 163, 184, 0.11);
  background: rgba(7, 10, 15, 0.44);
}

.history-list {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.tab-btn,
.settings-tab-btn,
.history-tab {
  border-radius: 8px;
  letter-spacing: 0;
}

#section-settings {
  display: none;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

#section-settings.active {
  display: grid;
}

.settings-head {
  position: sticky;
  top: 16px;
  margin: 0;
}

.settings-head-block,
.settings-tabs-block {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(13, 17, 26, 0.76);
}

.settings-tabs {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  overflow: visible;
}

.settings-tab-btn {
  justify-content: flex-start;
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  text-align: left;
}

#settings-content-wrapper {
  min-width: 0;
}

.settings-global-card,
.settings-instance-card {
  padding: 20px;
  border-radius: 12px;
}

.settings-instance-head {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom-color: rgba(148, 163, 184, 0.10);
}

.settings-instance-title {
  font-size: 17px;
}

.settings-panel {
  padding: 16px;
  margin-bottom: 14px;
  border-radius: 10px;
  border-color: rgba(148, 163, 184, 0.10);
  background: rgba(7, 10, 15, 0.38);
}

.settings-panel-title {
  margin-bottom: 14px;
  font-size: 14px;
  letter-spacing: 0;
}

.settings-grid-auto,
.settings-grid-wide {
  gap: 14px;
}

input.cfg,
select.cfg {
  border-radius: 8px;
  background: rgba(4, 7, 12, 0.72);
  border-color: rgba(148, 163, 184, 0.16);
}

.icon-btn,
.card-icon-btn {
  border-radius: 8px;
}

.settings-save-fab {
  border-radius: 10px;
  border-color: rgba(249, 115, 22, 0.22);
  background: rgba(10, 13, 18, 0.92);
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    min-height: auto;
  }

  .main {
    padding: 14px;
  }


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

  .settings-head {
    position: static;
  }

  .settings-tabs {
    flex-direction: row;
    overflow-x: auto;
  }

  .settings-tab-btn {
    width: auto;
    flex: 0 0 auto;
  }
}

@media (max-width: 720px) {

  .cards-grid,
  .cards-grid[data-count="1"],
  .cards-grid[data-count="2"],
  .history-list,
  #recent-actions {
    grid-template-columns: 1fr;
  }


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

/* Settings page redesign */
#section-settings {
  display: none;
}

#section-settings.active {
  display: block;
}

.settings-head {
  display: block;
  margin: 0 0 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.settings-head-block,
.settings-tabs-block {
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(113, 113, 122, 0.72);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.settings-tabs {
  display: flex;
  flex-direction: row;
  gap: 28px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.settings-tab-btn {
  position: relative;
  width: auto;
  min-height: 46px;
  flex: 0 0 auto;
  justify-content: center;
  padding: 0 2px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: rgba(161, 161, 170, 0.98);
  font-size: 14px;
  font-weight: 650;
  text-align: center;
  letter-spacing: 0;
}

.settings-tab-btn:hover {
  color: rgba(244, 244, 245, 0.98);
  background: transparent;
  border-bottom-color: rgba(212, 212, 216, 0.38);
}

.settings-tab-btn.active {
  color: #fff;
  background: transparent;
  border-bottom-color: var(--accent-color);
  box-shadow: none;
}

#settings-content-wrapper {
  min-width: 0;
  width: 100%;
  max-width: none;
}

.settings-global-card,
.settings-instance-card,
#settings-tab-empty {
  border-radius: 12px;
  border: 1px solid rgba(63, 63, 70, 0.92);
  background: rgba(24, 24, 27, 0.78);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.20);
}

.settings-global-card,
.settings-instance-card {
  padding: 24px;
}

.settings-global-card {
  padding: 22px 24px 20px;
}

.settings-global-head,
.settings-instance-head {
  margin-bottom: 4px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(63, 63, 70, 0.92);
}

.settings-global-head h3,
.settings-instance-title {
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.settings-global-copy,
.settings-instance-url,
.settings-panel-help {
  color: rgba(161, 161, 170, 0.98);
}

.settings-global-head {
  margin-bottom: 0;
  padding-bottom: 18px;
  align-items: flex-start;
}

.settings-global-icon {
  margin-top: 2px;
}

.settings-global-section,
.settings-panel {
  border: 0;
  border-top: 1px solid rgba(63, 63, 70, 0.92);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.settings-global-section,
.settings-panel {
  padding: 22px 0;
}

.settings-global-actions-wrap,
.settings-global-preferences,
.settings-panel {
  display: grid;
  grid-template-columns: minmax(190px, 0.36fr) minmax(0, 0.64fr);
  gap: 24px;
  align-items: start;
}

.settings-global-actions-copy,
.settings-global-preferences-copy,
.settings-panel-copy {
  min-width: 0;
  max-width: 330px;
}

.settings-global-actions-copy h4,
.settings-global-preferences-copy h4,
.settings-panel-title {
  margin: 0;
  padding: 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  border: 0;
}

.settings-panel-help,
.settings-global-actions-copy .subline,
.settings-global-preferences-copy .subline {
  margin-top: 7px;
  line-height: 1.5;
}

.settings-panel-body,
.settings-global-actions,
.settings-global-preferences-grid {
  min-width: 0;
}

.settings-global-actions {
  justify-content: flex-start;
}

#settings-tab-global .settings-global-section:first-of-type {
  border-top: 0;
  padding-top: 16px;
}

.settings-global-preferences {
  grid-template-columns: minmax(220px, 0.3fr) minmax(0, 0.7fr);
  gap: 18px 28px;
}

.settings-global-preferences-copy {
  max-width: 260px;
}

.settings-add-instance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
  align-items: stretch;
}

.settings-add-tile {
  display: flex;
  min-height: 118px;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  border: 2px dashed rgba(161, 161, 170, 0.58);
  border-radius: 12px;
  background: rgba(39, 39, 42, 0.45);
  color: rgba(228, 228, 231, 0.96);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.settings-add-tile:hover {
  border-color: rgba(249, 115, 22, 0.72);
  background: rgba(249, 115, 22, 0.10);
  color: #fff;
}

.settings-add-tile-icon {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(249, 115, 22, 0.16);
  color: rgba(255, 237, 213, 0.98);
}

.settings-add-tile-icon svg {
  width: 18px;
  height: 18px;
}

.settings-add-tile-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.settings-add-tile-title {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
}

.settings-add-tile-sub {
  color: rgba(161, 161, 170, 0.98);
  font-size: 12px;
  line-height: 1.35;
}

.settings-global-preferences-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
}

.settings-global-field-wide {
  grid-column: 1 / -1;
}

.settings-global-help {
  grid-column: 2;
  margin: 2px 0 0;
  max-width: 760px;
}

.settings-grid-auto,
.settings-grid-wide {
  gap: 14px;
}

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

.settings-panel-body > .settings-grid-auto + .settings-grid-auto {
  margin-top: 14px;
}

.settings-toggle-group {
  justify-content: flex-start;
  padding: 8px;
  border-radius: 9px;
  border-color: rgba(63, 63, 70, 0.92);
  background: rgba(9, 9, 11, 0.52);
}

.settings-toggle-chip {
  font-size: 13px;
}

input.cfg,
select.cfg {
  min-height: 40px;
  border-radius: 8px;
  border-color: rgba(82, 82, 91, 0.95);
  background: rgba(9, 9, 11, 0.72);
}

input.cfg:focus,
select.cfg:focus {
  border-color: rgba(249, 115, 22, 0.56);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.14);
}

.settings-test-connection-btn {
  min-width: 48px;
}

.danger-panel {
  border-top-color: rgba(239, 68, 68, 0.34);
}

.settings-panel-actions {
  display: flex;
  justify-content: flex-start;
}

.settings-app-card {
  padding: 24px;
}

.settings-app-head {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(63, 63, 70, 0.92);
}

.settings-app-head h3 {
  margin: 0 0 6px;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.settings-server-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.settings-server-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(63, 63, 70, 0.92);
  border-radius: 12px;
  background: rgba(39, 39, 42, 0.62);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.settings-server-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.settings-server-summary {
  min-width: 0;
}

.settings-server-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
}

.settings-server-title > span:first-of-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-server-url {
  margin-top: 7px;
}

.settings-server-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-card-action {
  border-color: rgba(249, 115, 22, 0.28);
}

.settings-card-toggle {
  padding: 6px 10px 6px 8px;
  border: 1px solid rgba(82, 82, 91, 0.95);
  border-radius: 999px;
  background: rgba(9, 9, 11, 0.52);
}

.settings-connection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  align-items: end;
}

.settings-instance-settings {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 5, 9, 0.78);
  backdrop-filter: blur(10px);
}

.settings-instance-settings[hidden] {
  display: none !important;
}

.settings-instance-settings-card {
  width: min(640px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 0;
  border: 1px solid rgba(82, 82, 91, 0.98);
  border-radius: 12px;
  background: rgba(24, 24, 27, 0.98);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.54);
  scrollbar-width: thin;
  scrollbar-color: rgba(113, 113, 122, 0.9) rgba(24, 24, 27, 0.98);
}

.settings-instance-settings-card::-webkit-scrollbar {
  width: 10px;
}

.settings-instance-settings-card::-webkit-scrollbar-track {
  background: rgba(24, 24, 27, 0.98);
}

.settings-instance-settings-card::-webkit-scrollbar-thumb {
  border: 2px solid rgba(24, 24, 27, 0.98);
  border-radius: 999px;
  background: rgba(113, 113, 122, 0.9);
}

.settings-instance-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(63, 63, 70, 0.92);
  background: rgba(39, 39, 42, 0.58);
}

.settings-instance-settings-head h3 {
  margin: 0 0 5px;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.settings-modal-priority {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
  margin: 0 22px;
  padding: 18px 0;
  border-bottom: 1px solid rgba(63, 63, 70, 0.72);
}

.settings-modal-priority .settings-panel-title {
  margin-bottom: 4px;
}

.settings-modal-priority-control .settings-grid-auto {
  grid-template-columns: minmax(180px, 220px);
  margin: 0;
}

.settings-modal-close {
  flex: 0 0 auto;
}

.settings-modal-head-actions,
.settings-modal-search-types {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-modal-search-types .settings-toggle-chip {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid rgba(82, 82, 91, 0.95);
  border-radius: 999px;
  background: rgba(39, 39, 42, 0.52);
  font-size: 12px;
}

.settings-instance-settings .settings-panel {
  display: block;
  margin: 0 22px;
  padding: 20px 0;
}

.settings-instance-settings .settings-panel:first-child {
  border-top: 0;
}

.settings-instance-settings .settings-panel-copy {
  max-width: none;
  margin-bottom: 14px;
}

.settings-instance-settings .settings-panel-body {
  width: 100%;
}

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

.settings-instance-settings .settings-grid-auto > .field {
  margin-top: 0;
}

.settings-instance-settings .settings-run-schedule-grid {
  grid-template-columns: minmax(0, 1fr);
  max-width: 280px;
}

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

.settings-instance-settings .settings-behavior-limits {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
}

.settings-instance-settings input[type="number"] {
  width: 100%;
}

.settings-instance-settings .settings-grid-auto:empty {
  display: none;
}

.settings-instance-settings .settings-grid-spaced {
  margin-bottom: 14px;
}

.settings-instance-settings .settings-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.settings-instance-settings .settings-toggle-chip {
  justify-content: flex-start;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid rgba(82, 82, 91, 0.95);
  border-radius: 10px;
  background: rgba(39, 39, 42, 0.52);
}

.settings-instance-settings .settings-switch-row {
  width: 100%;
  justify-content: flex-start;
}

.settings-instance-settings .field-stack-gap {
  margin-top: 0;
}

.settings-instance-settings .settings-cleanup-grid {
  align-items: start;
  gap: 12px 14px;
}

.settings-instance-settings .settings-cleanup-field {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 6px;
  justify-content: flex-start;
}

.settings-instance-settings .settings-cleanup-field .settings-toggle-chip {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
}

.settings-add-server-card {
  align-self: stretch;
}

.settings-instance-card,
.settings-add-server-card {
  min-height: 224px;
}

.settings-save-fab {
  border-radius: 10px;
  border-color: rgba(249, 115, 22, 0.22);
  background: rgba(8, 11, 17, 0.94);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.34);
  z-index: 1010;
}

@media (max-width: 900px) {
  .settings-global-actions-wrap,
  .settings-global-preferences,
  .settings-panel {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .settings-global-actions-copy,
  .settings-global-preferences-copy,
  .settings-panel-copy {
    max-width: none;
  }

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

  .settings-global-help {
    grid-column: 1;
    max-width: none;
  }

  .settings-server-head {
    flex-direction: column;
  }

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

  .settings-server-actions > button {
    flex: 1 1 0;
  }
}

@media (max-width: 760px) {
  .settings-tabs {
    gap: 22px;
  }

  .settings-global-preferences-grid,
  .settings-grid-wide {
    grid-template-columns: 1fr;
  }

  .settings-instance-card,
  .settings-global-card {
    padding: 18px;
  }

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

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

  .settings-instance-settings {
    padding: 12px;
  }

  .settings-instance-settings-card {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .settings-instance-settings-head {
    padding: 16px;
  }

  .settings-modal-priority {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-inline: 16px;
  }

  .settings-instance-settings .settings-panel {
    margin-inline: 16px;
  }

  .settings-instance-settings .settings-grid-auto,
  .settings-instance-settings .settings-toggle-group {
    grid-template-columns: 1fr;
  }
}

/* History can contain hundreds of cards. Keep its scroll path cheap to avoid
   browser checkerboarding/gray gaps during fast fling scrolling. */
#section-runs {
  overflow-x: hidden;
  min-width: 0;
}

.history-card {
  overflow-x: hidden;
  min-width: 0;
  background: #10141d;
  box-shadow: none;
}

.history-list-wrap,
.history-list,
.history-list-item,
.history-entry,
.history-entry-main {
  min-width: 0;
}

.history-list {
  contain: layout;
}

.history-list-item {
  background: #0b0f17;
  box-shadow: none;
  contain: layout paint;
}

.history-entry-cover-wrap {
  background: #171b24;
  box-shadow: none;
}
