/* BizAuto app styles */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --ink: #14202b;
  --ink-2: #475565;
  --muted: #6b7886;
  --line: #e3e8ee;
  --brand: #0b7a5c;
  --brand-ink: #ffffff;
  --brand-soft: #e3f4ee;
  --accent: #f2a516;
  --side: #0e1c24;
  --side-ink: #b9c6cf;
  --ok: #0f8a5f; --ok-soft: #e2f5ec;
  --warn: #a8620a; --warn-soft: #fdf2df;
  --bad: #c23934; --bad-soft: #fde8e7;
  --info: #2c62b8; --info-soft: #e6eefb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .05), 0 4px 16px rgba(16, 24, 32, .05);
  --font: "Plus Jakarta Sans", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.08rem; } h4 { font-size: .95rem; }
p { margin: 0 0 1em; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; font-size: .85em; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex-shrink: 0; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 1.15rem; padding: 4px 10px 18px; }
.brand:hover { text-decoration: none; }
.logo {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #14a37a, #0b7a5c); color: #fff; font-weight: 800; font-size: 1rem;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--side-ink); font-weight: 500; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: rgba(20,163,122,.18); color: #fff; }
.sidebar nav a.active svg { color: #3fd3a4; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding: 14px 10px 0; font-size: .85rem; }
.sidebar-foot .who { display: flex; flex-direction: column; margin-bottom: 8px; }
.sidebar-foot .who b { color: #fff; } .sidebar-foot .who small { opacity: .7; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .logout { color: var(--side-ink); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 1.25rem; margin: 0; flex: 1; }
.menu-btn { display: none; background: none; border: 0; padding: 4px; color: var(--ink); cursor: pointer; }
.loc-switch select { max-width: 260px; }
.content { padding: 24px 28px 48px; max-width: 1180px; width: 100%; }

.banner { background: var(--warn-soft); color: var(--warn); padding: 9px 28px; font-weight: 600; font-size: .9rem; border-bottom: 1px solid #f3dfb8; }
.banner.bad { background: var(--bad-soft); color: var(--bad); border-color: #f6c9c6; }
.banner.admin { background: var(--info-soft); color: var(--info); border-color: #c9d9f4; }

/* ---------- cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.75rem; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.stat .sub { color: var(--muted); font-size: .85rem; }
.stat .delta.up { color: var(--ok); } .stat .delta.down { color: var(--bad); }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .88rem; color: var(--ink-2); }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfd8e1; border-radius: 9px;
  padding: 9px 12px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,122,92,.15); }
.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.counter { font-size: .78rem; color: var(--muted); text-align: right; font-weight: 500; }
.counter.over { color: var(--bad); }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; font-size: .9rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; font-size: .9rem;
  padding: 9px 16px; border-radius: 9px; border: 1px solid #cfd8e1; background: #fff; color: var(--ink); cursor: pointer;
  text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: #b8c4cf; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: #096b51; }
.btn.ai { background: #fff8e8; border-color: #f0d18f; color: #7a4a00; }
.btn.ai:hover { background: #fdeec9; }
.btn.danger { color: var(--bad); border-color: #f0c4c1; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.small { padding: 5px 11px; font-size: .82rem; }
.btn.big { padding: 12px 20px; font-size: 1rem; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- alerts, pills ---------- */
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; border: 1px solid transparent; }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: #bfe7d4; }
.alert.error { background: var(--bad-soft); color: var(--bad); border-color: #f6c9c6; }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: #f3dfb8; }
.alert.info { background: var(--info-soft); color: var(--info); border-color: #c9d9f4; }

.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill-published, .pill-replied, .pill-uploaded, .pill-success, .pill-ok { background: var(--ok-soft); color: var(--ok); border-color: #bfe7d4; }
.pill-scheduled { background: var(--info-soft); color: var(--info); border-color: #c9d9f4; }
.pill-draft { background: var(--warn-soft); color: var(--warn); border-color: #f3dfb8; }
.pill-failed, .pill-new, .pill-revoked { background: var(--bad-soft); color: var(--bad); border-color: #f6c9c6; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); text-transform: uppercase; letter-spacing: .03em; }

.stars { color: var(--accent); letter-spacing: 1px; font-size: 1rem; }
.stars .off { color: #d9dee3; }

/* ---------- tables & lists ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.tabs .count { background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; font-size: .75rem; margin-left: 4px; }

.list-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .body { flex: 1; min-width: 0; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.activity li:last-child { border-bottom: 0; }
.activity .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 8px; flex-shrink: 0; }
.activity .dot.error { background: var(--bad); }
.activity time { color: var(--muted); font-size: .8rem; margin-left: auto; white-space: nowrap; }

/* ---------- posts ---------- */
.post-card { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; margin-bottom: 10px; background: #fff; }
.post-card img { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.post-card .body { flex: 1; min-width: 0; }
.post-card .text { white-space: pre-line; color: var(--ink-2); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.post-card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.error-text { color: var(--bad); font-size: .82rem; margin-top: 6px; }

.preview {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; max-width: 380px;
}
.preview .ph { background: var(--surface-2); aspect-ratio: 4/3; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.preview img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.preview .pt { padding: 12px 14px; white-space: pre-line; font-size: .9rem; color: var(--ink-2); }
.preview .pc { padding: 0 14px 14px; }
.preview .pc span { display: inline-block; color: #1a73e8; font-weight: 600; font-size: .9rem; }

.plan-grid .plan-item { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.plan-item textarea { min-height: 110px; margin-top: 8px; }

/* ---------- reviews ---------- */
.review { padding: 16px 0; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: 0; }
.review-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.review .comment { white-space: pre-line; margin: 6px 0 10px; }
.owner-reply { background: var(--surface-2); border-left: 3px solid var(--brand); padding: 9px 12px; border-radius: 0 8px 8px 0; font-size: .9rem; white-space: pre-line; }
.reply-box textarea { min-height: 84px; }

/* ---------- media ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.gallery figcaption { padding: 8px 10px; font-size: .8rem; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.dropzone { border: 2px dashed #c4d0da; border-radius: 12px; padding: 22px; text-align: center; background: var(--surface-2); cursor: pointer; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- audit ---------- */
.score-ring { --p: 0; width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: conic-gradient(var(--c, var(--brand)) calc(var(--p) * 1%), #e8edf1 0); }
.score-ring > div { width: 112px; height: 112px; border-radius: 50%; background: #fff; display: grid; place-items: center; text-align: center; }
.score-ring b { font-size: 2.2rem; line-height: 1; } .score-ring small { color: var(--muted); }
.check { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.check:last-child { border-bottom: 0; }
.check .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; flex-shrink: 0; }
.check.ok .ic { background: var(--ok-soft); color: var(--ok); }
.check.bad .ic { background: var(--bad-soft); color: var(--bad); }
.check .pts { margin-left: auto; color: var(--muted); font-size: .82rem; white-space: nowrap; }

/* ---------- onboarding ---------- */
.steps-list { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps-list li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.steps-list li:last-child { border-bottom: 0; }
.steps-list li::before { counter-increment: s; content: counter(s); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: .82rem; flex-shrink: 0; }
.steps-list li.done::before { content: "✓"; background: var(--ok-soft); color: var(--ok); border-color: #bfe7d4; }
.steps-list li .go { margin-left: auto; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty h3 { color: var(--ink); }

/* ---------- billing ---------- */
.price-big { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; }
.option-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.option-grid label { border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; text-align: center; font-weight: 600; color: var(--ink); }
.option-grid input { display: none; }
.option-grid label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(11,122,92,.15); }
.option-grid small { display: block; color: var(--muted); font-weight: 500; }

/* ---------- auth ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 10% -10%, #d7efe6 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #fbe9c6 0, transparent 55%), var(--bg); }
.auth-card { background: #fff; width: 100%; max-width: 430px; border-radius: 16px; padding: 30px; box-shadow: 0 10px 40px rgba(16,24,32,.08); border: 1px solid var(--line); }
.auth-card.wide { max-width: 760px; }
.brand-lg { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--ink); margin-bottom: 22px; }
.brand-lg:hover { text-decoration: none; }
.checklist { list-style: none; padding: 0; columns: 2; font-size: .9rem; }
.checklist .ok { color: var(--ok); } .checklist .bad { color: var(--bad); font-weight: 700; }
.steps li { margin-bottom: 10px; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 11px 18px;
  border-radius: 10px; font-weight: 600; font-size: .9rem; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--bad); }

.chart-box { position: relative; height: 300px; }
.kw-list { list-style: none; margin: 0; padding: 0; }
.kw-list li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }

/* ---------- responsive ---------- */
.nav-overlay { display: none; }
@media (max-width: 960px) {
  .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.g3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
  .menu-btn { display: block; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .topbar h1 { font-size: 1.08rem; }
  .loc-switch { width: 100%; } .loc-switch select { max-width: none; }
  .content { padding: 16px 16px 40px; }
  .banner { padding: 9px 16px; }
  .grid.g2, .grid2 { grid-template-columns: 1fr; }
  .option-grid { grid-template-columns: repeat(2, 1fr); }
  .post-card img { width: 64px; height: 64px; }
  .checklist { columns: 1; }
}

@media print {
  .sidebar, .topbar, .banner, .no-print, .btn { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

.list-item > .pill { align-self: flex-start; }
