@font-face {
  font-family: "Montserrat";
  src: url("../fonts/Montserrat-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/Montserrat-Italic-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f3f5fb;
  --bg-grad-1: radial-gradient(900px 500px at -10% -20%, #dcecff 0%, transparent 55%);
  --bg-grad-2: radial-gradient(900px 500px at 110% 120%, #efe9ff 0%, transparent 58%);
  --bg-grad-3: linear-gradient(180deg, #f8faff 0%, #eef2fb 100%);
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --panel-border: rgba(255, 255, 255, 0.75);
  --panel-shadow-1: 0 20px 45px rgba(17, 40, 84, 0.12);
  --panel-shadow-2: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  --text: #1d2433;
  --muted: #5f6b82;
  --line: #d8dfec;
  --line-strong: #c4cee1;
  --accent: #0f6cbd;
  --accent-dark: #115ea3;
  --accent-soft: #d6e9fb;
  --ok: #107c10;
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --surface-soft: linear-gradient(160deg, #f9fcff 0%, #edf5ff 100%);
  --surface-shadow: 0 8px 18px rgba(31, 72, 128, 0.12);
  --footer-text: #445572;
  --footer-meta: #6f7f98;
  --table-head-bg: #f4f8ff;
  --table-head-text: #38557d;
  --preview-canvas-border: #cdd9ec;
}

:root[data-theme="dark"] {
  --bg: #111621;
  --bg-grad-1: radial-gradient(900px 500px at -10% -20%, #1c2d4a 0%, transparent 60%);
  --bg-grad-2: radial-gradient(900px 500px at 110% 120%, #2d2348 0%, transparent 62%);
  --bg-grad-3: linear-gradient(180deg, #151d2b 0%, #0f141e 100%);
  --panel: rgba(22, 31, 46, 0.82);
  --panel-strong: rgba(26, 37, 56, 0.94);
  --panel-border: rgba(165, 194, 239, 0.15);
  --panel-shadow-1: 0 22px 50px rgba(3, 7, 14, 0.5);
  --panel-shadow-2: 0 1px 0 rgba(168, 192, 229, 0.12) inset;
  --text: #f4f8ff;
  --muted: #c2d0e8;
  --line: #32435f;
  --line-strong: #4e6387;
  --accent: #5ea6f3;
  --accent-dark: #3d8de4;
  --accent-soft: #233a58;
  --surface-soft: linear-gradient(160deg, #1d2b41 0%, #202f47 100%);
  --surface-shadow: 0 10px 24px rgba(2, 7, 17, 0.4);
  --footer-text: #c5d2ea;
  --footer-meta: #98abcd;
  --table-head-bg: #22344f;
  --table-head-text: #e1ecff;
  --preview-canvas-border: #40536f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Montserrat", sans-serif;
  color: var(--text);
  background:
    var(--bg-grad-1),
    var(--bg-grad-2),
    var(--bg-grad-3),
    var(--bg);
  min-height: 100vh;
}

.controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.controls-header h1 {
  margin: 0;
}

.controls-header .theme-toggle {
  border: 1px solid #b8cff0;
  border-radius: 999px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.96), rgba(232, 243, 255, 0.92));
  color: #244a79;
  box-shadow: var(--surface-shadow);
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.controls-header .theme-toggle-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(15, 108, 189, 0.16);
  font-size: 0.88rem;
}

:root[data-theme="dark"] .controls-header .theme-toggle {
  border-color: #7fa8df;
  background: linear-gradient(150deg, rgba(38, 53, 79, 0.96), rgba(30, 45, 69, 0.92));
  color: #f1f7ff;
}

:root[data-theme="dark"] .controls-header .theme-toggle-icon {
  background: rgba(94, 166, 243, 0.22);
}

.site-footer {
  max-width: 1400px;
  margin: 4px auto 26px;
  padding: 0 28px;
}

.site-footer-card {
  margin: 0 auto;
  max-width: 980px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.78), rgba(244, 249, 255, 0.9));
  backdrop-filter: blur(10px);
  box-shadow:
    0 10px 26px rgba(20, 52, 102, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.72) inset;
  padding: 12px 16px;
}

.site-footer-main,
.site-footer-meta {
  margin: 0;
  text-align: center;
}

.site-footer-main {
  font-size: 0.84rem;
  color: var(--footer-text);
}

.site-footer-meta {
  margin-top: 5px;
  font-size: 0.77rem;
  color: var(--footer-meta);
  letter-spacing: 0.03em;
}

.site-footer a {
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
  border-radius: 6px;
  padding: 1px 4px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.site-footer a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background-color: rgba(15, 108, 189, 0.08);
}

:root[data-theme="dark"] .site-footer-card {
  border-color: rgba(153, 183, 230, 0.22);
  background: linear-gradient(160deg, rgba(28, 42, 63, 0.9), rgba(22, 34, 52, 0.9));
}

:root[data-theme="dark"] .quick-steps {
  color: #d7e4fb;
  border-color: #45608a;
}

:root[data-theme="dark"] .controls .section-head:not(:first-of-type) {
  border-top-color: rgba(140, 167, 206, 0.35);
}

:root[data-theme="dark"] .spoiler-meta {
  color: #d6e7ff;
  border-color: #5b7eac;
  background: rgba(35, 52, 78, 0.9);
}

:root[data-theme="dark"] .subtitle.compact,
:root[data-theme="dark"] .hint,
:root[data-theme="dark"] .import-status,
:root[data-theme="dark"] .page-info {
  color: #d0ddf3;
}

:root[data-theme="dark"] input {
  color: #f4f8ff;
  border-color: #536b92;
  background: #1d2a3f;
}

:root[data-theme="dark"] input::placeholder {
  color: #a9bddb;
}

:root[data-theme="dark"] .table-wrap,
:root[data-theme="dark"] .preview-toolbar {
  border-color: #4a6288;
  background: rgba(31, 46, 69, 0.78);
}

:root[data-theme="dark"] th,
:root[data-theme="dark"] td {
  border-bottom-color: #4a6288;
}

:root[data-theme="dark"] button.ghost {
  background: rgba(37, 54, 82, 0.92);
  color: #ecf4ff;
  border-color: #6e95ca;
  box-shadow: 0 8px 18px rgba(2, 8, 19, 0.38);
}

:root[data-theme="dark"] .empty-state {
  color: #d8e6ff;
  background: #203552;
  border-color: #5a7eaf;
}

:root[data-theme="dark"] .color-spoiler summary,
:root[data-theme="dark"] .import-spoiler summary {
  color: #c8dcf8;
  border-color: #4a6990;
  background: linear-gradient(160deg, rgba(30, 44, 66, 0.96), rgba(24, 37, 58, 0.92));
  box-shadow: 0 8px 18px rgba(2, 8, 20, 0.38);
}

:root[data-theme="dark"] .color-spoiler summary::before,
:root[data-theme="dark"] .import-spoiler summary::before {
  color: #91baf0;
  background: rgba(94, 166, 243, 0.12);
}

:root[data-theme="dark"] .color-spoiler summary::after,
:root[data-theme="dark"] .import-spoiler summary::after {
  color: #91baf0;
}

:root[data-theme="dark"] .color-spoiler summary:hover,
:root[data-theme="dark"] .import-spoiler summary:hover {
  border-color: #6a90be;
  box-shadow: 0 12px 24px rgba(2, 8, 20, 0.5);
}

:root[data-theme="dark"] .color-spoiler summary:focus-visible,
:root[data-theme="dark"] .import-spoiler summary:focus-visible {
  border-color: #7eaedf;
  box-shadow:
    0 0 0 3px rgba(94, 166, 243, 0.22),
    0 12px 24px rgba(2, 8, 20, 0.4);
}

:root[data-theme="dark"] .color-spoiler[open],
:root[data-theme="dark"] .import-spoiler[open] {
  background: linear-gradient(170deg, rgba(22, 33, 52, 0.97), rgba(18, 28, 46, 0.97));
  box-shadow:
    0 14px 28px rgba(2, 8, 20, 0.45),
    0 1px 0 rgba(168, 192, 229, 0.1) inset;
}

:root[data-theme="dark"] .color-spoiler[open] summary,
:root[data-theme="dark"] .import-spoiler[open] summary {
  border-color: #5c84b4;
  box-shadow: 0 10px 24px rgba(2, 8, 20, 0.4);
}

.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  gap: 24px;
  grid-template-columns: 1.4fr 1fr;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  padding: 22px;
  backdrop-filter: blur(14px) saturate(130%);
  box-shadow:
    var(--panel-shadow-1),
    var(--panel-shadow-2);
  animation: fade-slide-in 0.5s ease both;
}

h1,
h2 {
  margin: 0 0 10px;
}

.subtitle {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.subtitle.compact {
  margin: 0 0 10px;
  font-size: 0.88rem;
}

.quick-steps {
  margin: 0 0 18px;
  padding: 12px 14px 12px 36px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: #41516c;
  font-size: 0.9rem;
  box-shadow: var(--surface-shadow);
}

.quick-steps li + li {
  margin-top: 4px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 30px 0 12px;
}

.controls .section-head:not(:first-of-type) {
  padding-top: 18px;
  border-top: 1px solid rgba(154, 174, 206, 0.32);
}

.section-head h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(120deg, var(--accent-dark), var(--accent));
  box-shadow: 0 6px 18px rgba(15, 108, 189, 0.28);
}

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

.color-spoiler,
.import-spoiler {
  margin: 8px 0 2px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: transparent;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.import-spoiler {
  margin-top: 10px;
}

.color-spoiler summary,
.import-spoiler summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 11px 13px;
  color: #274b78;
  border: 1px solid #bfd4f3;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(234, 243, 255, 0.92));
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--surface-shadow);
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.color-spoiler summary::-webkit-details-marker,
.import-spoiler summary::-webkit-details-marker {
  display: none;
}

.color-spoiler summary::before,
.import-spoiler summary::before {
  content: ">";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 14px;
  font-weight: 800;
  margin-right: 2px;
  color: #3a5f91;
  background: rgba(15, 108, 189, 0.1);
  border-radius: 999px;
  transition: transform 0.15s ease;
}

.color-spoiler summary::after,
.import-spoiler summary::after {
  content: "+";
  margin-left: auto;
  font-size: 1.1rem;
  font-weight: 800;
  color: #3a5f91;
  transition: transform 0.15s ease;
}

.color-spoiler summary:hover,
.import-spoiler summary:hover {
  transform: translateY(-1px);
  border-color: #9cc0eb;
  box-shadow: 0 12px 24px rgba(31, 72, 128, 0.16);
}

.color-spoiler summary:focus-visible,
.import-spoiler summary:focus-visible {
  outline: none;
  border-color: #7eaedf;
  box-shadow:
    0 0 0 3px rgba(15, 108, 189, 0.18),
    0 12px 24px rgba(31, 72, 128, 0.16);
}

.color-spoiler[open],
.import-spoiler[open] {
  border-color: var(--line-strong);
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.94), rgba(242, 248, 255, 0.94));
  box-shadow:
    0 14px 28px rgba(26, 66, 120, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.color-spoiler[open] summary,
.import-spoiler[open] summary {
  border-color: #8ab4e8;
  box-shadow: 0 10px 24px rgba(15, 108, 189, 0.2);
}

.color-spoiler[open] summary::after,
.import-spoiler[open] summary::after {
  transform: rotate(45deg);
}

.color-spoiler[open] summary::before,
.import-spoiler[open] summary::before {
  transform: rotate(90deg);
}

.color-grid {
  padding: 8px 12px 12px;
}

.spoiler-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 12px 12px;
}

.spoiler-actions .ghost {
  padding: 8px 12px;
  font-size: 0.82rem;
}

.spoiler-title {
  font-weight: 750;
}

.spoiler-meta {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #5d7ca5;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #c8d9f0;
  background: rgba(255, 255, 255, 0.85);
}

.import-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 0 12px 12px;
}

.import-row input[type="file"] {
  flex: 1 1 260px;
  background: #fff;
}

.import-status {
  min-height: 20px;
  margin: 0;
  padding: 0 12px 12px;
  font-size: 0.83rem;
  color: #3f5680;
}

.import-spoiler .subtitle.compact {
  line-height: 1.45;
  margin: 10px 12px 12px;
}

.import-spoiler .actions {
  margin: 0;
  padding: 0 12px 10px;
}

.import-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  padding: 0 12px 12px;
}

.import-row input[type="file"] {
  flex: initial;
  min-width: 0;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #ced9ea;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.import-row input[type="file"]::file-selector-button {
  border: 1px solid #bfd4f3;
  border-radius: 9px;
  padding: 7px 10px;
  margin-right: 10px;
  font: inherit;
  font-weight: 700;
  color: #234c7e;
  background: linear-gradient(145deg, #ffffff, #eef5ff);
  cursor: pointer;
}

.import-row button {
  white-space: nowrap;
}

:root[data-theme="dark"] .import-spoiler .subtitle.compact,
:root[data-theme="dark"] .import-status {
  color: #dbe7fb;
}

:root[data-theme="dark"] .import-row input[type="file"] {
  border-color: #5d79a2;
  color: #eef5ff;
  background: linear-gradient(180deg, #1f2e45, #1c2a3f);
  box-shadow: inset 0 1px 0 rgba(175, 205, 246, 0.08);
}

:root[data-theme="dark"] .import-row input[type="file"]::file-selector-button {
  border-color: #6f97cd;
  color: #eef5ff;
  background: linear-gradient(145deg, #34507a, #2b446a);
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.88rem;
  gap: 6px;
  font-weight: 600;
}

input {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

input:focus {
  outline: none;
  border-color: #6ea8df;
  box-shadow:
    0 0 0 3px rgba(15, 108, 189, 0.17),
    0 6px 16px rgba(15, 108, 189, 0.1);
  transform: translateY(-1px);
}

.hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

input[type="color"] {
  padding: 4px;
  height: 44px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

button {
  border: none;
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, var(--accent-dark), var(--accent));
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(15, 108, 189, 0.23);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

button:hover {
  transform: translateY(-1px) scale(1.01);
  filter: brightness(1.03);
  box-shadow: 0 14px 28px rgba(15, 108, 189, 0.27);
}

button.ghost {
  background: rgba(255, 255, 255, 0.86);
  color: #204a7d;
  border: 1px solid #c7d7ee;
  box-shadow: 0 6px 14px rgba(30, 72, 126, 0.08);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--surface-shadow);
}

.sort-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
}

.sort-controls label {
  margin-right: 2px;
  font-size: 0.84rem;
  color: #35557f;
  font-weight: 700;
}

.sort-controls select {
  min-width: 210px;
  height: 38px;
  border: 1px solid #c7d7ee;
  border-radius: var(--radius-md);
  padding: 0 10px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
}

.sort-controls button {
  padding: 9px 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

td.editable-cell {
  cursor: text;
}

.cell-edit-input {
  width: 100%;
  min-width: 60px;
  padding: 3px 7px;
  font: inherit;
  font-size: inherit;
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(15, 108, 189, 0.15);
  outline: none;
  box-sizing: border-box;
}

:root[data-theme="dark"] .cell-edit-input {
  box-shadow: 0 0 0 3px rgba(94, 166, 243, 0.2);
}

th {
  background: var(--table-head-bg);
  color: var(--table-head-text);
}

.counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: #17518f;
  background: var(--accent-soft);
}

.empty-state {
  margin: 10px 0 0;
  font-size: 0.86rem;
  color: #435779;
  background: #f3f8ff;
  border: 1px dashed #b7cae7;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.remove-btn {
  padding: 0 12px;
  height: 32px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid #d3e0f1;
  background: rgba(255, 255, 255, 0.72);
}

.move-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1;
}

.move-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.move-btn svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row-actions .ghost {
  box-shadow: none;
}

.row-actions .remove-btn {
  margin-left: 0;
}

:root[data-theme="dark"] .row-actions {
  border-color: #5576a4;
  background: rgba(23, 35, 53, 0.7);
}

:root[data-theme="dark"] .sort-controls {
  border-color: #4a6288;
  background: rgba(31, 46, 69, 0.78);
}

:root[data-theme="dark"] .sort-controls label {
  color: #d9e7ff;
}

:root[data-theme="dark"] .sort-controls select {
  color: #f4f8ff;
  border-color: #5d79a2;
  background: rgba(27, 40, 60, 0.92);
}

:root[data-theme="dark"] .row-actions .ghost {
  background: rgba(40, 59, 89, 0.94);
  color: #eef6ff;
  border-color: #6e95ca;
}

.reorder-hint {
  margin-top: 8px;
}

.draggable-row {
  cursor: grab;
}

.draggable-row:active {
  cursor: grabbing;
}

.draggable-row td {
  transition: box-shadow 0.14s ease, background-color 0.14s ease;
}

.draggable-row:focus-visible td {
  outline: 2px solid #2f77bf;
  outline-offset: -2px;
}

.draggable-row.is-dragging {
  opacity: 0.55;
}

.draggable-row.drop-before td {
  box-shadow: inset 0 3px 0 #2f77bf;
}

.draggable-row.drop-after td {
  box-shadow: inset 0 -3px 0 #2f77bf;
}

:root[data-theme="dark"] .draggable-row.drop-before td {
  box-shadow: inset 0 3px 0 #84bdf8;
}

:root[data-theme="dark"] .draggable-row.drop-after td {
  box-shadow: inset 0 -3px 0 #84bdf8;
}

:root[data-theme="dark"] .draggable-row:focus-visible td {
  outline-color: #84bdf8;
}

.preview-panel {
  position: sticky;
  top: 12px;
  height: fit-content;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--surface-shadow);
}

.preview-toolbar button {
  padding: 7px 10px;
  font-size: 0.8rem;
}

.page-info {
  min-width: 115px;
  text-align: center;
  font-size: 0.82rem;
  color: #3f5d86;
  font-weight: 700;
}

#previewCanvas {
  width: 100%;
  max-width: 405px;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  border: 1px solid var(--preview-canvas-border);
  display: block;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 22px 44px rgba(28, 57, 109, 0.18);
}

.controls > * {
  animation: fade-slide-in 0.45s ease both;
}

.controls > *:nth-child(1) { animation-delay: 0.02s; }
.controls > *:nth-child(2) { animation-delay: 0.04s; }
.controls > *:nth-child(3) { animation-delay: 0.06s; }
.controls > *:nth-child(4) { animation-delay: 0.08s; }
.controls > *:nth-child(5) { animation-delay: 0.1s; }
.controls > *:nth-child(6) { animation-delay: 0.12s; }
.controls > *:nth-child(7) { animation-delay: 0.14s; }
.controls > *:nth-child(8) { animation-delay: 0.16s; }
.controls > *:nth-child(9) { animation-delay: 0.18s; }

@keyframes fade-slide-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

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

  .preview-panel {
    position: static;
  }
}

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

  .import-row {
    grid-template-columns: 1fr;
  }

  .import-row button {
    width: 100%;
    justify-content: center;
  }

  .sort-controls {
    align-items: stretch;
  }

  .sort-controls select,
  .sort-controls button {
    width: 100%;
  }
}
