/* UPLY — стили админки и публичного сайта */
:root {
  --bg: #f4f6fb; --card: #ffffff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --brand: #1d4ed8; --brand-d: #1e3a8a; --brand-l: #dbeafe; --star: #f5b400;
  --ok: #047857; --ok-l: #d1fae5; --warn: #b45309; --warn-l: #fef3c7; --bad: #b91c1c; --bad-l: #fee2e2;
  --radius: 10px; --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 2px 8px rgba(15, 23, 42, .04);
  --font: "Segoe UI", Roboto, "Noto Sans", "Noto Sans Hebrew", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
code { font-family: Consolas, "Cascadia Mono", monospace; font-size: .9em; background: #f1f5f9; padding: .05em .35em; border-radius: 4px; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.num { text-align: end; font-variant-numeric: tabular-nums; }
.w1 { width: 1%; }
.plain { list-style: none; padding: 0; margin: 0 0 1rem; }
.plain li { padding: .2rem 0; }

/* ---------- кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2; }
.btn:hover { border-color: #cbd5e1; background: #f8fafc; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.danger { color: var(--bad); border-color: #fecaca; }
.btn.warn { color: var(--warn); border-color: #fde68a; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; justify-content: center; }
.btn.big { padding: .8rem 1.4rem; font-size: 1.05rem; }
.link { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; padding: .5rem .6rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; max-width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid #93c5fd; outline-offset: 1px; }
input[readonly] { background: #f8fafc; }
textarea { width: 100%; resize: vertical; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; min-width: 0; }
.field > label { font-weight: 600; font-size: .9rem; }
.field input:not([type=checkbox]):not([type=radio]), .field select { width: 100%; }
.field small { color: var(--muted); font-size: .8rem; }
.field.check label { font-weight: 500; display: flex; gap: .5rem; align-items: flex-start; }
.field.check input { margin-top: .25rem; }
.req { color: var(--bad); }
.input-row { display: flex; gap: .5rem; }
.input-row input { flex: 1; min-width: 0; }
.input-row .w-num { flex: 0 0 5.5rem; }
.input-row select { width: auto !important; flex: 1; min-width: 0; }
.w-num { width: 5.5rem !important; }
.w-code { width: 8rem; }
.radio-row { border: 0; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.form-actions { margin-top: .5rem; }
.narrow-form { max-width: 520px; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }

/* ---------- раскладка админки ---------- */
body.admin { display: grid; grid-template-columns: 230px 1fr; grid-template-rows: 56px 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; padding: 0 1rem; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .brand img { display: block; height: 32px; width: auto; }
.topbar .quick { flex: 1; max-width: 420px; }
.topbar .quick input { width: 100%; }
.topbar .who { margin-inline-start: auto; display: flex; gap: .9rem; align-items: center; font-size: .9rem; }
.menu-toggle { display: none; background: none; border: 0; font-size: 1.4rem; cursor: pointer; padding: .25rem .5rem; }
.sidebar { background: #fff; border-inline-end: 1px solid var(--line); padding: .75rem .5rem; position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; }
.sidebar a { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-radius: 8px; color: var(--text); font-weight: 500; }
.sidebar a:hover { background: #f1f5f9; text-decoration: none; }
.sidebar a.active { background: var(--brand-l); color: var(--brand-d); }
.sidebar .ic { width: 1.2rem; text-align: center; opacity: .75; }
.sidebar .pill { margin-inline-start: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: .75rem; padding: 0 .45rem; }
.sidebar .ver { color: var(--muted); font-size: .75rem; padding: 1rem .7rem 0; }
.content { padding: 1.25rem 1.5rem 3rem; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; }
.form h2 { margin-top: .5rem; padding-top: .5rem; }
.form h2:not(:first-of-type) { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }
.count { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--muted); background: #eef2f7; border-radius: 999px; padding: 0 .55rem; vertical-align: middle; }
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash-ok { background: var(--ok-l); color: #065f46; border-color: #a7f3d0; }
.flash-error { background: var(--bad-l); color: #991b1b; border-color: #fecaca; }
.flash-warn { background: var(--warn-l); color: #92400e; border-color: #fde68a; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: #f8fafc; }
.table tbody tr:hover { background: #f8fafc; }
.table.small td { font-size: .85rem; }
.table .kv { font-size: .8rem; max-width: 340px; word-break: break-word; }
tr.dim td { opacity: .55; }
tr.strike td { text-decoration: line-through; }
a.code, .code-title { font-family: Consolas, "Cascadia Mono", monospace; font-weight: 700; letter-spacing: .02em; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; align-items: center; }
.filters input[type=search] { min-width: 240px; flex: 1; }
.filters.inline { margin: 0; }
form.inline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0; }
.sheet-bar { justify-content: space-between; margin-bottom: .75rem; }
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-top: 1rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem .9rem; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.totals { margin: 0 0 1rem; }

/* ---------- статусы ---------- */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; vertical-align: middle; font-family: var(--font); letter-spacing: 0; }
.st-new { background: #f1f5f9; color: #475569; }
.st-awaiting { background: #fef3c7; color: #92400e; }
.st-active { background: #d1fae5; color: #065f46; }
.st-sold { background: #ccfbf1; color: #115e59; }
.st-rent { background: #dbeafe; color: #1e40af; }
.st-trial { background: #ede9fe; color: #5b21b6; }
.st-expired { background: #fee2e2; color: #991b1b; }
.st-suspended { background: #ffedd5; color: #9a3412; }
.st-archived { background: #e2e8f0; color: #334155; }
.ps-unpaid { background: #fff1f2; color: #9f1239; }
.ps-partial { background: #fef3c7; color: #92400e; }
.ps-paid { background: #ecfdf5; color: #047857; }
.ps-refund { background: #f1f5f9; color: #475569; }
.ps-free { background: #f5f3ff; color: #6d28d9; }
.pay-received { background: #ecfdf5; color: #047857; }
.pay-pending { background: #fef3c7; color: #92400e; }
.pay-cancelled { background: #f1f5f9; color: #64748b; }
.state-line { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1.1rem; font-weight: 500; }
.state-line.ok { background: var(--ok-l); color: #065f46; }
.state-line.bad { background: var(--bad-l); color: #991b1b; }

/* ---------- плитки и графики ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.1rem; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; display: flex; flex-direction: column; color: var(--text); box-shadow: var(--shadow); }
.tile:hover { text-decoration: none; border-color: #93c5fd; }
.tile .num { font-size: 1.7rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile span:last-child { color: var(--muted); font-size: .85rem; }
.tile.ok .num { color: var(--ok); }
.tile.bad .num { color: var(--bad); }
.mini-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.mini-stats div { display: flex; flex-direction: column; }
.mini-stats b { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.mini-stats span { color: var(--muted); font-size: .8rem; }
svg.chart { width: 100%; height: auto; display: block; margin: .25rem 0 .5rem; }
svg.chart .bar { fill: var(--brand); }
svg.chart .bar:hover { fill: var(--brand-d); }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .88rem; }
.dl dd { margin: 0; min-width: 0; word-break: break-word; }
.url { font-family: Consolas, monospace; font-size: .85rem; background: #f8fafc; border: 1px solid var(--line); border-radius: 6px; padding: .4rem .6rem; word-break: break-all; margin: 0 0 .5rem; }
.qr-box img { display: block; margin: 0 0 .75rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.ops { display: flex; flex-direction: column; gap: .75rem; }
.ops > form { padding-bottom: .75rem; border-bottom: 1px dashed var(--line); }
.ops > form:last-child { border-bottom: 0; padding-bottom: 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.thumbs a { position: relative; display: block; width: 96px; height: 96px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.thumbs span { position: absolute; bottom: 0; inset-inline: 0; background: rgba(15, 23, 42, .7); color: #fff; font-size: .7rem; text-align: center; }
.title-with-logo { display: flex; gap: .9rem; align-items: center; }
.logo-thumb { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* ---------- публичные страницы ---------- */
body.public { background: #fff; }
body.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; background: var(--bg); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 2rem; width: 100%; max-width: 560px; }
.panel.narrow { max-width: 400px; }
.panel h1 { margin: 1rem 0; }
.inactive-card { text-align: center; max-width: 520px; }
.inactive-card .lead { font-size: 1.2rem; font-weight: 600; margin: 1.5rem 0 1rem; }
.inactive-card .other { color: var(--muted); margin: .5rem 0; }
.inactive-card .contacts { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: 1.5rem 0 1rem; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.site-head { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.site-head img { display: block; }
.langs { display: flex; gap: .9rem; font-size: .9rem; }
.langs a[aria-current] { font-weight: 700; color: var(--text); }
.hero { background: linear-gradient(160deg, #eff6ff 0%, #fff 60%); padding: 3.5rem 0; }
.hero-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 2.5rem; align-items: center; }
.hero h1 { font-size: 2.4rem; line-height: 1.15; margin-bottom: 1rem; }
.hero .lead { font-size: 1.15rem; color: #334155; margin: 0 0 1.5rem; }
.card-mock { aspect-ratio: 85.6 / 54; border-radius: 16px; background: #fff; box-shadow: 0 20px 40px rgba(29, 78, 216, .18), 0 2px 6px rgba(15, 23, 42, .08); display: grid; grid-template-columns: 1fr 1.1fr; gap: 6%; padding: 7%; transform: rotate(-3deg); }
.mock-qr { align-self: center; }
.mock-qr svg { display: block; width: 100%; height: auto; }
.mock-text { display: flex; flex-direction: column; justify-content: center; gap: .3rem; }
.mock-text b { color: var(--brand); font-size: 1.6rem; letter-spacing: .03em; }
.mock-text span { color: var(--star); font-size: 1.2rem; letter-spacing: .1em; }
.mock-text small { color: var(--muted); }
.block { padding: 2.5rem 1rem; }
.block h2 { font-size: 1.6rem; margin-bottom: 1.25rem; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; counter-reset: s; }
.steps li { counter-increment: s; background: var(--bg); border-radius: 12px; padding: 1.2rem; display: flex; flex-direction: column; gap: .35rem; }
.steps li::before { content: counter(s); width: 2rem; height: 2rem; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.feature { border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem; }
.feature h3 { margin-top: 0; }
.feature p { margin: 0; color: #334155; }
.uses { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0; }
.uses li { background: var(--brand-l); color: var(--brand-d); border-radius: 999px; padding: .4rem .9rem; font-weight: 500; }
.contact { background: var(--bg); border-radius: 16px; margin-bottom: 2rem; }
.contact .card { margin: 0; }
.contact-list li { font-size: 1.05rem; }
.site-foot { border-top: 1px solid var(--line); padding: 1.5rem 0; color: var(--muted); font-size: .9rem; }

/* ---------- языки и письмо справа налево ---------- */
.lang-switch { display: inline-flex; gap: .15rem; border: 1px solid var(--line); border-radius: 8px; padding: .1rem; background: #fff; }
.lang-switch a { padding: .15rem .45rem; border-radius: 6px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.lang-switch a:hover { text-decoration: none; background: #f1f5f9; }
.lang-switch a[aria-current] { background: var(--brand); color: #fff; }
.panel-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
svg.chart { direction: ltr; }
[dir=rtl] .url, [dir=rtl] code, [dir=rtl] a.code, [dir=rtl] .code-title, [dir=rtl] input[readonly],
[dir=rtl] input[type=email], [dir=rtl] input[type=tel], [dir=rtl] input[dir=ltr] { direction: ltr; unicode-bidi: isolate; }
[dir=rtl] .url, [dir=rtl] input[readonly] { text-align: left; }
[dir=rtl] .code-title { display: block; text-align: right; }
[dir=rtl] .sidebar .pill { margin-inline-start: auto; }

/* ---------- мобильные ---------- */
@media (max-width: 900px) {
  body.admin { grid-template-columns: 1fr; }
  .menu-toggle { display: block; }
  .sidebar { position: fixed; top: 56px; bottom: 0; inset-inline-start: 0; width: 250px; height: auto; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 16px rgba(15, 23, 42, .12); }
  [dir=rtl] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; }
  .topbar .quick { display: none; }
  .content { padding: 1rem; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .hero-grid, .steps { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
  .card-mock { max-width: 360px; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { margin-top: .35rem; }
  .filters input[type=search] { min-width: 0; width: 100%; }
}
@media (min-width: 901px) and (max-width: 1200px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print { .sidebar, .topbar, .actions, .ops, .filters { display: none !important; } body.admin { display: block; } }
