:root {
  --bg: #07060d;
  --panel: #13101d;
  --panel-2: #1a1627;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f5f1e8;
  --muted: #a7a2b8;
  --dim: #6d6880;
  --gold: #d0ab5d;
  --gold-hi: #f6d58e;
  --cyan: #2ee6ff;
  --violet: #9d5cff;
  --danger: #ff5d73;
  --ok: #3ee89a;
  --font: "Readex Pro", "Segoe UI", Tahoma, system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--text);
  background:
    radial-gradient(600px 400px at 100% 0%, rgba(208,171,93,.12), transparent 70%),
    radial-gradient(700px 500px at 0% 100%, rgba(157,92,255,.12), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
button, input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }

/* buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: 11px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-strong); background: rgba(255,255,255,.04); font-weight: 500; font-size: 14px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.btn:hover { border-color: rgba(208,171,93,.55); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn-gold { background: linear-gradient(135deg, var(--gold-hi), var(--gold)); color: #1b1406; border-color: transparent; box-shadow: 0 0 18px rgba(208,171,93,.3); }
.btn-gold:hover { box-shadow: 0 0 26px rgba(208,171,93,.5); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: rgba(255,93,115,.6); }
.icon-only { width: 38px; padding: 0; }
.btn-sm { height: 32px; padding: 0 10px; border-radius: 9px; font-size: 13px; }
.btn-sm.icon-only { width: 32px; }
.btn-sm .ic { width: 16px; height: 16px; }

.input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 11px; outline: 0;
  background: rgba(0,0,0,.3); border: 1px solid var(--line-strong); transition: border-color .2s, box-shadow .2s;
}
textarea.input { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: rgba(208,171,93,.7); box-shadow: 0 0 0 3px rgba(208,171,93,.14); }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.field small { color: var(--dim); font-size: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 13.5px; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 999px; background: #2a2538; position: relative; cursor: pointer; transition: background .2s; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #8f8aa3; transition: transform .2s, background .2s; }
.switch input:checked { background: rgba(208,171,93,.35); }
.switch input:checked::after { transform: translateX(-18px); background: var(--gold-hi); box-shadow: 0 0 10px rgba(246,213,142,.8); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: min(380px, 100%); display: grid; gap: 12px; justify-items: center; text-align: center;
  padding: 34px 26px; border-radius: 24px; background: rgba(19,16,29,.8); border: 1px solid var(--line-strong);
  box-shadow: 0 0 60px rgba(157,92,255,.18);
}
.login-card img { filter: drop-shadow(0 0 14px rgba(208,171,93,.6)); margin-bottom: 4px; }
.login-card h1 { margin: 0; font-size: 24px; }
.login-card p { margin: 0 0 8px; color: var(--muted); }
.login-card .btn { width: 100%; height: 44px; }
.form-error { min-height: 20px; color: var(--danger); font-size: 13px; }

/* shell */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 18px; background: rgba(7,6,13,.85); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.bar-brand { display: flex; align-items: center; gap: 10px; }
.bar-brand img { filter: drop-shadow(0 0 8px rgba(208,171,93,.5)); }
.bar-brand b { display: block; line-height: 1.2; }
.bar-brand small { color: var(--muted); font-size: 12px; }
.bar-actions { display: flex; gap: 8px; }
.nav { display: flex; gap: 6px; padding: 12px 18px 0; max-width: 980px; margin: 0 auto; overflow-x: auto; }
.nav button {
  height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; white-space: nowrap;
}
.nav button[aria-current="true"] { background: linear-gradient(135deg, var(--gold-hi), var(--gold)); color: #1b1406; border-color: transparent; font-weight: 600; }
.main { max-width: 980px; margin: 0 auto; padding: 16px 18px 80px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.seg button { height: 32px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; cursor: pointer; }
.seg button[aria-current="true"] { background: var(--panel-2); box-shadow: inset 0 0 0 1px rgba(208,171,93,.5); color: var(--gold-hi); }
.hint { color: var(--muted); font-size: 13px; }

.cat-card { display: flex; align-items: center; gap: 14px; padding: 14px; margin-bottom: 16px; }
.cat-card .grow { flex: 1; min-width: 0; }
.cat-card b { font-size: 17px; }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); margin-inline-start: 6px; vertical-align: middle; }
.tag.on { color: var(--ok); border-color: rgba(62,232,154,.45); }
.tag.off { color: #ff8fe6; border-color: rgba(255,79,216,.45); }

.thumb {
  position: relative; width: 52px; height: 52px; border-radius: 13px; overflow: hidden; flex: none;
  display: grid; place-items: center; color: var(--gold-hi);
  background: radial-gradient(circle, rgba(157,92,255,.3), transparent 75%), #1b1530; border: 1px solid var(--line-strong);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ic { width: 55%; height: 55%; filter: drop-shadow(0 0 5px rgba(246,213,142,.6)); }
.thumb.lg { width: 64px; height: 64px; }

.section { margin-bottom: 12px; overflow: hidden; }
.section.hidden-sec { opacity: .6; }
.sec-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.sec-row .grow { flex: 1; min-width: 0; }
.sec-row b { font-size: 16px; }
.sec-row small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { transition: transform .2s; color: var(--dim); }
.section.open .chev { transform: rotate(180deg); }
.acts { display: flex; gap: 4px; flex: none; }
.items { border-top: 1px solid var(--line); padding: 6px 8px 10px; display: none; }
.section.open .items { display: block; }
.item-row { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 12px; }
.item-row:hover { background: rgba(255,255,255,.025); }
.item-row .thumb { width: 46px; height: 46px; border-radius: 11px; }
.item-row .grow { flex: 1; min-width: 0; }
.item-row .name { font-weight: 500; }
.item-row .name .tag { font-size: 11px; }
.item-row .cap { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row.muted .name, .item-row.muted .thumb { opacity: .5; }
.price-input { width: 108px; height: 36px; text-align: center; direction: ltr; font-weight: 600; color: var(--gold-hi); }
.price-input.saved { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(62,232,154,.15); }
.add-row { margin: 8px 6px 2px; }
@media (max-width: 640px) {
  .item-row { flex-wrap: wrap; }
  .item-row .grow { flex-basis: calc(100% - 60px); }
  .item-row .price-wrap { margin-inline-start: 56px; }
  .item-row .acts { margin-inline-start: auto; }
  .sec-row .acts .hide-sm { display: none; }
}

/* modal */
.modal { width: min(560px, calc(100% - 20px)); max-height: calc(100dvh - 20px); padding: 0; border: 0; background: transparent; color: var(--text); }
.modal::backdrop { background: rgba(4,3,8,.72); backdrop-filter: blur(5px); }
.modal-card { display: flex; flex-direction: column; max-height: calc(100dvh - 20px); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 20px; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 18px; display: grid; gap: 14px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }

.picker { display: flex; align-items: center; gap: 14px; }
.picker .preview {
  width: 116px; height: 116px; border-radius: 16px; overflow: hidden; flex: none; display: grid; place-items: center; color: var(--gold-hi);
  background: radial-gradient(circle, rgba(157,92,255,.3), transparent 75%), #1b1530; border: 1px dashed rgba(208,171,93,.45);
}
.picker .preview.wide { width: 190px; height: 100px; }
.picker .preview img { width: 100%; height: 100%; object-fit: cover; }
.picker .preview .ic { width: 46%; height: 46%; }
.picker .btns { display: grid; gap: 8px; }

.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.icon-opt {
  display: grid; justify-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: 11px; cursor: pointer; font-size: 10.5px; color: var(--muted);
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
}
.icon-opt .ic { width: 24px; height: 24px; color: var(--gold-hi); }
.icon-opt[aria-pressed="true"] { border-color: var(--gold); background: rgba(208,171,93,.12); color: var(--text); box-shadow: 0 0 12px rgba(208,171,93,.25); }
.badge-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-sugg button { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font-size: 12.5px; }

/* settings */
.settings { padding: 18px; display: grid; gap: 14px; }
.settings h3 { margin: 0; font-size: 16px; }

/* ratings */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { padding: 14px; text-align: center; }
.stat b { display: block; font-size: 26px; color: var(--gold-hi); text-shadow: 0 0 12px rgba(208,171,93,.5); }
.stat span { color: var(--muted); font-size: 12.5px; }
.rating { padding: 14px; margin-bottom: 10px; }
.rating-head { display: flex; align-items: center; gap: 10px; }
.rating-stars { color: var(--gold-hi); letter-spacing: 2px; direction: ltr; }
.rating-head .grow { flex: 1; }
.rating-head time { color: var(--dim); font-size: 12px; }
.rating p { margin: 8px 0 0; white-space: pre-wrap; }
.rating .meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }

/* qr */
.qr-wrap { display: grid; grid-template-columns: minmax(0, 320px) 1fr; gap: 20px; padding: 20px; align-items: center; }
@media (max-width: 640px) { .qr-wrap { grid-template-columns: 1fr; } }
.qr-wrap img { border-radius: 18px; border: 1px solid var(--line-strong); }
.qr-wrap .btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.qr-url { direction: ltr; text-align: right; font-weight: 600; color: var(--cyan); word-break: break-all; }

.toast {
  position: fixed; bottom: 22px; left: 50%; translate: -50% 0; z-index: 100; padding: 10px 18px; border-radius: 12px;
  background: #1c1730; border: 1px solid rgba(208,171,93,.5); box-shadow: 0 10px 30px rgba(0,0,0,.5); font-size: 14px;
}
.toast.error { border-color: rgba(255,93,115,.6); color: #ffc2cb; }
