/* Island Factions — Family Management Portal
   Tokens: wine, charcoal, metallic gold, warm cream. */
:root {
  --ink: #16100f;
  --ink-2: #1c1416;
  --panel: #211719;
  --panel-2: #2a1d20;
  --panel-3: #33242a;
  --line: rgba(200, 161, 90, 0.14);
  --line-2: rgba(239, 228, 208, 0.08);
  --wine: #7a1f33;
  --wine-2: #9b2b43;
  --wine-deep: #4a1320;
  --gold: #c8a15a;
  --gold-2: #e6c98f;
  --gold-3: #8f6f36;
  --cream: #efe4d0;
  --cream-2: #d9ccb6;
  --muted: #a3968a;
  --muted-2: #7b6f67;
  --ok: #6fb592;
  --warn: #e1a651;
  --bad: #d86470;
  --info: #8fb3d9;
  --gold-metal: linear-gradient(135deg, #f1dca6 0%, #c8a15a 38%, #8f6f36 62%, #e6c98f 100%);
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7);
  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --sans: "Hanken Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #1d1315 0%, #150e0f 100%);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.sidebar .frond { position: absolute; right: -60px; bottom: 40px; width: 260px; opacity: 0.07; pointer-events: none; color: var(--gold); }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; border-bottom: 1px solid var(--line); }
.brand img, .brand svg { width: 42px; height: 42px; flex: none; }
.brand-name { font-family: var(--display); font-size: 19px; letter-spacing: 0.04em; line-height: 1.05; color: var(--cream); }
.brand-sub { font-size: 11.5px; color: var(--gold); letter-spacing: 0.08em; margin-top: 3px; }
.nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px;
  color: var(--cream-2); font-size: 14px; font-weight: 500; text-decoration: none; position: relative;
}
.nav a svg { width: 18px; height: 18px; opacity: 0.7; flex: none; }
.nav a:hover { background: rgba(239, 228, 208, 0.04); color: var(--cream); }
.nav a.active { background: linear-gradient(90deg, rgba(122, 31, 51, 0.55), rgba(122, 31, 51, 0.12)); color: var(--cream); }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--gold-metal); }
.nav a.active svg { opacity: 1; color: var(--gold-2); }
.nav a.soon { color: var(--muted-2); cursor: default; }
.nav a.soon:hover { background: none; }
.nav .soon-tag { margin-left: auto; font-size: 10.5px; color: var(--muted-2); border: 1px solid var(--line-2); border-radius: 20px; padding: 1px 7px; }
.nav-group { font-size: 11.5px; color: var(--muted-2); padding: 14px 12px 6px; letter-spacing: 0.04em; }
.me { border-top: 1px solid var(--line); padding: 14px 16px; display: flex; gap: 10px; align-items: center; position: relative; }
.me .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--wine); display: grid; place-items: center; font-family: var(--display); color: var(--gold-2); font-size: 15px; }
.me .who { flex: 1; min-width: 0; }
.me .who b { display: block; font-size: 14px; font-weight: 600; }
.me .who span { font-size: 12px; color: var(--gold); }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 8px; padding: 6px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { color: var(--cream); border-color: var(--line); }
.icon-btn svg { width: 18px; height: 18px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 14px 32px; background: rgba(22, 16, 15, 0.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-2);
}
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 440px; }
.search input { width: 100%; padding: 9px 12px 9px 36px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 9px; }
.search input::placeholder { color: var(--muted-2); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--muted-2); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; max-height: 420px; overflow: auto; }
.search-results .grp { font-size: 11.5px; color: var(--muted-2); padding: 8px 10px 4px; }
.search-results a { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 6px; color: var(--cream); text-decoration: none; font-size: 14px; }
.search-results a:hover, .search-results a.hl { background: rgba(200, 161, 90, 0.1); }
.search-results .empty { padding: 10px; color: var(--muted); font-size: 14px; }
.week-chip { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--cream-2); white-space: nowrap; }
.week-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(111, 181, 146, 0.18); }
.week-chip b { color: var(--cream); font-weight: 600; }
.test-clock { background: repeating-linear-gradient(45deg, #5a3a12, #5a3a12 10px, #4a2f0e 10px, #4a2f0e 20px); color: #ffe2a8; font-size: 13px; padding: 6px 32px; text-align: center; }
.test-clock a { color: #fff; text-decoration: underline; }

.page { padding: 28px 32px 80px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-family: var(--display); font-weight: 500; font-size: 34px; line-height: 1.1; margin: 0; letter-spacing: 0.005em; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }

/* ---------- Primitives ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--cream); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: rgba(200, 161, 90, 0.4); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn.gold { background: var(--gold-metal); color: #24170a; border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn.gold:hover { filter: brightness(1.06); }
.btn.wine { background: var(--wine); border-color: var(--wine-2); }
.btn.wine:hover { background: var(--wine-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--cream-2); }
.btn.ghost:hover { background: rgba(239, 228, 208, 0.05); }
.btn.danger { background: rgba(216, 100, 112, 0.14); border-color: rgba(216, 100, 112, 0.4); color: #f3b3ba; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 7px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; filter: none; }

.panel { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: 0.01em; }
.panel-head .sub { color: var(--muted); font-size: 13px; }
.panel-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel-body { padding: 18px 20px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-ok { color: var(--ok); background: rgba(111, 181, 146, 0.1); border-color: rgba(111, 181, 146, 0.25); }
.b-warn { color: var(--warn); background: rgba(225, 166, 81, 0.1); border-color: rgba(225, 166, 81, 0.28); }
.b-bad { color: var(--bad); background: rgba(216, 100, 112, 0.1); border-color: rgba(216, 100, 112, 0.3); }
.b-info { color: var(--info); background: rgba(143, 179, 217, 0.1); border-color: rgba(143, 179, 217, 0.25); }
.b-gold { color: var(--gold-2); background: rgba(200, 161, 90, 0.1); border-color: rgba(200, 161, 90, 0.3); }
.b-mute { color: var(--muted); background: rgba(163, 150, 138, 0.08); border-color: rgba(163, 150, 138, 0.2); }
.b-wine { color: #f0b8c4; background: rgba(155, 43, 67, 0.25); border-color: rgba(155, 43, 67, 0.5); }

.tier { font-family: var(--display); font-weight: 600; color: var(--gold-2); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }

/* Tooltip */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: #0c0808; color: var(--cream); border: 1px solid var(--line); padding: 7px 10px; border-radius: 7px;
  font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; line-height: 1.4;
  width: max-content; max-width: 260px; white-space: normal; z-index: 50; pointer-events: none;
}

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--cream-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.req::after { content: " *"; color: var(--gold); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; background: var(--ink-2); border: 1px solid rgba(239, 228, 208, 0.12);
  border-radius: 8px; color: var(--cream);
}
.input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(200, 161, 90, 0.15); }
textarea.input { min-height: 84px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] { width: 44px; height: 40px; border: 1px solid rgba(239, 228, 208, 0.12); border-radius: 8px; background: var(--ink-2); padding: 3px; cursor: pointer; }
.form-error { background: rgba(216, 100, 112, 0.12); border: 1px solid rgba(216, 100, 112, 0.35); color: #f5c2c8; padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }

/* Combo box */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0; max-height: 240px; overflow: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; }
.combo-list div { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.combo-list div:hover, .combo-list div.hl { background: rgba(200, 161, 90, 0.12); }
.combo-list div small { color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.link { cursor: pointer; }
table.t tbody tr.link:hover td { background: rgba(239, 228, 208, 0.025); }
table.t td.r, table.t th.r { text-align: right; }
.empty-state { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty-state b { display: block; color: var(--cream); font-size: 16px; margin-bottom: 4px; }

/* Crest (family logo or monogram) */
.crest { width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center; overflow: hidden; font-family: var(--display); font-size: 20px; color: var(--cream); position: relative; box-shadow: inset 0 0 0 1px rgba(230, 201, 143, 0.35); }
.crest img { width: 100%; height: 100%; object-fit: cover; }
.crest.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }
.crest.xl { width: 92px; height: 92px; border-radius: 22px; font-size: 42px; box-shadow: inset 0 0 0 2px rgba(230, 201, 143, 0.55), 0 12px 30px -12px rgba(0,0,0,.8); }

/* The legacy rope: LP progress bar with the next level marked */
.rope { position: relative; height: 10px; border-radius: 10px; background: rgba(239, 228, 208, 0.07); box-shadow: inset 0 1px 2px rgba(0,0,0,.5); overflow: hidden; }
.rope > i { position: absolute; inset: 0 auto 0 0; border-radius: 10px; background: var(--gold-metal); box-shadow: 0 0 12px rgba(200, 161, 90, 0.35); transition: width .5s ease; }
.rope.lg { height: 14px; }
.rope-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 7px; }
.rope-meta b { color: var(--cream); font-weight: 600; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-family: var(--display); font-size: 30px; line-height: 1.1; }
.stat .k { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.stat.warn .v { color: var(--warn); }
.stat.bad .v { color: var(--bad); }
.stat.gold .v { background: var(--gold-metal); -webkit-background-clip: text; background-clip: text; color: transparent; }

.dash-cols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; margin-bottom: 26px; }
.cov-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line-2); }
.cov-row:last-child { border-bottom: 0; }
.cov-row .fam { font-weight: 600; flex: 1; }
.cov-row .mgr { color: var(--muted); font-size: 13px; width: 110px; }
.cov-progress { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.cov-progress .big { font-family: var(--display); font-size: 28px; }
.cov-progress .rope { flex: 1; }
.mgr-strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line-2); }
.mgr-pill { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); }
.mgr-pill.done { border-color: rgba(111, 181, 146, 0.35); }
.mgr-pill.open { border-color: rgba(225, 166, 81, 0.35); }

