:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --line: #ccd3da;
  --line-soft: #e3e7eb;
  --text: #1f252c;
  --muted: #64707c;
  --muted-2: #8a949e;
  --accent: #607080;
  --accent-strong: #3f4d5a;
  --accent-soft: #e3e9ee;
  --accent-ink: #ffffff;
  --danger: #a84b4b;
  --danger-bg: #f9eeee;
  --warn: #7a6470;
  --success: #426b5b;
  --success-bg: #edf5f1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(96, 112, 128, 0.12), transparent 340px),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(96, 112, 128, 0.22);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.token-drawer {
  border-bottom: 1px solid rgba(96, 112, 128, 0.18);
  background: rgba(255, 255, 255, 0.94);
}

.token-inline-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  width: min(900px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 14px 0;
}

.token-inline-form label {
  margin-bottom: 0;
}

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

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(96, 112, 128, 0.42);
  border-radius: 8px;
  color: var(--accent-strong);
  background: #f7f9fb;
}

.shell {
  width: min(1480px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.section {
  margin-bottom: 26px;
}

.hero-band {
  padding: 8px 0 4px;
}

.section-head,
.detail-head,
.field-row,
.grid-2,
.grid-3 {
  display: grid;
  gap: 18px;
}

.section-head,
.detail-head {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.grid-2 {
  grid-template-columns: minmax(280px, 0.8fr) minmax(380px, 1.2fr);
  align-items: start;
}

.grid-3 {
  grid-template-columns: repeat(4, minmax(230px, 1fr));
}

.metrics-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.2fr) minmax(260px, 0.8fr);
  gap: 18px;
}

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

h1,
h2 {
  margin: 0 0 10px;
  font-weight: 650;
}

h1 {
  max-width: 760px;
  font-size: 36px;
  line-height: 1.08;
}

h2 {
  font-size: 18px;
}

.lead {
  max-width: 640px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.panel {
  padding: 18px;
  border: 1px solid rgba(96, 112, 128, 0.2);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.64), transparent), var(--surface);
  box-shadow: 0 18px 50px rgba(31, 37, 44, 0.08);
}

label {
  display: block;
  margin-bottom: 12px;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.checkbox-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.checkbox-row span {
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: none;
}

.checkbox-row a {
  color: var(--accent-strong);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  color: var(--text);
  font: inherit;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(96, 112, 128, 0.14);
}

textarea {
  resize: vertical;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 92px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  min-height: 30px;
  padding: 5px 9px;
  transform: translateY(-50%);
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.password-toggle:hover {
  border-color: var(--line-soft);
  background: var(--surface-2);
}

button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

button:hover,
.link-button:hover {
  border-color: var(--accent);
  background: #eef3f7;
}

.primary {
  border-color: var(--accent);
  background: #465665;
  color: var(--accent-ink);
}

.primary:hover {
  background: #2f3b46;
}

.danger {
  border-color: rgba(185, 74, 67, 0.5);
  color: var(--danger);
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(96, 112, 128, 0.2);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(31, 37, 44, 0.06);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #edf1f4;
  color: var(--accent-strong);
  font-size: 11px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

tr:hover td {
  background: rgba(96, 112, 128, 0.045);
}

.badge,
.token-state {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f7f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.badge.big {
  min-height: 31px;
  font-size: 14px;
}

.badge.warn {
  border-color: rgba(122, 100, 112, 0.34);
  background: #f2eef1;
  color: var(--warn);
}

.token-state.ok {
  border-color: rgba(63, 125, 90, 0.36);
  background: var(--success-bg);
  color: var(--success);
}

.token-state.bad,
.error {
  border-color: rgba(185, 74, 67, 0.34);
  background: var(--danger-bg);
  color: var(--danger);
}

.token-state {
  cursor: pointer;
  text-decoration: none;
}

.token-card,
.top-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button-row {
  flex-wrap: wrap;
}

.token-card {
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 11px;
  border: 1px solid rgba(96, 112, 128, 0.2);
  border-radius: 8px;
  background: var(--surface-2);
}

.notice {
  margin-bottom: 18px;
  padding: 11px 13px;
  border: 1px solid rgba(63, 125, 90, 0.26);
  border-radius: 8px;
  background: var(--success-bg);
  color: var(--success);
}

.error {
  margin-bottom: 16px;
  padding: 11px 13px;
  border-radius: 8px;
}

.back {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}

.variant-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 18px;
}

.gallery-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}

.gallery-item {
  margin: 0;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.gallery-item figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.upload-thumb {
  position: relative;
  cursor: grab;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 8px;
}

.upload-thumb.dragging {
  opacity: 0.55;
}

.upload-thumb img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  margin-bottom: 6px;
}

.upload-thumb span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 28px;
  padding: 4px 8px;
  border-color: rgba(168, 75, 75, 0.38);
  background: rgba(255, 255, 255, 0.92);
  color: var(--danger);
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(31, 37, 44, 0.14);
}

.upload-remove:hover {
  border-color: rgba(168, 75, 75, 0.7);
  background: var(--danger-bg);
}

.range-calendar {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid rgba(96, 112, 128, 0.22);
  border-radius: 8px;
  background: #f8fafb;
}

.range-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.range-summary strong {
  color: var(--accent-strong);
}

.range-calendar-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(260px, 1fr);
  gap: 14px;
}

