:root {
  --ink: #16233A;
  --ink-soft: #4B5A72;
  --line: #E3E9F1;
  --surface: #FFFFFF;
  --page: #F6F9FC;
  --brand-deep: #0E4F52;
  --brand: #14808A;
  --brand-bright: #2FB8A6;
  --accent: #E8734A;
  --good: #1E8E5A;
  --bad: #C6402E;
  --radius: 14px;
  --shadow: 0 12px 30px rgba(16, 42, 67, 0.08);
  --font: "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--page);
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
}

.brand-panel {
  position: relative;
  background: linear-gradient(160deg, var(--brand-deep) 0%, var(--brand) 55%, var(--brand-bright) 100%);
  color: #F2FBF9;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.brand-panel::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18), transparent 65%);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.2px;
  z-index: 1;
}

.brand-mark .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

.brand-copy {
  z-index: 1;
  max-width: 420px;
}

.brand-copy h1 {
  font-size: 30.5px;
  line-height: 1.25;
  margin: 0 0 16px;
  font-weight: 600;
}

.brand-copy p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(242, 251, 249, 0.86);
  margin: 0;
}

.brand-foot {
  z-index: 1;
  font-size: 11.5px;
  color: rgba(242, 251, 249, 0.65);
}

.form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 36px;
}

.card h2 {
  margin: 0 0 6px;
  font-size: 21.5px;
  font-weight: 650;
}

.card .sub {
  margin: 0 0 28px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="date"],
.field input[type="password"] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--ink);
  background: #FCFDFE;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 128, 138, 0.14);
}

.hint { font-size: 11px; color: var(--ink-soft); line-height: 1.5; }

.field .hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.checkbox-line input { width: 15px; height: 15px; }

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 42px;
}

.toggle-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 4px;
  font-size: 14.5px;
  line-height: 1;
}

.rule-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rule {
  font-size: 11px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}

.rule .mark {
  width: 15px;
  display: inline-block;
  text-align: center;
  color: var(--bad);
}

.rule.met { color: var(--good); }
.rule.met .mark { color: var(--good); }

.match-note {
  margin-top: 6px;
  font-size: 11px;
}
.match-note.ok { color: var(--good); }
.match-note.no { color: var(--bad); }

.btn-primary {
  width: 100%;
  padding: 12px 16px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease;
  margin-top: 6px;
}

