:root {
  --paper: #f6f0e2;
  --paper-strong: #fffaf0;
  --ink: #1c1a16;
  --muted: #655e52;
  --line: rgba(28, 26, 22, 0.12);
  --line-strong: rgba(28, 26, 22, 0.2);
  --panel: rgba(255, 250, 240, 0.78);
  --panel-strong: rgba(255, 250, 240, 0.92);
  --accent: #c84d21;
  --accent-soft: #f19a67;
  --forest: #244b3c;
  --shadow: 0 18px 60px rgba(47, 34, 20, 0.16);
  --radius: 22px;
  --radius-sm: 14px;
  --mono: "SFMono-Regular", "IBM Plex Mono", "Cascadia Code", monospace;
  --display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  --body: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(241, 154, 103, 0.35), transparent 30%),
    linear-gradient(135deg, #e1d4b5 0%, #f6f0e2 42%, #ede4d5 100%);
  color: var(--ink);
  font-family: var(--body);
}

body {
  position: relative;
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

.background-orbit {
  position: fixed;
  border-radius: 999px;
  filter: blur(16px);
  opacity: 0.38;
  z-index: 0;
}

.orbit-a {
  width: 28rem;
  height: 28rem;
  background: radial-gradient(circle, rgba(200, 77, 33, 0.5), rgba(200, 77, 33, 0));
  top: -10rem;
  right: -8rem;
}

.orbit-b {
  width: 32rem;
  height: 32rem;
  background: radial-gradient(circle, rgba(36, 75, 60, 0.35), rgba(36, 75, 60, 0));
  bottom: -14rem;
  left: -10rem;
}

.grain {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.04) 0.7px, transparent 0.7px);
  background-size: 9px 9px;
  mix-blend-mode: multiply;
  pointer-events: none;
  opacity: 0.3;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.login-view {
  min-height: calc(100vh - 4rem);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.5rem;
  align-items: center;
}

.hero-copy {
  padding: 2rem 1rem;
}

.eyebrow {
  margin: 0 0 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: var(--forest);
  font-weight: 700;
}

.hero-copy h1,
.masthead h1,
.section-head h2,
.panel-head h2,
.panel-head h3,
.stat-panel h3 {
  font-family: var(--display);
  line-height: 0.96;
  margin: 0;
}

.hero-copy h1 {
  font-size: clamp(3.2rem, 8vw, 5.9rem);
  max-width: 10ch;
}

.lede {
  max-width: 55ch;
  margin: 1.4rem 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-points {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: grid;
  gap: 0.75rem;
}

.hero-points li {
  background: rgba(255, 250, 240, 0.54);
  border: 1px solid var(--line);
  padding: 0.95rem 1rem;
  border-radius: 999px;
  width: fit-content;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.login-panel,
.stack-form {
  padding: 1.4rem;
  display: grid;
  gap: 1rem;
}

.panel-head {
  display: grid;
  gap: 0.3rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
}

textarea,
.editor,
.code-block {
  font-family: var(--mono);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(200, 77, 33, 0.25);
  border-color: rgba(200, 77, 33, 0.55);
}

.primary-button,
.secondary-button,
.ghost-button,
.upload-chip span,
.action-chip {
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.2rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #e1784d);
  color: white;
  box-shadow: 0 10px 24px rgba(200, 77, 33, 0.28);
}

.secondary-button {
  background: rgba(36, 75, 60, 0.12);
  color: var(--forest);
  border: 1px solid rgba(36, 75, 60, 0.14);
}

.ghost-button,
.upload-chip span,
.action-chip {
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  border: 1px solid var(--line);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.upload-chip span:hover,
.action-chip:hover,
.tab:hover {
  transform: translateY(-1px);
}

.error-text {
  min-height: 1.1rem;
  color: #9a2600;
}

.hidden {
  display: none !important;
}

.dashboard-view {
  display: grid;
  gap: 1.2rem;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.4rem;
}

.masthead-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

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

.overview-grid,
.two-column,
.three-column,
.provider-grid {
  display: grid;
  gap: 1rem;
}

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

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

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

.provider-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.stat-panel,
.section-head {
  padding: 1.25rem 1.4rem;
}

.tabs {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  padding: 0.82rem 1.05rem;
  white-space: nowrap;
}

.tab.active {
  background: linear-gradient(135deg, var(--forest), #356956);
  color: white;
  border-color: transparent;
}

.tab-panel {
  display: none;
  gap: 1rem;
}

.tab-panel.active {
  display: grid;
}

.provider-card {
  padding: 1.2rem;
  display: grid;
  gap: 0.8rem;
}

.provider-actions,
.provider-status,
.mini-grid {
  display: grid;
  gap: 0.65rem;
}

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

.provider-status {
  background: rgba(255, 255, 255, 0.58);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 0.9rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  border-radius: 999px;
  background: rgba(36, 75, 60, 0.1);
  color: var(--forest);
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.table-shell {
  padding: 0.4rem;
  overflow-x: auto;
}

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

.table-shell th,
.table-shell td {
  text-align: left;
  padding: 0.95rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table-shell tbody tr:hover {
  background: rgba(255, 255, 255, 0.42);
}

.editor {
  min-height: 28rem;
  width: 100%;
  padding: 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(28, 26, 22, 0.94);
  color: #f6f0e2;
  box-shadow: var(--shadow);
}

.code-block {
  margin: 0;
  padding: 1rem;
  min-height: 12rem;
  background: rgba(28, 26, 22, 0.94);
  color: #f1ead8;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: auto;
}

.code-block.tall {
  min-height: 28rem;
}

.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  max-width: 28rem;
  background: rgba(28, 26, 22, 0.93);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  border-radius: 18px;
  padding: 0.95rem 1rem;
  z-index: 9;
}

@media (max-width: 1100px) {
  .login-view,
  .overview-grid,
  .three-column,
  .two-column {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 {
    max-width: 13ch;
  }
}

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

  .masthead {
    flex-direction: column;
  }

  .provider-actions,
  .mini-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 0.5rem 0;
  }
}
