:root {
  color-scheme: light;
  --ink: #2f3e4c;
  --muted: #aab0b6;
  --line: #b7b7b7;
  --panel: #ffffff;
  --page: #eef3f7;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #dff4f1;
  --warn: #7c2d12;
  --shadow: 0 18px 60px rgba(20, 33, 43, 0.13);
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 470px) minmax(0, 1fr);
  gap: 28px;
  min-height: 100vh;
  padding: 28px;
}

.editor-panel,
.preview-panel {
  min-width: 0;
}

.editor-panel {
  align-self: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.brand-row,
.action-row,
.rib-preview header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 2.8vw, 2.1rem);
  line-height: 1.05;
}

.rib-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea {
  resize: vertical;
  min-height: 86px;
}

input:focus,
textarea:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

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

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  padding: 0 16px;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  background: #e6edf3;
  color: var(--ink);
}

.secondary-button:hover {
  background: #d9e3eb;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  background: #e6edf3;
  color: var(--ink);
  font-size: 1.25rem;
}

.preview-panel {
  display: grid;
  place-items: center;
  padding: 18px 0;
}

.rib-preview {
  width: min(100%, 820px);
  aspect-ratio: 1.18 / 1;
  min-height: 520px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 0;
  box-shadow: var(--shadow);
  padding: clamp(42px, 7vw, 92px) clamp(34px, 8vw, 64px);
}

.rib-preview header {
  display: block;
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: clamp(58px, 8vw, 78px);
  text-align: center;
}

.rib-preview h2 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: clamp(2rem, 4.2vw, 2.65rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.rib-subtitle {
  margin-bottom: 36px;
  color: var(--muted);
  font-size: clamp(1.42rem, 2.9vw, 1.85rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.05;
}

.rib-layout {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  column-gap: clamp(34px, 6vw, 58px);
  row-gap: 28px;
}

.rib-field {
  min-width: 0;
  border-top: 2px solid var(--line);
  padding-top: 8px;
}

.rib-field h4 {
  margin: -34px 0 13px;
  color: var(--ink);
  font-size: clamp(1.28rem, 2.7vw, 1.68rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.05;
  text-transform: uppercase;
}

.rib-preview p {
  margin-bottom: 0;
  color: var(--ink);
  font-size: clamp(1.08rem, 1.95vw, 1.22rem);
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.iban-block p {
  font-family: inherit;
  font-size: clamp(1.25rem, 2.55vw, 1.48rem);
  letter-spacing: 0;
  white-space: normal;
}

.holder-block p + p {
  margin-top: 18px;
  color: var(--ink);
  font-weight: 500;
}

.bic-block p {
  font-size: clamp(1.25rem, 2.55vw, 1.48rem);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
  transform: translateY(20px);
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  padding: 13px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .preview-panel {
    padding-bottom: 28px;
  }
}

@media (max-width: 560px) {
  .editor-panel {
    padding: 18px;
  }

  .two-columns,
  .rib-layout {
    grid-template-columns: 1fr;
  }

  .rib-preview {
    aspect-ratio: auto;
    min-height: 660px;
  }

  .action-row {
    align-items: stretch;
    flex-direction: column;
  }
}
