/* Дизайн-система «Forum Speaker Q&A»: темно-синій, золото, камінь */
:root {
  --navy: #192F51;
  --navy-soft: #243F6B;
  --navy-dark: #0E1D33;
  --gold: #B6883E;
  --gold-hover: #9E732F;
  --gold-text: #8A6420;          /* золото для дрібного тексту (контраст ≥ 4.5:1 на білому) */
  --gold-soft: rgba(182, 136, 62, .12);
  --stone: #EEECE3;
  --stone-2: #F0EEE5;
  --stone-3: #EAE8DF;
  --surface: #FFFFFF;
  --line: #E7E7E7;
  --line-strong: #D1D5DB;
  --muted: #5F6B7D;
  --ink: var(--navy);
  --paper: var(--stone);
  --accent: var(--navy);
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(25, 47, 81, .06);
  --sun: var(--gold);
  --sun-soft: #FDF8F0;
  --ok: #2E7D32;
  --ok-soft: rgba(46, 125, 50, .1);
  --danger: #C53030;
  --danger-soft: #FFDAD6;
  --radius: 12px;
  --shadow-1: 0 4px 16px -2px rgba(25, 47, 81, .05), 0 1px 3px 0 rgba(25, 47, 81, .03);
  --shadow-2: 0 8px 24px -4px rgba(25, 47, 81, .08), 0 2px 6px -1px rgba(25, 47, 81, .04);
  --shadow-card: 0 12px 36px -4px rgba(25, 47, 81, .08), 0 4px 16px -2px rgba(25, 47, 81, .04);
  --body: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: var(--body);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }
body { margin: 0; background: var(--stone); color: var(--ink); font: 16px/1.55 var(--body); -webkit-font-smoothing: antialiased; min-height: 100vh; }
::selection { background: var(--gold); color: #fff; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.2; margin: 0 0 .6em; letter-spacing: -0.015em; color: var(--navy); }
h1 { font-size: clamp(1.4rem, 2.6vw, 1.75rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--navy); text-underline-offset: 3px; }
a:hover { color: var(--gold-hover); }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Верхня панель (робочі сторінки: темно-синя) ---------- */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  min-height: 3.25rem; padding: .4rem clamp(1rem, 3vw, 2rem); background: var(--navy); color: #fff; border-bottom: 1px solid var(--navy-soft);
  box-shadow: 0 2px 8px rgba(14, 29, 51, .18); }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: .95rem; letter-spacing: -0.01em; color: inherit; text-decoration: none; }
