:root {
  color-scheme: light;
  --bg: #eef5f4;
  --panel: #ffffff;
  --text: #1d2a30;
  --muted: #60737a;
  --line: #cfdedd;
  --accent: #236f82;
  --accent-strong: #155568;
  --danger: #a33c3c;
  --danger-bg: #fff0f0;
  --focus: #7fb3c0;
  --shadow: 0 10px 28px rgba(26, 59, 70, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}

.app-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 24px 16px 40px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 700;
}

h2 {
  font-size: 18px;
  font-weight: 650;
}

.subtitle {
  color: var(--muted);
  margin-top: 2px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.tab {
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
}

.tab.is-active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}

.panel,
.access-denied {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.access-denied {
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

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

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(127, 179, 192, 0.22);
}

.form-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rows {
  display: grid;
  gap: 8px;
}

.data-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 44px;
  gap: 8px;
  align-items: center;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  min-height: 40px;
}

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

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

.secondary-button {
  padding: 8px 12px;
  color: var(--accent-strong);
  background: #f2f8f8;
  border-color: #bdd5d8;
}

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

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--accent-strong);
  background: #fff;
  border-color: var(--line);
}

.icon-button:hover {
  background: #f4f8f8;
}

.icon-button.danger {
  color: var(--danger);
}

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

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  padding: 10px 0;
}

.link-button:hover {
  text-decoration: underline;
}

.results-empty {
  color: var(--muted);
  padding: 18px 0 4px;
}

.result-stack {
  display: grid;
  gap: 18px;
  margin-top: 16px;
}

.result-block {
  display: grid;
  gap: 8px;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 32px));
  padding: 12px 14px;
  background: #1d2a30;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
  text-align: center;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 18px 12px 32px;
  }

  .panel {
    padding: 14px;
  }

  .section-grid,
  .data-row,
  .result-row {
    grid-template-columns: 1fr;
  }

  .data-row {
    position: relative;
    padding-right: 48px;
  }

  .data-row .icon-button {
    position: absolute;
    right: 0;
    top: 26px;
  }

  .section-header,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
