:root {
  --bg: #f3efe5;
  --bg-soft: #fffdf8;
  --panel: #fffaf0;
  --line: #d9cfbd;
  --text: #1f2b2d;
  --muted: #5f6f73;
  --primary: #0f6b5b;
  --primary-strong: #0b574a;
  --danger: #9b2f23;
  --danger-strong: #7f251c;
  --shadow: 0 14px 40px rgba(26, 42, 43, 0.12);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(145deg, var(--bg), #e8f0e5 58%, #f7ece3 100%);
}

.ambient {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.45;
}

.ambient-a {
  width: 340px;
  height: 340px;
  background: #7db9a9;
  top: -80px;
  left: -40px;
}

.ambient-b {
  width: 300px;
  height: 300px;
  background: #e8a97f;
  right: -70px;
  bottom: -80px;
}

.app-shell {
  position: relative;
  max-width: 1260px;
  margin: 0 auto;
  padding: 26px 18px 28px;
}

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

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
}

h1 {
  margin: 2px 0 0;
  font-family: "Source Serif 4", serif;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.06;
}

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

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 14px;
}

.panel {
  background: color-mix(in srgb, var(--panel) 88%, white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
}

.panel-list {
  padding: 14px;
  min-height: 72vh;
  display: flex;
  flex-direction: column;
}

.panel-editor {
  padding: 16px;
  min-height: 72vh;
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.08rem;
}

.badge {
  font-size: 0.72rem;
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 3px 10px;
}

.badge-soft {
  background: #e8f3f0;
  border-color: #bed7d1;
  color: #1a6355;
}

.integrations {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffcf7;
  padding: 10px;
  margin-bottom: 12px;
}

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

.integrations-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.integration-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffefb;
  padding: 9px;
  margin-bottom: 8px;
}

.integration-card:last-child {
  margin-bottom: 0;
}

.integration-card-muted {
  background: #f9f6ef;
}

.integration-meta {
  display: grid;
  gap: 2px;
}

.integration-name {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #233538;
}

.integration-details {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.integration-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.83rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fffefb;
  color: var(--text);
  font: inherit;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: #6aa69a;
  box-shadow: 0 0 0 3px rgba(74, 139, 124, 0.22);
}

.contact-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.contact-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffcf6;
  padding: 10px;
  text-align: left;
  width: 100%;
  cursor: pointer;
  animation: enter 200ms ease;
}

@keyframes enter {
  from {
    transform: translateY(4px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.contact-card:hover {
  border-color: #8ab8ad;
  transform: translateY(-1px);
}

.contact-card.active {
  border-color: var(--primary);
  background: #eef8f5;
}

.contact-name {
  font-weight: 700;
  color: #233538;
  margin: 0 0 3px;
}

.contact-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.list-state {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.form-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

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

.editor-actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
  padding-top: 14px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(140deg, var(--primary), #2c8a79);
}

.btn-primary:hover {
  background: linear-gradient(140deg, var(--primary-strong), #247263);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(140deg, var(--danger), #bb4a3c);
}

.btn-danger:hover {
  background: linear-gradient(140deg, var(--danger-strong), #9b3e32);
}

.btn-ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: #334548;
}

.btn-sm {
  padding: 7px 10px;
  font-size: 0.8rem;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.status {
  margin: 10px 0 0;
  font-size: 0.86rem;
}

.status-info {
  color: #315860;
}

.status-error {
  color: #8d2b20;
}

.status-ok {
  color: #176255;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .panel-list,
  .panel-editor {
    min-height: auto;
  }

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