@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;700&family=Space+Grotesk:wght@500;700&display=swap");

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --edge: #dbe2ea;
  --text: #1d2530;
  --muted: #617083;
  --accent: #3574d4;
  --danger: #b33939;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", sans-serif;
  background: linear-gradient(180deg, #f5f7fb, #f4f6f8);
  color: var(--text);
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", sans-serif;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 14px 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.kicker {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.06em;
  font-size: 12px;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(24px, 4vw, 34px);
}

.status {
  margin: 8px 0 12px;
  color: #285f31;
  font-size: 14px;
}

.status.error {
  color: #9c2f2f;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.shell {
  display: grid;
  grid-template-columns: 250px 1fr 370px;
  gap: 10px;
  min-height: calc(100vh - 130px);
}

.pane {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 10px;
  min-height: 420px;
}

.pane-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.pane-head h2 {
  margin: 0;
  font-size: 18px;
}

.pane-head small {
  color: var(--muted);
}

button,
input,
select {
  font: inherit;
}

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

button.ghost {
  background: #ecf1f8;
  color: #23496f;
}

button.danger {
  background: var(--danger);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input,
select {
  border: 1px solid var(--edge);
  border-radius: 9px;
  padding: 8px 9px;
  background: #fff;
}

.space-list {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 280px);
  overflow: auto;
}

.space-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--edge);
  text-align: left;
}

.space-item.active {
  background: #e9f0fe;
  border-color: #b7cef7;
}

.space-item small {
  color: var(--muted);
}

.space-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 0.7fr 0.7fr auto auto;
  gap: 6px;
  margin-bottom: 8px;
}

.prompt-list {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 250px);
  overflow: auto;
}

.prompt-item {
  width: 100%;
  border: 1px solid var(--edge);
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
  padding: 10px;
}

.prompt-item.active {
  background: #eef4ff;
  border-color: #b7cef7;
}

.prompt-item h3 {
  margin: 0;
  font-size: 16px;
}

.prompt-item p {
  margin: 6px 0 0;
  font-size: 13px;
  color: #3b4a5a;
  line-height: 1.35;
}

.prompt-item-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.prompt-detail {
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 12px;
  min-height: 320px;
}

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

.prompt-detail h3 {
  margin: 0;
  font-size: 21px;
}

.detail-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  border: 1px solid #c2d6f6;
  background: #eaf2ff;
  color: #29518e;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}

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

.detail-text {
  margin: 12px 0 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  border: 1px solid #cfd8e3;
  background: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  color: #3f4f63;
}

.detail-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.empty-message {
  border: 1px dashed var(--edge);
  border-radius: 10px;
  padding: 16px;
  background: var(--panel-soft);
}

.empty-message h3 {
  margin: 0;
}

.empty-message p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

  .detail-pane {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: start;
  }

  .shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

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

  .space-list,
  .prompt-list {
    max-height: 320px;
  }
}
