:root {
  color-scheme: dark;
  --bg: #080d14;
  --bg-soft: #0d1420;
  --panel: #121a27;
  --panel-strong: #172233;
  --text: #eef5ff;
  --muted: #91a1b8;
  --line: #263349;
  --brand: #5eead4;
  --brand-dark: #2dd4bf;
  --brand-ink: #042f2e;
  --danger: #fb7185;
  --success: #34d399;
  --warning: #fbbf24;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --input-bg: #0b111b;
  --button-text: #04111f;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fb;
  --bg-soft: #eef4fb;
  --panel: #ffffff;
  --panel-strong: #f8fafc;
  --text: #152033;
  --muted: #607089;
  --line: #dbe3ef;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-ink: #ffffff;
  --danger: #b42318;
  --success: #067647;
  --warning: #c2410c;
  --shadow: 0 18px 40px rgba(30, 41, 59, 0.08);
  --input-bg: #ffffff;
  --button-text: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(94, 234, 212, 0.16), transparent 34rem),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
  color: var(--text);
}

a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 74px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.topbar-nav,
.topbar-actions,
.oauth-row,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-nav {
  justify-content: center;
}

.topbar-actions {
  justify-content: flex-end;
}

.nav-link,
.ghost-btn,
.button-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, var(--text) 4%);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.ghost-btn:hover,
.nav-link:hover,
.button-link:hover {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  background: color-mix(in srgb, var(--panel) 70%, var(--brand) 12%);
}

.site-brand {
  width: fit-content;
  max-width: 100%;
  min-height: 52px;
  display: inline-grid;
  grid-template-columns: 44px minmax(0, auto);
  align-items: center;
  gap: 12px;
  padding: 6px 12px 6px 6px;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 78%, var(--brand) 7%);
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 13px;
  background:
    radial-gradient(circle at 28% 24%, #ffffff 0 8%, transparent 9%),
    linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 38%, #7c3aed));
  box-shadow: 0 14px 28px color-mix(in srgb, var(--brand) 18%, transparent);
}

.brand-mark > span {
  position: absolute;
  display: block;
  background: color-mix(in srgb, var(--brand-ink) 90%, transparent);
  border-radius: 999px;
}

.brand-mark > span:first-child {
  width: 20px;
  height: 5px;
  transform: rotate(-38deg) translate(1px, -4px);
}

.brand-mark > span:nth-child(2) {
  width: 18px;
  height: 5px;
  transform: rotate(38deg) translate(2px, 6px);
}

.brand-mark.has-image {
  background: var(--panel-strong);
  box-shadow: none;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-name {
  min-width: 0;
  max-width: 260px;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.auth-first {
  align-items: start;
  padding-top: clamp(24px, 6vw, 82px);
}

.admin-title {
  padding: 22px 0 26px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p { overflow-wrap: anywhere; }

h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 16px;
  font-size: 24px;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

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

.admin-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow);
}

.admin-sidebar-title {
  padding: 4px 4px 8px;
  border-bottom: 1px solid var(--line);
}

.admin-sidebar-title h2 {
  margin: 0;
  font-size: 20px;
}

.admin-nav-btn {
  justify-content: flex-start;
  min-height: 42px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.admin-nav-btn:hover,
.admin-nav-btn.is-active {
  border-color: color-mix(in srgb, var(--brand) 44%, var(--line));
  background: color-mix(in srgb, var(--brand) 14%, var(--panel));
  color: var(--text);
}

.admin-main {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.admin-tab-panel {
  min-width: 0;
}

.admin-settings-form {
  display: contents;
}

.settings-save-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.profile-grid {
  display: grid;
  gap: 14px;
}

.profile-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 82%, transparent);
}

.profile-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.profile-card-head h3 {
  margin: 0;
}

.profile-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.profile-meta div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 78%, var(--text) 4%);
}

