/* ============================================================
   YUKA — base
   Shared reset, type, controls and overlays for store + admin
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, h4, h5, h6, ul, ol, dl, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--accent, #2358d6); color: var(--card, #fff); }

:root {
  --paper: #f2efe7;
  --ink: #1e241f;
  --accent: #2358d6;
  --accent-2: #e9dc6a;
  --soft: #e7e2d6;
  --card: #fffdf7;
  --line: #cec8ba;
  --radius: 10px;
  --display: "Songti SC", "Noto Serif SC", Georgia, serif;
  --sans: "Inter", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --shadow: 0 18px 50px -28px rgba(20, 28, 22, .45);
  --wrap: 1200px;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.wrap { width: min(var(--wrap), calc(100% - 48px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--mono); }
.serif { font-family: var(--display); }
.muted { color: color-mix(in srgb, var(--ink) 56%, transparent); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--ink);
  --btn-fg: var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) * .55);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.2;
  transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
  text-align: center;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }
.btn-accent { --btn-bg: var(--accent); --btn-fg: #fff; }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.btn-soft { --btn-bg: var(--soft); --btn-fg: var(--ink); }
.btn-danger { --btn-bg: #b5372b; --btn-fg: #fff; }
.btn-sm { min-height: 34px; padding: 7px 13px; font-size: 12.5px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.btn .arrow { transition: transform .18s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- forms ---------- */
.field { display: grid; gap: 7px; }
.field > label, .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 66%, transparent);
}
.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * .45);
  background: color-mix(in srgb, var(--card) 82%, transparent);
  color: var(--ink);
  font-size: 14px;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.textarea { min-height: 108px; resize: vertical; line-height: 1.65; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--ink) 36%, transparent); }
.input[disabled], .select[disabled], .textarea[disabled] { opacity: .55; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-note { font-size: 12px; line-height: 1.55; color: color-mix(in srgb, var(--ink) 52%, transparent); }
.form-error { color: #a72f24; font-size: 12.5px; min-height: 18px; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.range { width: 100%; accent-color: var(--accent); }

/* ---------- chips / tags ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.5;
  letter-spacing: .02em;
  white-space: nowrap;
}
.chip-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-soft { background: var(--soft); border-color: transparent; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- boot ---------- */
.boot-screen {
  min-height: 80vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
}
.boot-mark { font-family: var(--display); font-size: clamp(38px, 8vw, 76px); letter-spacing: .18em; }
.boot-line { width: 160px; height: 1px; background: var(--line); overflow: hidden; }
.boot-line span { display: block; width: 45%; height: 100%; background: var(--ink); animation: bootline 1.2s ease-in-out infinite; }
@keyframes bootline { 0% { transform: translateX(-120%); } 100% { transform: translateX(340%); } }

/* ---------- toast ---------- */
.toast-root {
  position: fixed;
  z-index: 1200;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 240px;
  max-width: min(380px, calc(100vw - 44px));
  padding: 13px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--card);
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, .5);
  font-size: 13.5px;
  line-height: 1.5;
  animation: toastin .25s ease both;
  pointer-events: auto;
}
.toast::before { content: ""; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--accent-2); flex: none; }
.toast.is-error::before { background: #ff7a66; }
.toast.is-out { animation: toastout .22s ease both; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastout { to { opacity: 0; transform: translateY(6px); } }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 23, 19, .55);
  backdrop-filter: blur(4px);
  animation: fadein .2s ease both;
}
.modal {
  position: relative;
  width: min(560px, 100%);
  max-height: min(86vh, 900px);
  overflow: auto;
  padding: 30px;
  border-radius: calc(var(--radius) * .9);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .55);
  animation: modalin .24s cubic-bezier(.2, .8, .2, 1) both;
}
.modal-wide { width: min(800px, 100%); }
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 18px;
  color: color-mix(in srgb, var(--ink) 60%, transparent);
}
.modal-close:hover { background: var(--soft); color: var(--ink); }
.modal-head { padding-right: 30px; margin-bottom: 22px; }
.modal-head h2 { font-family: var(--display); font-size: clamp(22px, 3vw, 30px); line-height: 1.25; letter-spacing: -.01em; }
.modal-head p { margin-top: 6px; font-size: 13px; color: color-mix(in srgb, var(--ink) 56%, transparent); }
@keyframes fadein { from { opacity: 0; } }
@keyframes modalin { from { opacity: 0; transform: translateY(14px) scale(.985); } }

/* ---------- misc ---------- */
.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 64px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: color-mix(in srgb, var(--ink) 55%, transparent);
}
.empty strong { font-family: var(--display); font-size: 22px; color: var(--ink); font-weight: 500; }
.divider { height: 1px; background: var(--line); border: 0; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton {
  background: linear-gradient(90deg, var(--soft) 25%, color-mix(in srgb, var(--soft) 55%, var(--card)) 50%, var(--soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 760px) {
  .wrap { width: calc(100% - 32px); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .modal { padding: 24px 20px; }
  .toast-root { right: 12px; left: 12px; bottom: 12px; align-items: stretch; }
  .toast { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
