:root {
  --brand: #0072BC;
  --brand-600: #005E9C;
  --brand-50: #E8F3FB;
  --red: #C8102E;
  --red-50: #FCEBEE;
  --green: #12805C;
  --green-50: #E6F4EE;
  --amber: #B45309;
  --amber-50: #FEF3E2;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --text: #16202C;
  --muted: #5B6878;
  --line: #E3E8EF;
  --line-2: #EEF2F6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --skeleton: #E9EEF4;
  --skeleton-2: #F4F7FA;
  --overlay: rgba(10, 18, 28, .55);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #3D9BE0;
    --brand-600: #62B0EA;
    --brand-50: #13263A;
    --red: #F0586F;
    --red-50: #3A1720;
    --green: #3CC08E;
    --green-50: #10302A;
    --amber: #F0A64A;
    --amber-50: #3A2A12;
    --bg: #0E141B;
    --card: #17202A;
    --text: #E7EDF4;
    --muted: #9AA8B8;
    --line: #283443;
    --line-2: #1F2935;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    --skeleton: #1F2A36;
    --skeleton-2: #26323F;
    --overlay: rgba(0, 0, 0, .65);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, transform .1s, opacity .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.lg { min-height: 52px; font-size: 16px; padding: 12px 20px; border-radius: 14px; }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 12px; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 72px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.input[readonly] { background: var(--line-2); color: var(--muted); }
.input.invalid { border-color: var(--red); }
.input.warn { border-color: var(--amber); }
.hint { font-size: 12.5px; color: var(--muted); }
.hint.err { color: var(--red); }
.hint.warn { color: var(--amber); }
.date-wrap { position: relative; }
.date-wrap .input { padding-right: 44px; }
.date-wrap .cal {
  position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center; color: var(--muted); pointer-events: none;
}
.date-wrap input[type=date] {
  position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; opacity: 0; cursor: pointer; border: 0; padding: 0;
}
.date-wrap input[type=date]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 20px;
}
.badge.gray { background: var(--line-2); color: var(--muted); }
.badge.green { background: var(--green-50); color: var(--green); }
.badge.red { background: var(--red-50); color: var(--red); }
.badge.blue { background: var(--brand-50); color: var(--brand); }
.badge.amber { background: var(--amber-50); color: var(--amber); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-cv { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; background: var(--red-50); color: var(--red); vertical-align: 2px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; }
.login-logo { width: 56px; height: 56px; border-radius: 16px; background: var(--red); display: grid; place-items: center; margin-bottom: 16px; }
.login-card h1 { font-size: 22px; font-weight: 800; }
.login-card .sub { color: var(--muted); margin: 4px 0 20px; }
.login-note { margin-top: 16px; padding: 12px; background: var(--brand-50); border-radius: 12px; font-size: 13.5px; color: var(--text); }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line);
  padding: 0 16px; padding-top: env(safe-area-inset-top);
}
.topbar-inner { max-width: 1240px; margin: 0 auto; height: 60px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; min-width: 0; }
.brand .mark { width: 34px; height: 34px; border-radius: 10px; background: var(--red); display: grid; place-items: center; flex: none; }
.brand .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav button {
  border: 0; background: transparent; padding: 8px 12px; border-radius: 10px; font-weight: 600; color: var(--muted);
  cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 6px; transition: background .15s, color .15s;
}
.nav button:hover { background: var(--line-2); color: var(--text); }
.nav button.active { background: var(--brand-50); color: var(--brand); }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; border: 0; background: transparent; padding: 4px; border-radius: 12px; }
.user-chip:hover { background: var(--line-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-chip .nm { text-align: left; line-height: 1.2; }
.user-chip .nm b { display: block; font-size: 14px; }
.user-chip .nm span { font-size: 12px; color: var(--muted); }
.menu {
  position: absolute; right: 16px; top: 58px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; z-index: 40; animation: pop .15s ease-out;
}
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; border: 0; background: transparent; padding: 10px 12px; border-radius: 10px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--line-2); }
.main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 40px; }
.view { animation: fadein .18s ease-out; }
.page-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title h1 { font-size: 22px; font-weight: 800; }

.bottom-nav { display: none; }

/* ---------- Deadline ---------- */
.deadline { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--brand-50); margin-bottom: 16px; }
.deadline.urgent { background: var(--red-50); }
.deadline .num { font-size: 22px; font-weight: 800; color: var(--brand); line-height: 1; }
.deadline.urgent .num { color: var(--red); }

