/* Mugibot — shared styles for the website, dashboard and admin. */
:root {
  --bg: #f7f7f8; --surface: #ffffff; --surface-2: #f2f3f5; --fg: #111827; --muted: #5b6472; --line: #e3e5ea;
  --brand: #3b2a7a; --brand-fg: #ffffff; --accent: #facc15; --accent-fg: #111827;
  --ok: #15803d; --ok-bg: #e8f6ec; --warn: #a15c07; --warn-bg: #fdf3dc; --err: #b91c1c; --err-bg: #fdecec; --info-bg: #eaf1fe; --info: #1d4ed8;
  --radius: 12px; --shadow: 0 1px 2px rgba(17, 24, 39, .06), 0 4px 16px rgba(17, 24, 39, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #151a22; --surface-2: #1c222c; --fg: #e8eaef; --muted: #9aa3b2; --line: #2a313c;
    --brand: #a78bfa; --brand-fg: #0d1117; --ok: #4ade80; --ok-bg: #12301d; --warn: #fbbf24; --warn-bg: #33270c; --err: #f87171; --err-bg: #3a1515;
    --info-bg: #14233f; --info: #93b4ff; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #151a22; --surface-2: #1c222c; --fg: #e8eaef; --muted: #9aa3b2; --line: #2a313c;
  --brand: #a78bfa; --brand-fg: #0d1117; --ok: #4ade80; --ok-bg: #12301d; --warn: #fbbf24; --warn-bg: #33270c; --err: #f87171; --err-bg: #3a1515;
  --info-bg: #14233f; --info: #93b4ff; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(28px, 5vw, 46px); letter-spacing: -.02em; }
h2 { font-size: clamp(20px, 3vw, 28px); letter-spacing: -.01em; }
h3 { font-size: 17px; }
p { margin: .5em 0; }
code, kbd { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden, [hidden] { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 14px; padding: 9px 14px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.accent { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.danger { color: var(--err); }
.btn.small { padding: 5px 9px; font-size: 13px; border-radius: 7px; }
.btn.big { padding: 13px 20px; font-size: 16px; border-radius: 11px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
input, select, textarea { font: inherit; width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
input[type="checkbox"] { width: auto; margin: 0 6px 0 0; }
.check { display: flex; align-items: flex-start; gap: 6px; font-weight: 400; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 12px; }
.grid4 { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 0 12px; }
.grid2 > .span2 { grid-column: span 2; }
@media (max-width: 720px) { .grid4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } .grid2 > .span2 { grid-column: auto; } }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.msg { min-height: 20px; font-size: 14px; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }

/* Cards, pills, notices */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok, .pill.in_stock, .pill.preorder { background: var(--ok-bg); color: var(--ok); }
.pill.warn, .pill.blocked, .pill.coming_soon { background: var(--warn-bg); color: var(--warn); }
.pill.err, .pill.error, .pill.not_found { background: var(--err-bg); color: var(--err); }
.pill.out_of_stock { background: var(--surface-2); color: var(--muted); }
.notice { border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; background: var(--info-bg); color: var(--fg); border: 1px solid transparent; }
.notice.warn { background: var(--warn-bg); }
.notice.err { background: var(--err-bg); }
.notice.ok { background: var(--ok-bg); }

/* Site header */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; text-decoration: none; letter-spacing: -.01em; }
.logo img { width: 28px; height: 28px; }
.topbar nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.topbar nav a.link { text-decoration: none; padding: 6px 10px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.topbar nav a.link:hover { color: var(--fg); background: var(--surface-2); }
@media (max-width: 720px) { .topbar nav a.link.opt { display: none; } }

/* Landing */
.hero { padding: 64px 0 40px; text-align: center; }
.hero p.lead { font-size: clamp(16px, 2.2vw, 20px); color: var(--muted); max-width: 680px; margin: 12px auto 26px; }
.hero .ctas { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.badge { display: inline-block; background: var(--accent); color: var(--accent-fg); border-radius: 99px; padding: 4px 12px; font-size: 13px; font-weight: 700; margin-bottom: 18px; }
.section { padding: 48px 0; }
.section h2 { text-align: center; }
.section > .wrap > p.sub { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature .icon { font-size: 22px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; counter-reset: step; }
.steps .card { position: relative; padding-top: 34px; }
.steps .card::before { counter-increment: step; content: counter(step); position: absolute; top: -14px; left: 18px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg); font-weight: 800; display: grid; place-items: center; }
.price-card { max-width: 420px; margin: 0 auto; text-align: center; }
.price-card .price { font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.price-card ul { text-align: left; padding-left: 20px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 0 auto 10px; max-width: 760px; }
.faq summary { cursor: pointer; font-weight: 700; }
.fair { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.fair div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
footer.site { border-top: 1px solid var(--line); padding: 26px 0; margin-top: 30px; color: var(--muted); font-size: 14px; }
footer.site .wrap { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
footer.site a { color: var(--muted); }

/* Auth pages */
.auth { max-width: 420px; margin: 48px auto; padding: 0 16px; }
.auth .card { padding: 26px; }
.auth h1 { font-size: 26px; }

/* Dashboard */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 60px); }
.side { border-right: 1px solid var(--line); padding: 16px 10px; background: var(--surface); }
.side a { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 9px; text-decoration: none; font-weight: 600; color: var(--muted); font-size: 14px; }
.side a:hover { background: var(--surface-2); color: var(--fg); }
.side a.active { background: var(--brand); color: var(--brand-fg); }
.main { padding: 22px; min-width: 0; max-width: 980px; }
.main h2 { font-size: 22px; }
.tab-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tab-head h2 { margin: 0; margin-right: auto; }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; gap: 4px; position: sticky; top: 60px; z-index: 5; }
  .side a { white-space: nowrap; padding: 7px 10px; }
  .main { padding: 16px; }
}

.items { list-style: none; margin: 0; padding: 0; }
.items > li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.items > li:first-child { border-top: 0; }
.items .info { flex: 1 1 260px; min-width: 0; }
.items .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.items .meta { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.items .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.items li.off .name { color: var(--muted); text-decoration: line-through; }
.qty { width: 64px; text-align: center; padding: 7px 6px; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.status-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.code-big { font: 700 30px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; background: var(--surface-2); border-radius: 10px; padding: 10px 16px; display: inline-block; }
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { padding: 9px 2px; border-top: 1px solid var(--line); display: flex; gap: 10px; font-size: 14px; }
.feed li:first-child { border-top: 0; }
.feed time { color: var(--muted); white-space: nowrap; font-size: 12.5px; min-width: 82px; }
.feed .lvl { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-top: 7px; flex: 0 0 auto; }
.feed .lvl.success { background: var(--ok); }
.feed .lvl.warn { background: var(--warn); }
.feed .lvl.urgent { background: var(--err); }

/* Toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--info); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 14px; }
.toast.urgent { border-left-color: var(--err); }
.toast.success { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast b { display: block; }

/* Tables (admin) */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat .n { font-size: 26px; font-weight: 800; }

/* Legal */
.legal { max-width: 760px; margin: 30px auto; padding: 0 16px; }
.legal h2 { text-align: left; margin-top: 1.4em; font-size: 20px; }
.block { width: 100%; }
.mt { margin-top: 14px; }
/* Cards laid out in a grid don't stack, so no gap above them. */
.features > .card + .card, .steps > .card + .card, .stats > .card + .card { margin-top: 0; }
.status-row input[type="search"] { width: auto; flex: 1 1 220px; }
.topbar .wrap.full { max-width: none; }
.host-warning { background: var(--warn-bg); color: var(--fg); padding: 10px 16px; text-align: center; font-size: 14px; border-bottom: 1px solid var(--line); }
.host-warning a { font-weight: 700; }

/* Mugibot additions */
.pill.paused, .pill.pending, .pill.not_listed, .pill.unknown { background: var(--surface-2); color: var(--muted); }
.pill.info { background: var(--info-bg); color: var(--info); margin-left: 6px; }
.pill.flow-verified { background: var(--ok-bg); color: var(--ok); }
.pill.flow-beta { background: var(--info-bg); color: var(--info); }
.pill.flow-draft { background: var(--warn-bg); color: var(--warn); }
.flow { font-size: 12px; font-weight: 600; white-space: nowrap; }
.flow-verified { color: var(--ok); }
.flow-beta { color: var(--info); }
.flow-draft { color: var(--warn); }
.warn-text { color: var(--warn); }
fieldset.profile { margin: 0 0 16px; min-width: 0; }
fieldset.profile legend { font-weight: 700; padding: 0 6px; }
ul.plain { padding-left: 18px; margin: 6px 0; }
ul.plain li { margin: 4px 0; }
details > summary { cursor: pointer; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.tabs a { text-decoration: none; padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); border: 1px solid var(--line); background: var(--surface); }
.tabs a.active { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); }
.checks { list-style: none; padding: 0; margin: 8px 0; }
.checks li { padding: 6px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.checks li:first-child { border-top: 0; }
.checks .ok-mark { color: var(--ok); font-weight: 800; }
.checks .no-mark { color: var(--err); font-weight: 800; }
pre.flow-json { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow: auto; max-height: 320px; font-size: 12px; }
.buy-card { max-width: 520px; margin: 40px auto; }
@media (max-width: 560px) {
  .btn { white-space: normal; text-align: center; }
  .items .acts { gap: 4px; }
  .tab-head .btn { white-space: nowrap; }
}
@media (max-width: 720px) {
  .topbar nav .opt { display: none; }
  .topbar nav .pill { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
  .topbar .wrap { gap: 8px; }
}
.status-row select { width: auto; }
.tab-head form.status-row { flex: 1 1 420px; justify-content: flex-end; }
.status-row input:not([type="checkbox"]) { width: auto; flex: 1 1 200px; }
