.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 22px;
  border-radius: 999px; border: 1px solid var(--hairline); background: var(--surface); color: var(--bone);
  font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .25s var(--ease), background .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--witch-deep); background: var(--raised); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  color: #1A0F08; border-color: transparent; background: linear-gradient(180deg, #FFA048, #FF7A1A 55%, #E9600B);
  box-shadow: 0 8px 26px rgba(255, 122, 26, .32);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #FFB06A, #FF8A2E 55%, #F06A14); box-shadow: 0 12px 34px rgba(255, 122, 26, .5); }
.btn.danger { color: #FF8A8E; border-color: rgba(229, 72, 77, .5); background: rgba(229, 72, 77, .1); }
.btn.danger:hover:not(:disabled) { background: rgba(229, 72, 77, .22); border-color: var(--blood); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field > label, .label { color: var(--ash); font-size: 11.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 16px; border-radius: 14px; background: rgba(11, 10, 13, .75);
  border: 1px solid var(--hairline); transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover { border-color: #3a3342; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--pumpkin); box-shadow: 0 0 0 3px rgba(255, 122, 26, .2); }
.input[aria-invalid="true"] { border-color: var(--blood); box-shadow: 0 0 0 3px rgba(229, 72, 77, .18); }
.input:disabled, .select:disabled { opacity: .55; cursor: not-allowed; }
.select { appearance: none; padding-right: 40px; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--ash) 50%), linear-gradient(135deg, var(--ash) 50%, transparent 50%); background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%; background-size: 6px 6px; background-repeat: no-repeat; }
.hint { color: var(--ash); font-size: 12.5px; }
.hint.error { color: #FF8A8E; }
.counter { text-align: right; }

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--raised); color: var(--bone); border: 1px solid var(--hairline);
}
.chip.witch { background: var(--witch-shade); color: var(--witch); border-color: rgba(168, 139, 245, .4); }
.chip.pumpkin { background: var(--pumpkin-shade); color: var(--pumpkin-light); border-color: rgba(255, 122, 26, .4); }
.badge { padding: 3px 11px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.badge.live { color: var(--leaf); background: rgba(91, 211, 138, .12); box-shadow: inset 0 0 0 1px rgba(91, 211, 138, .4); }
.badge.draft { color: var(--candle); background: rgba(255, 210, 122, .1); box-shadow: inset 0 0 0 1px rgba(255, 210, 122, .35); }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(11, 10, 13, .75); border: 1px solid var(--hairline); }
.segmented button {
  min-height: 36px; padding: 0 18px; border: 0; border-radius: 999px; background: none; color: var(--ash); font-weight: 700; cursor: pointer;
  transition: background .25s var(--ease), color .25s var(--ease);
}
.segmented button:hover:not(:disabled) { color: var(--bone); }
.segmented button[aria-pressed="true"] { background: linear-gradient(180deg, #FFA048, #FF7A1A); color: #1A0F08; }
.segmented button:disabled { opacity: .4; cursor: not-allowed; }

.panel {
  position: relative; padding: 26px; border-radius: 24px; background: linear-gradient(180deg, rgba(23, 18, 31, .88), rgba(14, 12, 18, .88));
  border: 1px solid transparent; background-clip: padding-box;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(168, 139, 245, .16), inset 0 1px 0 rgba(255, 178, 122, .12);
}
.panel + .panel { margin-top: 20px; }
.panel h2 { font-size: 18px; margin-bottom: 4px; }
.panel .lead { color: var(--ash); margin-bottom: 20px; }

.progress { height: 8px; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--pumpkin), var(--candle)); transition: width .2s linear; }

.list { display: grid; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 16px; background: rgba(11, 10, 13, .6);
  border: 1px solid var(--hairline); text-align: left; width: 100%; color: inherit;
  transition: border-color .25s var(--ease), transform .25s var(--ease), background .25s var(--ease);
}
button.item { cursor: pointer; }
button.item:hover, button.item[aria-pressed="true"] { border-color: var(--witch); background: var(--witch-shade); transform: translateX(3px); }
.item .meta { min-width: 0; }
.item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item small { display: block; color: var(--ash); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb { flex: none; width: 46px; height: 46px; border-radius: 12px; object-fit: cover; background: var(--witch-shade); display: grid; place-items: center; font-weight: 800; color: var(--witch); }
.mono { font-family: var(--mono); font-size: 12px; color: var(--ash); }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast {
  padding: 12px 18px; border-radius: 18px; background: rgba(20, 18, 23, .96); border: 1.5px solid rgba(255, 122, 26, .6);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55); font-weight: 600; animation: rise .35s var(--ease);
}
.toast.error { border-color: rgba(229, 72, 77, .75); }

dialog.sheet {
  width: min(520px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 24px; color: var(--bone); background: transparent; overflow: visible;
}
dialog.sheet::backdrop { background: rgba(5, 3, 8, .72); backdrop-filter: blur(8px); }
dialog.sheet[open] { animation: rise .35s var(--ease); }
dialog.sheet .panel { margin: 0; }
dialog.sheet .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
dialog.wide { width: min(760px, calc(100vw - 32px)); }
.scroll { max-height: min(52vh, 460px); overflow: auto; border-radius: 14px; }

.skeleton { border-radius: var(--radius); min-height: 150px; background: linear-gradient(100deg, var(--surface) 30%, var(--raised) 50%, var(--surface) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 70px 20px; text-align: center; }
.empty h2 { font-size: 22px; }
.empty .pumpkin { width: 96px; height: 96px; animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 0 24px rgba(255, 122, 26, .35)); }
.error-box { padding: 14px 18px; border-radius: 16px; border: 1px solid rgba(229, 72, 77, .5); background: rgba(229, 72, 77, .09); color: #FFB0B3; }

@keyframes spin { to { transform: rotate(360deg); } }