/* ---------- Member page ---------- */
.member-grid { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.photo-card { text-align: center; }
.photo-frame {
  position: relative; width: 100%; max-width: 270px; aspect-ratio: 3 / 4; margin: 0 auto; border-radius: 14px; overflow: hidden;
  background: var(--line-2); border: 2px dashed var(--line); transition: border-color .15s, background .15s;
}
.photo-frame.has { border-style: solid; border-color: var(--line); }
.photo-frame.drag { border-color: var(--brand); background: var(--brand-50); }
.photo-frame img.ph { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-frame .empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px; color: var(--muted); }
.photo-frame .empty svg { width: 62%; height: auto; }
.photo-frame .uploading { position: absolute; inset: 0; background: var(--overlay); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; gap: 10px; padding: 16px; }
.photo-status { margin: 12px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.photo-tips { margin-top: 12px; font-size: 13px; color: var(--muted); }
.drop-hint { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-grid .full { grid-column: 1 / -1; }
.ro-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 14px; border-radius: 12px; background: var(--line-2); margin-bottom: 16px; }
.ro-list div span { display: block; font-size: 12px; color: var(--muted); }
.ro-list div b { font-weight: 600; }
.name-line { font-size: 20px; font-weight: 800; }

/* ---------- Progress ---------- */
.bar { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s ease; }
.bar.red > i { background: var(--red); }
.bar.green > i { background: var(--green); }
.progress-line { position: relative; height: 6px; border-radius: 99px; background: rgba(255,255,255,.25); overflow: hidden; width: 80%; }
.progress-line i { position: absolute; left: 0; top: 0; bottom: 0; background: #fff; border-radius: 99px; transition: width .3s; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stat .v { font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat.red .v { color: var(--red); }
.stat.green .v { color: var(--green); }
.stat.blue .v { color: var(--brand); }
.stat.amber .v { color: var(--amber); }
.stat.click { cursor: pointer; transition: transform .1s; }
.stat.click:hover { transform: translateY(-1px); }
.cb-list { display: grid; gap: 14px; }
.cb-item .top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.cb-item .top b { flex: 1; min-width: 180px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--line-2); padding: 10px 12px; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tbl td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--line-2); }
.tbl tr.low td { background: var(--red-50); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .thumb { width: 36px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--line-2); display: block; }
.tbl .thumb.empty { display: grid; place-items: center; font-size: 10px; color: var(--muted); }
.tbl.edit td { padding: 4px 6px; }
.tbl.edit input, .tbl.edit select { width: 100%; min-width: 110px; border: 1px solid transparent; background: transparent; padding: 6px 8px; border-radius: 8px; min-height: 34px; }
.tbl.edit input:focus, .tbl.edit select:focus { border-color: var(--brand); background: var(--card); outline: none; }
.tbl.edit tr.dirty td { background: var(--amber-50); }
.tbl.edit input.dirty, .tbl.edit select.dirty { border-color: var(--amber); }
.tbl .grp td { background: var(--brand-50); font-weight: 700; color: var(--brand); }

/* Mobile cards replacing table */
.m-cards { display: none; }
.m-card { display: flex; gap: 12px; padding: 12px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); align-items: center; cursor: pointer; }
.m-card + .m-card { margin-top: 10px; }
.m-card .thumb { width: 48px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--line-2); flex: none; }
.m-card .b { flex: 1; min-width: 0; }
.m-card .b b { display: block; }
.m-card .b .muted { font-size: 13px; }

/* ---------- Chips / filters ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .c { opacity: .75; margin-left: 4px; }
.filters { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }

/* ---------- Gallery ---------- */
.gallery-group + .gallery-group { margin-top: 24px; }
.gallery-group h3 { margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.g-item { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.g-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.g-item .img { aspect-ratio: 3/4; background: var(--line-2); position: relative; }
.g-item .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-item .img .none { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; font-weight: 600; border: 2px dashed var(--line); border-radius: 12px 12px 0 0; }
.g-item .cap { padding: 8px 10px; font-size: 13px; line-height: 1.35; }
.g-item .cap b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Skeleton ---------- */
.sk { background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-2) 37%, var(--skeleton) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
.sk-line { height: 14px; margin: 8px 0; }
.sk-block { height: 120px; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: var(--overlay); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadein .15s ease-out; }
.modal { background: var(--bg); border-radius: 20px; box-shadow: var(--shadow-lg); width: 100%; max-width: 980px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .18s ease-out; }
.modal.sm { max-width: 460px; }
.modal.md { max-width: 720px; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); background: var(--card); border-radius: 20px 20px 0 0; }
.modal-head h2 { flex: 1; font-size: 17px; }
.modal-body { padding: 16px 20px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--card); border-radius: 0 0 20px 20px; flex-wrap: wrap; }