.btn-primary:hover { background: var(--brand-deep); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { background: #A9B7C4; cursor: not-allowed; }

.btn-danger-primary { background: var(--bad); }
.btn-danger-primary:hover { background: #A6362A; }

.alt-link {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--ink-soft);
}

.alt-link a { color: var(--brand); text-decoration: none; font-weight: 600; }
.alt-link a:hover { text-decoration: underline; }

.banner {
  display: none;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 12px;
  margin-bottom: 18px;
  line-height: 1.5;
}

.banner.show { display: block; }
.banner.error { background: #FDEDEA; color: var(--bad); border: 1px solid #F6C7BE; }
.banner.success { background: #E9F7EF; color: var(--good); border: 1px solid #BFE8D0; }

.terms-block {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 4px 0 4px;
}

.terms-block input { margin-top: 3px; width: 15px; height: 15px; flex-shrink: 0; }
.terms-block a { color: var(--brand); font-weight: 600; text-decoration: none; }
.terms-block a:hover { text-decoration: underline; }

/* --- Signup wizard --- */
.wizard-step { animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.wizard-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  align-items: center;
}
.wizard-actions .btn-primary { flex: 1; }
.wizard-actions .btn-small { flex-shrink: 0; }

/* --- Auth card (login/signup/verify/forgot-password): further reduced text,
   scoped so it never affects account/dashboard forms which share the same
   .field/.btn-primary/.banner classes. --- */
.card h2 { font-size: 19px; }
.card .sub { font-size: 11.5px; }
.card .field label { font-size: 10.5px; }
.card .field input[type="text"],
.card .field input[type="email"],
.card .field input[type="tel"],
.card .field input[type="date"],
.card .field input[type="password"] { font-size: 11.5px; }
.card .hint,
.card .field .hint { font-size: 10px; }
.card .checkbox-line { font-size: 10.5px; }
.card .rule { font-size: 10px; }
.card .match-note { font-size: 10px; }
.card .btn-primary { font-size: 12px; }
.card .alt-link { font-size: 11px; }
.card .banner { font-size: 11px; }
.card .terms-block { font-size: 10.5px; }
.card .desc { font-size: 10.5px; }

/* --- Modal (admin first-time setup) --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 45, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-overlay.show { display: flex; }

.modal-box {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 16px;
  padding: 34px 32px;
  box-shadow: 0 24px 60px rgba(16,42,67,0.25);
}

/* --- Dashboards --- */
.dash-shell {
  min-height: 100vh;
  background: var(--page);
}
.dash-top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dash-top .who { font-size: 12.5px; color: var(--ink-soft); }
.dash-top .who strong { color: var(--ink); }
.logout-btn {
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink);
}
.logout-btn:hover { border-color: var(--brand); color: var(--brand); }
.dash-body {
  max-width: 880px;
  margin: 48px auto;
  padding: 0 24px;
}
.dash-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.dash-card h1 { margin: 0 0 4px; font-size: 17px; }
.dash-card p { color: var(--ink-soft); line-height: 1.5; font-size: 12.5px; }

/* --- Verify page --- */
.code-input {
  letter-spacing: 10px;
  font-size: 20px;
  text-align: center;
  font-weight: 600;
}

/* --- Sidebar / hamburger shell for dashboards --- */
.app-shell {
  min-height: 100vh;
  display: flex;
  background: var(--page);
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--brand-deep);
  color: #EAF6F4;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  transition: transform .2s ease;
}

.sidebar .brand-mark {
  color: #fff;
  padding: 0 8px 22px;
  font-size: 16px;
}

.sidebar-logo-wrap {
  margin: 0 8px 22px;
  display: inline-flex;
  background: rgba(255,255,255,0.95);
  border-radius: 8px;
  padding: 6px 9px;
}

.sidebar-logo {
  height: 16px;
  width: auto;
  display: block;
}

.brand-panel-logo {
  height: 100px;
  width: auto;
  display: block;
  align-self: flex-start;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.sidebar a.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  color: rgba(234, 246, 244, 0.85);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
}

.sidebar a.nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar a.nav-link.active {
  background: rgba(255,255,255,0.14);
  color: #fff;
}

.sidebar a.nav-logout {
  margin-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 14px;
  color: rgba(255,140,120,0.9);
}
.sidebar a.nav-logout:hover {
  background: rgba(220,80,60,0.18);
  color: #fff;
}

/* --- Dashboard welcome hero (avatar + greeting) --- */
.welcome-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}
.welcome-hero .avatar-preview {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
.welcome-hero .greeting h1 { margin: 0 0 2px; }
.welcome-hero .greeting p { margin: 0; color: var(--ink-soft); font-size: 11px; }

@media (max-width: 480px) {
  .welcome-hero { gap: 10px; }
  .welcome-hero .avatar-preview { width: 40px; height: 40px; }
}

.main-area {
  flex: 1;
  min-width: 0;
}

.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.top-bar-logo {
  height: 60px;
  width: auto;
  display: block;
}

.wallet-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #F0FBFA;
  border: 1px solid #BFEAE3;
  border-radius: 999px;
  padding: 5px 13px 5px 10px;
  flex-shrink: 0;
}
.wallet-icon { font-size: 12.5px; line-height: 1; }
.wallet-amount { font-weight: 700; font-size: 11.5px; color: var(--brand-deep); }
.wallet-label { font-size: 10px; color: var(--ink-soft); font-weight: 600; }
.wallet-php {
  font-size: 10px;
  font-weight: 700;
  color: var(--brand-deep);
  padding-left: 8px;
  margin-left: 4px;
  border-left: 1px solid #BFEAE3;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notif-btn {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.notif-btn:hover { border-color: var(--brand); }
.notif-dot {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid #fff;
}

.notif-dropdown {
  position: fixed;
  width: 300px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(16,42,67,0.2);
  z-index: 250;
  padding: 0;
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  border-radius: 12px 12px 0 0;
}
.notif-select-all {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-soft);
  cursor: pointer;
}
.notif-select-all input { width: 14px; height: 14px; }
.notif-delete-btn {
  border: 1px solid #F3C9C2;
  color: var(--bad);
  background: #fff;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 11.5px;
  cursor: pointer;
}
.notif-delete-btn:hover:not(:disabled) { border-color: var(--bad); background: #FDEDEA; }
.notif-delete-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.notif-list { padding: 6px; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 8px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}
.notif-item.unread { background: #F0FBFA; }
.notif-item + .notif-item { margin-top: 2px; }
.notif-check { width: 14px; height: 14px; margin-top: 3px; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-message { color: var(--ink); }
.notif-time { color: var(--ink-soft); font-size: 10.5px; margin-top: 3px; }
.notif-item-delete {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
}
.notif-item-delete:hover { color: var(--bad); }
.notif-empty { padding: 20px 12px; text-align: center; color: var(--ink-soft); font-size: 12px; }

.notif-reward { margin-top: 6px; }
.notif-claim-btn {
  background: linear-gradient(135deg, #FFD866, #FFA23A);
  color: #5A3600;
  border: none;
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.notif-chest-img { width: 22px; height: 22px; object-fit: contain; border-radius: 5px; }
.notif-claim-btn:hover { filter: brightness(1.05); }
.notif-claim-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.notif-reward.claimed { font-size: 11px; color: var(--good); font-weight: 600; margin-top: 6px; }

/* --- ECP Balance page --- */
.settings-card.balance-hero {
  text-align: center;
  background: linear-gradient(160deg, var(--brand-deep) 0%, var(--brand) 60%, var(--brand-bright) 100%);
  color: #fff;
}
.balance-hero-label { font-size: 12px; opacity: 0.85; letter-spacing: .04em; text-transform: uppercase; }
.balance-hero-amount { font-size: 34px; font-weight: 800; margin: 8px 0 2px; }
.balance-hero-unit { font-size: 16px; font-weight: 600; opacity: 0.9; }
.balance-hero-php { font-size: 14px; opacity: 0.9; margin-bottom: 10px; }
.balance-hero-rate { font-size: 11px; opacity: 0.75; margin-top: 12px; }

.balance-hero-split {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  margin: 14px 0 4px;
}
.balance-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.balance-stat-value { font-size: 28px; font-weight: 800; }
.balance-stat-label { font-size: 11px; opacity: 0.85; letter-spacing: .03em; text-transform: uppercase; }
.balance-stat-divider { width: 1px; height: 44px; background: rgba(255,255,255,0.35); }

@media (max-width: 420px) {
  .balance-hero-split { gap: 16px; }
  .balance-stat-value { font-size: 22px; }
}

.exchange-result {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-deep);
  margin: 4px 0 18px;
}

/* --- Ad banner --- */
.ad-banner-wrap {
  max-width: 468px;
  margin: 0 auto 24px;
  min-height: 50px;
  overflow: hidden;
  border-radius: 8px;
}

.ad-carousel-wrap {
  position: relative;
  margin: 14px 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  height: 100px;
}
.ad-carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.5s ease;
}
.ad-carousel-slide {
  min-width: 100%;
  flex-shrink: 0;
  height: 100%;
}
.ad-carousel-slide img,
.ad-carousel-slide a { display: block; width: 100%; height: 100%; }
.ad-carousel-slide img { object-fit: fill; }
.ad-carousel-dots {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 5px;
}
.ad-carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
}
.ad-carousel-dot.active { background: #fff; }

/* --- Lobby --- */
.lobby-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (min-width: 480px) {
  .lobby-grid { grid-template-columns: repeat(3, 1fr); }
}
.lobby-item-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  text-align: center;
  padding-bottom: 10px;
}
.lobby-item-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #F6F9FC;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  overflow: hidden;
}
.lobby-item-photo img { width: 100%; height: 100%; object-fit: cover; }
.lobby-item-name { font-size: 12.5px; font-weight: 700; margin-top: 8px; padding: 0 6px; }
.lobby-item-status { font-size: 10px; color: var(--ink-soft); margin-top: 2px; }
.lobby-item-card.status-coming_soon, .lobby-item-card.status-maintenance { opacity: 0.6; cursor: default; }
.lobby-item-card.status-available:hover { border-color: var(--brand); }

.market-chart-wrap {
  position: relative;
  width: 100%;
  height: 110px;
  background: #F6FBFA;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.market-chart-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.market-chart-current {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-deep);
  background: rgba(255,255,255,0.85);
  padding: 3px 9px;
  border-radius: 999px;
}

.hamburger-btn {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--ink);
  flex-shrink: 0;
}

.top-bar .who { font-size: 12.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 9px; }
.top-bar .who strong { color: var(--ink); }
.who-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}

