:root {
  --ink: #23233a;
  --muted: #6b6b82;
  --line: #e6e6ef;
  --bg: #f4f4fa;
  --card: #ffffff;
  --brand: #4a3f8f;
  --brand-2: #6a5fb5;
  --ok: #1f7a4d;
  --ok-bg: #e6f4ec;
  --warn: #8a6d1a;
  --warn-bg: #fdf3d8;
  --danger: #b3312b;
  --danger-bg: #fbe7e6;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(30, 25, 70, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

.view { min-height: 100vh; }
.center { display: flex; align-items: center; justify-content: center; padding: 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

/* Brand */
.brand { display: flex; align-items: center; gap: 14px; }
.brand.small { gap: 10px; }
.brand h1 { margin: 0; font-size: 1.6rem; color: var(--brand); letter-spacing: -0.02em; }
.mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 700; font-size: 1.2rem;
}
.brand.small .mark { width: 30px; height: 30px; font-size: 1rem; border-radius: 8px; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 0.95rem; }

/* Auth */
.auth-card { max-width: 440px; width: 100%; }
.lede { color: var(--muted); margin: 18px 0; }
.dev-signin { display: grid; gap: 12px; margin-top: 8px; }
.dev-signin label { display: grid; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.dev-note { background: var(--warn-bg); color: var(--warn); padding: 10px 12px; border-radius: 8px; font-size: 0.85rem; margin: 0; }
.fineprint { color: #9a9ab0; font-size: 0.8rem; margin-top: 20px; text-align: center; }

/* Inputs */
input, select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px;
  font: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 1px; border-color: var(--brand-2); }
textarea { min-height: 80px; resize: vertical; }
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.tight { gap: 8px; margin-bottom: 12px; }
.row .or { color: var(--muted); font-size: 0.85rem; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; border-radius: 9px;
  padding: 10px 16px; background: #eee; color: var(--ink);
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.small { padding: 8px 12px; font-size: 0.85rem; }
.btn.submit { width: 100%; padding: 14px; font-size: 1.05rem; background: var(--ok); color: #fff; margin-top: 8px; }

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar-right { display: flex; align-items: center; gap: 18px; }
.who { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.rep-chip { display: flex; align-items: baseline; gap: 5px; background: var(--brand); color: #fff; padding: 6px 12px; border-radius: 20px; }
.rep-score { font-size: 1.15rem; font-weight: 700; }
.rep-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; }

/* Layout */
.layout { max-width: 1080px; margin: 24px auto; padding: 0 24px; display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }

h2 { margin: 0 0 4px; font-size: 1.3rem; }
h3 { margin: 0 0 12px; font-size: 1.05rem; }

/* Recorder */
.recorder { margin: 18px 0; }
.video-wrap { position: relative; background: #14141f; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; }
.video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.live-checklist {
  position: absolute; top: 12px; right: 12px;
  background: rgba(20, 20, 31, 0.82); color: #fff; backdrop-filter: blur(4px);
  padding: 12px 14px; border-radius: 10px; max-width: 210px; font-size: 0.82rem;
}
.live-checklist ul { margin: 6px 0 0; padding-left: 18px; }
.live-checklist li { margin: 3px 0; }
.lc-title { margin: 0; font-weight: 700; }
.lc-timer { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-weight: 700; margin-bottom: 8px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff5a52; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.rec-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.rec-controls .hint { color: var(--muted); font-size: 0.82rem; }
.upload-alt { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.upload-alt label { font-size: 0.85rem; }

/* Contacts */
.contacts { list-style: none; margin: 0; padding: 0; }
.contacts li { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.contacts li:last-child { border-bottom: none; }
.contacts .c-email { color: var(--muted); font-size: 0.82rem; }
.contacts .x { cursor: pointer; color: var(--muted); border: none; background: none; font-size: 1rem; }

/* Agreements */
.agreements { display: grid; gap: 12px; }
.agreement { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.agreement .a-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.agreement .a-subject { font-weight: 700; }
.agreement .a-meta { color: var(--muted); font-size: 0.82rem; margin: 4px 0 10px; }
.badge { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge.honored { background: var(--ok-bg); color: var(--ok); }
.badge.flagged { background: var(--danger-bg); color: var(--danger); }
.a-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.a-actions a.link { font-size: 0.85rem; color: var(--brand); text-decoration: none; align-self: center; }
.a-parties { font-size: 0.78rem; color: var(--muted); margin-top: 8px; }
.tick { color: var(--ok); }
.rep-detail { font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }

/* Messages */
.msg { padding: 12px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 0.9rem; }
.msg.success { background: var(--ok-bg); color: var(--ok); }
.msg.error { background: var(--danger-bg); color: var(--danger); }
.msg.info { background: #eceafb; color: var(--brand); }

/* Language switch */
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: #fff; }
.lang-switch button { border: none; background: none; padding: 5px 11px; font: inherit; font-size: 0.75rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.lang-switch button.active { background: var(--brand); color: #fff; }
.auth-card { position: relative; }
.auth-card .lang-switch { position: absolute; top: 16px; right: 16px; }

/* Nav */
.nav { display: flex; gap: 4px; }
.nav-link { background: none; border: none; font: inherit; font-weight: 600; color: var(--muted); padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.nav-link:hover { background: #f1f0fa; }
.nav-link.active { color: var(--brand); background: #eceafb; }
.small { font-size: 0.85rem; }

/* Role toggle */
.role-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .role-toggle { grid-template-columns: 1fr; } }
.role-opt { display: flex; align-items: flex-start; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; cursor: pointer; font-weight: 500; }
.role-opt:has(input:checked) { border-color: var(--brand); background: #f6f4ff; }
.role-opt input { width: auto; margin-top: 3px; }
.role-opt small { display: block; color: var(--muted); font-weight: 400; }

/* Pills */
.pill { display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: 20px; background: #edecf5; color: var(--muted); vertical-align: middle; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }

/* Lookup card */
.lookup-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 12px; }
.lookup-card.flagged { border-color: var(--danger); background: var(--danger-bg); }
.lu-top { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.lu-stats { display: flex; gap: 14px; font-size: 0.82rem; color: var(--muted); margin-bottom: 10px; }
.lu-stats .bad b { color: var(--danger); }
.avatar-init { display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700; border-radius: 50%; width: 56px; height: 56px; font-size: 1.3rem; }
.avatar-init.sm { width: 40px; height: 40px; font-size: 0.95rem; }

/* Red flag note on agreement card */
.rf-note { margin-top: 10px; background: var(--danger-bg); color: var(--danger); padding: 8px 10px; border-radius: 8px; font-size: 0.82rem; }
.a-role { margin-top: 2px; }

/* Profile page */
.profile-wrap { max-width: 760px; margin: 24px auto; padding: 0 24px; }
.profile { padding: 0; overflow: hidden; }
.cover { height: 110px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.cover-flagged { background: linear-gradient(135deg, #b3312b, #d9584f); }
.profile-head { display: flex; align-items: flex-end; gap: 16px; padding: 0 28px; margin-top: -40px; }
.avatar { flex: none; }
.avatar-img { width: 96px; height: 96px; border-radius: 50%; border: 4px solid #fff; object-fit: cover; background: #fff; }
.profile-head .avatar-init { width: 96px; height: 96px; font-size: 2rem; border: 4px solid #fff; }
.identity { flex: 1; padding-bottom: 4px; }
.identity h1 { margin: 0; font-size: 1.5rem; }
.identity .headline { margin: 2px 0 0; color: var(--ink); }
.identity .loc { margin: 2px 0 0; color: var(--muted); font-size: 0.88rem; }
.profile-head .btn { margin-bottom: 8px; }
.flag-banner { margin: 16px 28px 0; background: var(--danger-bg); color: var(--danger); border: 1px solid #f0b7b3; padding: 12px 14px; border-radius: 9px; font-size: 0.9rem; font-weight: 500; }
.stat-row { display: flex; gap: 12px; padding: 20px 28px 4px; }
.stat { flex: 1; background: #f7f7fc; border-radius: 10px; padding: 14px; text-align: center; }
.stat-num { display: block; font-size: 1.7rem; font-weight: 700; color: var(--brand); }
.stat-num.bad { color: var(--danger); }
.stat-lbl { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.about { padding: 12px 28px; }
.about h3 { margin-bottom: 6px; }
.profile-email { padding: 0 28px 24px; font-size: 0.82rem; }
.profile.card .field, .profile.card h2 { margin-left: 28px; margin-right: 28px; }
.profile.card h2 { padding-top: 24px; }
.profile.card .row { margin: 0 28px 28px; }

/* Avatar column with prominent points under the picture */
.profile-head { align-items: flex-start; }
.avatar-col { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.btn.tiny { padding: 5px 11px; font-size: 0.78rem; }
.points-big { text-align: center; line-height: 1; }
.points-big .pn { display: block; font-size: 2rem; font-weight: 800; color: var(--brand); }
.points-big .pl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.points-locked { font-size: 0.78rem; font-weight: 700; color: var(--danger); background: var(--danger-bg); padding: 5px 10px; border-radius: 8px; text-align: center; }
.identity { padding-top: 44px; }

/* Sections */
.section { padding: 16px 28px; border-top: 1px solid var(--line); }
.section h3 { margin: 0 0 6px; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
.section-head h3 { margin: 0; }

/* Portfolio gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.pf-item { position: relative; margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #faf9fe; }
.pf-item img { width: 100%; height: 120px; object-fit: cover; display: block; }
.pf-item figcaption { padding: 6px 9px; font-size: 0.78rem; color: var(--muted); }
.pf-del { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 1rem; line-height: 1; }

/* Lookup avatar + flag line */
.avatar-img.sm { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.lu-flag { background: var(--danger-bg); color: var(--danger); padding: 8px 10px; border-radius: 8px; font-size: 0.8rem; margin-bottom: 10px; font-weight: 500; }
