:root {
  --bg: #f4efe4;
  --bg-strong: #efe5d5;
  --panel: rgba(255, 251, 244, 0.76);
  --panel-strong: rgba(255, 248, 239, 0.96);
  --ink: #1f2220;
  --ink-soft: #5d6058;
  --line: rgba(31, 34, 32, 0.12);
  --line-strong: rgba(31, 34, 32, 0.22);
  --accent: #b55233;
  --accent-strong: #8a321d;
  --teal: #0f6d68;
  --gold: #cc9837;
  --danger: #8d3a2f;
  --shadow: 0 24px 60px rgba(62, 41, 18, 0.14);
  --heading-font: "Baskerville", "Iowan Old Style", "Palatino Linotype", serif;
  --ui-font: "Avenir Next", "Helvetica Neue", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--ui-font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(181, 82, 51, 0.15), transparent 28%),
    radial-gradient(circle at bottom right, rgba(15, 109, 104, 0.16), transparent 24%),
    linear-gradient(180deg, #f8f2e9 0%, #f0e6d6 100%);
}

body.modal-open {
  overflow: hidden;
}

.page-glow {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(48px);
  pointer-events: none;
  opacity: 0.35;
  z-index: 0;
}

.page-glow-a {
  top: -8rem;
  right: -6rem;
  background: rgba(181, 82, 51, 0.22);
}

.page-glow-b {
  bottom: -10rem;
  left: -6rem;
  background: rgba(15, 109, 104, 0.18);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.5rem;
}

.sidebar {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: linear-gradient(180deg, rgba(29, 34, 32, 0.92), rgba(42, 48, 45, 0.88));
  color: #f7f1e5;
  box-shadow: var(--shadow);
}

.brand h1,
.panel h2,
.panel h3,
.stat-card strong {
  margin: 0;
  font-family: var(--heading-font);
  letter-spacing: -0.02em;
}

.brand-copy,
.sidebar-copy {
  margin: 0.35rem 0 0;
  color: rgba(247, 241, 229, 0.74);
  line-height: 1.5;
  font-size: 0.95rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  color: rgba(247, 241, 229, 0.58);
}

.panel .eyebrow,
.stat-card p,
.sidebar-label {
  color: var(--ink-soft);
}

.sidebar-nav {
  display: grid;
  gap: 0.55rem;
}

.sidebar-nav a {
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  color: #f7f1e5;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.sidebar-nav a:hover {
  transform: translateX(4px);
  border-color: rgba(204, 152, 55, 0.4);
  background: rgba(204, 152, 55, 0.08);
}

