:root {
  --cream: #f7f1e7;
  --cream-2: #f1e8da;
  --linen: #fbf7f0;
  --beige: #e9dbc7;
  --oak: #d1ad7b;
  --oak-deep: #a8783f;
  --ink: #342318;
  --ink-2: #674d3d;
  --muted: #8d7867;
  --line: #ddcdb9;
  --line-soft: #eadfce;
  --white: #fffdf8;
  --accent: #ef9e20;
  --accent-deep: #c97a0e;
  --cocoa: #391e10;
  --rose: #e5007d;
  --teal: #0f766e;
  --blue: #315a9c;
  --focus: rgba(239, 158, 32, 0.34);
  --sans: "Familjen Grotesk", "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(251, 247, 240, 0.96), rgba(247, 241, 231, 0.62) 360px),
    var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 9px 16px;
  font-weight: 600;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--ink);
  background: var(--cream-2);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 36px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(251, 247, 240, 0.88);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.brand img {
  display: block;
  width: 132px;
  height: auto;
}

.brand span {
  font-family: var(--mono);
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(250px, 312px) minmax(320px, 430px) minmax(440px, 1fr);
  gap: 22px;
  width: min(1600px, calc(100% - 56px));
  margin: 28px auto;
  align-items: start;
}

.panel {
  min-width: 0;
}

.people-panel,
.editor-panel,
.preview-panel {
  padding: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-head h1,
.panel-head h2,
.message-head h3,
.install-band h2,
.install-band h3 {
  margin: 0;
  line-height: 1.03;
  letter-spacing: 0;
}

.panel-head h1,
.panel-head h2,
.install-band h2 {
  font-size: 26px;
  font-weight: 600;
}

.message-head h3,
.install-band h3 {
  font-size: 18px;
  font-weight: 600;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent-deep);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span {
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--ink);
  padding: 12px 13px;
  min-height: 42px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
}

.field textarea {
  resize: vertical;
  line-height: 1.45;
}

.search-field input {
  min-height: 44px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.56);
}

.segmented button {
  border: 0;
  min-height: 34px;
  padding: 8px 13px;
  color: var(--ink-2);
  background: transparent;
}

.segmented button:hover {
  transform: none;
  color: var(--ink);
  background: var(--cream-2);
}

.segmented button.is-active {
  color: var(--cream);
  background: var(--ink);
}

.profile-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  max-height: calc(100vh - 265px);
  overflow: auto;
  padding-right: 2px;
}

.profile-card {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  text-align: left;
  border: 0;
  border-radius: 14px;
  background: transparent;
  padding: 11px 12px;
}

.profile-card > span:first-child {
  min-width: 0;
}

.profile-card:hover {
  background: var(--cream-2);
}

.profile-card.is-active {
  background: var(--ink);
  color: var(--cream);
}

.profile-card.is-active .profile-email {
  color: rgba(247, 241, 231, 0.74);
}

.profile-name {
  display: block;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-email {
  display: block;
  min-width: 0;
  margin-top: 3px;
  color: var(--ink-2);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chip {
  align-self: start;
  border-radius: 999px;
  background: var(--linen);
  color: var(--accent-deep);
  padding: 5px 9px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-card.is-active .profile-chip {
  background: rgba(247, 241, 231, 0.14);
  color: var(--accent);
}

.profile-chip.belgium,
.profile-chip.poland {
  background: var(--linen);
  color: var(--accent-deep);
}

.quiet-button {
  min-height: 34px;
  padding: 7px 13px;
  color: var(--ink-2);
}

.signature-form {
  background: rgba(255, 253, 248, 0.44);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  padding: 18px;
}

.message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  margin: 14px 0 14px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.message-fields {
  opacity: 0.58;
  transition: opacity 0.18s ease;
}

.message-fields.is-enabled {
  opacity: 1;
}

.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-button {
  color: var(--cream);
  background: var(--ink);
  border-color: var(--ink);
}

.primary-button:hover {
  color: var(--cocoa);
  background: var(--accent);
  border-color: var(--accent);
}

.status {
  min-height: 28px;
  max-width: 240px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-align: right;
  text-transform: uppercase;
}

.preview-frame {
  background: var(--linen);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  padding: 30px;
  min-height: 244px;
  overflow: auto;
}

.preview-frame.responsive-preview {
  max-width: 390px;
  min-height: 360px;
  margin-inline: auto;
}

.signature-preview {
  display: inline-block;
  max-width: 100%;
  background: transparent;
  padding: 0;
}

.html-field {
  margin-top: 16px;
  margin-bottom: 0;
}

.html-field textarea {
  min-height: 152px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}

.install-band {
  width: min(1600px, calc(100% - 56px));
  margin: 8px auto 34px;
  padding: 26px 0 0;
  border-top: 1px solid var(--line-soft);
}

.install-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 18px;
}

.install-grid article {
  padding: 0;
}

.install-grid ol {
  margin: 10px 0 0 20px;
  padding: 0;
  color: var(--ink-2);
  line-height: 1.55;
  font-size: 14px;
}

@media (max-width: 1220px) {
  .app-shell {
    grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  }

  .preview-panel {
    grid-column: 1 / -1;
  }
}

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

  .topbar-meta {
    flex-wrap: wrap;
  }

  .app-shell,
  .install-band {
    width: min(100% - 24px, 680px);
  }

  .app-shell,
  .install-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .profile-list {
    max-height: 340px;
  }

  .preview-frame {
    padding: 16px;
  }

  .signature-preview {
    padding: 14px;
  }

  .preview-toolbar {
    align-items: stretch;
  }

  .preview-toolbar,
  .action-row {
    flex-direction: column;
  }

  .action-row button,
  .preview-toolbar .segmented {
    width: 100%;
  }
}

@media (max-width: 460px) {
  .brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .brand img {
    width: 118px;
  }

  .topbar-meta span {
    white-space: normal;
  }

  .profile-card {
    grid-template-columns: 1fr;
  }

  .profile-chip {
    display: none;
  }

  .segmented {
    grid-auto-flow: row;
    border-radius: 18px;
  }
}
