:root {
  --bg: #f6f7fb; --card: #fff; --ink: #1b2233; --muted: #636b7f; --line: #e3e6ef;
  --brand: #3b4cca; --brand-d: #2c3aa6; --brand-l: #eceffd; --accent: #ff7a59;
  --ok: #1f9d6b; --ok-l: #e5f6ee; --warn: #b7791f; --warn-l: #fdf3e1; --bad: #c8363d; --bad-l: #fdecec;
  --radius: 14px; --shadow: 0 1px 2px rgba(20,30,60,.06), 0 6px 24px rgba(20,30,60,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.8rem; line-height: 1.2; margin: 0 0 .4em; }
h2 { font-size: 1.25rem; margin: 0 0 .6em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
[hidden] { display: none !important; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; background: rgba(255,255,255,.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.1rem; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), #7b5cff); color: #fff; font-size: .95rem; }
#nav > span { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.navlink { padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 500; }
.navlink:hover, .navlink.active { background: var(--brand-l); color: var(--brand-d); }
body:not(.is-member) .member-only, body.is-member .guest-only, body:not(.is-admin) .admin-only { display: none !important; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 10px 18px;
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--brand-d); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); }
.btn-ghost:hover { background: var(--brand-l); }
.btn-danger { background: var(--bad); } .btn-danger:hover { background: #a82a30; }
.btn-small { padding: 6px 12px; font-size: .9rem; }
.btn-big { padding: 13px 26px; font-size: 1.05rem; }
.btn-full { width: 100%; }
.linkbtn { background: none; border: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

/* layout */
main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 40px; }
.view.narrow { max-width: 440px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 18px; }
.card.danger { border-left: 4px solid var(--bad); }

/* flash */
.flash { max-width: 1040px; margin: 14px auto 0; padding: 12px 16px; border-radius: 10px; background: var(--ok-l); color: #11603f; font-weight: 500; }
.flash.bad { background: var(--bad-l); color: var(--bad); }

/* forms */
label { display: block; font-weight: 600; font-size: .95rem; margin: 0 0 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font: inherit; font-weight: 400; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-l); }
textarea { resize: vertical; }
.form-msg { min-height: 1.2em; margin: 10px 0 0; font-weight: 500; }
.form-msg.ok { color: var(--ok); } .form-msg.bad { color: var(--bad); }
.help { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 999px; font-weight: 500; cursor: pointer; margin: 0; user-select: none; }
.chip input { margin: 0; accent-color: var(--brand); }
.chip:has(input:checked) { border-color: var(--brand); background: var(--brand-l); color: var(--brand-d); }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; }
.toggle.locked { cursor: default; opacity: .8; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.google-box .g-btn { display: flex; justify-content: center; min-height: 44px; }
.or { position: relative; text-align: center; margin: 16px 0; color: var(--muted); font-size: .9rem; }
.or::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.or span { position: relative; background: #fff; padding: 0 10px; }

/* home */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 30px; align-items: center; padding: 30px 0 40px; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); letter-spacing: -.02em; }
.accent { background: linear-gradient(90deg, var(--brand), #7b5cff 60%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.15rem; color: #3d4559; max-width: 36em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.hero-art { display: flex; justify-content: center; }
.ring { position: relative; width: 300px; height: 300px; max-width: 80vw; max-height: 80vw; }
.ring .av { position: absolute; width: 58px; height: 58px; font-size: 1.05rem; transform: translate(-50%, -50%); box-shadow: 0 4px 14px rgba(0,0,0,.12); border: 3px solid #fff; }
.ring .av.center { width: 96px; height: 96px; font-size: 1.6rem; left: 50%; top: 50%; }
.agent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 10px 0 40px; }
.agent-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; gap: 14px; align-items: flex-start; }
.agent-card.lead-card { grid-column: 1 / -1; background: linear-gradient(135deg, #fff, var(--brand-l)); }
.agent-card h3 { margin: 0; font-size: 1.05rem; }
.agent-card .role { color: var(--brand-d); font-weight: 600; font-size: .9rem; }
.agent-card p { margin: 6px 0 0; color: var(--muted); font-size: .92rem; }
.av { flex: none; display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: #fff; font-weight: 700; letter-spacing: .02em; }
.how { padding: 10px 0; }
.steps { max-width: 620px; margin: 0 auto 26px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 14px 16px 14px 60px; background: #fff; border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 10px; }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }

/* dashboard */
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: flex; flex-wrap: wrap; gap: 5px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.tab { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 11px 6px 6px; border: 0; border-radius: 999px; background: #fff; box-shadow: var(--shadow);
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; color: var(--ink); }
.tab .av { width: 26px; height: 26px; font-size: .7rem; }
.tab[aria-selected=true] { background: var(--brand); color: #fff; }
.panel { margin-top: 14px; }
.agent-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.agent-head .av { width: 84px; height: 84px; font-size: 1.6rem; }
.agent-head h2 { margin: 0; font-size: 1.5rem; }
.agent-head .grow { flex: 1; min-width: 200px; }
.status { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 12px; border-radius: 999px; font-size: .88rem; font-weight: 600; background: var(--warn-l); color: var(--warn); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.live { background: var(--ok-l); color: var(--ok); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.settings-grid .full { grid-column: 1 / -1; }
.section-title { grid-column: 1 / -1; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 8px 0 12px; border-top: 1px solid var(--line); padding-top: 16px; }
.save-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.save-bar .form-msg { margin: 0; }

/* messages */
.msg-list { display: grid; gap: 12px; }
.msg { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 16px 18px; }
.msg-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.msg h3 { margin: 0; font-size: 1.02rem; }
.msg .meta { color: var(--muted); font-size: .85rem; }
.msg .body { white-space: pre-wrap; margin: 8px 0 0; color: #3d4559; overflow-wrap: anywhere; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--brand-l); color: var(--brand-d); font-size: .8rem; font-weight: 600; }
.tag.bad { background: var(--bad-l); color: var(--bad); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; background: #fff; border-radius: 12px; box-shadow: var(--shadow); }

/* account */
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.details dt { color: var(--muted); } .details dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* admin */
.table-wrap { overflow-x: auto; background: #fff; border-radius: 12px; box-shadow: var(--shadow); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table th { background: #fafbfe; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15,20,40,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; background: #fff; border-radius: var(--radius); padding: 26px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-x { position: absolute; right: 12px; top: 10px; border: 0; background: none; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--muted); }
body.modal-open { overflow: hidden; }
.big-icon { font-size: 3rem; color: var(--brand); }

.foot { text-align: center; padding: 20px; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); }
.foot p { margin: 4px 0; }

@media (max-width: 900px) { .agent-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .tabs { flex-wrap: nowrap; }
  .agent-grid { grid-template-columns: 1fr; }
  main { padding: 16px 14px 30px; }
  .hero { grid-template-columns: 1fr; padding: 10px 0 24px; text-align: center; }
  .hero-actions { justify-content: center; }
  .hero-art { order: -1; }
  .ring { width: 230px; height: 230px; }
  .ring .av { width: 46px; height: 46px; font-size: .85rem; }
  .ring .av.center { width: 74px; height: 74px; font-size: 1.25rem; }
  .lead { margin: 0 auto; }
  .settings-grid { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .topbar { padding: 8px 12px; }
  .brand span:last-child { display: none; }
  .navlink { padding: 6px 5px; font-size: .86rem; }
  #nav > span { flex-wrap: nowrap; gap: 2px; }
  .topbar { gap: 8px; }
  .agent-head .av { width: 64px; height: 64px; font-size: 1.25rem; }
  .dash-head .btn { width: 100%; }
}

/* v1.1 (2026-11-22): agent portraits */
.av.photo { color: transparent; text-shadow: none; overflow: hidden; }
.agent-card .av { width: 76px; height: 76px; }
.agent-head .av { width: 104px; height: 104px; }
@media (max-width: 640px) { .agent-card .av { width: 60px; height: 60px; } .agent-head .av { width: 76px; height: 76px; } }
/* v1.2: version tag next to the title */
.brand .ver-tag { margin-left: 8px; font-size: .72rem; font-weight: 600; color: #6b7280; background: #eef0f7; border-radius: 999px; padding: 2px 8px; align-self: center; }