.sidebar-nav a.active {
  transform: translateX(4px);
  border-color: rgba(204, 152, 55, 0.58);
  background: linear-gradient(135deg, rgba(204, 152, 55, 0.18), rgba(181, 82, 51, 0.14));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.sidebar-card,
.panel,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.sidebar-card {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.content-header {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: end;
  padding: 1.25rem 1.35rem;
  background:
    linear-gradient(135deg, rgba(255, 249, 241, 0.94), rgba(248, 236, 218, 0.82)),
    radial-gradient(circle at top right, rgba(15, 109, 104, 0.12), transparent 22%);
}

.content-eyebrow {
  margin-bottom: 0.45rem;
}

.content-header h2 {
  font-size: clamp(1.8rem, 2.4vw, 2.6rem);
  line-height: 1.08;
}

.content-description {
  max-width: 36rem;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.page-view {
  display: grid;
  gap: 1.5rem;
}

.page-view[hidden] {
  display: none !important;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
  gap: 1.5rem;
  padding: 1.6rem;
  background:
    linear-gradient(135deg, rgba(255, 249, 241, 0.95), rgba(249, 239, 225, 0.82)),
    radial-gradient(circle at top right, rgba(204, 152, 55, 0.16), transparent 25%);
}

.hero-panel h2 {
  font-size: clamp(2rem, 2.6vw, 3rem);
  line-height: 1.06;
}

.hero-description {
  max-width: 40rem;
  margin: 0.85rem 0 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

.connection-form,
.form-grid,
.toolbar {
  display: grid;
  gap: 0.9rem;
}

.connection-form {
  align-self: start;
  padding: 1rem;
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
}

.field-hint {
  margin: -0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.55;
}

.field-hint code {
  padding: 0.12rem 0.35rem;
  border-radius: 0.45rem;
  background: rgba(31, 34, 32, 0.08);
  font-size: 0.82rem;
}

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

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

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

.banner-toolbar {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}

label span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

input,
select,
textarea {
  width: 100%;
  padding: 0.82rem 0.95rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(181, 82, 51, 0.45);
  box-shadow: 0 0 0 4px rgba(181, 82, 51, 0.12);
}

textarea {
  resize: vertical;
  min-height: 6rem;
}

.block-field {
  display: grid;
  gap: 0.45rem;
}

.upload-card {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  border: 1px dashed rgba(31, 34, 32, 0.18);
  border-radius: 1.15rem;
  background: rgba(255, 255, 255, 0.58);
}

.upload-status {
  margin: 0;
}

.image-preview {
  width: 100%;
  max-height: 14rem;
  object-fit: cover;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.wide {
  grid-column: 1 / -1;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1.7rem;
}

.checkbox-field input {
  width: auto;
  margin: 0;
}

.form-actions,
.header-actions,
.placement-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 0.82rem 1.2rem;
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

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

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.4);
  transform: none;
  opacity: 0.58;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff8f2;
  box-shadow: 0 12px 30px rgba(181, 82, 51, 0.26);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  border: 1px solid var(--line);
}

.ghost-button.compact {
  padding: 0.55rem 0.8rem;
  font-size: 0.86rem;
}

.ghost-button.danger {
  color: var(--danger);
  border-color: rgba(141, 58, 47, 0.18);
}

.panel {
  padding: 1.35rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.panel-header h3 {
  font-size: 1.6rem;
}

.notice {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  padding: 0.95rem 1.1rem;
  border-radius: 1.1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.notice-success {
  border-color: rgba(15, 109, 104, 0.28);
  background: rgba(233, 247, 245, 0.92);
}

.notice-error {
  border-color: rgba(141, 58, 47, 0.28);
  background: rgba(251, 239, 236, 0.92);
}

.notice-busy {
  border-color: rgba(204, 152, 55, 0.32);
  background: rgba(255, 247, 225, 0.92);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.pill-idle {
  background: rgba(255, 255, 255, 0.1);
}

.pill-success {
  background: rgba(15, 109, 104, 0.18);
  color: #dbf7f4;
}

.pill-error {
  background: rgba(181, 82, 51, 0.22);
  color: #fff1eb;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.stat-card {
  padding: 1.1rem;
}

.stat-card p {
  margin: 0 0 0.55rem;
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
}

.stat-card strong {
  display: block;
  font-size: 2.15rem;
  line-height: 1;
}

.stat-card span {
  display: block;
  margin-top: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background: rgba(255, 255, 255, 0.52);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 52rem;
}

.data-table th,
.data-table td {
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(31, 34, 32, 0.08);
  vertical-align: top;
}

.data-table th {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  position: sticky;
  top: 0;
}

.data-table tbody tr {
  transition: background 160ms ease;
}

.data-table tbody tr:hover {
  background: rgba(181, 82, 51, 0.05);
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(31, 34, 32, 0.08);
}

.status-active,
.status-confirmed {
  background: rgba(15, 109, 104, 0.14);
  color: var(--teal);
}

.status-sleeping,
.status-awaiting_confirmation {
  background: rgba(204, 152, 55, 0.18);
  color: #7a5506;
}

.status-failed,
.status-partial_failure {
  background: rgba(141, 58, 47, 0.14);
  color: var(--danger);
}

.stack-list {
  display: grid;
  gap: 0.95rem;
}

.stack-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.75);
}

.stack-card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.9rem;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(24, 19, 13, 0.46);
  backdrop-filter: blur(10px);
}

.modal-shell[hidden] {
  display: none;
}

.modal-card {
  width: min(42rem, 100%);
  max-height: min(90vh, 52rem);
  overflow: auto;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 1.5rem;
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.98), rgba(245, 235, 219, 0.96)),
    radial-gradient(circle at top right, rgba(181, 82, 51, 0.12), transparent 26%);
  box-shadow: 0 34px 80px rgba(36, 24, 12, 0.32);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 0.75rem;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.55rem;
}

.modal-hint {
  margin: 0 0 1rem;
}

.modal-actions {
  justify-content: end;
}

.code-block {
  margin: 0;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: rgba(31, 34, 32, 0.92);
  color: #efe8da;
  overflow: auto;
  min-height: 9rem;
  font-size: 0.88rem;
  line-height: 1.6;
}

.empty-state {
  color: rgba(239, 232, 218, 0.7);
}

.clickable-row {
  cursor: pointer;
}

.clickable-row.active {
  background: rgba(15, 109, 104, 0.08);
}

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

  .sidebar {
    position: static;
  }

  .hero-panel,
  .content-header,
  .toolbar,
  .banner-toolbar,
  .stats-grid,
  .form-grid,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .data-table {
    min-width: 44rem;
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 0.9rem;
  }

  .panel,
  .sidebar,
  .hero-panel {
    padding: 1rem;
    border-radius: 1.15rem;
  }

  .panel-header,
  .stack-card-header,
  .modal-header {
    flex-direction: column;
    align-items: start;
  }

  .content-header {
    align-items: start;
  }

  .form-actions,
  .header-actions,
  .placement-actions {
    width: 100%;
  }

  .form-actions button,
  .header-actions button {
    width: 100%;
  }

  .data-table {
    min-width: 36rem;
  }
}
