/* Jai Admins — futuristic dark purple dashboard styling.
   Design tokens support light and dark. Desktop-first with tablet/mobile
   breakpoints; the sidebar collapses to a drawer on small screens. */

:root {
  /* Shared design language with the Jai Mails webmail: Inter UI + Space Grotesk
     for brand/headings, generous radius, purple glow. */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-brand: "Space Grotesk", "Geist", "Inter", ui-sans-serif, system-ui, sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 252px;
  --transition: 160ms ease;
}

/* DARK — the primary Jai Admins identity (near-black + neon purple). */
:root[data-theme="dark"] {
  --bg: #0a0712;              /* near-black base */
  --bg-grad:
    radial-gradient(1100px 700px at 88% -12%, #2a1358 0, transparent 55%),
    radial-gradient(760px 560px at 4% 4%, #1c0f3e 0, transparent 52%),
    linear-gradient(165deg, #0b0716 0%, #070510 100%);
  --surface: #120c22;         /* charcoal card */
  --surface-2: #0f0a1c;       /* raised/darker surface */
  --sidebar: linear-gradient(180deg, #0e0920 0%, #0a0714 100%);
  --border: #241b3a;          /* subtle purple-tinted border */
  --border-strong: #33254f;
  --text: #f3f0ff;            /* high-contrast text */
  --text-dim: #a99fc7;        /* muted lavender-gray */
  --text-faint: #7a6f9c;
  --brand: #a06bff;           /* neon purple primary */
  --brand-2: #7b3ff2;         /* deeper violet (gradient/hover) */
  --brand-3: #c8a6ff;         /* light lavender highlight */
  --brand-weak: #1c1136;      /* purple-tinted weak bg (active nav, chips) */
  --accent: #c8a6ff;
  --ok: #34d399;
  --ok-weak: #10261f;
  --warn: #fbbf24;
  --warn-weak: #2a220f;
  --danger: #ff5d7a;
  --danger-weak: #2a1420;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 10px 30px rgba(0,0,0,0.5);
  --shadow-lg: 0 24px 70px rgba(0,0,0,0.6);
  --glow: 0 0 24px color-mix(in srgb, var(--brand) 40%, transparent);
  --scene-1: #1a0f38;
  --scene-2: #0a0712;
}

/* LIGHT — clean lavender-white + purple (properly designed, not inverted). */
:root[data-theme="light"] {
  --bg: #f5f2fd;              /* soft lavender-white base */
  --bg-grad:
    radial-gradient(1000px 640px at 88% -12%, #ece2ff 0, transparent 55%),
    radial-gradient(720px 520px at 4% 4%, #f0e9ff 0, transparent 50%),
    linear-gradient(165deg, #faf8ff 0%, #f2ecfb 100%);
  --surface: #ffffff;         /* white cards */
  --surface-2: #f4eefc;       /* pale lavender raised */
  --sidebar: linear-gradient(180deg, #fbf9ff 0%, #f3eefb 100%);
  --border: #e4ddf3;          /* subtle lavender border */
  --border-strong: #d6cbee;
  --text: #1a1230;            /* near-black charcoal */
  --text-dim: #6c6390;        /* gray-purple secondary */
  --text-faint: #9187b0;
  --brand: #7b3ff2;           /* violet primary */
  --brand-2: #6321d6;         /* deeper purple hover */
  --brand-3: #8a53ef;
  --brand-weak: #efe7ff;      /* light purple weak bg */
  --accent: #7b3ff2;
  --ok: #16a34a;
  --ok-weak: #e5f6ec;
  --warn: #b7791f;
  --warn-weak: #fbeecd;
  --danger: #d61f47;
  --danger-weak: #fbe1e8;
  --shadow: 0 1px 2px rgba(99, 33, 214, 0.06), 0 8px 24px rgba(99, 33, 214, 0.08);
  --shadow-lg: 0 18px 50px rgba(99, 33, 214, 0.16);
  --glow: 0 0 22px color-mix(in srgb, var(--brand) 26%, transparent);
  --scene-1: #ece2ff;
  --scene-2: #f5f2fd;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-grad, var(--bg));
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14.5px;
  line-height: 1.5;
}
a { color: var(--brand); }
button { font-family: inherit; }

/* ---------- Login ---------- */
.login-scene {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--scene-1), transparent 60%),
    var(--scene-2);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.brand-mark { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 6px; }
/* Purple rounded-square envelope mark (same treatment as the Jai Mails logo). */
.brand-mark .flake {
  width: 38px; height: 38px; display: grid; place-items: center; color: #fff;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 50%, transparent), inset 0 1px 0 rgba(255,255,255,0.2);
}
.brand-mark .flake svg { width: 22px; height: 22px; }
.brand-name { font-family: var(--font-brand); font-weight: 700; letter-spacing: -0.01em; font-size: 21px; }
.brand-name .fm { color: var(--brand-3); text-shadow: 0 0 18px color-mix(in srgb, var(--brand) 55%, transparent); }
.brand-sub { text-align: center; color: var(--text-dim); margin: 2px 0 22px; font-size: 13px; }
.lc-title { text-align: center; font-size: 18px; margin: 0 0 18px; }
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
.field-wrap { position: relative; display: flex; align-items: center; }
.field-icon { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--text-faint); display: inline-flex; pointer-events: none; }
.field input {
  width: 100%; padding: 11px 12px 11px 38px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-size: 14.5px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
.pw-toggle { position: absolute; right: 8px; background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 6px; display: inline-flex; }
.pw-toggle svg { width: 18px; height: 18px; }
.btn-primary {
  width: 100%; margin-top: 6px; padding: 12px 14px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-radius: var(--radius-sm);
  font-weight: 650; font-size: 14.5px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 38%, transparent), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: filter var(--transition), opacity var(--transition), box-shadow var(--transition);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 14px 30px color-mix(in srgb, var(--brand) 50%, transparent), inset 0 1px 0 rgba(255,255,255,0.24); }
.btn-primary:disabled { opacity: .7; cursor: default; }
.notice { margin-top: 14px; font-size: 13px; color: var(--danger); background: var(--danger-weak); border: 1px solid var(--danger); border-radius: var(--radius-sm); padding: 9px 11px; display: none; }
.notice.show { display: block; }
.login-foot { text-align: center; color: var(--text-faint); font-size: 12px; margin-top: 18px; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.side {
  background: var(--sidebar, var(--surface)); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh;
}
.side .brand { display: flex; align-items: center; gap: 11px; padding: 6px 6px 18px; }
.side .brand .flake {
  width: 34px; height: 34px; display: grid; place-items: center; color: #fff; flex: 0 0 auto;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 45%, transparent), inset 0 1px 0 rgba(255,255,255,0.18);
}
.side .brand .flake svg { width: 20px; height: 20px; }
.side .brand .brand-name { font-family: var(--font-brand); font-size: 18px; letter-spacing: -0.01em; }
.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-dim); text-decoration: none; border: none; background: none; cursor: pointer; font-size: 14px; width: 100%; text-align: left;
  transition: background var(--transition), color var(--transition);
}
.nav-link svg { width: 19px; height: 19px; flex: 0 0 auto; }
.nav-link:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--text); }
.nav-link.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 24%, transparent), color-mix(in srgb, var(--brand) 10%, transparent));
  color: var(--text); font-weight: 650;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 38%, transparent);
}
.nav-link.active svg { color: var(--brand-3); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.who { display: flex; align-items: center; gap: 10px; padding: 8px; color: var(--text-dim); font-size: 13px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.who-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link.logout { color: var(--danger); }
.nav-link.logout:hover { background: var(--danger-weak); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 24px;
  border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; }
.topbar .spacer { flex: 1; }
.icon-btn { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-dim); width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; transition: var(--transition); }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.hamburger { display: none; }
.content { padding: 24px; max-width: 1200px; width: 100%; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: var(--transition); white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 34%, transparent), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 12px 28px color-mix(in srgb, var(--brand) 48%, transparent), inset 0 1px 0 rgba(255,255,255,0.22); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: none; color: var(--text-dim); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.sm { padding: 6px 9px; font-size: 12.5px; }

/* ---------- Cards / stats ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: border-color var(--transition), box-shadow var(--transition); }
.card:hover { border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.stat { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-label { color: var(--text-dim); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat-sub { color: var(--text-faint); font-size: 12.5px; margin-top: 3px; }
.stat-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-weak); color: var(--brand-3); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 22%, transparent); }
.stat-ico svg { width: 20px; height: 20px; }
.stat-ico.ok { background: var(--ok-weak); color: var(--ok); }
.stat-ico.warn { background: var(--warn-weak); color: var(--warn); }
.stat-ico.danger { background: var(--danger-weak); color: var(--danger); }
.section-title { font-size: 14px; font-weight: 650; margin: 26px 0 12px; color: var(--text); }

/* ---------- Toolbar / search ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-faint); }
.search-wrap input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 14px; }
.search-wrap input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }

/* ---------- Table ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-faint); padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; background: var(--surface-2); }
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.cell-email { font-weight: 600; }
.cell-dim { color: var(--text-dim); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.mini { background: none; border: 1px solid var(--border); border-radius: 7px; color: var(--text-dim); width: 30px; height: 30px; display: inline-grid; place-items: center; cursor: pointer; transition: var(--transition); }
.mini:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }
.mini.danger:hover { color: var(--danger); border-color: var(--danger); }
.mini svg { width: 15px; height: 15px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active { color: var(--ok); background: var(--ok-weak); }
.badge.disabled { color: var(--text-faint); background: var(--surface-2); }
.badge.on { color: var(--ok); background: var(--ok-weak); }
.badge.off { color: var(--warn); background: var(--warn-weak); }

/* progress bar for storage cells */
.usage { min-width: 130px; }
.usage-bar { height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 5px; }
.usage-fill { height: 100%; background: var(--brand); border-radius: 999px; }
.usage-fill.warn { background: var(--warn); }
.usage-fill.full { background: var(--danger); }
.usage-text { font-size: 12px; color: var(--text-dim); }

/* pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.pager-info { color: var(--text-dim); font-size: 13px; }
.pager-btns { display: flex; gap: 6px; }

/* states */
.state { text-align: center; padding: 48px 20px; color: var(--text-dim); }
.state .state-ico { width: 42px; height: 42px; color: var(--text-faint); margin: 0 auto 12px; display: inline-flex; }
.state h3 { margin: 0 0 4px; color: var(--text); font-size: 15px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px 20px; color: var(--text-dim); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.btn-spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 22, .55); display: grid; place-items: center; padding: 20px; z-index: 40; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
.form-row input, .form-row select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-size: 14px;
}
.form-row input:focus, .form-row select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pw-field { display: flex; gap: 8px; }
.pw-field input { flex: 1; }
.hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.form-err { color: var(--danger); font-size: 12.5px; margin-top: 8px; min-height: 16px; }
.inline-warn { display: flex; gap: 9px; align-items: flex-start; background: var(--warn-weak); color: var(--warn); border: 1px solid var(--warn); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; margin-bottom: 14px; }
.inline-warn svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }

