/* Prowl — Klaviyo/Omnisend-style UI */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-muted: #6b7280;
  --brand: #1f6feb;
  --brand-dark: #1858bd;
  --green: #10b981;
  --green-bg: #ecfdf5;
  --red: #ef4444;
  --red-bg: #fef2f2;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --gray-bg: #f3f4f6;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,0.04), 0 1px 4px rgba(16,24,40,0.02);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; background: var(--gray-bg); padding: 1px 5px; border-radius: 4px; }

.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* Sidebar */
.sidebar { background: #0f172a; color: #cbd5e1; padding: 20px 14px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; color: white; padding: 4px 8px 18px; }
.brand .logo { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; background: var(--brand); color: white; font-weight: 800; font-size: 14px; }
.brand-large { font-size: 24px; }
.brand-large .logo { width: 38px; height: 38px; font-size: 18px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a { color: #cbd5e1; padding: 9px 12px; border-radius: 6px; display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 500; }
.sidebar nav a:hover { background: #1e293b; color: white; text-decoration: none; }
.sidebar nav a.active { background: var(--brand); color: white; }
.sidebar nav a .icon { font-size: 14px; width: 18px; text-align: center; opacity: 0.85; }
.sidebar .logout { margin-top: 12px; }
.sidebar .logout button { width: 100%; background: transparent; border: 1px solid #334155; color: #cbd5e1; padding: 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.sidebar .logout button:hover { background: #1e293b; }

main { display: flex; flex-direction: column; }
.topbar { padding: 18px 32px; background: white; border-bottom: 1px solid var(--border); }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 600; }
.content { padding: 24px 32px; }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.card h3 { margin: 18px 0 10px; font-size: 14px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.card-header h2 { margin: 0; }

.row { display: flex; gap: 18px; margin-bottom: 18px; }
.row .card { margin-bottom: 0; }
.flex-1 { flex: 1; min-width: 0; }
.flex-2 { flex: 2; min-width: 0; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-label { color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-value { font-size: 28px; font-weight: 700; margin: 4px 0; color: var(--text); }
.stat-sub { color: var(--text-muted); font-size: 12.5px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table thead th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table tbody td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table tbody tr:last-child td { border-bottom: 0; }
table tbody tr:hover { background: var(--surface-2); }
table.kv td { padding: 6px 10px; border: 0; }
table.kv td:first-child { color: var(--text-muted); width: 160px; font-weight: 500; }

/* Forms */
label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 12px; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  display: block; width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 13.5px; background: white; color: var(--text); font-family: inherit; margin-top: 4px;
}
input:not([type=checkbox]):not([type=submit]) { box-sizing: border-box; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
textarea { resize: vertical; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; line-height: 1.5; }
.form-grid { display: grid; gap: 12px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
label.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.inline-form { display: flex; gap: 8px; }
.inline-form input, .inline-form select { width: auto; }

/* Buttons */
button, .btn, .btn-primary, .btn-small { font-family: inherit; cursor: pointer; border-radius: 6px; padding: 8px 14px; font-weight: 500; font-size: 13.5px; border: 1px solid var(--border-strong); background: white; color: var(--text); }
button:hover, .btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); color: white; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-small { padding: 5px 10px; font-size: 12.5px; }
.link-danger { background: transparent; border: 0; color: var(--red); padding: 4px 6px; font-size: 12.5px; cursor: pointer; }
.link-danger:hover { text-decoration: underline; background: transparent; }

/* Pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; text-transform: capitalize; }
.pill-green { background: var(--green-bg); color: #047857; }
.pill-blue  { background: var(--blue-bg);  color: var(--blue); }
.pill-red   { background: var(--red-bg);   color: #b91c1c; }
.pill-gray  { background: var(--gray-bg);  color: var(--text-muted); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }

/* Banners */
.banner { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; border: 1px solid; }
.banner-success { background: var(--green-bg); color: #047857; border-color: #a7f3d0; }
.banner-error { background: var(--red-bg); color: #b91c1c; border-color: #fecaca; }
.banner-warn { background: var(--amber-bg); color: var(--amber); border-color: #fde68a; }

.muted { color: var(--text-muted); }
details { margin-top: 8px; }
details summary { cursor: pointer; color: var(--brand); font-size: 13px; }

/* Event list */
.event-list { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow-y: auto; }
.event-list li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.event-list li:last-child { border-bottom: 0; }
.event-list .pill { margin-right: 6px; }

/* Bars */
.bar { width: 100px; height: 6px; background: var(--gray-bg); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 3px; transition: width 0.2s; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 60px 1fr 80px; gap: 10px; align-items: center; font-size: 12px; }
.bar-row .bar { width: 100%; height: 12px; }
.bar-label { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bar-val { color: var(--text); font-variant-numeric: tabular-nums; }

/* Picker */
.picker { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 8px; background: var(--surface-2); }
.picker-item { display: flex; gap: 8px; align-items: center; padding: 4px 6px; margin: 0; border-radius: 4px; cursor: pointer; font-weight: 400; }
.picker-item:hover { background: white; }

/* Login */
.login-page { background: linear-gradient(180deg, #f6f8fb 0%, #e2e8f0 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: white; border-radius: 12px; box-shadow: 0 10px 30px rgba(15,23,42,0.08); padding: 32px; width: 100%; max-width: 380px; }
.login-card .subtitle { color: var(--text-muted); margin-bottom: 20px; }
.login-card .btn-primary { width: 100%; padding: 10px; font-weight: 600; margin-top: 8px; }