.profile-meta span,
.profile-detail span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.profile-meta strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.profile-detail {
  display: grid;
  gap: 6px;
}

.profile-detail code {
  display: block;
  overflow-wrap: anywhere;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.profile-tags strong {
  margin-right: 4px;
}

.profile-tags span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 76%, var(--text) 4%);
  color: var(--muted);
  font-size: 13px;
}

.dashboard {
  display: grid;
  gap: 22px;
}

.dashboard-tabs {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 82%, var(--text) 4%);
}

.tab-btn {
  min-height: 38px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.tab-btn:hover,
.tab-btn.is-active {
  border-color: color-mix(in srgb, var(--brand) 44%, var(--line));
  background: color-mix(in srgb, var(--brand) 16%, var(--panel));
  color: var(--text);
}

.tab-panel {
  min-width: 0;
}

.compact-form {
  max-width: 680px;
}

.order-plan-grid {
  margin-top: 6px;
}

.entry-pages-field {
  display: grid;
  gap: 10px;
}

.entry-pages-list {
  display: grid;
  gap: 10px;
}

.entry-page-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 76%, transparent);
}

.entry-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.entry-page-head strong {
  font-size: 14px;
}

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

.entry-page-row label {
  margin-top: 0;
}

.entry-page-add {
  justify-self: start;
}

.mobile-ratio-field {
  display: grid;
  gap: 10px;
}

.ratio-head,
.ratio-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ratio-head span,
.ratio-labels {
  color: var(--muted);
  font-size: 13px;
}

.ratio-head strong {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
}

.mobile-ratio-input {
  width: 100%;
  min-height: 32px;
  margin: 0;
  accent-color: var(--brand);
  direction: rtl;
}

.ratio-labels span:last-child {
  text-align: right;
}

.schedule-field {
  display: grid;
  gap: 10px;
}

.schedule-head,
.schedule-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.schedule-head span {
  color: var(--muted);
  font-size: 13px;
}

.schedule-head strong {
  color: var(--text);
  font-size: 14px;
}

.schedule-canvas {
  width: 100%;
  height: 420px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel-strong) 86%, transparent), color-mix(in srgb, var(--input-bg) 94%, transparent));
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.schedule-actions {
  justify-content: flex-end;
}

.panel {
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

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

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

label {
  display: block;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 700;
}

fieldset {
  min-width: 0;
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

legend {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  width: min(420px, 100%);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 82%, var(--text) 4%);
}

.segmented-control label {
  margin: 0;
  min-width: 0;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}

.segmented-control input:checked + span {
  border-color: color-mix(in srgb, var(--brand) 44%, var(--line));
  background: color-mix(in srgb, var(--brand) 16%, var(--panel));
  color: var(--text);
}

input,
textarea {
  width: 100%;
  margin-top: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  outline: 3px solid color-mix(in srgb, var(--brand) 24%, transparent);
}

.geo-search-box {
  position: relative;
}

.geo-suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.geo-suggestion {
  width: 100%;
  min-height: 44px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.geo-suggestion:hover {
  background: color-mix(in srgb, var(--brand) 12%, var(--panel));
}

.geo-suggestion span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.geo-picker-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, var(--text) 4%);
}

.geo-picker-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.geo-picker-field strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.geo-picker-field .ghost-btn {
  grid-row: 1 / span 2;
  grid-column: 2;
  margin-top: 0;
}

