:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 8px 24px rgba(15, 23, 42, .06);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.stack > * + * { margin-top: 1rem; }

.container { max-width: 980px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.container-narrow { max-width: 520px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.card + .card { margin-top: 1rem; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: .25rem; }

input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=password], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 0;
  border-color: var(--brand);
}
textarea { min-height: 88px; resize: vertical; }

.check { display: flex; align-items: center; gap: .5rem; }
.check input { width: auto; }
.check label { margin: 0; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600;
  padding: .6rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
button:hover, .btn:hover { background: var(--brand-dark); }
button:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f8fafc; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-dark); }
.btn-sm { padding: .35rem .6rem; font-size: .85rem; }
.btn-block { width: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px;
  background: #f1f5f9; color: var(--muted);
}
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.warn { background: #fef3c7; color: #b45309; }
.badge.danger { background: #fee2e2; color: #b91c1c; }
.badge.brand { background: #dbeafe; color: #1d4ed8; }

.banner { padding: .75rem 1rem; border-radius: 8px; font-size: .9rem; margin-bottom: 1rem; }
.banner.ok { background: #dcfce7; color: #166534; }
.banner.warn { background: #fef3c7; color: #92400e; }
.banner.err { background: #fee2e2; color: #991b1b; }
.banner.info { background: #dbeafe; color: #1e40af; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table-wrap { overflow-x: auto; }

.topbar {
  background: var(--ink); color: #fff;
  padding: .8rem 1rem;
  display: flex; justify-content: space-between; align-items: center;
}
.topbar a, .topbar .brand { color: #fff; text-decoration: none; font-weight: 700; }
.topbar .row { gap: 1rem; }

.grid-meetings { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.qr-img { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 8px; background:#fff; }

.field-editor { border: 1px solid var(--line); border-radius: 8px; padding: .75rem; margin-bottom: .6rem; background: #f8fafc; }
.field-editor .row { gap: .5rem; }
.field-editor .grow { flex: 1 1 140px; }

.spinner { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.dark { border-color: rgba(37,99,235,.25); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

.geo-status { display:flex; align-items:center; gap:.6rem; padding:.75rem 1rem; border-radius:8px; background:#f8fafc; border:1px solid var(--line); }
.dot { width:10px;height:10px;border-radius:50%;background:var(--muted); flex:none; }
.dot.ok{background:var(--ok);} .dot.warn{background:var(--warn);} .dot.err{background:var(--danger);}

/* Analytics */
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:.75rem; margin-bottom:1rem; }
.stat { background:#f8fafc; border:1px solid var(--line); border-radius:10px; padding:.75rem .9rem; }
.stat .v { font-size:1.6rem; font-weight:800; color:var(--ink); line-height:1.1; }
.stat .l { font-size:.75rem; color:var(--muted); text-transform:uppercase; letter-spacing:.03em; margin-top:.2rem; }
.stat.good .v { color:#16a34a; } .stat.warn .v { color:#d97706; }
.chart { margin:.5rem 0 1rem; }
.chart h4 { margin:.75rem 0 .5rem; font-size:.9rem; }
.bar-row { display:flex; align-items:center; gap:.5rem; margin-bottom:.3rem; font-size:.82rem; }
.bar-row .lab { flex:0 0 130px; color:#334155; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bar-row .track { flex:1; background:#eef2f7; border-radius:6px; height:18px; overflow:hidden; }
.bar-row .fill { height:100%; background:linear-gradient(90deg,#2563eb,#1d4ed8); border-radius:6px; }
.bar-row .num { flex:0 0 auto; color:var(--muted); min-width:2.2rem; text-align:right; }
.spark { display:flex; align-items:flex-end; gap:2px; height:70px; padding:.25rem 0; }
.spark .col { flex:1; background:#93c5fd; border-radius:3px 3px 0 0; min-height:2px; position:relative; }
.spark .col:hover { background:#2563eb; }
.spark-x { display:flex; gap:2px; font-size:.65rem; color:var(--muted); }
.spark-x span { flex:1; text-align:center; }

.success-screen { text-align:center; padding: 2rem 1rem; }
.success-check { width:72px;height:72px;border-radius:50%;background:#dcfce7;color:#16a34a;display:flex;align-items:center;justify-content:center;font-size:2.5rem;margin:0 auto 1rem; }