.content-area {
  max-width: 920px;
  margin: 40px auto;
  padding: 0 24px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,30,45,0.4);
  z-index: 39;
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .hamburger-btn { display: inline-flex; }
}

/* --- Settings / system update page --- */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.settings-card h2 { margin: 0 0 6px; font-size: 17px; }
.desc { color: var(--ink-soft); font-size: 12px; margin: 0 0 20px; line-height: 1.55; }

.settings-card .desc { color: var(--ink-soft); font-size: 12px; margin: 0 0 20px; line-height: 1.55; }

.upload-drop {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 12.5px;
  background: #FAFCFE;
  cursor: pointer;
  overflow: hidden;
}

.upload-drop.drag { border-color: var(--brand); background: #F0FBFA; }
.upload-drop input[type="file"] { display: none; }

.file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #EFF6FF;
  color: var(--brand-deep);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  margin-top: 12px;
  max-width: 100%;
  box-sizing: border-box;
}

.file-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.file-chip-size {
  flex-shrink: 0;
  color: var(--ink-soft);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.history-table th, .history-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.history-table th { color: var(--ink-soft); font-weight: 600; font-size: 11px; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
}
.badge.success { background: #E9F7EF; color: var(--good); }
.badge.failed { background: #FDEDEA; color: var(--bad); }

.btn-small {
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  font-size: 11px;
  cursor: pointer;
  color: var(--ink);
}
.btn-small:hover { border-color: var(--brand); color: var(--brand); }

.btn-small.danger { border-color: #F3C9C2; color: var(--bad); }
.btn-small.danger:hover { border-color: var(--bad); background: #FDEDEA; }

/* --- Account page --- */
.avatar-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
}

.verify-side {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.verify-link {
  white-space: nowrap;
}

@media (max-width: 480px) {
  .avatar-row { flex-wrap: wrap; }
  .verify-side { margin-left: 0; align-items: flex-start; width: 100%; }
}

.avatar-preview {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #EEF3F8;
}

.avatar-actions label.upload-btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11.5px;
  cursor: pointer;
  color: var(--ink);
  background: #fff;
}
.avatar-actions label.upload-btn:hover { border-color: var(--brand); color: var(--brand); }
.avatar-actions input[type="file"] { display: none; }
.avatar-hint { font-size: 11px; color: var(--ink-soft); margin-top: 6px; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px 22px;
  margin: 18px 0 6px;
}
.info-grid .item label {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-soft);
  margin-bottom: 3px;
}
.info-grid .item .value { font-size: 13px; color: var(--ink); }

.info-grid .item input.value-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  padding: 0 0 2px;
  margin: 0;
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  opacity: 1;
}
.info-grid .item input.value-input:not(:disabled) {
  border-bottom: 1px solid var(--brand);
}
.info-grid .item input.value-input:not(:disabled):focus {
  outline: none;
}
.info-grid .item .checkbox-line {
  font-size: 10.5px;
}

@media (max-width: 700px) {
  .info-grid { grid-template-columns: 1fr 1fr; }
}

/* --- Verification status + ID selection --- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.status-pill.unverified { background: #FDF1E3; color: #A15C07; }
.status-pill.id_submitted, .status-pill.pending_review { background: #EAF1FE; color: #1D4ED8; }
.status-pill.verified { background: #E9F7EF; color: var(--good); }
.status-pill.rejected { background: #FDEDEA; color: var(--bad); }

.id-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0 20px;
}

.id-type-option {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
  background: #fff;
  transition: border-color .12s ease, background .12s ease, transform .05s ease;
}
.id-type-option .id-icon { font-size: 18px; line-height: 1; }
.id-type-option:hover { border-color: var(--brand); }
.id-type-option:active { transform: translateY(1px); }
.id-type-option input { position: absolute; opacity: 0; pointer-events: none; }
.id-type-option.selected { border-color: var(--brand); background: #F0FBFA; color: var(--brand-deep); }

.id-upload-preview {
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin-top: 12px;
}

/* --- Live selfie capture --- */
.camera-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #0E1B26;
  aspect-ratio: 3 / 4;
  max-width: 420px;
  margin: 0 auto;
}
.camera-wrap video, .camera-wrap canvas, .camera-wrap img.captured {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.camera-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

/* --- Account Management (admin) --- */
.members-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.members-table th, .members-table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.members-table th { color: var(--ink-soft); font-weight: 600; font-size: 11px; }
.member-name-cell { display: flex; align-items: center; gap: 10px; }
.member-name-cell img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }

.modal-box.wide { max-width: 640px; }
.review-images { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.review-images figure { margin: 0; }
.review-images img { width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.review-images figcaption { font-size: 11px; color: var(--ink-soft); margin-top: 6px; text-align: center; }
@media (max-width: 560px) { .review-images { grid-template-columns: 1fr; } }

.member-profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.member-profile-head .avatar-preview { width: 56px; height: 56px; flex-shrink: 0; }

.member-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* --- Daily Rewards icon uploader --- */
.reward-icon-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.reward-icon-uploader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.reward-icon-preview {
  width: 84px;
  height: 84px;
  border-radius: 14px;
  background: #F6F9FC;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  overflow: hidden;
}
.reward-icon-preview img { width: 100%; height: 100%; object-fit: contain; }
.reward-icon-uploader input[type="file"] { display: none; }

/* --- Payment Gateway management --- */
.gateway-add-form {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 18px;
}
.gateway-add-form h3 { font-size: 13.5px; margin: 0 0 12px; }

.gateway-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.gateway-qr-preview, .gateway-bank-preview {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  background: #F6F9FC;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  overflow: hidden;
  flex-shrink: 0;
}
.gateway-qr-preview img, .gateway-bank-preview img { width: 100%; height: 100%; object-fit: contain; }
.gateway-info { flex: 1; min-width: 160px; }
.gateway-info .gw-name { font-weight: 700; font-size: 13.5px; margin-bottom: 4px; }
.gateway-info .gw-detail { font-size: 11.5px; color: var(--ink-soft); }
.gateway-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}
.gateway-actions input[type="file"] { display: none; }

.withdrawal-gateway-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.withdrawal-gateway-item:last-child { border-bottom: none; }
.withdrawal-gateway-item .wg-photo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #F6F9FC;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  overflow: hidden;
  flex-shrink: 0;
}
.withdrawal-gateway-item .wg-photo img { width: 100%; height: 100%; object-fit: contain; }
.withdrawal-gateway-item .wg-name { font-weight: 700; flex: 1; }
.withdrawal-gateway-item .wg-type-badge {
  font-size: 10.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #EFF6FF;
  color: var(--brand-deep);
}
.withdrawal-gateway-item input[type="file"] { display: none; }

/* --- Notification Configuration --- */
.chest-gallery-thumb {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
}
.chest-gallery-thumb img { width: 100%; height: 100%; object-fit: contain; background: #F6F9FC; }
.chest-gallery-thumb .chest-delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  color: var(--bad);
}

.member-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 12.5px;
}
.member-picker-item img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }

/* --- Icon Configuration --- */
.icon-slot-group-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand-deep);
  margin: 18px 0 8px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.icon-slot-group-title:first-child { margin-top: 0; }

.icon-slot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}
@media (min-width: 480px) {
  .icon-slot-grid { grid-template-columns: repeat(4, 1fr); }
}

.icon-slot-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 6px;
  gap: 5px;
}
.icon-slot-preview {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #F6F9FC;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  overflow: hidden;
  flex-shrink: 0;
}
.icon-slot-preview img { width: 100%; height: 100%; object-fit: contain; }
.icon-slot-label { font-size: 10px; font-weight: 600; line-height: 1.3; }
.icon-slot-box input[type="file"] { display: none; }
.icon-slot-box label.btn-small, .icon-slot-box button.btn-small {
  font-size: 9.5px;
  padding: 4px 8px;
  width: 100%;
}
.icon-slot-pending { font-size: 9px; color: var(--brand-deep); font-weight: 700; }

/* --- Messages / Friends / Group Chat --- */
.msg-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.convo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.convo-item:last-child { border-bottom: none; }
.convo-item:hover { background: #F6FBFA; }
.convo-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #EEF3F8; flex-shrink: 0; }
.convo-info { flex: 1; min-width: 0; }
.convo-name { font-weight: 700; font-size: 13px; }
.convo-last { font-size: 11.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-badge { font-size: 10px; background: #EFF6FF; color: var(--brand-deep); padding: 2px 8px; border-radius: 999px; }

.friend-search-item, .group-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}
.friend-search-item:last-child, .group-picker-item:last-child { border-bottom: none; }
.friend-search-item img, .group-picker-item img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.friend-search-item .btn-small { margin-left: auto; }

.friend-req-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}
.friend-req-item img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.friend-req-actions { margin-left: auto; display: flex; gap: 6px; }

.friend-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
}
.friend-list-item:last-child { border-bottom: none; }
.friend-avatar-wrap { position: relative; flex-shrink: 0; }
.friend-avatar-wrap img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #EEF3F8; }
.online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: #C6CDD6;
}
.online-dot.online { background: var(--good); }
.friend-list-info { flex: 1; min-width: 0; }
.friend-list-name { font-weight: 700; font-size: 13px; }
.friend-list-status { font-size: 10.5px; color: var(--ink-soft); }
.friend-list-status.online { color: var(--good); }