.attn { list-style: none; margin: 0; padding: 6px 0; max-height: 440px; overflow: auto; }
.attn li a { display: flex; gap: 12px; padding: 10px 20px; color: var(--cream); text-decoration: none; align-items: flex-start; }
.attn li a:hover { background: rgba(239, 228, 208, 0.03); }
.attn .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 14px; }
.attn .ic.warn { background: rgba(225, 166, 81, 0.14); color: var(--warn); }
.attn .ic.bad { background: rgba(216, 100, 112, 0.14); color: var(--bad); }
.attn .ic.gold { background: rgba(200, 161, 90, 0.14); color: var(--gold-2); }
.attn .ic.info { background: rgba(143, 179, 217, 0.12); color: var(--info); }
.attn b { font-weight: 600; font-size: 14px; }
.attn small { display: block; color: var(--muted); font-size: 12.5px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters .input { width: auto; min-width: 150px; padding: 8px 11px; font-size: 14px; }
.filters select.input { padding-right: 30px; }
.fam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.fam-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.fam-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--fam, var(--wine)); }
.fam-card .top { display: flex; gap: 12px; align-items: center; }
.fam-card h3 { font-family: var(--display); font-weight: 500; font-size: 22px; margin: 0; line-height: 1.1; }
.fam-card .lvl { font-size: 13px; color: var(--muted); margin-top: 2px; }
.fam-card .lp { font-family: var(--display); font-size: 26px; }
.fam-card .lp small { font-family: var(--sans); font-size: 12px; color: var(--muted); margin-left: 4px; }
.fam-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 0; }
.fam-card dt { font-size: 12px; color: var(--muted); }
.fam-card dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; }
.fam-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }

/* ---------- Family profile ---------- */
.fam-hero { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 18px;
  background: radial-gradient(1200px 300px at 0% 0%, color-mix(in srgb, var(--fam, #7a1f33) 55%, transparent), transparent 70%), linear-gradient(180deg, #24181b, #1c1416); }
.fam-hero .inner { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; padding: 26px 28px; align-items: center; }
.fam-hero h1 { font-family: var(--display); font-weight: 500; font-size: 44px; line-height: 1; margin: 0 0 8px; }
.fam-hero .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fam-hero .lp-block { text-align: right; }
.fam-hero .lp-block .v { font-family: var(--display); font-size: 42px; line-height: 1; }
.fam-hero .lp-block .k { color: var(--muted); font-size: 13px; }
.hero-stats { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line-2); }
.hero-stats > div { padding: 14px 22px; border-right: 1px solid var(--line-2); }
.hero-stats > div:last-child { border-right: 0; }
.hero-stats .k { font-size: 12px; color: var(--muted); }
.hero-stats .v { font-weight: 600; font-size: 15px; margin-top: 3px; }
.progress-block { padding: 18px 28px 22px; border-top: 1px solid var(--line-2); display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.progress-block .next { display: flex; gap: 24px; font-size: 13px; color: var(--muted); }
.progress-block .next b { display: block; color: var(--cream); font-size: 15px; }

.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line-2); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 11px 14px; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--cream); }
.tabs button.active { color: var(--cream); border-bottom-color: var(--gold); }
.tabs button.soon { color: var(--muted-2); cursor: default; }
.tabs button.soon small { font-size: 10.5px; margin-left: 4px; opacity: .8; }

.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.cta-week { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--radius-lg); border: 1px solid rgba(200, 161, 90, 0.3); background: linear-gradient(120deg, rgba(122, 31, 51, 0.35), rgba(122, 31, 51, 0.08)); margin-bottom: 18px; }
.cta-week h3 { margin: 0; font-size: 16px; }
.cta-week p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.cta-week .btn { margin-left: auto; }

