:root {
  --bg: #f4f6f9; --card: #fff; --ink: #18212f; --muted: #6a7686; --line: #e2e7ee; --line2: #cfd6e0;
  --brand: #1f6feb; --brand-ink: #1558c4; --brand-soft: #e9f1fe; --ok: #1a9f5c; --ok-soft: #e5f6ed;
  --warn: #b76a00; --warn-soft: #fff4dd; --bad: #d1373f; --bad-soft: #fdeced;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }

/* ---- controls ---- */
.btn { text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: #fff; border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f6f8fb; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon { border: 0; background: none; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; flex: none; }
.icon:hover { background: #eef1f5; color: var(--ink); }
.icon.del:hover { background: var(--bad-soft); color: var(--bad); }
.icon:disabled { opacity: .25; cursor: default; background: none; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], select, textarea {
  border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
input.ghost { border-color: transparent; background: transparent; }
input.ghost:hover { border-color: var(--line2); background: #fff; }
label.field { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea, label.field > .row { margin-top: 5px; font-weight: 400; color: var(--ink); font-size: 15px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; user-select: none; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { width: 38px; height: 22px; border-radius: 11px; background: #c5ccd6; position: relative; transition: background .15s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { left: 18px; }
.switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch .off { color: var(--bad); }
.switch .on { color: var(--ok); }

/* ---- sign in ---- */
.auth { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth .card { width: 100%; max-width: 400px; padding: 30px; }
.auth h1 { font-size: 22px; margin: 14px 0 4px; }
.auth form { display: grid; gap: 14px; margin-top: 20px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.logo b { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 15px; }
.err { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 9px 12px; font-size: 14px; }

/* ---- shell ---- */
.shell { display: flex; min-height: 100%; }
.side { width: 220px; flex: none; background: #fff; border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .logo { padding: 0 8px 18px; }
.side nav { display: grid; gap: 2px; }
.side nav a { display: block; padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; }
.side nav a:hover { background: #f1f4f8; }
.side nav a.on { background: var(--brand-soft); color: var(--brand-ink); }
.side .foot { margin-top: auto; padding: 8px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.main { flex: 1; min-width: 0; padding: 26px 30px 60px; max-width: 1280px; }
.banner { border-radius: 10px; padding: 11px 15px; margin-bottom: 18px; background: var(--warn-soft); color: var(--warn); font-weight: 600; display: flex; align-items: center; gap: 12px; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner .grow { font-weight: 500; }
.head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { font-size: 24px; }
.head p { color: var(--muted); margin-top: 3px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.card + .card { margin-top: 16px; }
.plans > .card, .stats > .card, .grid > .card { margin-top: 0; }
.card > .top { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--line); }
.card > .pad { padding: 16px; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* ---- menu editor ---- */
.cat-name { font-size: 17px; font-weight: 700; }
.item-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 14px; border-bottom: 1px solid var(--line); }
.item-row.out { background: #fafbfc; }
.item-row.out .i-name { text-decoration: line-through; color: var(--muted); }
.thumb { width: 44px; height: 44px; border-radius: 8px; border: 1px dashed var(--line2); background: #f6f8fb center/cover no-repeat; cursor: pointer; flex: none; color: var(--muted); font-size: 18px; padding: 0; }
.thumb.has { border-style: solid; }
.i-text { flex: 1; min-width: 120px; display: grid; gap: 2px; }
.i-name { font-weight: 600; }
.i-desc { font-size: 13px; color: var(--muted); padding-top: 4px !important; padding-bottom: 4px !important; }
.i-badge { width: 112px !important; flex: none; font-size: 13px; }
.price { display: flex; align-items: center; border: 1px solid var(--line2); border-radius: 8px; background: #fff; width: 118px; flex: none; }
.price:focus-within { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.price span { padding-left: 10px; color: var(--muted); font-weight: 600; }
.price input { border: 0 !important; outline: 0 !important; background: none; font-weight: 700; font-size: 16px; padding-left: 4px; }
.add-row { padding: 10px 14px; }

/* ---- slideshows ---- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { border: 1px solid var(--line2); background: #fff; border-radius: 20px; padding: 6px 14px; font-weight: 600; cursor: pointer; }
.tabs button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 46%); gap: 20px; align-items: start; }
.split .right { position: sticky; top: 16px; }
.preview { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; border: 6px solid #10151d; }
.preview iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 720px; border: 0; transform-origin: 0 0; pointer-events: none; }
.themes { display: flex; gap: 8px; flex-wrap: wrap; }
.theme { border: 2px solid transparent; border-radius: 10px; padding: 3px; cursor: pointer; background: none; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.theme.on { border-color: var(--brand); color: var(--ink); }
.theme i { display: block; width: 62px; height: 38px; border-radius: 6px; border: 1px solid var(--line2); position: relative; margin-bottom: 3px; }
.theme i::after { content: ""; position: absolute; left: 8px; right: 22px; bottom: 9px; height: 5px; border-radius: 3px; background: var(--a); }
.slide-card .top { cursor: pointer; }
.slide-card .kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: #eef1f5; border-radius: 5px; padding: 3px 7px; flex: none; }
.slide-card .sum { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.slide-card.disabled .sum { color: var(--muted); text-decoration: line-through; }
.slide-card .top:only-child { border-bottom: 0; }
.form { display: grid; gap: 14px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; font-weight: 400; color: var(--ink); font-size: 14px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.pick { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.pick .thumb { width: 72px; height: 44px; }
.secs { width: 74px !important; flex: none; }

/* ---- screens ---- */
.steps { display: grid; gap: 6px; color: var(--muted); margin-bottom: 14px; padding-left: 20px; }
.steps b { color: var(--ink); }
.code-input { font: 700 22px Consolas, Menlo, monospace !important; letter-spacing: .2em; text-transform: uppercase; width: 180px !important; text-align: center; }
.screen-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.screen-row:last-child, .item-row:last-of-type { border-bottom: 0; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; width: 150px; flex: none; color: var(--muted); }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #b6bfcb; }
.status.on { color: var(--ok); }
.status.on::before { background: var(--ok); }

/* ---- media ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.tile .pic { aspect-ratio: 4 / 3; background: #10151d center/cover no-repeat; display: grid; place-items: center; color: #fff; font-size: 26px; width: 100%; border: 0; padding: 0; }
button.pic { cursor: pointer; }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .name { padding: 6px 8px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.tile .icon { position: absolute; top: 5px; right: 5px; background: rgba(255,255,255,.92); }
.modal { position: fixed; inset: 0; background: rgba(16,21,29,.5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 20; }
.modal .card { width: 100%; max-width: 760px; max-height: 86vh; display: flex; flex-direction: column; }
.modal .body { padding: 16px; overflow: auto; }

/* ---- billing ---- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.plan { padding: 18px; }
.plan.current { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.plan h3 { font-size: 17px; }
.plan .amount { font-size: 30px; font-weight: 800; margin: 8px 0 2px; }
.plan .amount small { font-size: 14px; font-weight: 500; color: var(--muted); }
.plan .btn { margin-top: 14px; width: 100%; justify-content: center; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 20px; padding: 2px 9px; background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

#toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 22px; font-weight: 600; opacity: 0; transition: all .2s; pointer-events: none; z-index: 30; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); }

@media (max-width: 980px) {
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; align-items: center; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .side .logo { padding: 0 10px 0 4px; }
  .side .logo span, .side .foot { display: none; }
  .side nav { display: flex; }
  .main { padding: 18px 14px 60px; }
  .split { grid-template-columns: 1fr; }
  .split .right { position: static; order: -1; }
  .item-row { flex-wrap: wrap; }
  .i-text { flex-basis: 60%; }
}