/* results table (bulk) */
.results { max-height: 340px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.results table td, .results table th { padding: 8px 12px; font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* storage page list */
.storage-list .card { margin-bottom: 12px; }
.storage-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.storage-row .who-email { font-weight: 600; }

/* toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 11px 18px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow-lg); z-index: 60; max-width: 90vw; }
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--ok); color: #fff; }

/* ---------- Responsive ---------- */
.scrim { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; top: 0; left: 0; z-index: 50; width: 82%; max-width: 300px; height: 100vh;
    transform: translateX(-105%); transition: transform var(--transition); box-shadow: var(--shadow-lg);
  }
  .side.open { transform: translateX(0); }
  .hamburger { display: grid; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(8,12,22,.45); z-index: 45; }
}
@media (max-width: 620px) {
  .content { padding: 16px; }
  .form-grid2 { grid-template-columns: 1fr; }
  .row-actions { flex-wrap: wrap; }
  thead th.hide-sm, tbody td.hide-sm { display: none; }
}

/* account email as a link button (opens details) */
.link-btn { background: none; border: none; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.row-check, #check-all { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand); }

/* Permission editor (Administrators) */
.perm-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; color: var(--text-dim); font-size: 12.5px; }
.perm-editor { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); }
.perm-group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--brand-3, var(--brand)); font-weight: 700; margin-bottom: 8px; }
.perm-grid { display: flex; flex-direction: column; gap: 6px; }
.perm-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.perm-item input { accent-color: var(--brand); width: 15px; height: 15px; }
.perm-item.disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Full-page credential result ---------- */
.cred-page { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

.cred-back { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; background: none; border: 1px solid var(--border-strong); color: var(--text-dim); border-radius: 999px; padding: 6px 14px 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--transition); }
.cred-back:hover { color: var(--text); border-color: color-mix(in srgb, var(--brand) 45%, var(--border-strong)); background: var(--surface); }
.cred-back svg { width: 16px; height: 16px; }