/* Chat full-screen-style modal */
#chatViewModal { padding: 0; }
#chatViewModal .chat-box {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--surface);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.chat-back-btn, .chat-settings-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--ink);
}
.chat-header-title { flex: 1; font-weight: 700; font-size: 14px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #F8FBFC;
}

.chat-msg-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  max-width: 88%;
}
.chat-msg-line.theirs { align-self: flex-start; }
.chat-msg-line.mine { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.chat-bubble-row { display: flex; flex-direction: column; min-width: 0; }
.chat-bubble-row.mine { align-items: flex-end; }
.chat-bubble-row.theirs { align-items: flex-start; }
.chat-sender-name { font-size: 10.5px; color: var(--ink-soft); margin-bottom: 2px; }
.chat-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  cursor: pointer;
  touch-action: pan-y;
  transition: transform 0.15s ease;
  user-select: none;
}
.chat-bubble-row.mine .chat-bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble-row.theirs .chat-bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-bubble img.chat-img { max-width: 100%; border-radius: 10px; display: block; }
.chat-bubble video.chat-video { max-width: 100%; border-radius: 10px; display: block; }
.chat-bubble a.chat-file-link { color: inherit; text-decoration: underline; font-size: 12.5px; }
.chat-time { font-size: 9.5px; color: var(--ink-soft); margin-top: 2px; }