.calendar-widget,
.calendar-note {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #ffffff;
}

.calendar-widget {
  padding: 12px;
}

.calendar-head {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  text-align: center;
}

.calendar-head strong {
  color: var(--text);
  text-transform: capitalize;
}

.calendar-nav {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  min-height: 36px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--text);
  font-weight: 700;
}

.calendar-day:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.calendar-day.outside {
  color: var(--muted-2);
}

.calendar-day.disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.calendar-day.in-range {
  background: #e9eef2;
}

.calendar-day.range-start,
.calendar-day.range-end {
  border-color: var(--accent-strong);
  background: #465665;
  color: #ffffff;
}

.calendar-notes {
  display: grid;
  gap: 12px;
}

.calendar-note {
  padding: 14px;
}

.calendar-note strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.calendar-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.photo-cell {
  padding: 13px;
  border: 1px solid rgba(96, 112, 128, 0.18);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 38px rgba(31, 37, 44, 0.06);
}

.photo-cell.changed {
  border-color: rgba(96, 112, 128, 0.58);
  box-shadow: inset 0 0 0 1px rgba(96, 112, 128, 0.1), 0 14px 38px rgba(31, 37, 44, 0.06);
}

.photo-index {
  margin-bottom: 9px;
  color: var(--accent-strong);
  font-weight: 700;
}

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

figure {
  margin: 0;
}

figcaption {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eef2f5;
}

.thumb {
  width: 54px;
  height: 72px;
}

.missing {
  display: grid;
  min-height: 160px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 11px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #2a251d;
  color: #fff8ea;
  font-size: 12px;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
}

.variant-metrics {
  display: grid;
  gap: 12px;
}

.metric-variant {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfcfd;
}

.metric-variant h3,
.panel h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.metric-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.metric-list div {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 12px;
  align-items: baseline;
}

.metric-list dt {
  color: var(--muted);
  font-size: 13px;
}

.metric-list dd {
  margin: 0;
  color: var(--text);
  font-weight: 750;
}

.metric-list.compact {
  margin-top: 8px;
}

.url-cell {
  max-width: 520px;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.empty {
  color: var(--muted);
  text-align: center;
}

.legal-content {
  max-width: 960px;
}

.legal-content h2 {
  margin-top: 22px;
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content p {
  color: var(--muted);
  line-height: 1.65;
}

.status-stack {
  display: grid;
  justify-items: end;
  gap: 7px;
}

@media (max-width: 1180px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

@media (max-width: 980px) {
  .grid-2,
  .grid-3,
  .metrics-grid,
  .variant-gallery-grid,
  .range-calendar-layout,
  .detail-head,
  .section-head {
    grid-template-columns: 1fr;
  }

  .status-stack {
    justify-items: start;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
  }

  .token-inline-form {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100vw - 20px, 1480px);
    padding-top: 18px;
  }

  h1 {
    font-size: 30px;
  }

  .field-row,
  .compare {
    grid-template-columns: 1fr;
  }
}