.brand:hover { color: inherit; }
.brand-mark { display: grid; place-items: center; width: 1.85rem; height: 1.85rem; border-radius: 8px; background: var(--gold); color: #fff; font-weight: 700; font-size: .95rem; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.top-r { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: .45rem; font-size: .78rem; font-weight: 600; color: #CBD5E1; background: rgba(14, 29, 51, .6); padding: .2rem .55rem; border-radius: 6px; }
.who small { color: #94A3B8; font-size: .78rem; }
.who small::before { content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: #64748B; margin-right: .45rem; vertical-align: middle; }
.top .btn.ghost { color: #fff; background: var(--navy-soft); border-color: transparent; }
.top .btn.ghost:hover { background: var(--navy-dark); color: #fff; }

/* Перемикач мови — «пігулка» */
.langs { display: inline-flex; align-items: center; padding: 3px; border-radius: 999px; background: var(--stone); border: 1px solid var(--line); }
.lang { border: 0; background: none; color: var(--navy); font: 500 .75rem var(--body); padding: .3rem .75rem; border-radius: 999px; cursor: pointer; transition: color .15s, background .15s; }
.lang:hover { color: var(--gold-hover); }
.lang.on { background: var(--navy); color: #fff; font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.top .langs { background: var(--navy-dark); border-color: var(--navy-soft); }
.top .lang { color: #CBD5E1; }
.top .lang:hover { color: #fff; }
.top .lang.on { background: var(--gold); color: #fff; }

.wrap { max-width: 1040px; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem); }
.wide { max-width: 1280px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.row-between h1 { margin: 0; }
.stack > * + * { margin-top: 1rem; }

/* ---------- Кнопки та поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--line); background: var(--surface); color: var(--navy);
  font: 600 .875rem var(--body); padding: .55rem 1rem; border-radius: 8px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s; }
.btn:hover { border-color: var(--gold); color: var(--navy); background: var(--sun-soft); }
.btn:active { transform: scale(.99); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 2px 6px rgba(25, 47, 81, .18); }
.btn.primary:hover { background: var(--navy-soft); border-color: var(--navy-soft); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.gold:hover { background: var(--gold-hover); border-color: var(--gold-hover); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--stone-2); border-color: transparent; }
.btn.soft { background: var(--stone-2); border-color: transparent; color: var(--muted); }
.btn.soft:hover { background: var(--stone-3); color: var(--navy); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); color: #93000A; }
.btn.sm { padding: .38rem .7rem; font-size: .8rem; }
.btn.icon { padding: .38rem .5rem; }
.btn[disabled] { opacity: .55; cursor: default; transform: none; }
.btn svg { width: 1em; height: 1em; flex: none; }
label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: .35rem; color: var(--navy); }
input[type=text], input[type=email], input[type=password], input[type=search], textarea, select {
  width: 100%; font: inherit; font-size: .9rem; color: var(--navy); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: .7rem 1rem; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #9CA3AF; }
textarea { resize: vertical; min-height: 6rem; }
select { padding-right: 2.2rem; appearance: none; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23192F51' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right .7rem center / 1rem; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(182, 136, 62, .15); }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; margin: 0; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--navy); flex: none; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .03em; padding: .15rem .55rem; border-radius: 999px; background: var(--stone-3); color: var(--navy); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.muted { background: var(--stone-2); color: var(--muted); }
.pill.sun { background: var(--gold-soft); color: var(--gold-text); }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); list-style: none; }

/* ---------- Вкладки ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; overflow-x: auto; }
.tab { border: 0; background: none; font: 600 .9rem var(--body); color: var(--muted); padding: .7rem .9rem; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--navy); }
.tab.on { color: var(--navy); border-bottom-color: var(--gold); }
.tab .count { font-weight: 500; color: var(--muted); margin-left: .3rem; }

/* ---------- Список форм ---------- */
.formlist { list-style: none; margin: 0; padding: 0; }
.formlist li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.25rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); transition: box-shadow .15s; }
.formlist li + li { margin-top: .6rem; }
.formlist li:hover { box-shadow: var(--shadow-2); }
.fl-title { font-weight: 700; font-size: 1.05rem; color: var(--navy); text-decoration: none; letter-spacing: -0.01em; }
.fl-title:hover { color: var(--gold-hover); }
.fl-meta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .35rem; font-size: .85rem; color: var(--muted); }
.fl-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* ---------- Таблиця й панелі ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 700; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; padding: .5rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .65rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl td.tr { text-align: right; white-space: nowrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: var(--shadow-1); }
.panel + .panel { margin-top: 1rem; }
.panel h2 { font-size: 1.05rem; }
.roles-help { font-size: .85rem; color: var(--muted); margin: .25rem 0 0; padding-left: 1.1rem; }

/* ---------- Конструктор ---------- */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .builder { grid-template-columns: 1fr; } }
.side { position: sticky; top: 4.5rem; }
@media (max-width: 900px) { .side { position: static; } }
.field-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1rem 1rem 1.35rem; box-shadow: var(--shadow-1); }
.field-card::before { content: ""; position: absolute; left: 0; top: .75rem; bottom: .75rem; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.field-card + .field-card { margin-top: .8rem; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.field-head select { width: auto; }
.ml-row { display: grid; grid-template-columns: 2.4rem 1fr; gap: .5rem; align-items: start; }
.ml-row + .ml-row { margin-top: .4rem; }
.ml-tag { font: 700 .72rem var(--body); color: var(--gold-text); padding-top: .8rem; text-align: center; letter-spacing: .05em; }
.opt-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: start; padding: .5rem 0; border-top: 1px dashed var(--line); }
.add-bar { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.savebar { position: sticky; bottom: 0; background: rgba(255,255,255,.95); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: .75rem clamp(1rem, 3vw, 2rem);
  display: flex; align-items: center; justify-content: flex-end; gap: 1rem; z-index: 5; }
.savebar .dirty { color: var(--gold-text); font-weight: 600; font-size: .875rem; margin-right: auto; }
.linkbox { display: flex; gap: .4rem; }
.linkbox input { font-size: .8rem; padding: .5rem .7rem; }
.sect + .sect { margin-top: 1.25rem; }
.logic { margin-top: .6rem; padding: .6rem .75rem; background: var(--stone-2); border: 1px dashed var(--line-strong); border-radius: 8px; }
.logic select { max-width: 100%; }
.logic-opts { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; align-items: center; margin-top: .5rem; }
.empty-fields { padding: 1.25rem; text-align: center; color: var(--muted); background: var(--stone-2); border: 1px dashed var(--line-strong); border-radius: 8px; }

/* ---------- Модерація ---------- */
.mod-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.1rem; }
.mod-head .title { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; min-width: 0; }
.mod-head h1 { margin: 0; font-size: 1.25rem; }
.back { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 600; color: var(--muted); text-decoration: none; margin-bottom: .6rem; }
.back:hover { color: var(--navy); }
.back svg { width: .9rem; height: .9rem; }
.live { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .65rem; border-radius: 999px; background: var(--ok-soft);
  color: var(--ok); font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.live::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--ok); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.strip { background: var(--surface); border-radius: var(--radius); padding: .6rem; box-shadow: var(--shadow-1); border: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: 1rem; }
.status-tabs { display: flex; gap: .2rem; overflow-x: auto; padding-bottom: 1px; }
.st-tab { display: inline-flex; align-items: center; gap: .4rem; border: 0; background: none; padding: .45rem .8rem; border-radius: 8px;
  font: 600 .82rem var(--body); color: var(--muted); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.st-tab:hover { background: var(--stone-3); color: var(--navy); }
.st-tab .count { font-weight: 400; opacity: .8; }
.st-tab .count.hot { opacity: 1; font-weight: 700; font-size: .7rem; padding: .05rem .45rem; border-radius: 999px; background: var(--gold); color: #fff; }
.st-tab.on { background: var(--navy); color: #fff; box-shadow: 0 1px 3px rgba(25, 47, 81, .2); }
.strip-r { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; flex: 1 1 420px; justify-content: flex-end; }
.strip input[type=search], .strip select { background-color: var(--stone-2); border-color: transparent; padding-top: .45rem; padding-bottom: .45rem; font-size: .85rem; border-radius: 8px; }
.strip input[type=search]:focus, .strip select:focus { background-color: var(--surface); border-color: var(--gold); }
.search { position: relative; flex: 1 1 200px; min-width: 180px; }
.search svg { position: absolute; left: .65rem; top: 50%; width: 1rem; height: 1rem; transform: translateY(-50%); color: #8A93A3; pointer-events: none; }
.strip .search input { padding-left: 2.1rem; }
.strip .grp { flex: 1 1 auto; min-width: 14rem; }
.subtools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: -.4rem 0 1rem; padding: 0 .25rem; font-size: .8rem; color: var(--muted); }
.subtools .ctl { display: flex; align-items: center; gap: .4rem; min-width: 0; max-width: 100%; }
.subtools .ctl select { min-width: 0; }
.subtools label { margin: 0; font-size: .78rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.subtools select { width: auto; max-width: 14rem; padding: .3rem 1.9rem .3rem .6rem; font-size: .8rem; background-color: transparent; border-color: var(--line-strong); border-radius: 8px; }
.subtools .check { font-size: .8rem; color: var(--muted); font-weight: 600; }
.subtools .sp { margin-left: auto; display: flex; gap: .4rem; }

.qlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.q { position: relative; display: flex; align-items: center; justify-content: space-between; gap: .75rem 1.25rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem .9rem 1.4rem;
  box-shadow: var(--shadow-1); transition: box-shadow .15s, opacity .15s; }
.q:hover { box-shadow: var(--shadow-2); }
.q.accent::before { content: ""; position: absolute; left: 0; top: .75rem; bottom: .75rem; width: 5px; border-radius: 0 4px 4px 0; background: var(--gold); }
.q.starred { border-color: rgba(182, 136, 62, .55); box-shadow: 0 0 0 1px rgba(182, 136, 62, .3), var(--shadow-1); }
.q.s-answered { background: rgba(255,255,255,.75); box-shadow: none; }
.q.s-answered .q-text { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(95, 107, 125, .5); font-weight: 400; }
.q.s-hidden { opacity: .6; box-shadow: none; }
.q.arrived { animation: arrive 1.6s ease-out; }
@keyframes arrive { from { background: var(--sun-soft); } to { background: var(--surface); } }
.q-main { flex: 1 1 auto; min-width: 0; }
.q-meta { display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: center; font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: .18rem .5rem; border-radius: 5px; background: var(--stone-3); color: var(--navy); }
.badge.new { background: var(--gold-soft); color: var(--gold-text); }
.badge.star { background: var(--gold); color: #fff; }
.badge.answered, .badge.hidden { background: var(--stone-2); color: var(--muted); }
.q-author { font-size: .95rem; font-weight: 700; color: var(--navy); letter-spacing: -0.01em; }
.tag { font-size: .75rem; font-weight: 500; padding: .12rem .5rem; border-radius: 5px; background: var(--stone-2); color: #44474E; overflow-wrap: anywhere; }
.tag.to { background: var(--stone-3); color: var(--navy); }
.tag.to b { font-weight: 600; }
.tag i { font-style: normal; opacity: .75; }
.q-meta .src { font-size: .68rem; font-weight: 700; color: var(--navy); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 .3rem; }
.q-meta .time::before { content: "• "; }
.q-label { font-size: .75rem; font-weight: 600; color: var(--muted); margin-top: .4rem; }
.q-text { font-size: 1rem; font-weight: 500; line-height: 1.45; color: var(--navy); white-space: pre-wrap; overflow-wrap: anywhere; }
.q.starred .q-text { font-weight: 600; }
.q-tr { margin-top: .4rem; padding-left: .75rem; border-left: 2px solid var(--gold); color: var(--muted); font-size: .92rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.q-tr b { font-size: .68rem; color: var(--gold-text); margin-right: .4rem; letter-spacing: .05em; }
.q-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; flex: none; }
.q-actions .note { font-size: .78rem; font-style: italic; color: var(--muted); padding: 0 .4rem; }
.star-on { color: var(--gold); }
/* Десктоп: усі метадані в один рядок (обгортки «розчиняються») */
.q-top, .q-who, .to-wrap { display: contents; }
.q-top .badge { order: 1; } .q-who .q-author { order: 2; } .q-who .tag { order: 3; }
.q-top .time { order: 4; } .q-top .src { order: 5; } .to-wrap .tag { order: 6; }
.q-author { display: inline-flex; align-items: center; gap: .3rem; }
.q-author svg { display: none; width: .95rem; height: .95rem; color: var(--gold); flex: none; }
.panel-pick { display: flex; flex: 1 1 auto; min-width: 14rem; margin: 0; font-weight: 400; }
.pp-ico, .pp-label { display: none; }
.pp-body { display: block; flex: 1; min-width: 0; }
.strip .grp { width: 100%; }
body.big .q-text { font-size: 1.6rem; }
body.big .q-tr { font-size: 1.2rem; }
.group-head { list-style: none; display: flex; align-items: baseline; gap: .6rem; margin: 1rem 0 0; padding: 0 .25rem .4rem; border-bottom: 2px solid var(--gold); }
.group-head:first-child { margin-top: 0; }
.group-head h2 { margin: 0; font-size: 1rem; }
.group-head .count { color: var(--muted); font-weight: 600; font-size: .85rem; }

/* ---------- Публічна форма ---------- */
.pub-page { display: flex; flex-direction: column; min-height: 100vh; }
.pub-top { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.9); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.pub-top-in { max-width: 56rem; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 1.5rem); height: 4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pub-top .brand { font-size: 1.05rem; color: var(--navy); }
.pub-top .brand-mark { width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--navy); color: var(--gold); font-size: 1.1rem; }
.pub { flex: 1; width: 100%; max-width: 48rem; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 1.5rem) 3rem; }
.pub-card { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow-card); padding: clamp(1.5rem, 5vw, 2.75rem); }
.pub-card > header { border-bottom: 1px solid var(--line); padding-bottom: 1.5rem; margin-bottom: 1.75rem; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text); margin-bottom: .5rem; }
.eyebrow::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--gold); }
.pub h1 { font-size: clamp(1.6rem, 4.5vw, 2.25rem); font-weight: 800; letter-spacing: -0.025em; margin-bottom: .5rem; }
.pub .desc { color: #4B5563; font-size: clamp(.9rem, 2vw, 1rem); white-space: pre-wrap; margin: 0; }
.pfield { margin: 0 0 1.4rem; border: 0; padding: 0; min-width: 0; }
.pfield.sep { padding-top: 1.25rem; border-top: 1px solid var(--line); }
.pfield legend, .pfield > label, .pfield .lbl-row label { font-weight: 700; font-size: .875rem; color: var(--navy); margin-bottom: .45rem; padding: 0; }
fieldset.pfield > legend { float: left; width: 100%; }
fieldset.pfield > legend ~ * { clear: both; }
.pfield .opt { font-size: .75rem; font-weight: 400; color: var(--muted); margin-left: .25rem; }
.pfield .req { color: var(--gold); font-weight: 700; margin-left: .25rem; }
.pfield .help { font-size: .82rem; color: var(--muted); margin: -.15rem 0 .55rem; }
.lbl-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.lbl-row label { margin-bottom: .45rem; }
.choices { display: flex; flex-direction: column; gap: .65rem; }
.pfield .choice { position: relative; display: flex; gap: .75rem; align-items: flex-start; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  cursor: pointer; font-weight: 500; font-size: .875rem; line-height: 1.5; color: var(--navy); margin: 0; transition: border-color .15s, background .15s; }
.pfield .choice:hover { border-color: rgba(25, 47, 81, .6); }
.pfield .choice input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.pfield .choice .ind { flex: none; width: 1.25rem; height: 1.25rem; margin-top: .05rem; border: 2px solid var(--line-strong); border-radius: 50%; background: #fff; transition: border-color .15s, background .15s, box-shadow .15s; }
.pfield .choice.multi .ind { border-radius: 6px; }
.pfield .choice:has(input:checked) { border-color: var(--navy); background: rgba(25, 47, 81, .025); }
.pfield .choice input:checked + .ind { border-color: var(--gold); background: var(--gold); box-shadow: inset 0 0 0 3px #fff; }
.pfield .choice.multi input:checked + .ind { box-shadow: none; background: var(--gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E") center / .8rem no-repeat; }
.pfield .choice:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.choice .time { color: var(--gold-text); font-weight: 700; margin-right: .1rem; white-space: nowrap; }
.choice .time svg { display: none; }
.pfield .err { color: var(--danger); font-size: .82rem; font-weight: 500; margin-top: .35rem; }
.pfield.invalid input[type=text], .pfield.invalid textarea { border-color: var(--danger); }
.pfield.invalid .choice { border-color: rgba(197, 48, 48, .45); }
.pfield textarea { min-height: 8.5rem; }
.counter { font-size: .75rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.hint { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--muted); margin-top: .5rem; }
.hint svg { width: 1rem; height: 1rem; color: var(--gold); flex: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.submit { padding-top: .5rem; }
.btn.block { width: 100%; justify-content: center; padding: .9rem 1.5rem; font-size: 1rem; font-weight: 700; border-radius: 12px; }
.btn.block svg { color: var(--gold); width: 1.05rem; height: 1.05rem; margin-left: .25rem; }
.done { text-align: center; padding: 2rem 1rem; }
.done h1 { font-size: clamp(1.3rem, 3.5vw, 1.75rem); }
.done .big-mark { display: grid; place-items: center; width: 4rem; height: 4rem; margin: 0 auto 1.25rem; border-radius: 50%; background: var(--navy); color: var(--gold); font: 700 1.8rem var(--body); }
.pub-foot { padding: 1.5rem 1rem; text-align: center; font-size: .75rem; color: var(--muted); border-top: 1px solid var(--line); background: rgba(255,255,255,.5); }

/* ---------- Вхід ---------- */
.login { max-width: 400px; margin: 10vh auto; padding: 0 1rem; }
.login .brand { color: var(--navy); }
.login .brand-mark { border-radius: 50%; background: var(--navy); color: var(--gold); }
.login .panel { padding: 1.75rem; box-shadow: var(--shadow-card); border-radius: 1rem; }
.login form > * + * { margin-top: 1rem; }
.form-err { color: var(--danger); font-size: .875rem; min-height: 1.2em; }

#toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%); background: var(--navy); color: #fff;
  padding: .7rem 1.15rem; border-radius: 10px; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-2); border-left: 4px solid var(--gold);
  transition: transform .25s; z-index: 50; max-width: 90vw; }
#toast.show { transform: translate(-50%, 0); }

/* =====================================================================
   Телефон і планшет (вертикально та горизонтально)
   Умова: вузький екран АБО сенсорний екран як основний (планшет у landscape)
   ===================================================================== */
@media (max-width: 1023px), (pointer: coarse) {
  body { font-size: 15px; }
  .top { min-height: 4rem; padding: .5rem 1rem; padding-top: max(.5rem, env(safe-area-inset-top)); }
  .brand { font-size: 1.05rem; }
  .brand-mark { width: 2.25rem; height: 2.25rem; font-size: 1.05rem; }
  .lang { padding: .45rem .85rem; font-size: .8rem; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 40px; padding: .5rem .85rem; font-size: .85rem; }
  input[type=text], input[type=email], input[type=password], textarea, select { font-size: 16px; } /* без автозуму в iOS */

  /* ---------- Публічна форма ---------- */
  .pub-top { background: var(--navy); border-bottom-color: var(--navy-soft); box-shadow: 0 4px 16px -2px rgba(25, 47, 81, .15); }
  .pub-top-in { height: 4rem; padding-top: env(safe-area-inset-top); }
  .pub-top .brand { color: #fff; }
  .pub-top .brand-mark { border-radius: 10px; background: var(--gold); color: #fff; }
  .pub-top .langs { background: var(--navy-dark); border-color: var(--navy-soft); }
  .pub-top .lang { color: #CBD5E1; }
  .pub-top .lang.on { background: var(--gold); color: #fff; }
  .pub { max-width: 40rem; padding: 1rem 1rem calc(2rem + env(safe-area-inset-bottom)); }
  .pub-card { background: none; border: 0; box-shadow: none; padding: 0; }
  .pub-card > header { position: relative; overflow: hidden; background: var(--navy); color: #fff; border: 0; border-radius: 14px;
    padding: 1.1rem 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: 0 6px 18px -6px rgba(25, 47, 81, .45); }
  .pub-card > header::after { content: ""; position: absolute; right: -1.6rem; bottom: -1.6rem; width: 7rem; height: 7rem; border-radius: 50%;
    background: var(--gold); opacity: .15; pointer-events: none; }
  .pub-card > header .eyebrow { color: #FEC978; font-size: .68rem; letter-spacing: .1em; }
  .pub-card > header .eyebrow::before { background: #FEC978; animation: pulse 1.8s ease-in-out infinite; }
  .pub-card > header h1 { color: #fff; font-size: 1.4rem; line-height: 1.25; margin-bottom: .35rem; }
  .pub-card > header .desc { color: #A9B8D4; font-size: .9rem; }
  .pub-card > form, .pub-card > .done { background: var(--surface); border-radius: 14px; padding: 1.1rem; box-shadow: var(--shadow-1); }
  .pfield { margin-bottom: 1.15rem; }
  .pfield.sep { border-top: 0; padding-top: .25rem; }
  .pfield legend, .pfield > label, .pfield .lbl-row label { font-weight: 600; font-size: .85rem; line-height: 1.4; }
  .pfield input[type=text], .pfield textarea { border-color: transparent; background: var(--surface); box-shadow: 0 1px 3px rgba(25, 47, 81, .1), 0 0 0 1px var(--line); padding: .8rem 1rem; }
  .pfield input[type=text]:focus, .pfield textarea:focus { background: #FCFBF7; box-shadow: 0 0 0 1px var(--gold), 0 0 0 4px rgba(182, 136, 62, .15); }
  .pfield .req { color: var(--danger); }
  .choices { gap: .6rem; }
  .pfield .choice { flex-direction: row; align-items: flex-start; padding: 1rem; border-color: transparent; border-radius: 14px;
    box-shadow: 0 1px 3px rgba(25, 47, 81, .1), 0 0 0 1px var(--line); }
  .pfield .choice:hover { border-color: transparent; }
  .pfield .choice:has(input:checked) { background: #F6F4EB; border-color: transparent; box-shadow: 0 0 0 1.5px var(--gold); }
  .pfield .choice .ind { width: 1.35rem; height: 1.35rem; border: 0; background: var(--stone-3); }
  .pfield .choice input:checked + .ind { background: #fff; box-shadow: inset 0 0 0 .3rem #fff, inset 0 0 0 1rem var(--gold), 0 0 0 1px var(--line); border: 0; }
  .choice > span:last-child { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; min-width: 0; }
  .choice .time { display: inline-flex; align-items: center; gap: .3rem; margin: 0; padding: .15rem .55rem; border-radius: 999px;
    background: var(--stone-2); color: #44474E; font-size: .75rem; font-weight: 600; }
  .choice .time svg { display: block; width: .85rem; height: .85rem; }
  .pfield .choice:has(input:checked) .time { background: #FFDDB0; color: #614000; }
  .choice .opt-title { font-size: 1.02rem; font-weight: 600; line-height: 1.4; color: var(--navy); }
  .lbl-row { align-items: center; }
  .counter { font-size: .72rem; }
  .hint { padding: .6rem .75rem; border-radius: 10px; background: #F6F4EB; color: #44474E; font-size: .78rem; line-height: 1.35; }
  .hint svg { width: 1.15rem; height: 1.15rem; }
  .btn.block { min-height: 52px; border-radius: 12px; font-size: .95rem; }

  /* ---------- Модерація ---------- */
  .wrap.wide { padding: 1rem 1rem calc(2rem + env(safe-area-inset-bottom)); }
  .mod-head { margin-bottom: .75rem; gap: .5rem; }
  .mod-head h1 { font-size: 1.05rem; }
  .strip { display: grid; grid-template-columns: minmax(0, 1fr); background: none; border: 0; box-shadow: none; padding: 0; gap: .75rem; }
  .strip-r { order: -1; }
  .strip-r { display: block; flex: none; width: 100%; min-width: 0; }
  .panel-pick { display: flex; align-items: center; gap: .65rem; width: 100%; min-width: 0; background: var(--surface); border-radius: 14px;
    padding: .55rem .6rem; box-shadow: var(--shadow-1); cursor: pointer; }
  .pp-ico { display: grid; place-items: center; flex: none; width: 2.25rem; height: 2.25rem; border-radius: 10px; background: var(--navy); color: #fff; }
  .pp-ico svg { width: 1.2rem; height: 1.2rem; }
  .pp-body { display: flex; flex-direction: column; min-width: 0; }
  .pp-label { display: block; font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-text); line-height: 1.2; }
  .strip .grp, .strip select.grp { border: 0; box-shadow: none; padding: .1rem 2.6rem .1rem 0; font-size: 1rem; font-weight: 600; color: var(--navy);
    text-overflow: ellipsis; white-space: nowrap; overflow: hidden; min-height: 0;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23192F51' stroke-width='2'%3E%3Cpath d='M8 9l4-4 4 4M16 15l-4 4-4-4'/%3E%3C/svg%3E") no-repeat right .5rem center / 1.1rem; }
  .strip .grp:focus { background-color: transparent; box-shadow: none; }
  .strip .grp { min-width: 0; width: 100%; }
  .panel-pick:focus-within { box-shadow: 0 0 0 2px var(--gold), var(--shadow-1); }
  .status-tabs { gap: .4rem; margin: 0; padding: 0 0 .25rem; min-width: 0; max-width: 100%; scrollbar-width: none; }
  .status-tabs::-webkit-scrollbar { display: none; }
  .st-tab { flex: none; min-height: 40px; padding: .45rem .95rem; border-radius: 999px; background: var(--surface); color: var(--navy); font-weight: 500;
    font-size: .85rem; box-shadow: 0 1px 3px rgba(25, 47, 81, .1); }
  .st-tab:hover { background: var(--surface); }
  .st-tab .count { font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: var(--stone-2); color: var(--muted); opacity: 1; }
  .st-tab .count.hot { background: #FFDDB0; color: #614000; }
  .st-tab.on { background: var(--navy); color: #fff; font-weight: 600; }
  .st-tab.on .count { background: rgba(255,255,255,.2); color: #fff; }

  .qlist { gap: .75rem; }
  .group-head { margin-top: .5rem; }
  .q { flex-direction: column; align-items: stretch; gap: .75rem; padding: 1rem; border-color: transparent; border-radius: 14px; }
  .q.accent { padding-left: 1.25rem; overflow: hidden; }
  .q.accent::before { top: 0; bottom: 0; width: 6px; border-radius: 0; }
  .q.starred { border-color: transparent; box-shadow: var(--shadow-2); }
  .q-meta { display: flex; flex-direction: column; align-items: stretch; gap: .5rem; margin-bottom: .6rem; }
  .q-top { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; }
  .q-top .time::before { content: none; }
  .q-top .time { font-weight: 500; }
  .q-top > *, .q-who > *, .to-wrap .tag { order: 0; }
  .to-wrap { display: flex; flex-wrap: wrap; gap: .3rem; margin-left: auto; order: 9; }
  .q-who { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; }
  .q-who .tag { background: none; padding: 0; font-size: .8rem; color: #44474E; }
  .q-who .tag::before { content: "• "; color: #74777F; }
  .q-author { font-size: .9rem; }
  .q-author svg { display: block; }
  .badge { font-size: .68rem; padding: .22rem .55rem; border-radius: 6px; }
  .badge.new::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: var(--gold); animation: pulse 1.8s ease-in-out infinite; }
  .q-text { font-size: 1.05rem; font-weight: 400; line-height: 1.6; color: #1B1C17; }
  .q.starred .q-text { font-weight: 500; }
  .q-actions { flex-wrap: nowrap; gap: .5rem; }
  .q-actions .btn { min-height: 46px; border-radius: 10px; font-size: .88rem; }
  .q-actions .a-main { flex: 1 1 0; min-width: 0; }
  .q-actions .a-main span { overflow: hidden; text-overflow: ellipsis; }
  .q-actions .a-x { flex: none; width: 46px; padding: 0; }
  .q-actions .a-x svg { width: 1.15rem; height: 1.15rem; }
  .q-actions .btn.prio { background: #FFDDB0; color: #614000; }
  .q-actions .btn.prio:hover { background: #FEC978; }
  .q-actions .btn svg { width: 1.1rem; height: 1.1rem; }
  body.big .q-text { font-size: 1.35rem; }
}

/* Планшет горизонтально: картки у дві колонки, перемикач панелі й статуси в один рядок */
@media (pointer: coarse) and (orientation: landscape) and (min-width: 900px), (min-width: 900px) and (max-width: 1023px) and (orientation: landscape) {
  .wrap.wide { padding-left: 1.5rem; padding-right: 1.5rem; }
  .strip { display: flex; flex-direction: row-reverse; align-items: center; justify-content: flex-end; }
  .status-tabs { min-width: 0; }
  .strip-r { flex: 1 1 22rem; max-width: 30rem; }
  .status-tabs { flex: 0 1 auto; min-width: 0; margin: 0; padding: 0 0 .25rem; }
  .qlist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: .9rem; }
  .qlist > .group-head, .qlist > .empty { grid-column: 1 / -1; }
  .pub { max-width: 44rem; }
}

/* Планшет вертикально: ширші поля, одна колонка */
@media (min-width: 700px) and (max-width: 1023px) and (orientation: portrait) {
  .wrap.wide { padding-left: 1.5rem; padding-right: 1.5rem; }
  .q { padding: 1.15rem 1.25rem; }
  .q.accent { padding-left: 1.5rem; }
  .q-actions { justify-content: flex-end; }
  .q-actions .a-main { flex: 0 1 12rem; }
}