.cred-hero { display: flex; align-items: center; gap: 18px; position: relative; overflow: hidden; border-color: color-mix(in srgb, var(--brand) 34%, var(--border)); box-shadow: 0 10px 40px color-mix(in srgb, var(--brand) 22%, transparent); }
.cred-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 60%); pointer-events: none; }
.cred-hero-ico { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 46%, transparent), inset 0 1px 0 rgba(255,255,255,0.25); }
.cred-hero-ico svg { width: 26px; height: 26px; }
.cred-hero-text h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.2px; }
.cred-hero-text p { color: var(--text-dim); font-size: 13.5px; margin-top: 3px; }

.cred-group { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cred-group-name { font-size: 16px; font-weight: 700; }
.cred-group-email { color: var(--brand-3, var(--brand)); font-size: 12.5px; margin-top: 2px; }
.cred-group-desc { color: var(--text-dim); font-size: 13px; margin-top: 6px; }
.cred-group-meta { text-align: right; color: var(--text-faint); font-size: 11.5px; line-height: 1.5; white-space: nowrap; }
.cred-group-meta strong { color: var(--text-dim); font-weight: 600; }
.cred-meta-line { color: var(--text-faint); font-size: 12px; }
.cred-meta-line strong { color: var(--text-dim); }

.cred-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.cred-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 13px; color: var(--text-dim); background: var(--brand-weak); border: 1px solid color-mix(in srgb, var(--brand) 26%, var(--border)); }
.cred-chip strong { color: var(--text); font-weight: 700; }
.cred-chip svg { width: 15px; height: 15px; color: var(--brand-3, var(--brand)); }

