:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #1d1a16;
  --muted: #5c564c;
  --line: #d9d0c3;
  --accent: #8a3b12;
  --accent-hover: #6e2e0d;
  --error: #8f1d1d;
  --ok: #21543a;
}

* {
  box-sizing: border-box;
}

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

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.header p {
  margin: 0 0 24px;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 1.02rem;
}

.abonent {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.abonent-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 12px;
}

.abonent-row {
  display: grid;
  gap: 12px 16px;
}

.abonent-row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.abonent-row-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.abonent-swap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.abonent-details {
  margin-top: 14px;
}

.abonent-details summary {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.abonent-details[open] summary {
  margin-bottom: 2px;
}

.button-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  white-space: normal;
  line-height: 1.3;
}

.button-secondary:hover:not(:disabled) {
  background: #f7f3ec;
}

@media (max-width: 900px) {
  .abonent-row-3,
  .abonent-row-4 {
    grid-template-columns: 1fr;
  }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
}

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

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label,
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
}

.combobox {
  position: relative;
}

.combobox-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 280px;
  margin: 4px 0 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(29, 26, 22, 0.14);
}

.combobox-option {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.combobox-option:hover,
.combobox-option.active {
  background: #f0e7d8;
}

.combobox-empty {
  padding: 8px 10px;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

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

.actions {
  margin: 8px 0 20px;
}

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

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status {
  margin: 0;
  color: var(--muted);
}

.status.error {
  color: var(--error);
}

.status.ok {
  color: var(--ok);
}

.metadata {
  margin: 16px 0 0;
  padding: 12px;
  overflow: auto;
  background: #f7f3ec;
  border-radius: 8px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.85rem;
}

.hidden {
  display: none;
}
