:root { --brand:#2f5bea; --brand-dark:#1e40c4; --ink:#0f172a; --muted:#64748b; --line:#e6eaf1; --bg:#f4f6fb; --ok:#16a34a; --err:#dc2626; }
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
code { background: #eef2fb; padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .nowrap { white-space: nowrap; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* Gate */
.gate { max-width: 360px; margin: 90px auto; background: #fff; padding: 30px; border-radius: 16px; box-shadow: 0 12px 44px rgba(15,23,42,.12); text-align: center; }
.gate h1 { font-size: 18px; margin: 6px 0; } .gate p { margin: 0 0 14px; }
.gate input { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font: inherit; margin-bottom: 12px; }
.gate .err { color: var(--err); font-size: 13px; margin-top: 12px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.logo.lg { width: 44px; height: 44px; font-size: 22px; margin: 0 auto 8px; }

/* Topbar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 22px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.crumbs { color: var(--muted); } .crumbs a { color: var(--brand); } .crumbs .sep { margin: 0 6px; color: #cbd5e1; }
.spacer { flex: 1; }
button, .btn-primary, .ghost { font: inherit; cursor: pointer; border-radius: 9px; border: 1px solid var(--line); background: #fff; padding: 8px 13px; }
.btn-primary { background: var(--brand); color: #fff; border: none; font-weight: 700; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary.sm, .ghost.sm { padding: 7px 12px; font-size: 13px; }
.ghost.xs { padding: 3px 8px; font-size: 12px; }

.main { max-width: 1080px; margin: 0 auto; padding: 22px; }

/* Panels & cards */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 18px; }
.panel.np { padding: 6px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel h2 { font-size: 15px; margin: 0 0 14px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 16px; }
.kpi .n { font-size: 27px; font-weight: 800; } .kpi .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Funnel */
.funnel-row { margin-bottom: 12px; }
.funnel-head { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 5px; }
.funnel-head .drop { color: #b91c1c; font-weight: 600; }
.bar { height: 30px; background: #eef2fb; border-radius: 8px; overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #2f5bea, #4f7cff); border-radius: 8px; transition: width .5s ease; min-width: 2px; }
.bar .val { position: absolute; left: 10px; top: 0; height: 100%; display: flex; align-items: center; color: #fff; font-size: 13px; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; }
.scroll { overflow-x: auto; } .pad { padding: 20px; }
.tag { display: inline-block; background: #eef2fb; color: #1e40c4; padding: 2px 8px; border-radius: 999px; font-size: 12px; }

/* Forms list cards */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.form-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 16px; transition: box-shadow .2s, transform .05s; color: var(--ink); }
.form-card:hover { box-shadow: 0 8px 24px rgba(15,23,42,.1); }
.form-card h3 { margin: 8px 0 2px; font-size: 16px; }
.fc-head { display: flex; justify-content: space-between; align-items: center; }
.fc-slug { font-size: 12px; margin-bottom: 12px; }
.fc-stats { display: flex; gap: 16px; }
.fc-stats div { display: flex; flex-direction: column; } .fc-stats b { font-size: 17px; } .fc-stats span { font-size: 11px; color: var(--muted); }
.status { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: capitalize; }
.st-on { background: #e7f8ee; color: #15803d; } .st-off { background: #fdecec; color: #b91c1c; }
.badges-mini .mini { font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 6px; margin-left: 3px; }
.mini.ok { background: #e7f8ee; color: #15803d; } .mini.off { background: #f1f5f9; color: #94a3b8; }

/* Detail */
.detail-head h1 { font-size: 21px; margin: 4px 0; display: flex; align-items: center; gap: 10px; }
.detail-head .url { font-size: 13px; } .detail-head { margin-bottom: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab { padding: 11px 16px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=search] { min-width: 220px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; }
select { font: inherit; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }

/* Leads table */
.leads td { white-space: nowrap; }
.note { width: 150px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; font: inherit; }
select.status { font-weight: 700; border: none; padding: 5px 8px; border-radius: 999px; }
.status.st-new { background: #eef2fb; color: #1e40c4; } .status.st-contacted { background: #fff2e8; color: #c2410c; }
.status.st-booked { background: #e7effe; color: #1d4ed8; } .status.st-won { background: #e7f8ee; color: #15803d; } .status.st-lost { background: #fdecec; color: #b91c1c; }
.pill { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pill-ok { background: #e7f8ee; color: #15803d; } .pill-fail { background: #fdecec; color: #b91c1c; } .pill-pend { background: #f1f5f9; color: #64748b; }
.mini-btn { padding: 3px 8px; font-size: 11px; border-radius: 7px; }

/* Settings */
.frow { display: grid; grid-template-columns: 240px 1fr; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; }
.frow > span { font-size: 13.5px; color: #475569; font-weight: 600; }
.frow input, .frow select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; }
.save-bar { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 40%); padding: 14px 0; }

.logs code { font-size: 12px; }
.err-box { color: var(--err); }
.panel.danger { border-color: #fbcaca; background: #fff8f8; }
.panel.danger h2 { color: #b91c1c; }
.btn-danger { background: #fff; color: #b91c1c; border: 1px solid #f1a9a9; font-weight: 700; padding: 9px 14px; border-radius: 9px; }
.btn-danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }

/* Toast */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 760px) { .cards { grid-template-columns: repeat(2, 1fr); } .cols { grid-template-columns: 1fr; } .frow { grid-template-columns: 1fr; gap: 6px; } }
