:root {
  --bg: #0c0607;
  --panel: rgba(24, 12, 14, 0.92);
  --panel-soft: rgba(42, 18, 23, 0.84);
  --panel-strong: rgba(58, 18, 26, 0.92);
  --border: rgba(214, 34, 34, 0.26);
  --border-strong: rgba(214, 34, 34, 0.58);
  --text: #f7e7e3;
  --muted: #b7857d;
  --accent: #d62222;
  --accent-soft: rgba(214, 34, 34, 0.16);
  --danger: #ff3b30;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Oxanium", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(214, 34, 34, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(104, 8, 8, 0.32), transparent 30%),
    linear-gradient(135deg, #070303, #140606 38%, #1b0808);
}

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

.login-card {
  width: min(100%, 420px);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-copy {
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 14px;
}

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

button,
input,
textarea {
  font: inherit;
}

code,
pre {
  font-family: "Space Mono", monospace;
}

.site-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 28px;
  border-right: 1px solid var(--border);
  background: rgba(10, 8, 4, 0.8);
  backdrop-filter: blur(18px);
}

.sidebar__header {
  margin-bottom: 24px;
}

.sidebar__copy,
.hero-panel__description {
  color: var(--muted);
  line-height: 1.5;
}

.sidebar__section {
  margin-bottom: 20px;
}

.sidebar__actions {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 2rem;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 3vw, 3.25rem);
}

h3 {
  margin-bottom: 0;
  font-size: 1.4rem;
}

.search-label,
.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.text-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(7, 6, 4, 0.9);
  outline: none;
}

.text-input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 4px rgba(214, 34, 34, 0.14);
}

.text-input:disabled {
  color: rgba(245, 232, 202, 0.78);
  background: rgba(23, 11, 14, 0.9);
  border-color: rgba(214, 34, 34, 0.14);
  box-shadow: none;
  cursor: default;
}

.textarea-input {
  resize: vertical;
  min-height: 96px;
}

.textarea-input--command,
.textarea-input--queue {
  min-height: 72px;
}

.textarea-input--queue {
  min-height: 44px;
  height: auto;
  overflow: hidden;
  line-height: 1.45;
  resize: none;
}

.anomaly-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.anomaly-link {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--text);
  text-align: left;
  background: linear-gradient(180deg, rgba(34, 14, 18, 0.92), rgba(20, 10, 13, 0.96));
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.anomaly-link span,
.anomaly-link small {
  display: block;
}

.anomaly-link span {
  font-weight: 700;
  font-size: 1.05rem;
}

.anomaly-link small {
  margin-top: 4px;
  color: var(--muted);
}

.anomaly-link:hover,
.anomaly-link.is-active {
  transform: translateX(4px);
  border-color: var(--border-strong);
  background: linear-gradient(180deg, rgba(88, 14, 14, 0.96), rgba(33, 9, 9, 0.98));
}

.content {
  padding: 28px;
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(52, 12, 12, 0.96), rgba(22, 8, 8, 0.98));
  box-shadow: var(--shadow);
}

.hero-panel__stats {
  display: flex;
  gap: 14px;
}

.hero-panel__badge {
  min-width: 150px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  text-align: center;
  background: var(--accent-soft);
}

.hero-panel__badge--small {
  min-width: 130px;
}

.hero-panel__badge span {
  display: block;
}

.hero-panel__badge span:first-child {
  font-size: 2.2rem;
  font-weight: 700;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
  gap: 22px;
  margin-top: 22px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.card__header,
.queue-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.card__header--stack {
  display: grid;
  gap: 18px;
}

.card__header--saved {
  margin-top: 10px;
}

.stack-form,
.library-editor,
.library-row__actions {
  display: grid;
  gap: 12px;
}

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

.page-status {
  min-height: 24px;
  color: var(--accent);
}

.saved-queue-list {
  display: grid;
  gap: 12px;
}

.saved-queue-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(33, 10, 10, 0.94), rgba(17, 8, 8, 0.97));
}

.saved-queue-card__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  border: none;
  padding: 0;
  color: var(--text);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.saved-queue-card__name {
  font-weight: 700;
}

.saved-queue-card__meta {
  color: var(--muted);
  font-size: 0.92rem;
}

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

.queue-manager {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(214, 34, 34, 0.14);
}

.queue-manager__header {
  margin-bottom: 12px;
}

.queue-name-field {
  display: block;
}

.queue-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.button {
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 12px 18px;
  color: #24090e;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ef4444, #d62222);
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.07);
}

.button--ghost,
.button--ghost-danger,
.button--small {
  color: var(--accent);
  background: transparent;
}

.button--ghost-danger {
  color: var(--danger);
  border-color: rgba(208, 75, 95, 0.45);
}

.button--small {
  padding: 10px 14px;
}

.button--wide {
  min-width: 120px;
}

.button--tiny {
  padding: 8px 12px;
  font-size: 0.78rem;
}

.copy-status {
  min-height: 24px;
  margin-bottom: 8px;
  color: var(--accent);
}

.queue-list {
  min-height: 360px;
  max-height: 560px;
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(14, 8, 10, 0.92);
}

.queue-list::-webkit-scrollbar {
  width: 10px;
}

.queue-list::-webkit-scrollbar-track {
  background: rgba(18, 10, 12, 0.95);
}

.queue-list::-webkit-scrollbar-thumb {
  border: 2px solid rgba(18, 10, 12, 0.95);
  border-radius: 999px;
  background: rgba(214, 34, 34, 0.7);
}

.queue-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto 42px;
  align-items: start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(214, 34, 34, 0.08);
}

.queue-row:last-child {
  border-bottom: none;
}

.queue-row__number {
  color: var(--muted);
  font-size: 1.2rem;
  text-align: center;
  padding-top: 8px;
}

.queue-row__body .text-input {
  padding: 11px 14px;
  border-radius: 12px;
}

.delay-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.delay-field input {
  width: 72px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--text);
  background: rgba(34, 13, 18, 0.92);
}

.icon-button {
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  background: transparent;
  cursor: pointer;
  padding-top: 8px;
}

.icon-button:hover {
  color: var(--danger);
}

.add-command-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 18px;
}

.text-input--large {
  font-size: 1.2rem;
}

.empty-state {
  color: var(--muted);
}

.empty-state--large {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 24px;
  text-align: center;
}

.empty-state--saved {
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  text-align: center;
}

@media (max-width: 1080px) {
  .site-shell,
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 720px) {
  .content,
  .sidebar {
    padding: 18px;
  }

  .hero-panel,
  .card__header,
  .queue-card__header,
  .queue-actions,
  .queue-row,
  .add-command-form,
  .hero-panel__stats {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .card,
  .queue-row {
    padding-left: 16px;
    padding-right: 16px;
  }

  .queue-row__number {
    text-align: left;
  }

  .delay-field {
    justify-content: flex-start;
  }
}
