:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --pane: #ffffff;
  --ink: #20231f;
  --muted: #6b7066;
  --line: #d9d7cf;
  --line-strong: #b9b7ad;
  --green: #187a5b;
  --green-soft: #e5f4ed;
  --amber: #9a6112;
  --amber-soft: #fff3d6;
  --blue: #2e5eaa;
  --blue-soft: #e7eefc;
  --red: #a33c31;
  --shadow: 0 20px 60px rgba(42, 43, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto 16px;
  max-width: 1500px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 8px;
  font-size: 16px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.top-actions,
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.button,
.icon-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
}

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

.button.secondary,
.button.ghost {
  background: var(--pane);
  color: var(--ink);
  border-color: var(--line-strong);
}

.button.compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-button {
  width: 40px;
  height: 40px;
  font-size: 19px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 auto 16px;
  max-width: 1500px;
}

.status-card,
.rail,
.pane,
.flow-column,
.note-panel {
  border: 1px solid var(--line);
  background: var(--pane);
  border-radius: 8px;
}

.status-card {
  min-height: 150px;
  padding: 16px;
  box-shadow: 0 10px 25px rgba(42, 43, 38, 0.06);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.service-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

.status-card.ok .service-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.status-card.bad .service-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px #f9e0dc;
}

.status-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 22px;
}

.status-card p {
  min-height: 42px;
  margin-bottom: 12px;
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  max-width: 1500px;
  margin: 0 auto;
}

.rail {
  min-height: calc(100vh - 245px);
  padding: 12px;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 12px 14px;
  text-align: left;
}

.tab:hover {
  background: #f6f6f3;
  border-color: var(--line);
}

.tab.active {
  background: var(--blue-soft);
  border-color: #adc4f2;
  color: var(--blue);
  font-weight: 700;
}

.workflow-mini {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.workflow-mini ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
  font-size: 13px;
}

.pane {
  min-height: calc(100vh - 245px);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.view {
  display: none;
  min-height: calc(100vh - 245px);
}

.view.active {
  display: block;
}

iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 245px);
  min-height: 680px;
  border: 0;
  background: #fff;
}

.flow-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.flow-column {
  padding: 18px;
  background: #fbfbf8;
}

.note-panel {
  margin: 0 16px 16px;
  padding: 18px;
}

.address-list {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px 14px;
  align-items: center;
}

.address-list span {
  color: var(--muted);
  font-size: 13px;
}

code {
  display: block;
  overflow: auto;
  border: 1px solid var(--line);
  background: #f6f6f3;
  border-radius: 8px;
  padding: 8px 10px;
  color: #2d463d;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  min-width: 220px;
  max-width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  opacity: 0;
  padding: 12px 14px;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 980px) {
  .topbar,
  .workspace {
    display: block;
  }

  .top-actions {
    margin-top: 14px;
  }

  .status-grid,
  .flow-board {
    grid-template-columns: 1fr;
  }

  .rail {
    min-height: auto;
    margin-bottom: 12px;
  }

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

  .pane,
  .view {
    min-height: 720px;
  }

  iframe {
    height: 720px;
    min-height: 720px;
  }
}
