:root {
  --ink: #16181d;
  --ink-soft: #6b7280;
  --line: #e5e7eb;
  --bg: #f7f8fa;
  --card: #ffffff;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --green: #d1fae5;
  --green-dark: #047857;
  --amber: #b45309;
  --danger: #dc2626;
  --sidebar-bg: #0f1729;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
code { background: #f1f1f4; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }

/* ---------- Public site ---------- */
body.pub { background: #fff; }
.pub-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 48px; border-bottom: 1px solid var(--line); }
.pub-brand { font-weight: 800; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.brand-mark { background: var(--brand); color: #fff; width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.pub-nav { display: flex; align-items: center; gap: 28px; font-weight: 600; font-size: 14.5px; }
.btn-primary { background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 8px; }
.hero { text-align: center; padding: 100px 24px 70px; max-width: 780px; margin: 0 auto; }
.eyebrow { color: var(--brand-dark); font-weight: 700; font-size: 13.5px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }
.hero h1 { font-size: 46px; line-height: 1.15; margin: 0 0 18px; letter-spacing: -0.02em; }
.hero .sub { font-size: 18px; color: var(--ink-soft); line-height: 1.6; margin-bottom: 30px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; }
.btn { display: inline-block; padding: 12px 22px; border-radius: 9px; font-weight: 700; font-size: 15px; cursor: pointer; border: none; }
.btn-outline { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn-block { width: 100%; text-align: center; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.section { max-width: 1100px; margin: 0 auto; padding: 70px 24px; }
.section h2 { font-size: 32px; text-align: center; margin-bottom: 10px; letter-spacing: -0.01em; }
.lede { text-align: center; color: var(--ink-soft); font-size: 16px; margin-bottom: 46px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature-card { border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.feature-card .icon { font-size: 26px; margin-bottom: 10px; }
.feature-card h3 { margin: 0 0 8px; font-size: 17px; }
.feature-card p { margin: 0; color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; }
.pub-footer { text-align: center; padding: 40px 24px; color: var(--ink-soft); font-size: 13.5px; border-top: 1px solid var(--line); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.auth-card { background: var(--card); border-radius: 16px; padding: 40px; width: 420px; box-shadow: 0 4px 24px rgba(0,0,0,0.06); }
.auth-card h1 { margin: 0 0 6px; font-size: 24px; }
.auth-card .sub { color: var(--ink-soft); margin: 0 0 24px; font-size: 14.5px; }
.auth-alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--ink-soft); }
.auth-alt a { color: var(--brand-dark); font-weight: 600; }
.error-box { background: #fee2e2; color: var(--danger); padding: 10px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; }
input[type=text], input[type=email], input[type=password], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 14.5px; font-family: inherit; background: #fff;
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--sidebar-bg); color: #e5e7eb; display: flex; flex-direction: column; padding: 22px 16px; flex-shrink: 0; }
.brand { font-weight: 800; font-size: 19px; display: flex; align-items: center; gap: 8px; padding: 0 8px 20px; }
.brand .brand-mark { background: transparent; font-size: 22px; width: auto; height: auto; }
.store-name { padding: 10px 8px 18px; font-weight: 700; font-size: 14px; border-bottom: 1px solid #232c42; margin-bottom: 14px; }
.plan-sub { font-weight: 400; color: #8a93a8; font-size: 12px; text-transform: capitalize; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a { padding: 10px 12px; border-radius: 8px; font-size: 14.5px; font-weight: 600; color: #c7cad4; display: flex; align-items: center; gap: 10px; }
.side-nav a.active, .side-nav a:hover { background: #1e2942; color: #fff; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; }
.sidebar-footer { border-top: 1px solid #232c42; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-mode-pill { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; width: fit-content; }
.ai-mode-pill.live { background: #0b3a2c; color: #34d399; }
.link-btn { background: none; border: none; color: #8a93a8; font-size: 13.5px; cursor: pointer; padding: 0; font-weight: 600; }
.link-btn:hover { color: #fff; }
.main-pane { flex: 1; padding: 32px 40px; max-width: 1280px; }
.flash { background: var(--green); color: var(--green-dark); padding: 10px 16px; border-radius: 8px; margin-bottom: 20px; font-weight: 600; font-size: 14px; }
.flash.danger { background: #fee2e2; color: var(--danger); }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; gap: 20px; }
.page-header h1 { margin: 0 0 4px; font-size: 26px; }
.page-header p { margin: 0; color: var(--ink-soft); font-size: 14.5px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.stat-card .label { color: var(--ink-soft); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 800; }
.stat-card .value.green { color: var(--green-dark); }
.stat-card .value.danger { color: var(--danger); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; margin-bottom: 20px; }
.card h2 { margin: 0 0 6px; font-size: 17px; }
.card h2.no-margin { margin: 0; }
.card-sub { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 16px; }
.empty-state { color: var(--ink-soft); font-size: 14px; padding: 30px 10px; text-align: center; }
.empty-state a { color: var(--brand-dark); font-weight: 700; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-soft); padding: 12px 20px; border-bottom: 1px solid var(--line); }
td { padding: 14px 20px; border-bottom: 1px solid #f1f1f4; font-size: 14px; }
tr:last-child td { border-bottom: none; }

.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: capitalize; background: #eef2ff; color: #4338ca; }
.pill.completed, .pill.done, .pill.active { background: var(--green); color: var(--green-dark); }
.pill.failed { background: #fee2e2; color: var(--danger); }
.pill.running { background: #fef3c7; color: var(--amber); }

@media (max-width: 900px) {
  .feature-grid, .stat-grid, .form-grid-2, .product-grid { grid-template-columns: 1fr; }
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; }
}

/* ---------- Product cards (Overview) ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-bottom: 24px; }
.product-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.product-card.failed { border-color: #fecaca; }
.product-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.product-card-id { display: flex; align-items: center; gap: 10px; }
.product-icon { font-size: 24px; width: 40px; height: 40px; border-radius: 10px; background: #f1f4fb; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.product-name { font-weight: 800; font-size: 16px; }
.product-tagline { font-size: 12.5px; color: var(--ink-soft); }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; }
.status-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.ok::before { background: #10b981; }
.status-dot.ok { color: var(--green-dark); }
.status-dot.failed::before { background: var(--danger); }
.status-dot.failed { color: var(--danger); }
.status-dot.unchecked::before { background: #9ca3af; }
.status-dot.unchecked { color: var(--ink-soft); }
.product-tenant { font-size: 12.5px; color: var(--ink-soft); }
.product-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric-tile { background: #fafbfc; border: 1px solid #f1f1f4; border-radius: 10px; padding: 10px 12px; }
.metric-tile .metric-label { font-size: 11px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 3px; }
.metric-tile .metric-value { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.product-error { font-size: 12.5px; color: var(--danger); background: #fef2f2; border-radius: 8px; padding: 8px 10px; }
.product-checked-at { font-size: 11.5px; color: var(--ink-soft); }
.product-actions { display: flex; gap: 8px; margin-top: auto; }
.product-actions form { flex: 1; }
.product-actions .btn { width: 100%; text-align: center; padding: 8px 12px; font-size: 13px; }

/* ---------- Connections settings ---------- */
.connection-row { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.connection-row-main { display: flex; align-items: center; gap: 12px; }
.connection-row code { background: #f4f4f7; padding: 2px 6px; border-radius: 5px; font-size: 12px; }