.geo-picker-panel {
  width: min(1040px, 100%);
  height: min(780px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.geo-picker-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  overflow: hidden;
}

.geo-picker-countries,
.geo-picker-regions {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.geo-country-row,
.geo-check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
}

.geo-country-row.active,
.geo-country-row:hover,
.geo-check-row:hover {
  background: color-mix(in srgb, var(--brand) 12%, var(--panel));
}

.geo-country-row input,
.geo-check-row input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.geo-country-row span,
.geo-check-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.geo-country-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.geo-picker-tree {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
}

.geo-picker-tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.geo-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.geo-picker-tree-head .ghost-btn,
.geo-picker-actions .ghost-btn {
  margin-top: 0;
}

.geo-picker-search {
  width: 100%;
  min-height: 42px;
  margin: 0;
}

.geo-picker-empty {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.geo-region-node {
  border-bottom: 1px solid var(--line);
}

.geo-city-list {
  padding: 0 0 8px 34px;
}

.geo-check-row.city {
  min-height: 38px;
  padding: 7px 12px;
  border-bottom: 0;
  color: var(--muted);
}

.geo-picker-footer-actions {
  flex-shrink: 0;
  margin-top: 0;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
}

.geo-picker-footer-actions button {
  min-width: 132px;
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 78%, transparent);
}

button,
.primary-btn {
  min-height: 42px;
  margin-top: 16px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: var(--button-text);
  font-weight: 700;
  cursor: pointer;
}

button:hover,
.primary-btn:hover { background: var(--brand-dark); }

.oauth-row {
  margin-top: 14px;
}

.oauth-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  text-decoration: none;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(440px, calc(100% - 36px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.toast.success { color: var(--success); }
.toast.error { color: var(--danger); }
.toast.info { color: var(--brand); }

.orders-list {
  display: grid;
  gap: 12px;
}

.order-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.order-card-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 8px;
  color: var(--muted);
}

.order-card-main {
  align-items: flex-start;
  margin-top: 0;
}

.order-card-row strong { color: var(--text); }

.order-card-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.order-card-actions .ghost-btn {
  margin-top: 0;
}

.icon-btn {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, var(--text) 4%);
  color: var(--muted);
  cursor: pointer;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-btn:hover {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  background: color-mix(in srgb, var(--panel) 70%, var(--brand) 12%);
  color: var(--text);
}

.danger-icon:hover {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
  background: color-mix(in srgb, var(--danger) 16%, var(--panel));
  color: var(--danger);
}

.log-icon:hover {
  border-color: color-mix(in srgb, var(--brand) 58%, var(--line));
  background: color-mix(in srgb, var(--brand) 18%, var(--panel));
  color: var(--brand);
}

.stats-icon:hover {
  border-color: color-mix(in srgb, var(--success) 58%, var(--line));
  background: color-mix(in srgb, var(--success) 16%, var(--panel));
  color: var(--success);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

#geo-picker-modal {
  z-index: 140;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(10px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(12px);
}

.modal-head h2 {
  margin-bottom: 4px;
}

.modal-head .icon-btn {
  font-size: 22px;
  line-height: 1;
}

.modal-form {
  padding: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions .ghost-btn,
.modal-actions button {
  margin-top: 0;
}

.order-stats-panel {
  width: min(980px, 100%);
  height: min(720px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.visit-log-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.visit-log-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 86%, transparent);
}

.visit-log-top,
.visit-log-metrics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.visit-log-top {
  margin-bottom: 12px;
}

.visit-log-top span {
  color: var(--muted);
  font-size: 13px;
}

.visit-log-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.visit-log-metric {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, var(--text) 3%);
}

.visit-log-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.visit-log-metric strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visit-log-metric .visit-device {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  color: var(--text);
}

.visit-log-metric .visit-device svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: currentColor;
}

.visit-log-metric .visit-device.mobile {
  color: var(--brand);
}

.visit-log-metric .visit-device.desktop {
  color: var(--success);
}

.visit-log-metric .visit-device span {
  display: inline;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transition-details {
  margin-top: 12px;
  color: var(--muted);
}

.transition-details summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 700;
}

.transition-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.transition-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 78%, var(--text) 4%);
}

.transition-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#visit-log-more {
  margin: 0 18px 18px auto;
}

.order-stats-body {
  flex: 1;
  display: grid;
  gap: 16px;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  padding: 18px;
  overflow: auto;
}