.quick-react-popup {
  position: fixed;
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px;
  box-shadow: 0 10px 28px rgba(16,42,67,0.2);
  z-index: 300;
}
.quick-react-popup span {
  font-size: 22px;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.quick-react-popup span:hover { transform: scale(1.25); }

.reply-preview {
  font-size: 10.5px;
  color: var(--ink-soft);
  background: #EEF3F8;
  border-left: 2px solid var(--brand);
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 3px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reactions-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.reaction-chip {
  font-size: 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  cursor: pointer;
}
.reaction-chip.mine { border-color: var(--brand); background: #EAF7F5; }

.read-avatars {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  margin-top: 2px;
}
.read-avatars img {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--surface);
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: #EEF3F8;
  font-size: 11.5px;
  border-top: 1px solid var(--line);
}
.reply-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar button {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--ink-soft);
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.chat-icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
.chat-text-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 9px 14px;
  font-family: var(--font);
  font-size: 13px;
}
.chat-send-btn {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--brand-deep); }

.emoji-picker {
  position: absolute;
  bottom: 60px;
  left: 12px;
  right: 12px;
  max-height: 160px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(16,42,67,0.18);
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.emoji-picker span {
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.emoji-picker span:hover { background: #F0FBFA; }

.attach-preview-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  overflow-x: auto;
}
.attach-preview-chip {
  font-size: 11px;
  background: #EFF6FF;
  color: var(--brand-deep);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.gateway-actions label.btn-small { margin: 0; }

/* --- Member deposit flow --- */
.gateway-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  margin-bottom: 10px;
}
.gateway-choice:hover { border-color: var(--brand); }
.gateway-choice-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #F6F9FC;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.gateway-choice-name { font-weight: 700; font-size: 13.5px; }

.gateway-details-box {
  background: #F6FBFA;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.7;
}
.gateway-details-box .gw-qr-large {
  width: 140px;
  height: 140px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.gateway-details-box .gw-qr-large img { width: 100%; height: 100%; object-fit: contain; }

.gw-details-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.gw-bank-photo-small {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  overflow: hidden;
  flex-shrink: 0;
}
.gw-bank-photo-small img { width: 100%; height: 100%; object-fit: contain; }
.gw-details-text { flex: 1; line-height: 1.7; }
.gw-qr-center { text-align: center; margin-top: 12px; }
.gw-qr-center .gw-qr-large { margin: 0 auto; }

/* --- Daily Reward popup --- */
.daily-reward-box {
  text-align: center;
  max-width: 380px;
}
.daily-reward-box .sub { text-align: center; }

.chest-stage {
  position: relative;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 4px;
}

.chest-icon {
  font-size: 84px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}
.chest-icon img { width: 90px; height: 90px; object-fit: contain; }

.chest-icon.shaking { animation: chestShake 0.55s ease-in-out; }
@keyframes chestShake {
  0%, 100% { transform: rotate(0deg) translateX(0); }
  15% { transform: rotate(-9deg) translateX(-3px); }
  30% { transform: rotate(8deg) translateX(3px); }
  45% { transform: rotate(-7deg) translateX(-2px); }
  60% { transform: rotate(6deg) translateX(2px); }
  75% { transform: rotate(-4deg); }
  90% { transform: rotate(2deg); }
}

.chest-icon.popped { animation: chestPop 0.45s ease-out; }
@keyframes chestPop {
  0% { transform: scale(1); }
  55% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.reward-amount-line {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--brand-deep);
  min-height: 18px;
  margin: 4px 0 16px;
}

.flying-coin {
  position: fixed;
  font-size: 22px;
  z-index: 300;
  pointer-events: none;
  opacity: 1;
  transition: transform 1s cubic-bezier(.22,.8,.32,1), opacity 1s ease;
  will-change: transform, opacity;
}

.reject-reason {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font-family: var(--font);
  font-size: 12px;
  margin-top: 10px;
  min-height: 64px;
}

/* --- Settings hub (clickable category cards) --- */
.settings-hub-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 520px;
}

.settings-hub-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: border-color .12s ease, transform .05s ease;
}
.settings-hub-card:hover { border-color: var(--brand); }
.settings-hub-card:active { transform: translateY(1px); }

.settings-hub-card .hub-icon { font-size: 28px; margin-bottom: 8px; }
.settings-hub-card .hub-title { font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 4px; line-height: 1.3; }
.settings-hub-card .hub-desc {
  font-size: 10px;
  color: var(--ink-soft);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 480px) {
  .settings-hub-grid { grid-template-columns: repeat(3, 1fr); }
}

.back-link {
  display: inline-block;
  font-size: 12.5px;
  color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: 16px;
  font-weight: 600;
}
.back-link:hover { color: var(--brand); }

/* --- Toast notifications (top-right) --- */
.toast-container {
  position: fixed;
  top: 78px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.toast {
  position: relative;
  background: var(--surface);
  border-left: 4px solid var(--bad);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(16,42,67,0.18);
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.toast-success { border-left-color: var(--good); }

@media (max-width: 480px) {
  .toast-container { left: 14px; right: 14px; top: 70px; max-width: none; }
}

/* --- Avatar crop modal --- */
.crop-wrap {
  max-height: 60vh;
  overflow: hidden;
  border-radius: 10px;
  background: #0E1B26;
}
.crop-wrap img {
  display: block;
  max-width: 100%;
}

/* =========================================================================
   MOBILE RESPONSIVENESS — applies across every page, any phone width.
   ========================================================================= */

/* Safety net: nothing should ever be able to create horizontal scroll. */
html, body { overflow-x: hidden; width: 100%; }
img, video, canvas, svg { max-width: 100%; }

/* Wide tables scroll horizontally inside their own box instead of
   pushing the whole page wider than the screen. */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll table { min-width: 480px; }

@media (max-width: 480px) {
  .card, .settings-card, .dash-card {
    padding: 24px 18px;
  }
  .modal-box {
    padding: 22px 18px;
  }
  .brand-copy h1 { font-size: 23.5px; }
  .card h2, .dash-card h1 { font-size: 18px; }
  .top-bar { padding: 12px 14px; }
  .content-area { padding: 0 14px; margin: 24px auto; }
  .row-2 { grid-template-columns: 1fr; }
  .avatar-row { gap: 14px; }
  .avatar-preview { width: 68px; height: 68px; }
}

@media (max-width: 640px) {
  .top-bar .who strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 110px;
    display: inline-block;
    vertical-align: bottom;
  }
  .top-bar .who { min-width: 0; }
  .camera-actions { flex-wrap: wrap; }
  .camera-actions button { flex: 1 1 auto; min-width: 110px; }
  .settings-card, .dash-card { padding: 26px 20px; }
}


/* Icon overrides: hidden until JS decides whether to show the default
   emoji or a custom-uploaded icon — prevents a flash of the default icon. */
[data-icon-slot], #notifEnvelopeIcon {
  visibility: hidden;
}
[data-icon-slot].icon-ready, #notifEnvelopeIcon.icon-ready {
  visibility: visible;
}
