:root {
  --bg: #0a0a0c; --bg2: #101013; --card: #15151a; --card2: #1b1b21; --line: #2a2720; --line2: #3a3426;
  --gold: #d4af37; --gold2: #f3d98b; --gold-dim: #8a7330; --text: #ece8dd; --muted: #9b958a; --faint: #6d685f;
  --ok: #5fbf7f; --warn: #e0a84a; --bad: #e0675a; --info: #7aa7e0;
  --r: 14px; --shadow: 0 18px 50px -24px #000;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; background: radial-gradient(1400px 700px at 50% -20%, #1c1910, var(--bg) 60%) fixed, var(--bg);
  color: var(--text); font: 15px/1.6 "Heebo", "Assistant", "Segoe UI", "Arial Hebrew", Arial, system-ui, sans-serif;
}
a { color: var(--gold2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 700; letter-spacing: .2px; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 16px; color: var(--gold2); }
.gold-text { background: linear-gradient(90deg, var(--gold), var(--gold2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12.5px; direction: ltr; unicode-bidi: embed; word-break: break-all; }
.ltr { direction: ltr; unicode-bidi: embed; }
.hidden { display: none !important; }

/* layout */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, #121215, #0c0c0e); border-inline-start: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--gold), #8d6d1c); display: grid; place-items: center; color: #111; font-size: 19px; box-shadow: 0 6px 20px -8px var(--gold); }
.brand b { font-size: 17px; display: block; } .brand span { font-size: 12px; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text); font-size: 14.5px; }
.nav a:hover { background: #1a1813; text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, #2a2412, #1a1710); color: var(--gold2); box-shadow: inset -3px 0 0 var(--gold); }
.nav .count { margin-inline-start: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.side-foot button { margin-top: 8px; width: 100%; }
.main { padding: 26px 30px 60px; max-width: 1280px; width: 100%; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.topbar h1 { margin: 0; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }

/* cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card.gold { border-color: var(--line2); background: linear-gradient(180deg, #19170f, var(--card)); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 2px; color: var(--gold2); font-variant-numeric: tabular-nums; }
.stat .value.bad { color: var(--bad); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* buttons & forms */
button, .btn { font: inherit; font-size: 14px; border-radius: 10px; padding: 8px 16px; cursor: pointer; border: 1px solid var(--line2); background: var(--card2); color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
button:hover:not(:disabled), .btn:hover { border-color: var(--gold-dim); text-decoration: none; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.primary { background: linear-gradient(180deg, #e2bf4c, #b38f25); color: #15120a; border-color: #c9a434; font-weight: 700; }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.danger { background: #2a1513; border-color: #5a2a24; color: #f1b3aa; }
.ghost { background: transparent; }
.sm { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
label.field { display: grid; gap: 5px; font-size: 13.5px; color: var(--muted); }
label.field > span b { color: var(--bad); font-weight: 400; }
input, select, textarea { font: inherit; font-size: 14.5px; color: var(--text); background: #0f0f12; border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; width: 100%; }
input[type=checkbox] { width: auto; accent-color: var(--gold); }
textarea { min-height: 90px; resize: vertical; }
input[type=datetime-local] { direction: ltr; }
.help { font-size: 12.5px; color: var(--faint); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

/* badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.b-draft { color: var(--muted); } .b-published { color: var(--ok); border-color: #2e5a3c; } .b-paused { color: var(--warn); border-color: #5a4524; }
.b-closed { color: var(--info); border-color: #2c4260; } .b-drawn { color: var(--gold2); border-color: var(--gold-dim); } .b-cancelled { color: var(--bad); border-color: #5a2a24; }
.b-paid, .b-processed { color: var(--ok); border-color: #2e5a3c; } .b-refunded { color: var(--info); border-color: #2c4260; }
.b-disputed, .b-duplicate, .b-error { color: var(--warn); border-color: #5a4524; } .b-rejected { color: var(--bad); }
.b-test { color: #c79bf2; border-color: #4b3460; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: start; font-weight: 600; color: var(--muted); font-size: 12.5px; background: #121215; position: sticky; top: 0; }
th, td { padding: 9px 12px; border-bottom: 1px solid #211f1a; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #17150f; }
td.num { font-variant-numeric: tabular-nums; }
.empty { padding: 28px; text-align: center; color: var(--faint); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-radius: 0; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--gold2); border-bottom-color: var(--gold); }

/* alerts, toasts, modal */
.alert { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; border: 1px solid; }
.alert.warn { background: #221b0e; border-color: #5a4524; color: #f0d3a0; }
.alert.bad { background: #241210; border-color: #5a2a24; color: #f1b3aa; }
.alert.ok { background: #0f1f15; border-color: #2e5a3c; color: #b9e6c7; }
.alert.info { background: #0f1724; border-color: #2c4260; color: #bcd3f2; }
.alert ul { margin: 6px 0 0; padding-inline-start: 18px; }
#toasts { position: fixed; bottom: 20px; left: 20px; display: grid; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 40px)); }
.toast { background: var(--card2); border: 1px solid var(--line2); border-inline-start: 4px solid var(--gold); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; }
.toast.bad { border-inline-start-color: var(--bad); } .toast.ok { border-inline-start-color: var(--ok); }
.modal-back { position: fixed; inset: 0; background: #000b; display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--card); border: 1px solid var(--line2); border-radius: 16px; padding: 22px; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow); }
.modal h2 { color: var(--gold2); }
.modal .body { margin: 8px 0 16px; color: var(--text); white-space: pre-wrap; }
.modal .confirm-word { color: var(--gold2); font-weight: 700; }

/* login */
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 410px; padding: 30px 28px; }
.login .brand { justify-content: center; padding-bottom: 8px; }
.login form { display: grid; gap: 14px; margin-top: 14px; }

/* preview of the telegram post */
.tg-preview { background: #17212b; color: #e9eef3; border-radius: 12px; padding: 12px 14px; font-size: 14px; white-space: pre-wrap; max-width: 460px; border: 1px solid #22303d; }
.tg-preview img { width: 100%; border-radius: 8px; margin-bottom: 8px; display: block; }
.tg-btn { margin-top: 6px; background: #2b5278; color: #fff; text-align: center; border-radius: 8px; padding: 7px; font-size: 13.5px; }
.thumb { max-width: 220px; border-radius: 10px; border: 1px solid var(--line2); display: block; }
.checks { display: grid; gap: 6px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.winner-box { text-align: center; padding: 18px; border: 1px solid var(--gold-dim); border-radius: 14px; background: radial-gradient(400px 160px at 50% 0, #2a2410, transparent); }
.winner-box .ticket { font-size: 44px; font-weight: 800; color: var(--gold2); letter-spacing: 1px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line2); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 0 0 auto; width: 250px; z-index: 40; transform: translateX(110%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px 16px 50px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3, .g2, .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; }
}
.grow { flex: 1; min-width: 220px; }
progress { flex: 1; height: 10px; accent-color: var(--gold); min-width: 120px; }
ol { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; }
/* editor */
.editor { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 18px; align-items: start; }
.sticky { position: sticky; top: 16px; }
.toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.toolbar button { padding: 4px 10px; font-size: 13px; border-radius: 8px; min-width: 34px; justify-content: center; }
.counter { font-size: 12.5px; color: var(--faint); text-align: end; }
.counter.bad { color: var(--bad); }
.btn-row { border: 1px dashed var(--line2); border-radius: 12px; padding: 10px; display: grid; gap: 8px; margin-bottom: 10px; }
.btn-row-head { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.btn-edit { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 8px; }
.btn-edit .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.url-out { font-size: 12px; color: var(--faint); direction: ltr; text-align: left; word-break: break-all; }
.tg-chat { background: #0e1621; border-radius: 14px; padding: 14px; border: 1px solid #1f2b38; }
.tg-msg { background: #182533; color: #e9eef3; border-radius: 12px; overflow: hidden; max-width: 420px; margin-inline-start: auto; }
.tg-msg img { width: 100%; display: block; }
.tg-body { padding: 8px 12px 10px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.tg-body a { color: #6ab3f3; }
.tg-body blockquote { border-inline-start: 3px solid #6ab3f3; margin: 4px 0; padding-inline-start: 8px; }
.tg-body code, .tg-body pre { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: #0e1621; border-radius: 4px; padding: 1px 4px; }
.tg-body tg-spoiler { background: #6b7a89; color: transparent; border-radius: 3px; }
.tg-keys { display: grid; gap: 4px; max-width: 420px; margin-inline-start: auto; margin-top: 4px; }
.tg-keys .r { display: grid; gap: 4px; grid-auto-flow: column; grid-auto-columns: 1fr; }
.tg-keys .k { background: #2b5278cc; color: #fff; text-align: center; border-radius: 8px; padding: 8px 6px; font-size: 13.5px; position: relative; }
.tg-keys .k small { position: absolute; top: 2px; left: 5px; font-size: 10px; opacity: .7; }
.post-card { display: grid; grid-template-columns: 84px 1fr auto; gap: 14px; align-items: center; }
.post-card .ph { width: 84px; height: 64px; border-radius: 10px; background: #1b1b21 center/cover no-repeat; border: 1px solid var(--line); display: grid; place-items: center; color: var(--faint); font-size: 22px; overflow: hidden; }
.post-card .ph img { width: 100%; height: 100%; object-fit: cover; }
.post-card .t { font-weight: 600; }
.post-card .sub { font-size: 13px; color: var(--muted); }
.b-removed { color: var(--bad); border-color: #5a2a24; }
.steps { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
@media (max-width: 1000px) { .editor { grid-template-columns: 1fr; } .sticky { position: static; } }
@media (max-width: 600px) { .post-card { grid-template-columns: 64px 1fr; } .post-card .acts { grid-column: 1 / -1; } .btn-edit .grid3 { grid-template-columns: 1fr; } }