/* ---------- Weekly review ---------- */
.review-head { display: flex; gap: 18px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.review-head h1 { font-family: var(--display); font-weight: 500; font-size: 34px; margin: 0; line-height: 1.05; }
.review-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.banner { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid; font-size: 14px; }
.banner .ic { font-size: 18px; line-height: 1.2; }
.banner b { display: block; font-size: 14.5px; margin-bottom: 2px; }
.banner .right { margin-left: auto; display: flex; gap: 8px; align-self: center; flex-wrap: wrap; }
.banner.lock { background: rgba(163, 150, 138, 0.07); border-color: rgba(163, 150, 138, 0.25); }
.banner.unlock { background: rgba(225, 166, 81, 0.08); border-color: rgba(225, 166, 81, 0.4); }
.banner.done { background: rgba(111, 181, 146, 0.07); border-color: rgba(111, 181, 146, 0.3); }
.banner.miss { background: rgba(216, 100, 112, 0.08); border-color: rgba(216, 100, 112, 0.35); }
.banner.info { background: rgba(143, 179, 217, 0.06); border-color: rgba(143, 179, 217, 0.25); }

.review-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.cat { margin-bottom: 16px; }
.cat-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.cat-head h2 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 20px; }
.cat-head .sum { font-weight: 700; color: var(--gold-2); }
.act { display: grid; grid-template-columns: 1fr 150px 128px 76px; gap: 14px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.act:last-child { border-bottom: 0; }
.act .name { font-weight: 600; font-size: 14.5px; }
.act .rule { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.act .capnote { font-size: 12px; color: var(--warn); font-weight: 600; }
.act .lp { text-align: right; font-weight: 700; font-size: 15px; }
.act .lp.zero { color: var(--muted-2); font-weight: 500; }
.act.over { background: rgba(225, 166, 81, 0.04); }
.stepper { display: flex; align-items: center; border: 1px solid rgba(239, 228, 208, 0.12); border-radius: 9px; overflow: hidden; background: var(--ink-2); width: 128px; }
.stepper button { width: 38px; height: 38px; background: none; border: 0; color: var(--gold-2); font-size: 18px; cursor: pointer; flex: none; }
.stepper button:hover { background: rgba(200, 161, 90, 0.1); }
.stepper button:disabled { color: var(--muted-2); cursor: default; background: none; }
.stepper input { width: 100%; text-align: center; background: none; border: 0; font-weight: 700; font-size: 16px; padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper.ro { width: auto; border: 0; background: none; }
.stepper.ro input { font-size: 16px; text-align: left; }

.total-card { position: sticky; top: 90px; padding: 20px; }
.total-card .k { color: var(--muted); font-size: 13px; }
.total-card .v { font-family: var(--display); font-size: 54px; line-height: 1; margin: 6px 0 2px; background: var(--gold-metal); -webkit-background-clip: text; background-clip: text; color: transparent; }
.total-card .unit { color: var(--cream-2); font-size: 13px; }
.total-card ul { list-style: none; margin: 16px 0; padding: 14px 0 0; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.total-card li { display: flex; justify-content: space-between; }
.total-card li span { color: var(--muted); }
.total-card .proj { font-size: 13px; color: var(--muted); padding: 12px 0; border-top: 1px solid var(--line-2); margin-bottom: 14px; }
.total-card .proj b { color: var(--cream); }
.total-card .btns { display: flex; flex-direction: column; gap: 8px; }
.levelup { color: var(--gold-2); font-weight: 600; }

.summary-list { list-style: none; padding: 0; margin: 0 0 16px; border: 1px solid var(--line-2); border-radius: var(--radius); }
.summary-list li { display: flex; justify-content: space-between; padding: 11px 16px; border-bottom: 1px solid var(--line-2); }
.summary-list li:last-child { border-bottom: 0; }
.summary-list li.total { background: rgba(200, 161, 90, 0.08); font-weight: 700; font-size: 16px; }
.diff { display: grid; grid-template-columns: 1fr 1fr 1fr; text-align: center; border: 1px solid var(--line-2); border-radius: var(--radius); margin-bottom: 16px; }
.diff > div { padding: 14px; border-right: 1px solid var(--line-2); }
.diff > div:last-child { border-right: 0; }
.diff .v { font-family: var(--display); font-size: 28px; }
.diff .k { font-size: 12px; color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 12px 20px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-size: 12.5px; }

/* ---------- Modals, drawers, toasts ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 5, 5, 0.7); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s ease; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow: auto; box-shadow: var(--shadow); animation: rise .18s ease; }
.modal.wide { max-width: 720px; }
.modal-head { padding: 20px 24px 0; }
.modal-head h2 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 26px; }
.modal-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.modal-body { padding: 20px 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; background: rgba(0,0,0,.12); position: sticky; bottom: 0; }
.drawer-scrim { place-items: stretch end; padding: 0; }
.drawer { background: var(--panel); border-left: 1px solid var(--line); width: min(460px, 100vw); height: 100vh; overflow: auto; display: flex; flex-direction: column; animation: slide .2s ease; }
.drawer .modal-body { flex: 1; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: #120c0c; border: 1px solid var(--line); border-left: 3px solid var(--ok); padding: 12px 16px; border-radius: 10px; min-width: 260px; max-width: 380px; box-shadow: var(--shadow); font-size: 14px; animation: rise .2s ease; }
.toast.err { border-left-color: var(--bad); }
.toast.gold { border-left-color: var(--gold); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; overflow: hidden; background: radial-gradient(900px 600px at 20% 30%, #5a1627 0%, #2a0d15 45%, #140a0b 100%); display: flex; flex-direction: column; justify-content: flex-end; padding: 56px; }
.login-art .frond { position: absolute; width: 620px; right: -140px; top: -60px; color: var(--gold); opacity: .12; }
.login-art .frond.b { width: 420px; left: -120px; bottom: -120px; top: auto; right: auto; transform: rotate(160deg); opacity: .08; }
.login-art .mark { width: 88px; margin-bottom: 28px; position: relative; }
.login-art h1 { font-family: var(--display); font-weight: 500; font-size: 58px; line-height: .98; margin: 0; letter-spacing: .01em; position: relative; }
.login-art h1 span { display: block; font-size: 22px; letter-spacing: .12em; color: var(--gold-2); margin-top: 16px; font-family: var(--sans); font-weight: 500; }
.login-art p { color: var(--cream-2); max-width: 420px; margin: 18px 0 0; position: relative; }
.login-form { display: grid; place-items: center; padding: 40px; background: var(--ink); }
.login-form form { width: 100%; max-width: 360px; }
.login-form h2 { font-family: var(--display); font-weight: 500; font-size: 30px; margin: 0 0 6px; }
.login-form .lead { color: var(--muted); margin: 0 0 26px; }
.login-form .btn { width: 100%; padding: 12px; margin-top: 8px; }
.login-form .fine { font-size: 12.5px; color: var(--muted-2); margin-top: 22px; }

/* ---------- Settings ---------- */
.lvl-grid { width: 100%; border-collapse: collapse; }
.lvl-grid th { font-size: 12px; color: var(--muted); text-align: left; padding: 8px; font-weight: 600; }
.lvl-grid td { padding: 6px 8px; border-top: 1px solid var(--line-2); }
.lvl-grid .input { padding: 7px 10px; }
.lvl-grid td:first-child { font-family: var(--display); font-size: 18px; width: 70px; }
.switch { position: relative; width: 38px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: rgba(239,228,208,.12); border-radius: 22px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: var(--cream-2); border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--wine-2); }
.switch input:checked + span::before { transform: translateX(16px); background: var(--gold-2); }
details.audit-d summary { cursor: pointer; color: var(--gold-2); font-size: 13px; }
pre.json { white-space: pre-wrap; word-break: break-word; font-size: 12px; background: var(--ink-2); padding: 10px; border-radius: 8px; color: var(--cream-2); margin: 8px 0 0; max-width: 560px; }

.loading { padding: 60px; text-align: center; color: var(--muted); }
.spin { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: sp 0.8s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .dash-cols, .two { grid-template-columns: 1fr; }
  .review-layout { grid-template-columns: 1fr; }
  .total-card { position: static; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; width: 270px; transform: translateX(-100%); transition: transform .2s ease; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .menu-btn { display: grid; }
  .topbar { padding: 12px 16px; }
  .week-chip .long { display: none; }
  .page { padding: 20px 16px 80px; }
  .fam-hero .inner { grid-template-columns: auto 1fr; }
  .fam-hero .lp-block { grid-column: 1 / -1; text-align: left; }
  .fam-hero h1 { font-size: 34px; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .progress-block { grid-template-columns: 1fr; }
  .act { grid-template-columns: 1fr 128px; }
  .act .rule-col { grid-column: 1 / -1; order: 3; }
  .act .lp { grid-column: 2; }
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 260px; padding: 32px; }
  .login-art h1 { font-size: 40px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
}

/* ============================================================
   Phases 4-7: Reputation, Relationships, Milestones, Discipline
   ============================================================ */

/* Alliance meeting progress: Meeting 1 ✓ / 2 ✓ / 3 ○ */
.dots { display: inline-flex; gap: 6px; align-items: center; }
.dots i {
  font-style: normal; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; border: 1px solid var(--line); color: var(--muted-2); background: rgba(0,0,0,.18);
}
.dots i.on { color: var(--ok); border-color: rgba(111,181,146,.45); background: rgba(111,181,146,.1); }

/* Respect / Fear side by side. They are independent, never two ends of one scale. */
.rep-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rep-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: rgba(0,0,0,.14); }
.rep-box .k { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.rep-box .v { font-family: 'Bodoni Moda', Didot, Georgia, serif; font-size: 34px; line-height: 1.1; margin-top: 4px; }
.rep-box.respect .v { color: var(--ok); }
.rep-box.fear .v { color: var(--gold-2); }
.rep-box .sub { font-size: 12px; color: var(--muted-2); margin-top: 2px; }

/* Tier eligibility panel on the Family hero */
.gate { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: rgba(0,0,0,.16); }
.gate.pending { border-color: rgba(225,166,81,.4); background: rgba(225,166,81,.06); }
.gate.ready { border-color: rgba(111,181,146,.4); background: rgba(111,181,146,.06); }
.gate.frozen { border-color: rgba(216,100,112,.4); background: rgba(216,100,112,.06); }
.gate h4 { margin: 0 0 10px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--cream-2); font-weight: 600; }
.gate ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gate li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.gate li .mark { width: 18px; flex: none; text-align: center; font-size: 13px; }
.gate li.met .mark { color: var(--ok); }
.gate li.unmet .mark { color: var(--warn); }
.gate li small { display: block; color: var(--muted-2); font-size: 12px; }
.gate .blocking { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--cream-2); }

/* Streak pips for the 2-week consistency requirement */
.streak { display: inline-flex; gap: 4px; vertical-align: middle; }
.streak i { width: 18px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); }
.streak i.on { background: var(--ok); }

/* Attendee chips when logging a qualifying meeting */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(0,0,0,.2); font-size: 12.5px;
}
.chip.hoh { border-color: rgba(200,161,90,.5); background: rgba(200,161,90,.1); color: var(--gold-2); }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.chip button:hover { color: var(--bad); }

/* Pair header on a relationship record */
.pair { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pair .vs { color: var(--muted-2); font-family: 'Bodoni Moda', Didot, Georgia, serif; font-size: 20px; }
.pair .side { display: flex; align-items: center; gap: 10px; font-weight: 600; }

/* Consequence picker in the discipline ruling form */
.cons { display: grid; gap: 10px; }
.cons label.opt {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 10px; background: rgba(0,0,0,.14); cursor: pointer;
}
.cons label.opt:hover { border-color: rgba(200,161,90,.34); }
.cons label.opt.major { border-color: rgba(216,100,112,.28); }
.cons label.opt input { margin-top: 3px; }
.cons label.opt b { display: block; font-size: 13.5px; font-weight: 600; }
.cons label.opt small { color: var(--muted-2); font-size: 12px; }
.cons .extra { margin: 8px 0 0 28px; }

@media (max-width: 720px) {
  .rep-pair { grid-template-columns: 1fr; }
}