/* Preview (upload) */
.pv-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.pv-frame { position: relative; width: 100%; aspect-ratio: 3/4; border-radius: 12px; overflow: hidden; background: #000; touch-action: pinch-zoom; }
.pv-frame img { width: 100%; height: 100%; object-fit: fill; display: block; }
.pv-frame { cursor: zoom-in; max-height: 64vh; margin: 0 auto; }
.pv-ov { position: absolute; inset: 0; pointer-events: none; }
.pv-band { position: absolute; left: 0; right: 0; }
.pv-band.blue { background: rgba(56, 189, 248, .28); border-top: 1px dashed #38BDF8; border-bottom: 1px dashed #38BDF8; }
.pv-band.red { background: rgba(244, 63, 94, .16); border-top: 1px dashed #F43F5E; border-bottom: 1px dashed #F43F5E; }
.pv-line { position: absolute; left: 0; right: 0; border-top: 2px solid #22C55E; }
.pv-line.bad { border-top-color: #F43F5E; }
.pv-line span { position: absolute; right: 4px; top: -18px; font-size: 11px; font-weight: 700; color: #fff; background: rgba(0,0,0,.55); padding: 0 6px; border-radius: 6px; }
.pv-line.below span { top: 3px; }
.pv-span { position: absolute; left: 8px; width: 0; border-left: 2px solid #22C55E; }
.pv-span.bad { border-left-color: #F43F5E; }
.pv-span b { position: absolute; top: 50%; left: 6px; transform: translateY(-50%); font-size: 13px; color: #fff; background: rgba(0,0,0,.6); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.checks { list-style: none; margin: 0 0 12px; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.ck { display: flex; gap: 10px; padding: 9px 12px; font-size: 14px; }
.ck + .ck { border-top: 1px solid var(--line-2); }
.ck .ic { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; margin-top: 1px; }
.ck.ok .ic { background: var(--green-50); color: var(--green); }
.ck.fail .ic { background: var(--amber-50); color: var(--amber); }
.ck.block .ic { background: var(--red-50); color: var(--red); }
.ck.info .ic { background: var(--brand-50); color: var(--brand); }
.ck.fail, .ck.block { background: color-mix(in srgb, var(--amber-50) 45%, transparent); }
.ck-h { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.ck-h .val { color: var(--muted); }
.ck.fail .val, .ck.block .val { color: var(--red); font-weight: 600; }
.ck .need { font-size: 12.5px; color: var(--muted); }
.ck .fix { font-size: 13px; color: var(--text); margin-top: 2px; }
.pv-confirm { padding: 10px 12px; border-radius: 12px; background: var(--amber-50); margin-top: 8px; font-size: 14px; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; display: inline-block; vertical-align: middle; }
.pv-frame svg.guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pv-meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0 0 14px; }
.pv-meta dt { color: var(--muted); }
.pv-meta dd { margin: 0; font-weight: 600; word-break: break-word; }
.alert { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; font-size: 14px; margin-bottom: 8px; }
.alert.warn { background: var(--amber-50); color: var(--amber); }
.alert.err { background: var(--red-50); color: var(--red); }
.alert.ok { background: var(--green-50); color: var(--green); }
.alert.info { background: var(--brand-50); color: var(--brand); }
.fullview { position: fixed; inset: 0; background: #000; z-index: 80; overflow: auto; touch-action: pinch-zoom pan-x pan-y; }
.fullview img { max-width: 100%; display: block; margin: 0 auto; }
.fullview .x { position: fixed; top: 12px; right: 12px; z-index: 2; background: rgba(255,255,255,.9); color: #000; }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; animation: slidein .2s ease-out; }
.toast.ok { background: var(--green); color: #fff; }
.toast.err { background: var(--red); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .2s; }

/* ---------- Install hint ---------- */
.install { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); margin-bottom: 16px; font-size: 13.5px; }

/* ---------- Guide illustration ---------- */
.guide-box { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 12px; background: var(--line-2); margin-top: 12px; text-align: left; }
.guide-box svg { width: 84px; flex: none; }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slidein { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 28px; height: 28px; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.dark { border-color: var(--line); border-top-color: var(--brand); }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .member-grid { grid-template-columns: 300px 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .search { grid-column: 1 / -1; }
  .topbar .nav { display: none; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card);
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); overflow-x: auto; scrollbar-width: none;
  }
  .bottom-nav::-webkit-scrollbar { display: none; }
  .bottom-nav button {
    flex: 1 0 auto; min-width: 72px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); border-radius: 10px; cursor: pointer;
  }
  .bottom-nav button .ic { font-size: 19px; line-height: 1.1; }
  .bottom-nav button.active { color: var(--brand); background: var(--brand-50); }
  body.has-bottom .main { padding-bottom: 96px; }
  body.has-bottom .toasts { bottom: 84px; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .main { padding: 14px 12px 32px; }
  .card { padding: 16px; }
  .member-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .ro-list { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .v { font-size: 22px; }
  .filters { grid-template-columns: 1fr; }
  .user-chip .nm { display: none; }
  .brand .t { font-size: 15px; }
  .pv-grid { grid-template-columns: 1fr; }
  .pv-frame { max-width: 300px; margin: 0 auto; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { max-height: 94vh; border-radius: 20px 20px 0 0; }
  .modal-foot { border-radius: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .hide-m { display: none !important; }
  .m-cards { display: block; }
  .t-desktop { display: none; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .page-title h1 { font-size: 20px; }
  .toasts { left: 16px; right: 16px; max-width: none; }
}
@media (min-width: 641px) { .show-m { display: none !important; } }
