*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    .icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; fill: currentColor; }
    :root {
      --orange: #ff7a18; --teal: #0f766e; --glass: rgba(255,255,255,.13);
      --glass-border: rgba(255,255,255,.22); --radius: 1.25rem;
      --font-body: 'Poppins', system-ui, sans-serif;
      --font-display: 'Poppins', system-ui, sans-serif;
    }
    body {
      font-family: var(--font-body); min-height: 100dvh;
      background: linear-gradient(135deg, #1a0533 0%, #0f2440 40%, #0d3b38 100%);
      color: #fff; padding: 0 0 3rem;
    }
    .ambient { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
    .ambient::before {
      content: ''; position: absolute; width: 600px; height: 600px; border-radius: 50%;
      background: radial-gradient(circle, rgba(255,122,24,.25) 0%, transparent 70%);
      top: -200px; right: -100px;
    }
    .ambient::after {
      content: ''; position: absolute; width: 500px; height: 500px; border-radius: 50%;
      background: radial-gradient(circle, rgba(15,118,110,.25) 0%, transparent 70%);
      bottom: -150px; left: -100px;
    }
    header {
      position: relative; z-index: 1;
      display: flex; align-items: center; justify-content: space-between;
      padding: 1.1rem 1.5rem; gap: 1rem;
      background: var(--site-soft); border-bottom: 1px solid var(--glass-border);
      backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    }
    .header-left { display: flex; align-items: center; gap: .75rem; }
    .back-btn {
      display: inline-flex; align-items: center; gap: .35rem;
      background: var(--site-soft); border: 1px solid var(--glass-border);
      color: #fff; border-radius: .5rem; padding: .4rem .75rem;
      font-family: var(--font-body); font-size: .85rem; cursor: pointer;
      text-decoration: none; transition: background .2s;
    }
    .back-btn:hover { background: var(--site-soft); }
    header h1 { font-family: var(--font-display); font-size: 1.2rem; }
    .logout-btn {
      background: rgba(220,38,38,.15); border: 1px solid rgba(220,38,38,.35);
      color: #fca5a5; border-radius: .5rem; padding: .4rem .75rem;
      font-family: var(--font-body); font-size: .85rem; cursor: pointer;
      transition: background .2s;
    }
    .logout-btn:hover { background: rgba(220,38,38,.3); }
    .page-wrap {
      position: relative; z-index: 1;
      width: min(820px, calc(100% - 2rem)); margin: 2rem auto;
      display: flex; flex-direction: column; gap: 1.5rem;
    }
    .card {
      background: var(--glass); border: 1px solid var(--glass-border);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      border-radius: var(--radius); padding: 2rem;
      box-shadow: 0 8px 32px rgba(0,0,0,.2);
    }
    h3 { font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 1.25rem; }
    .form-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
    .form-group { flex: 1 1 180px; margin-bottom: 1rem; }
    label { display: block; color: var(--site-muted); font-size: .8rem; font-weight: 500; margin-bottom: .35rem; }
    input[type="text"], input[type="tel"], select {
      width: 100%; min-width: 0; max-width: 100%; background: var(--site-soft); border: 1px solid var(--glass-border);
      border-radius: .6rem; padding: .7rem .9rem; color: #fff;
      font-family: var(--font-body); font-size: .95rem; outline: none;
      transition: border-color .2s;
    }
    select option { background: #1a0533; color: #fff; }
    input:focus, select:focus { border-color: var(--orange); }
    input::placeholder { color: var(--site-muted); }
    input[type="color"] {
      width: 48px; height: 44px; border-radius: .6rem; border: 1px solid var(--glass-border);
      background: var(--site-soft); cursor: pointer; padding: 2px;
    }
    .btn-primary {
      padding: .75rem 1.5rem;
      background: linear-gradient(135deg, var(--orange), #e05e00);
      color: #fff; font-family: var(--font-body); font-size: .95rem; font-weight: 700;
      border: none; border-radius: .75rem; cursor: pointer;
      transition: opacity .2s, transform .1s; white-space: nowrap;
    }
    .btn-primary:hover { opacity: .9; } .btn-primary:active { transform: scale(.98); }
    .btn-primary:disabled { opacity: .5; cursor: not-allowed; }
    .error-msg {
      background: rgba(220,38,38,.15); border: 1px solid rgba(220,38,38,.4);
      color: #fca5a5; border-radius: .6rem; padding: .65rem .9rem;
      font-size: .85rem; margin-bottom: 1rem; display: none;
    }
    .error-msg.visible { display: block; }
    .success-msg {
      background: rgba(15,118,110,.2); border: 1px solid rgba(15,118,110,.4);
      color: #6ee7b7; border-radius: .6rem; padding: .75rem .9rem;
      font-size: .9rem; margin-bottom: 1rem; display: none;
      align-items: center; justify-content: space-between; gap: .75rem;
    }
    .success-msg.visible { display: flex; }
    .success-msg code {
      background: rgba(0,0,0,.25); padding: .3rem .6rem; border-radius: .4rem;
      font-size: 1rem; letter-spacing: .1em; font-weight: 700;
    }
    .copy-btn {
      background: var(--site-soft); border: 1px solid var(--glass-border);
      color: #fff; border-radius: .4rem; padding: .3rem .6rem; font-size: .75rem;
      cursor: pointer; flex-shrink: 0;
    }
    .copy-btn:hover { background: var(--site-soft); }
    .member-row {
      display: grid; align-items: center; gap: .4rem;
      grid-template-columns: 28px minmax(0, 1.2fr) minmax(0, 1fr) 82px auto auto;
      border-bottom: 1px solid var(--glass-border); padding: .5rem 0;
      list-style: none;
    }
    .member-row > * { min-width: 0; }
    #membersList { list-style: none; }
    .avatar-circle {
      width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      font-size: .65rem; font-weight: 700; color: #fff; font-family: var(--font-display);
    }
    .member-info { flex: 1 1 140px; min-width: 0; }
    .member-info input.edit-name {
      width: 100%; background: var(--site-soft); border: 1px solid var(--glass-border);
      border-radius: .5rem; padding: .45rem .6rem; color: #fff; font-weight: 600;
      font-family: var(--font-body); font-size: .78rem; outline: none; transition: border-color .2s;
    }
    .member-info input.edit-name:focus { border-color: var(--orange); }
    .member-meta { color: var(--site-muted); font-size: .65rem; margin-top: .1rem; }
    input.edit-key {
      flex: 0 1 140px; background: rgba(0,0,0,.2); border: 1px solid var(--glass-border);
      border-radius: .5rem; padding: .45rem .6rem; color: #fff; letter-spacing: .05em;
      font-family: var(--font-body); font-size: .75rem; outline: none; transition: border-color .2s;
    }
    input.edit-key:focus { border-color: var(--orange); }
    .role-select {
      width: 100%; padding: .4rem .3rem; font-size: .75rem;
    }
    .icon-btn {
      background: var(--site-soft); border: 1px solid var(--glass-border);
      color: #fff; border-radius: .5rem; padding: .4rem .65rem; font-size: .78rem;
      cursor: pointer; transition: background .2s; white-space: nowrap;
    }
    .icon-btn:hover { background: var(--site-soft); }
    .icon-btn.danger { background: rgba(220,38,38,.15); border-color: rgba(220,38,38,.35); color: #fca5a5; }
    .icon-btn.danger:hover { background: rgba(220,38,38,.3); }
    .empty-state { color: var(--site-muted); text-align: center; padding: 2rem 0; font-size: .9rem; }
    .loading { color: var(--site-muted); text-align: center; padding: 1.5rem 0; }
    .bulk-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
    .bulk-table th {
      text-align: left; color: var(--site-muted); font-size: .78rem; font-weight: 500;
      padding: .4rem .5rem; border-bottom: 1px solid var(--glass-border);
    }
    .bulk-table td { padding: .4rem .5rem; vertical-align: middle; }
    .bulk-table input[type="text"], .bulk-table input[type="tel"], .bulk-table select {
      width: 100%; background: var(--site-soft); border: 1px solid var(--glass-border);
      border-radius: .5rem; padding: .55rem .7rem; color: #fff;
      font-family: var(--font-body); font-size: .9rem; outline: none; transition: border-color .2s;
    }
    .bulk-table input:focus, .bulk-table select:focus { border-color: var(--orange); }
    .bulk-table select option { background: #1a0533; color: #fff; }
    .bulk-actions { display: flex; gap: .75rem; }
    .bulk-table { table-layout: fixed; }
    .bulk-table th:last-child { width: 46px; }
    .bulk-table th:nth-child(3) { width: 100px; }
    .bulk-table input, .bulk-table select { min-width: 0; }
    @media (max-width: 600px) {
      header { padding: .75rem; gap: .5rem; }
      .header-left { flex-wrap: wrap; gap: .3rem; }
      header h1 { font-size: .95rem; }
      .back-btn, .logout-btn { padding: .4rem; font-size: .72rem; }
      .page-wrap { width: calc(100% - 1rem); margin: 1rem auto; gap: 1rem; }
      .card { padding: .8rem; border-radius: .75rem; }
      .card > p { font-size: .78rem; }
      h3 { font-size: 1rem; margin-bottom: .65rem; }
      .member-row { grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr); gap: .3rem; padding: .45rem 0; }
      .member-row .avatar-circle { width: 24px; height: 24px; grid-row: 1 / 3; }
      .member-row .role-select { grid-column: 2; grid-row: 2; }
      .member-actions { display: flex; gap: .3rem; grid-column: 3; grid-row: 2; }
      .member-actions .icon-btn { flex: 1; padding: .4rem .25rem; font-size: .7rem; }
      .member-meta { display: none; }
      .member-info input.edit-name, input.edit-key { padding: .4rem; }
      .bulk-table, .bulk-table tbody { display: block; width: 100%; }
      .bulk-table thead { display: none; }
      .bulk-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; gap: .3rem; padding: .5rem 0; border-bottom: 1px solid var(--glass-border); }
      .bulk-table td { min-width: 0; padding: 0; }
      .bulk-table td:first-child { grid-column: 1; }
      .bulk-table td:nth-child(2) { grid-column: 2 / 4; }
      .bulk-table td:nth-child(3) { grid-column: 1 / 3; }
      .bulk-table td:last-child { grid-column: 3; }
      .bulk-table input[type="text"], .bulk-table input[type="tel"], .bulk-table select { font-size: .8rem; padding: .45rem; }
      .bulk-actions { margin-top: .75rem; }
      .bulk-actions .btn-primary { font-size: .85rem; padding: .6rem 1rem; }
    }
    @media (min-width: 601px) {
      .member-actions { display: contents; }
    }

/* Compact member directory; details and editing open on demand. */
.family-site.account-admin #membersList .member-row { display: block; padding: 0; border-radius: 0; background: transparent; box-shadow: none; }
.member-details { width: 100%; }
.member-details summary { cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 10px 4px; font-size: .78rem; }
.member-details summary::before { content: none; }
.member-details summary::-webkit-details-marker { display: none; }
.member-name { flex: 1; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.member-summary-phone { color: var(--site-muted); font-size: .74rem; }
.member-summary-role { width: 52px; text-transform: capitalize; font-size: .72rem; }
.member-profile { padding: 8px 4px 18px; }
.member-profile-fields { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 14px; font-size: .78rem; }
.member-profile-fields dt { color: var(--site-muted); font-size: .7rem; }
.member-profile-fields dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.member-edit { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr) 82px auto auto; align-items: center; gap: 6px; }
@media (max-width: 600px) {
  .member-details summary { gap: 7px; }
  .member-summary-phone { font-size: .68rem; }
  .member-edit { grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr); }
  .member-edit .member-actions { display: flex; }
}

.family-site .member-edit-icon { width: 14px; height: 14px; flex: 0 0 14px; color: var(--site-muted); }
.family-site .member-profile-fields { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: 12px; }
.family-site .member-edit { grid-template-columns: 28px minmax(0, 2fr) minmax(0, 2fr) minmax(100px, 1fr) auto; align-items: end; gap: 10px; }
.family-site .member-edit > * { min-width: 0; }
.family-site .member-edit .avatar-circle { align-self: end; margin-bottom: 8px; grid-row: auto; }
.family-site .member-edit label { font-size: 11px; margin: 0 0 5px; }
.family-site.account-page .member-edit input, .family-site.account-page .member-edit select { height: 44px; min-height: 44px; margin: 0; width: 100%; font-size: 13px; padding: 10px; }
.family-site .member-edit .member-actions { display: flex; gap: 6px; grid-column: auto; grid-row: auto; }
.family-site .member-edit .member-actions button { height: 44px; padding: 10px; }
@media (max-width: 600px) {
  .family-site .member-profile-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .family-site .member-profile-fields > div:first-child { grid-column: 1 / -1; }
  .family-site .member-edit { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .family-site .member-edit .avatar-circle { display: none; }
  .family-site .member-edit .role-select { grid-column: auto; grid-row: auto; }
  .family-site .member-edit .member-actions { justify-content: flex-end; }
}

.member-email-field { max-width: 520px; margin: 0 0 16px; }
.family-site .member-email-field label { font-size: 12px; margin-bottom: 5px; }
.family-site.account-page .member-email-field input { width: 100%; min-width: 0; }
.member-email-hint { font-size: 12px; color: var(--site-muted); margin-top: 5px; line-height: 1.5; }
