:root {
  --role-color: #9363de;
  --admin-paper: #f4f6fb;
  --admin-ink: #172435;
  --admin-soft: #4b6077;
  --admin-line: #aabbd0;
  --admin-surface: #ffffffd9;
  --admin-header: #dee4ee;
  --admin-frost: #eef4ffb8;
  --admin-shine: #ffffffde;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --admin-paper: #111722;
  --admin-ink: #eef4ff;
  --admin-soft: #b7c7dc;
  --admin-line: #586b87;
  --admin-surface: #172232ed;
  --admin-header: #28364a;
  --admin-frost: #152132be;
  --admin-shine: #eef6ff28;
  color-scheme: dark;
}

body { margin: 0; color: var(--admin-ink); background: var(--admin-paper); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
#app {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 0 18%, color-mix(in srgb, var(--role-color) 48%, transparent), transparent 65%),
    radial-gradient(ellipse at 100% 78%, color-mix(in srgb, var(--role-color) 32%, transparent), transparent 70%),
    var(--admin-paper);
}
#app button, #app input, #app textarea, #app select { font: inherit; color: inherit; }
#app button, #app select, #app input:not([type="checkbox"]), #app textarea {
  min-height: 36px;
  border: 1px solid var(--admin-line);
  border-radius: 7px;
  padding: 7px 10px;
  background: var(--admin-surface);
}
#app button { cursor: pointer; line-height: 1.25; }
#app button:hover:not(:disabled) { border-color: var(--role-color); background: var(--ui-surface-hover); }
#app button:disabled { opacity: .48; cursor: default; }
#app button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--role-color) 75%, var(--admin-ink));
  background: color-mix(in srgb, var(--role-color) 17%, var(--admin-paper));
}
#app button.primary { background: #253952; color: #fff; border-color: #253952; }
#app a { color: var(--admin-ink); text-underline-offset: 3px; }
#app button:focus-visible, #app a:focus-visible, #app input:focus-visible,
#app textarea:focus-visible, #app select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--role-color) 75%, var(--admin-ink));
  outline-offset: 3px;
}
#app .square { width: 34px; min-width: 34px; height: 34px; padding: 7px; display: grid; place-items: center; }
#app h1, #app h2, #app h3 { margin: 0; line-height: 1.3; font-weight: 600; }
#app h1 { font-size: 23px; }
#app h2 { font-size: 17px; }
#app h3 { font-size: 14px; }
#app p { line-height: 1.55; }
.muted { color: var(--admin-soft); }
.small { font-size: 12px; }
.glass {
  background:
    radial-gradient(circle, #57749909 .6px, transparent .85px) 0 0 / 3px 3px,
    linear-gradient(136deg, var(--admin-shine), transparent 49%),
    var(--admin-frost);
  backdrop-filter: blur(22px) saturate(125%);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
  box-shadow: inset 0 1px 0 var(--admin-shine);
}
.admin-header {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto auto auto auto;
  align-items: center;
  gap: 14px;
  min-height: 86px;
  padding: 17px 22px;
  border-bottom: 1px solid var(--admin-line);
  position: relative;
  z-index: 4;
}
.admin-brand strong { display: block; font-size: 21px; letter-spacing: .01em; }
.admin-brand strong span { font-size: 17px; font-weight: 400; }
.admin-brand small { display: block; margin-top: 5px; font-size: 11px; color: var(--admin-soft); }
.admin-switch { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--admin-line); border-radius: 9px; }
#app .admin-switch button { font-size: 12px; min-height: 32px; padding: 6px 9px; border-color: transparent; background: transparent; white-space: nowrap; }
#app .admin-switch button[aria-pressed="true"] { border-color: var(--admin-line); background: var(--admin-surface); }
.admin-switch small { font-size: 10px; }
.role-controls { display: flex; gap: 5px; align-items: center; font-size: 12px; }
#app .role-controls select { width: 130px; min-height: 36px; padding: 6px; font-size: 12px; }
.admin-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 9px; padding: 11px 20px; font-size: 12px; border-top: 1px solid var(--admin-line); background: var(--admin-surface); }
.admin-footer > div { display: flex; gap: 17px; align-items: center; }
#app .admin-footer button { min-height: 28px; font-size: 12px; padding: 4px 8px; }
.admin-error { color: var(--ui-danger); background: var(--ui-danger-surface); border: 1px solid var(--ui-danger); border-radius: 8px; padding: 12px; overflow-wrap: anywhere; }
.loading { padding: 36px; margin: 0; }
.login-stage { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); border: 1px solid var(--admin-line); border-radius: 18px; padding: 30px; }
.login-card > button { width: 100%; }
.admin-field { display: grid; gap: 7px; margin: 15px 0; font-size: 12px; }
.admin-field > span { font-weight: 600; }
.admin-field input, .admin-field textarea { width: 100%; }
.admin-field input[type="color"] { width: 46px; height: 34px; min-height: 34px; padding: 3px !important; }
.admin-field input[type="checkbox"] { width: 18px; }
.admin-field small { color: var(--admin-soft); }
#catalog-dialog { width: min(900px, calc(100vw - 36px)); max-height: calc(100dvh - 36px); }

@media (max-width: 1180px) {
  .admin-header { grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 10px; }
  .admin-brand { grid-column: 1 / -1; }
  .admin-header .role-controls { justify-self: start; }
  .admin-header .admin-settings { justify-self: end; }
}
@media (max-width: 640px) {
  .admin-header { display: flex; flex-wrap: wrap; padding: 15px; }
  .admin-brand { width: 100%; }
  .admin-footer > div { flex-wrap: wrap; gap: 12px; }
  #app .admin-switch button { font-size: 12px; }
  .admin-header .admin-settings { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}
