/* Flyr.os Console — mobile-first, no deps */
:root {
  --brand: #0B6E2E; --accent: #00A82D;
  --ink: #17211a; --ink-2: #41524a; --ink-3: #77847c;
  --surface: #ffffff; --surface-2: #f0f4f0; --line: #dfe7df;
  --danger: #c0342b; --amber: #b57d0a;
  --radius: 14px; --sab: env(safe-area-inset-bottom, 0px); --sat: env(safe-area-inset-top, 0px);
  --shadow-lg: 0 12px 32px rgba(15, 40, 22, .16);
  --tr: 160ms ease;
}
* { box-sizing: border-box; margin: 0; }
button { font: inherit; border: 0; background: none; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }
body { background: #f4f6f4; color: var(--ink); min-height: 100dvh; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px calc(32px + var(--sab)); background: linear-gradient(160deg, #07250f, #0B6E2E 70%, #0d8a3a); }
.login .card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; padding: 28px 24px; box-shadow: var(--shadow-lg); }
.login .mark { width: 52px; height: 52px; border-radius: 14px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; margin-bottom: 14px; }
.login h1 { font-size: 22px; margin-bottom: 4px; }
.login .sub { color: var(--ink-3); font-size: 14px; margin-bottom: 20px; }
.login .demo-note { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--ink-3); }
.login .demo-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.login .demo-row button { flex: 1; min-width: 100px; min-height: 42px; border-radius: 10px; border: 1.5px solid var(--line); font-weight: 700; font-size: 12.5px; color: var(--brand); background: var(--surface-2); }
.login .brandline { color: rgba(255,255,255,.75); font-size: 13px; margin-top: 22px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 6px; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 48px; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 13px; background: var(--surface); outline: none; transition: border var(--tr);
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--brand); }
.err { color: var(--danger); font-size: 13px; margin: 8px 0; }
.hint { color: var(--ink-3); font-size: 12.5px; margin-top: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: 14.5px; transition: filter var(--tr), transform var(--tr); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-ghost { background: var(--surface); border: 1.5px solid var(--line); color: var(--ink); }
.btn-danger { background: rgba(192, 52, 43, .08); color: var(--danger); border: 1.5px solid rgba(192, 52, 43, .3); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- shell ---------- */
.shell { min-height: 100dvh; padding-bottom: calc(76px + var(--sab)); }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--sat)) 16px 10px; background: var(--brand); color: #fff; }
.topbar .logo { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-weight: 800; overflow: hidden; flex: 0 0 auto; }
.topbar .logo img { width: 100%; height: 100%; object-fit: cover; }
.topbar .who { flex: 1; min-width: 0; }
.topbar .who strong { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .who small { font-size: 11.5px; opacity: .82; }
.rolebadge { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: rgba(255,255,255,.2); padding: 4px 9px; border-radius: 999px; }
.topbar .out { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.16); display: grid; place-items: center; font-size: 16px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(10px); padding-bottom: var(--sab); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 8px; font-size: 10.5px; font-weight: 700; color: var(--ink-3); }
.tabbar button .ic { font-size: 19px; line-height: 1; }
.tabbar button.on { color: var(--brand); }

.view { padding: 18px 16px; max-width: 860px; margin: 0 auto; animation: fadein 180ms ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; } }
.view h2 { font-size: 20px; margin-bottom: 4px; }
.view .vsub { color: var(--ink-3); font-size: 13.5px; margin-bottom: 18px; }

/* ---------- cards & stats ---------- */
.statgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
@media (min-width: 640px) { .statgrid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat small { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.stat strong { display: block; font-size: 24px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.stat .sub2 { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.stat.hero { background: var(--brand); border-color: var(--brand); color: #fff; }
.stat.hero small, .stat.hero .sub2 { color: rgba(255,255,255,.8); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card h3 { font-size: 15.5px; margin-bottom: 10px; }
.rowline { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--surface-2); }
.rowline:last-child { border-bottom: 0; }
.rowline .grow { flex: 1; min-width: 0; }
.rowline .grow strong { display: block; font-size: 14.5px; }
.rowline .grow small { color: var(--ink-3); font-size: 12.5px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 800; font-size: 14px; color: var(--brand); flex: 0 0 auto; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.badge.ok { background: rgba(0,168,45,.1); color: var(--brand); }
.badge.warn { background: rgba(181,125,10,.12); color: var(--amber); }
.badge.bad { background: rgba(192,52,43,.1); color: var(--danger); }
.badge.off { background: var(--surface-2); color: var(--ink-3); }

/* ---------- tables ---------- */
.tblwrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--surface-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl select { min-height: 36px; border: 1.5px solid var(--line); border-radius: 8px; padding: 4px 8px; background: var(--surface); }

/* ---------- plans ---------- */
.plans { display: grid; gap: 12px; margin: 16px 0; }
@media (min-width: 640px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.plan { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.plan.cur { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,168,45,.12); }
.plan h4 { font-size: 16px; }
.plan .p { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.plan .p small { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.plan ul { list-style: none; padding: 0; margin: 6px 0 12px; font-size: 13.5px; color: var(--ink-2); display: grid; gap: 6px; }
.plan ul li::before { content: "✓ "; color: var(--accent); font-weight: 800; }
.plan .spacer { flex: 1; }

/* ---------- branding ---------- */
.swatches { display: flex; gap: 12px; margin: 8px 0 16px; }
.swatch { flex: 1; }
.swatch input[type="color"] { width: 100%; height: 56px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); padding: 4px; cursor: pointer; }
.swatch code { display: block; text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.flyerprev { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); margin-top: 14px; }
.flyerprev .fp-head { padding: 16px; color: #fff; display: flex; align-items: center; gap: 12px; }
.flyerprev .fp-logo { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-weight: 800; overflow: hidden; }
.flyerprev .fp-logo img { width: 100%; height: 100%; object-fit: cover; }
.flyerprev .fp-body { background: var(--surface); padding: 14px 16px; font-size: 13px; color: var(--ink-3); }
.flyerprev .fp-cta { display: inline-block; margin-top: 10px; padding: 9px 16px; border-radius: 999px; color: #fff; font-weight: 700; font-size: 13px; }

/* ---------- listing editor ---------- */
.editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.editor-head .back { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-size: 17px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; }
.slotrow { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.slotrow input { flex: 1; }
.slotrow .x { width: 40px; height: 40px; border-radius: 10px; background: rgba(192,52,43,.08); color: var(--danger); font-weight: 800; flex: 0 0 auto; }
.checkline { display: flex; align-items: center; gap: 10px; min-height: 48px; font-weight: 600; font-size: 14.5px; margin-bottom: 12px; }
.checkline input { width: 22px; height: 22px; accent-color: var(--brand); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(92px + var(--sab)); transform: translate(-50%, 16px); z-index: 90; background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600; padding: 11px 18px; border-radius: 999px; opacity: 0; transition: all 220ms ease; pointer-events: none; max-width: 86vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err-t { background: var(--danger); }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .big { font-size: 34px; margin-bottom: 10px; }
.demoband { background: rgba(181,125,10,.1); border: 1px solid rgba(181,125,10,.3); color: var(--amber); font-size: 12.5px; font-weight: 600; border-radius: 10px; padding: 9px 12px; margin-bottom: 14px; }