.cred-warn { margin-bottom: 0; }

.cred-actions-bar { display: flex; flex-wrap: wrap; gap: 10px; }
.cred-actions-bar .btn.copied { border-color: var(--ok); color: var(--ok); }

.cred-table-wrap { padding: 0; overflow: auto; max-height: 60vh; }
.cred-table { width: 100%; border-collapse: collapse; }
.cred-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2, var(--surface)); backdrop-filter: blur(6px); text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); padding: 12px 14px; border-bottom: 1px solid var(--border); }
.cred-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.cred-table tbody tr:last-child td { border-bottom: none; }
.cred-table tbody tr:hover { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.cred-table .cred-num { width: 44px; color: var(--text-faint); font-size: 12px; }
.cred-table .cred-email { color: var(--text); }
.cred-table .cred-pass { color: var(--brand-3, var(--brand)); font-weight: 600; letter-spacing: .3px; }
.cred-table .cred-actions { width: 1%; white-space: nowrap; text-align: right; }
.cred-table .cred-actions .mini { margin-left: 4px; }
.cred-table th.cred-actions { text-align: right; }

@media (max-width: 640px) {
  .cred-hero { gap: 14px; padding: 16px; }
  .cred-hero-text h2 { font-size: 19px; }
  .cred-actions-bar .btn { flex: 1 1 auto; justify-content: center; }
  .cred-group { flex-direction: column; }
  .cred-group-meta { text-align: left; }
}

/* ---------- Full-page Group Details + group Credentials ---------- */
/* Group detail/credentials pages are content-width (wider than the narrow
   credential-result page) and rely on normal page-level scrolling. */
.content > .cred-page:has(.cred-actions-bar) { max-width: 1120px; }
.cred-page .table-wrap { margin-top: 0; }
.cred-page .section-title { margin-top: 4px; }

/* Password-unavailable cell on the group Credentials page. */
.cred-pass-na { font-size: 12.5px; }
.cred-table td.cred-pass-na .cell-dim { font-style: italic; }
.cred-table td.cred-pass .mini { vertical-align: middle; margin-left: 6px; }

/* Small button used inside the credentials table (Generate New Password). */
.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.btn.sm svg { width: 14px; height: 14px; }