.order-stats-body.is-loading .order-stats-summary div,
.order-stats-body.is-loading .order-stats-chart {
  opacity: 0.68;
  transition: opacity 0.16s ease;
}

.stats-period-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  width: min(560px, 100%);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 82%, var(--text) 4%);
}

.stats-period-tabs button {
  min-height: 36px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.stats-period-tabs button.active {
  border-color: color-mix(in srgb, var(--brand) 44%, var(--line));
  background: color-mix(in srgb, var(--brand) 16%, var(--panel));
  color: var(--text);
}

.order-stats-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.order-stats-summary div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.order-stats-summary strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-stats-summary span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.order-stats-chart-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.order-stats-body.is-loading .order-stats-chart-wrap::after {
  content: "Обновляю";
  position: absolute;
  right: 18px;
  top: 18px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.order-stats-chart {
  width: 100%;
  height: 100%;
  min-height: 320px;
  display: block;
  border-radius: 8px;
  background: var(--panel);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 18%, var(--panel));
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.status-pill.saved {
  background: color-mix(in srgb, var(--brand) 14%, var(--panel));
  color: var(--brand);
}

.status-pill.done {
  background: color-mix(in srgb, var(--success) 18%, var(--panel));
  color: var(--success);
}

.status-pill.error {
  background: color-mix(in srgb, var(--danger) 18%, var(--panel));
  color: var(--danger);
}

.status-pill.processing {
  background: color-mix(in srgb, var(--warning) 18%, var(--panel));
  color: var(--warning);
}

.status-pill.active {
  background: color-mix(in srgb, var(--success) 18%, var(--panel));
  color: var(--success);
}

.status-pill.paused {
  background: color-mix(in srgb, var(--muted) 18%, var(--panel));
  color: var(--muted);
}

.site-footer {
  width: min(1120px, calc(100% - 32px));
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.user-label,
.hint {
  color: var(--muted);
  font-size: 14px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: auto;
  margin: 0;
}

.provider-box {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

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

.stats div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.stats strong {
  display: block;
  font-size: 26px;
}

.stats span {
  color: var(--muted);
  font-size: 13px;
}

.theme-switch {
  margin: 0;
  cursor: pointer;
}

.theme-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.theme-switch-track {
  position: relative;
  width: 172px;
  min-height: 42px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 8%, transparent);
}

.theme-switch-thumb {
  position: absolute;
  left: 4px;
  top: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border-radius: 999px;
  background: var(--brand);
  transition: transform 0.22s ease;
}

.theme-switch input:checked + .theme-switch-track .theme-switch-thumb {
  transform: translateX(100%);
}

.theme-switch-text {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: color 0.22s ease;
}

.theme-switch input:not(:checked) + .theme-switch-track .theme-dark,
.theme-switch input:checked + .theme-switch-track .theme-light {
  color: var(--button-text);
}

.hidden { display: none !important; }

code {
  padding: 2px 5px;
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
}

@media (max-width: 780px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 14px 16px;
  }

  .section-head,
  .site-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .topbar-nav {
    justify-content: space-between;
  }

  .auth-grid,
  .admin-grid,
  .admin-layout,
  .form-grid,
  .entry-page-grid,
  .profile-meta,
  .stats,
  .order-stats-summary,
  .visit-log-metrics {
    grid-template-columns: 1fr;
  }

  .stats-period-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .geo-picker-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .geo-picker-countries {
    max-height: 180px;
  }

  .geo-picker-field {
    grid-template-columns: 1fr;
  }

  .geo-picker-field .ghost-btn {
    grid-row: auto;
    grid-column: auto;
  }

  .geo-picker-tree-head,
  .geo-picker-footer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .geo-picker-actions,
  .geo-picker-footer-actions button {
    width: 100%;
  }

  .admin-sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-sidebar-title {
    grid-column: 1 / -1;
  }

  .transition-list li {
    grid-template-columns: 1fr;
  }
}
