/* ============================================================
   APHETA CLIENT VAULT — Design System
   Inherits all brand tokens from the main site aesthetic.
   Cormorant Garamond (editorial) + Inter (UI)
   Bronze accent: #8a6f48
   ============================================================ */

:root {
  --black:      #0a0a0a;
  --ink:        #1a1a1a;
  --grey-900:   #2a2a2a;
  --grey-700:   #555;
  --grey-500:   #8a8a8a;
  --grey-300:   #d6d6d6;
  --grey-100:   #f3f3f1;
  --paper:      #ffffff;
  --bone:       #fafaf7;
  --accent:     #8a6f48;
  --accent-soft:#b89971;
  --red:        #c0392b;
  --green:      #27ae60;

  --serif:  'Cormorant Garamond', Georgia, serif;
  --sans:   'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --sidebar-w:  260px;
  --topbar-h:   64px;
  --transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--sans); color: var(--ink); background: var(--bone); }
a    { color: inherit; text-decoration: none; }
button { font-family: var(--sans); cursor: pointer; }
input, textarea, select { font-family: var(--sans); }
img  { display: block; max-width: 100%; }

/* ── Page fade-in ───────────────────────────────────────────────────────────── */
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
body { animation: pageFadeIn 0.5s var(--ease-out) both; }

/* ── Spinner ────────────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; display: inline-block; }

/* ============================================================
   AUTH PAGES (login, invite-accept, forgot, reset)
   ============================================================ */

.auth-page {
  min-height: 100vh;
  background: var(--bone);
  display: flex;
  align-items: stretch;
}

.back-link {
  position: fixed;
  top: 28px;
  left: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--grey-500);
  transition: color var(--transition);
  z-index: 10;
}
.back-link:hover { color: var(--ink); }

.auth-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 48px;
  gap: 40px;
}

.auth-brand { text-align: center; }
.auth-logo  { height: 52px; display: inline-block; }

/* ── Auth card ──────────────────────────────────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--paper);
  border: 1px solid var(--grey-300);
  padding: clamp(36px, 6vw, 56px);
}

.auth-card-header {
  margin-bottom: 36px;
}

.auth-card-header h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.01em;
  color: var(--black);
  margin-bottom: 8px;
  line-height: 1.1;
}

.auth-card-header p {
  font-size: 14px;
  color: var(--grey-500);
  font-weight: 300;
  line-height: 1.6;
}

/* ── Form fields ────────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
}

.field label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--grey-500);
}

.field input,
.field textarea,
.field .select-field {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--grey-300);
  padding: 12px 0;
  font-size: 15px;
  font-weight: 300;
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
  border-radius: 0;
  -webkit-appearance: none;
}

.field input:focus,
.field textarea:focus,
.field .select-field:focus {
  border-bottom-color: var(--accent);
}

.field input.readonly {
  color: var(--grey-500);
  cursor: default;
}

.field textarea {
  resize: vertical;
  min-height: 80px;
  padding: 8px 0;
}

.field-inner {
  position: relative;
  display: flex;
  align-items: center;
}

/* Checkbox fields opt out of `.field input` (that rule strips native checkbox
   appearance and forces width:100% + border-bottom, meant for text inputs —
   applied to a checkbox it renders as an invisible full-width line). */
.field-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 28px;
}

.field-checkbox input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--accent);
}

.field-checkbox label {
  font-size: 14px;
  font-weight: 300;
  color: var(--ink);
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
}

.field-inner input { padding-right: 36px; }

.toggle-pass {
  position: absolute;
  right: 0;
  background: none;
  border: none;
  padding: 4px;
  color: var(--grey-500);
  transition: color var(--transition);
  display: flex;
}
.toggle-pass:hover { color: var(--ink); }

/* ── Password strength ──────────────────────────────────────────────────────── */
.pass-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.pass-strength-bar {
  flex: 1;
  height: 2px;
  background: var(--grey-300);
  position: relative;
  overflow: hidden;
}
.pass-strength-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.4s var(--ease-out), background 0.3s;
}
.pass-strength-fill.weak   { background: var(--red); }
.pass-strength-fill.fair   { background: #e67e22; }
.pass-strength-fill.good   { background: #f1c40f; }
.pass-strength-fill.strong { background: var(--green); }
.pass-strength-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--grey-500);
  white-space: nowrap;
  min-width: 48px;
}

/* ── Form footer ────────────────────────────────────────────────────────────── */
.form-footer {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 28px;
  margin-top: -16px;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 32px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border: 1px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}

.btn-primary {
  background: var(--black);
  border-color: var(--black);
  color: var(--paper);
}
.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  border-color: var(--grey-300);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.btn-full  { width: 100%; }
.btn-sm    { padding: 10px 20px; font-size: 10px; }

.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-spinner { display: none; }
.btn.loading .btn-label  { opacity: 0; }
.btn.loading .btn-spinner { display: flex; position: absolute; }

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 20px;
  border-left: 3px solid;
}
.alert-error   { background: #fdf2f2; border-color: var(--red);   color: var(--red); }
.alert-warn    { background: #fdf8ed; border-color: #e67e22;      color: #8a4a00; }
.alert-success { background: #f0faf4; border-color: var(--green); color: #1a5f35; }
.alert-note    { background: #f3f3f1; border-color: #8a6f48; }

/* ── Forced 2FA enrollment banner ───────────────────────────────────────────── */
.enroll-banner {
  background: #fdf8ed;
  border: 1px solid #e8c97a;
  border-left: 4px solid #c89540;
  padding: 18px 24px;
  margin-bottom: 32px;
  color: #5a3a05;
}
.enroll-banner strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #3d2700;
}
.enroll-banner p {
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}

/* ── Links ──────────────────────────────────────────────────────────────────── */
.link-muted {
  font-size: 12px;
  color: var(--grey-500);
  transition: color var(--transition);
}
.link-muted:hover { color: var(--accent); }

/* ── Auth note ──────────────────────────────────────────────────────────────── */
.auth-note {
  margin-top: 28px;
  font-size: 12px;
  color: var(--grey-500);
  text-align: center;
  line-height: 1.7;
}

/* ── Auth footer ────────────────────────────────────────────────────────────── */
.auth-footer {
  display: flex;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--grey-500);
  text-transform: uppercase;
}

/* ── Invite badge ───────────────────────────────────────────────────────────── */
.invite-badge {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 4px 12px;
  display: inline-block;
  margin-bottom: 20px;
}

/* ── Invite meta block ──────────────────────────────────────────────────────── */
.invite-meta {
  background: var(--bone);
  border-left: 3px solid var(--grey-300);
  padding: 12px 16px;
  margin-bottom: 28px;
  font-size: 13px;
  color: var(--grey-700);
  font-style: italic;
  display: none;
}
.invite-meta.visible { display: block; }

/* ── Success icon ───────────────────────────────────────────────────────────── */
.success-icon { margin-bottom: 20px; }

/* ============================================================
   APP LAYOUT (dashboard, admin, settings)
   ============================================================ */

.app-page {
  display: flex;
  min-height: 100vh;
  background: var(--bone);
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
/* Locked to the viewport: fixed positioning + explicit height so the user
   widget at the bottom stays visible regardless of how long the main content
   scrolls. The nav (links) scrolls internally if it exceeds available space. */
.app-sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--paper);
  border-right: 1px solid var(--grey-300);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  align-self: flex-start;
  z-index: 50;
  overflow: visible;
}

.sidebar-brand {
  padding: 28px 28px 20px;
  border-bottom: 1px solid var(--grey-300);
  flex-shrink: 0;
}
.sidebar-logo { height: 36px; }

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-700);
  transition: all var(--transition);
  border-left: 2px solid transparent;
}
.sidebar-link:hover {
  color: var(--ink);
  background: var(--bone);
  border-left-color: var(--grey-300);
}
.sidebar-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--bone);
}

.upload-badge {
  margin-left: auto;
  background: #e53e3e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  letter-spacing: normal;
  text-transform: none;
}
.upload-badge.u-hidden { display: none; }

/* Small dot on a folder row/card that has unseen files from an upload
   request link — same red as .upload-badge, no count needed at this scale. */
.folder-unseen-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e53e3e;
  margin-left: 6px;
  flex-shrink: 0;
  vertical-align: middle;
}
/* Grid view: .file-card already has position:relative — pin the dot to the
   card's corner instead of inline next to the icon. */
.file-card .folder-unseen-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  margin-left: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px;
  border-top: 1px solid var(--grey-300);
  flex-shrink: 0;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  background: var(--accent);
  color: var(--paper);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.sidebar-user-info {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey-500);
}

.sidebar-logout {
  background: none;
  border: none;
  color: var(--grey-500);
  padding: 4px;
  flex-shrink: 0;
  transition: color var(--transition);
  display: flex;
}
.sidebar-logout:hover { color: var(--red); }

/* ── Main content area ──────────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top bar ────────────────────────────────────────────────────────────────── */
.app-topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--grey-300);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.sidebar-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
}
.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--ink);
}

.topbar-breadcrumb { flex: 1; display: flex; align-items: center; gap: 12px; }
.topbar-eyebrow {
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--grey-500);
}
.topbar-path {
  font-size: 13px;
  color: var(--grey-700);
}

.topbar-actions { display: flex; gap: 12px; align-items: center; }

/* ── Storage bar ────────────────────────────────────────────────────────────── */
.storage-bar-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--grey-100);
  background: var(--paper);
}

.storage-bar {
  flex: 1;
  max-width: 300px;
  height: 2px;
  background: var(--grey-100);
  overflow: hidden;
  border-radius: 0;
}

.storage-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.8s var(--ease-out);
}

.storage-label {
  font-size: 11px;
  color: var(--grey-500);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ── Vault coming soon ──────────────────────────────────────────────────────── */
.vault-coming-soon {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 32px;
  gap: 20px;
  color: var(--grey-500);
}

.vault-coming-icon { color: var(--grey-300); margin-bottom: 8px; }

.vault-coming-soon h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(28px, 3vw, 40px);
  color: var(--ink);
}

.vault-coming-soon p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--grey-500);
  max-width: 420px;
}

.vault-quota-preview {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-top: 8px;
}

/* ── Drop overlay ───────────────────────────────────────────────────────────── */
.drop-overlay[hidden] { display: none !important; }
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: pageFadeIn 0.2s var(--ease-out) both;
}
.drop-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 300;
}

/* ── Admin ──────────────────────────────────────────────────────────────────── */
/* .admin-tabs-wrap holds the scrollable .admin-tabs plus a right-edge fade
   affordance (toggled by admin.js) so on narrow viewports it's obvious this
   is a horizontally-scrollable tab strip, not a cut-off layout. Without this,
   tabs that don't fit just overflowed the whole page with zero visual hint —
   see admin.js updateTabsScrollHint(). */
.admin-tabs-wrap {
  position: relative;
  border-bottom: 1px solid var(--grey-300);
  background: var(--paper);
}
.admin-tabs-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 1px;
  width: 36px;
  background: linear-gradient(to right, rgba(255,255,255,0), var(--paper) 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}
.admin-tabs-wrap.has-overflow-right::after { opacity: 1; }

.admin-tabs {
  display: flex;
  gap: 0;
  padding: 0 32px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }

.admin-tab {
  background: none;
  border: none;
  padding: 16px 24px 14px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--grey-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  flex-shrink: 0;
  white-space: nowrap;
}
.admin-tab:hover  { color: var(--ink); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.admin-tab-content { padding: 32px; }

/* ── Data table ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey-500);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--grey-300);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--grey-100);
  color: var(--ink);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bone); }

.table-empty {
  text-align: center;
  color: var(--grey-500);
  padding: 48px 16px !important;
  font-style: italic;
}

.status-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 0;
}
.status-badge.pending  { background: var(--grey-100); color: var(--grey-700); }
.status-badge.used     { background: #f0faf4; color: #1a5f35; }
.status-badge.expired  { background: #fdf2f2; color: var(--red); }
.status-badge.active   { background: #f0faf4; color: #1a5f35; }
.status-badge.inactive { background: var(--grey-100); color: var(--grey-700); }

.btn-revoke {
  background: none;
  border: 1px solid var(--grey-300);
  color: var(--grey-500);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-revoke:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-backdrop[hidden] { display: none !important; }
.modal-sm { max-width: 460px; }
.modal-delete-warn { color: #c0392b; font-size: 13px; margin-bottom: 16px; }
.modal-delete-label { font-size: 12px; font-weight: 500; }
.btn-danger-fill { background: #c0392b; color: #fff; border-color: #c0392b; }
.btn-danger-fill:hover { background: #a93226; border-color: #a93226; }
.btn-delete-acct { margin-top: 8px; border-color: #c0392b; }
#deleteAccountModal, #pinModal { z-index: 300; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: pageFadeIn 0.2s var(--ease-out) both;
}

.modal {
  background: var(--paper);
  border: 1px solid var(--grey-300);
  border-radius: 14px;
  padding: 0;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,0.14);
  animation: pageFadeIn 0.3s var(--ease-out) both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--grey-300, #eee);
  margin-bottom: 0;
}

.modal-header h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 24px;
  color: var(--black);
}

.modal-close {
  background: none;
  border: none;
  color: var(--grey-500);
  padding: 6px;
  cursor: pointer;
  border-radius: 6px;
  transition: color var(--transition), background 0.15s;
}
.modal-close:hover { color: var(--ink); background: var(--bg-2, #f5f5f5); }
.modal-close:hover { color: var(--ink); }

/* ── Settings ───────────────────────────────────────────────────────────────── */
.settings-sections {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-section {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  padding: 40px 32px;
  border-bottom: 1px solid var(--grey-300);
}

.settings-section-label h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  color: var(--black);
  margin-bottom: 8px;
}

.settings-section-label p {
  font-size: 13px;
  color: var(--grey-500);
  line-height: 1.6;
}

.settings-section-form { max-width: 400px; }

/* ── Sessions list ──────────────────────────────────────────────────────────── */
.sessions-list { display: flex; flex-direction: column; gap: 12px; }

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bone);
  border: 1px solid var(--grey-300);
  font-size: 13px;
}

.session-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-item-device {
  font-weight: 400;
  color: var(--ink);
}

.session-item-meta {
  font-size: 11px;
  color: var(--grey-500);
}

.session-item-current {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  /* Sidebar: back to fixed on mobile so it doesn't occupy flex space */
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16,1,0.3,1);
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.15);
  }
  /* Main takes full width — no margin since sidebar is out of flow */
  .app-main {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }
  /* Backdrop shown when sidebar is open */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 99;
  }
  .sidebar-backdrop.visible { display: block; }
  /* Hamburger button — injected by JS, top-right corner */
  .sidebar-open-btn {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 110;
    background: var(--ink);
    border: none;
    color: var(--paper);
    padding: 10px 12px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
  }
  /* Remove extra padding compensation — button is top-right, not top-left */
  .app-main > *:first-child { padding-left: 0; }
  .email-search-header      { padding-left: 28px; }
  /* Push page content down/right to not overlap hamburger */
  .app-main > *:first-child { padding-left: 48px; }
  .email-search-header      { padding-left: 56px; }
  .settings-section {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .admin-tab-content { padding: 20px 16px; }
}

@media (max-width: 600px) {
  .auth-layout { padding: 64px 16px 40px; }
  .auth-card   { padding: 32px 24px; }
  .app-topbar  { padding: 0 16px; }
  .storage-bar-wrap { padding: 10px 16px; }
  .admin-stats-grid { grid-template-columns: 1fr 1fr; }
  .file-row  { grid-template-columns: 24px 1fr 90px auto; }
  .file-list-header { display: none; }
  /* The eyebrow ("VAULT", "ADMINISTRATION"...) is redundant with the
     breadcrumb/tabs below it and was squeezing the search box down to ~2
     visible characters of placeholder text next to the hamburger + Upload
     button. Drop it here so search gets its room back. */
  .topbar-eyebrow { display: none; }
  .topbar-search  { margin: 0 12px; }
}

/* ============================================================
   VAULT — File Browser (Phase 2)
   ============================================================ */

/* Same fix as .email-search-page: .app-main normally only has min-height:100vh,
   so on a long file list the whole document grows taller than the viewport and
   scrolls as one page — the storage bar, the New Folder/Trash toolbar and the
   Name/Size/Modified header (even though it's already position:sticky) all
   scroll away with it, because their sticky/static context stops being the
   viewport-bounded .vault-content pane. Pinning .app-main to a real 100vh with
   overflow:hidden makes .vault-content (flex:1; overflow-y:auto) the only
   scrolling region again, so everything above it stays fixed in place.
   Scoped to .vault-page only — other pages (Admin, Settings, Help, Forms) are
   unaffected and keep normal whole-page scrolling. */
.vault-page .app-main {
  height: 100vh;
  overflow: hidden;
}

/* ── Vault layout ────────────────────────────────────────────────────────────── */
.vault-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vault-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 32px;
  height: 52px;
  border-bottom: 1px solid var(--grey-100);
  background: var(--paper);
  flex-shrink: 0;
}

/* Back button — sits just left of the breadcrumb. Pairs with folders now
   navigating on a single click: with no spare click gesture left over to
   mean "go up", this needs to be an explicit, always-visible control. */
.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--grey-300);
  color: var(--grey-700);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-back:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-back:disabled { color: var(--grey-300); border-color: var(--grey-100); cursor: default; }

.vault-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--grey-500);
  overflow: hidden;
}

.vault-crumb {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition);
  font-size: 13px;
}
.vault-crumb:hover { color: var(--accent); }
.vault-crumb.active { color: var(--ink); font-weight: 400; cursor: default; }
.vault-crumb.active:hover { color: var(--ink); }

.vault-crumb-sep { color: var(--grey-300); font-size: 11px; margin: 0 2px; }

.vault-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* View toggle */
.view-toggle {
  display: flex;
  border: 1px solid var(--grey-300);
}
.view-toggle-btn {
  background: none;
  border: none;
  padding: 6px 10px;
  color: var(--grey-500);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
}
.view-toggle-btn.active { background: var(--ink); color: var(--paper); }
.view-toggle-btn:not(.active):hover { color: var(--ink); }

/* Sort button */
.sort-select {
  background: none;
  border: none;
  border-bottom: 1px solid var(--grey-300);
  padding: 6px 4px;
  font-size: 11px;
  color: var(--grey-500);
  cursor: pointer;
  outline: none;
  letter-spacing: 0.05em;
}

/* New folder button */
.btn-new-folder {
  background: none;
  border: 1px solid var(--grey-300);
  color: var(--grey-700);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}
.btn-new-folder:hover { border-color: var(--accent); color: var(--accent); }

/* ── File list view ──────────────────────────────────────────────────────────── */
.vault-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* List view */
.file-list {
  width: 100%;
}

.file-list-header {
  display: grid;
  grid-template-columns: 32px 24px 1fr 70px 95px 175px;
  column-gap: 8px;
  gap: 0;
  padding: 0 32px;
  border-bottom: 1px solid var(--grey-300);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}
.file-list-header-cell {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--grey-500);
  padding: 10px 8px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.file-list-header-cell:hover { color: var(--ink); }
.file-list-header-cell.sort-active { color: var(--accent); }
.file-list-header-cell.col-size,
.file-list-header-cell.col-date { justify-content: flex-end; padding-right: 8px; }

.file-row {
  display: grid;
  grid-template-columns: 32px 24px 1fr 70px 95px 175px;
  column-gap: 8px;
  padding: 0 32px;
  border-bottom: 1px solid var(--grey-100);
  cursor: pointer;
  transition: background var(--transition);
  align-items: center;
  min-height: 48px;
}
.file-row:hover { background: var(--bone); }
.file-row.selected { background: rgba(138,111,72,0.06); }

.file-row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-400);
  flex-shrink: 0;
}
.file-row-icon .folder-icon { color: var(--accent); }

.file-row-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 0 8px;
}
.file-row-name-text {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-row-name-sub {
  font-size: 10px;
  color: var(--grey-500);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.file-row-size {
  font-size: 12px;
  color: var(--grey-500);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-variant-numeric: tabular-nums;
}

.file-row-date {
  font-size: 12px;
  color: var(--grey-500);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  white-space: nowrap;
}

.file-list-header-cell:last-child { padding-right: 16px; }

.file-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  padding: 0 8px 0 8px;
  opacity: 0;
  transition: opacity var(--transition);
}
.file-row:hover .file-row-actions { opacity: 1; }

.row-action-btn {
  background: none;
  border: none;
  padding: 6px;
  color: var(--grey-500);
  cursor: pointer;
  transition: color var(--transition);
  display: flex;
  align-items: center;
  border-radius: 0;
}
.row-action-btn:hover { color: var(--ink); }
.row-action-btn.danger:hover { color: var(--red); }

/* ── Grid view ───────────────────────────────────────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  padding: 24px 32px;
}

.file-card {
  background: var(--paper);
  border: 1px solid var(--grey-300);
  padding: 20px 16px 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.file-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(138,111,72,0.08);
}
.file-card.selected { border-color: var(--accent); background: rgba(138,111,72,0.04); }

.file-card-icon { color: var(--grey-400); }
.file-card-icon .folder-icon { color: var(--accent); }

.file-card-name {
  font-size: 12px;
  color: var(--ink);
  word-break: break-word;
  line-height: 1.4;
  max-width: 100%;
}

.file-card-meta {
  font-size: 10px;
  color: var(--grey-500);
  letter-spacing: 0.05em;
}

.file-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity var(--transition);
}
.file-card:hover .file-card-actions { opacity: 1; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.vault-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 32px;
  gap: 20px;
  color: var(--grey-500);
  text-align: center;
}
.vault-empty-icon { color: var(--grey-300); margin-bottom: 8px; }
.vault-empty h3 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 28px;
  color: var(--ink);
}
.vault-empty p {
  font-size: 14px;
  line-height: 1.7;
  max-width: 360px;
}

/* ── Upload progress panel ───────────────────────────────────────────────────── */
.upload-tray {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  background: var(--paper);
  border: 1px solid var(--grey-300);
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  z-index: 150;
  overflow: hidden;
  animation: pageFadeIn 0.25s var(--ease-out) both;
}
.upload-tray[hidden] { display: none; }

.upload-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-100);
  background: var(--bone);
}
.upload-tray-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink);
}
.upload-tray-close {
  background: none;
  border: none;
  color: var(--grey-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
}
.upload-tray-close:hover { color: var(--ink); }

.upload-tray-list { max-height: 280px; overflow-y: auto; }

.upload-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--grey-100);
}
.upload-item:last-child { border-bottom: none; }

.upload-item-info { flex: 1; min-width: 0; }
.upload-item-name {
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-item-size { font-size: 10px; color: var(--grey-500); margin-top: 2px; }

.upload-item-bar {
  height: 2px;
  background: var(--grey-100);
  margin-top: 6px;
  overflow: hidden;
}
.upload-item-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
  width: 0%;
}
.upload-item-fill.done  { background: var(--green); width: 100%; }
.upload-item-fill.error { background: var(--red);   width: 100%; }

.upload-item-status {
  flex-shrink: 0;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-300);
}
.upload-item-status.done  { color: var(--green); }
.upload-item-status.error { color: var(--red);   }

/* ── Context menu ────────────────────────────────────────────────────────────── */
.ctx-menu {
  position: fixed;
  background: var(--paper);
  border: 1px solid var(--grey-300);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 300;
  min-width: 180px;
  animation: pageFadeIn 0.15s var(--ease-out) both;
  padding: 4px 0;
}
.ctx-menu[hidden] { display: none; }

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--transition);
}
.ctx-item:hover { background: var(--bone); }
.ctx-item.danger { color: var(--red); }
.ctx-item.danger:hover { background: #fdf2f2; }
.ctx-sep { height: 1px; background: var(--grey-100); margin: 4px 0; }

/* ── Rename inline input ─────────────────────────────────────────────────────── */
.rename-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  outline: none;
  font-size: 13px;
  color: var(--ink);
  width: 100%;
  padding: 2px 0;
}

/* ── Trash view ──────────────────────────────────────────────────────────────── */
.trash-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 32px;
  background: rgba(192,57,43,0.06);
  border-bottom: 1px solid rgba(192,57,43,0.15);
  font-size: 12px;
  color: var(--red);
}

/* ── New folder modal (inline) ───────────────────────────────────────────────── */
.inline-create-row {
  display: grid;
  grid-template-columns: 40px 1fr 120px 160px 80px;
  gap: 0;
  padding: 0 32px;
  border-bottom: 1px solid var(--grey-100);
  align-items: center;
  background: rgba(138,111,72,0.04);
  min-height: 48px;
}

/* ── Loading skeleton ────────────────────────────────────────────────────────── */
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--grey-100) 25%, var(--grey-300) 50%, var(--grey-100) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0;
}
.skeleton-row {
  height: 48px;
  margin-bottom: 1px;
  width: 100%;
}

/* ── Responsive vault ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .file-list-header { grid-template-columns: 36px 1fr 80px 56px; }
  .file-list-header .col-date { display: none; }
  .file-row         { grid-template-columns: 36px 1fr 80px 56px; }
  .file-row .file-row-date { display: none; }
  .vault-toolbar    { padding: 0 16px; }
  .file-grid        { padding: 16px; gap: 12px; }
  .upload-tray      { width: calc(100vw - 32px); right: 16px; bottom: 16px; }
}
@media (max-width: 600px) {
  .file-list-header { grid-template-columns: 36px 1fr 56px; }
  .file-list-header .col-size { display: none; }
  .file-row         { grid-template-columns: 36px 1fr 56px; padding: 0 16px; }
  .file-row .file-row-size { display: none; }
  .vault-breadcrumb { font-size: 12px; }
  .storage-bar-wrap { padding: 8px 16px; }
}

/* ============================================================
   Utility classes — for CSP without unsafe-inline (style-src)
   ============================================================ */

/* Visibility (paired with the [hidden] attribute for semantic JS hiding) */
.u-hidden          { display: none !important; }

/* Flex layout */
.u-flex-row        { display: flex; gap: 12px; }
.u-flex-row-wrap   { display: flex; gap: 12px; flex-wrap: wrap; }
.u-flex-row-start  { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.u-flex-grow      { flex: 1; min-width: 240px; }

/* Margin */
.u-mt-8            { margin-top: 8px; }
.u-mt-16           { margin-top: 16px; }
.u-mb-12           { margin: 0 0 12px; }
.u-mb-16           { margin: 0 0 16px; }
.u-mb-20           { margin: 0 0 20px; }
.u-mb-24           { margin-bottom: 24px; }

/* Typography */
.u-text-xs         { font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; color: #8a8a8a; margin: 0 0 6px; }
.u-text-sm-mute    { font-size: 13px; color: #8a8a8a; }
.u-text-sm-mute-mb { font-size: 13px; color: #8a8a8a; margin: 0 0 16px; }
.u-text-sm-body    { font-size: 13px; color: #555; line-height: 1.6; }
.u-text-sm-body-mb { font-size: 13px; color: #555; margin: 0 0 12px; line-height: 1.6; }
.u-text-sm-body-mb16 { font-size: 13px; color: #555; margin: 0 0 16px; line-height: 1.6; }
.u-text-sm-ink     { font-size: 13px; color: #1a1a1a; margin: 0 0 12px; }
.u-text-sm-ink-lh  { font-size: 13px; color: #1a1a1a; margin: 0 0 12px; line-height: 1.6; }
.u-text-sm-warn    { font-size: 13px; color: #8a6f48; margin: 0 0 16px; line-height: 1.6; }
.u-step-heading    { font-size: 18px; font-weight: 400; margin: 0 0 8px; letter-spacing: -0.01em; }

/* Colors inline */
.u-color-ink       { color: #1a1a1a; }
.u-color-ok        { color: #1a7a1a; }
.u-color-accent    { color: var(--accent); }
.u-color-muted     { color: var(--grey-500); }
.u-color-muted-13  { margin-top: 16px; color: var(--grey-500); font-size: 13px; }

/* TOTP setup wizard */
.mfa-qr-img        { width: 200px; height: 200px; border: 1px solid #d6d6d6; background: #fff; padding: 8px; }
.mfa-secret-text   { display: block; background: #f3f3f1; padding: 10px 12px; font-size: 12px; word-break: break-all; border: 1px solid #d6d6d6; font-family: 'SF Mono', Menlo, monospace; }

/* Recovery codes grid */
.mfa-recovery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f3f3f1;
  padding: 16px;
  border: 1px solid #d6d6d6;
  margin-bottom: 16px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 13px;
}

/* Inline confirm-action panel */
.mfa-confirm-action-wrap {
  margin-top: 16px;
  padding: 16px;
  background: #f3f3f1;
  border: 1px solid #d6d6d6;
}

/* Invite-accept success */
.invite-success-card {
  text-align: center;
  padding: 64px 48px;
}

/* Password strength bar — initial width 0 */
.pass-strength-fill { width: 0%; }


/* ============================================================
   Toggle switches (Notifications preferences)
   ============================================================ */
.toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--grey-200, #e5e5e5);
  cursor: pointer;
}
.toggle-row:last-child { border-bottom: none; }

.toggle-row-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.toggle-row-label strong {
  font-weight: 500;
  font-size: 14px;
  color: var(--ink, #1a1a1a);
}
.toggle-row-hint {
  font-size: 12px;
  color: var(--grey-500, #8a8a8a);
  line-height: 1.5;
}

.toggle-input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-switch {
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  background: var(--grey-300, #d6d6d6);
  border-radius: 12px;
  position: relative;
  transition: background 160ms ease;
  margin-top: 2px;
}
.toggle-switch::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 160ms ease;
}
.toggle-input:checked + .toggle-switch {
  background: var(--ink, #1a1a1a);
}
.toggle-input:checked + .toggle-switch::before {
  transform: translateX(18px);
}
.toggle-input:focus-visible + .toggle-switch {
  outline: 2px solid var(--accent, #8a6f48);
  outline-offset: 2px;
}

/* ============================================================
   Admin Dashboard — Overview, Members, drawer
   ============================================================ */

/* Metrics grid */
.admin-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.metric-card {
  background: var(--paper);
  border: 1px solid var(--grey-300);
  padding: 20px 24px;
}
.metric-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey-500);
  font-weight: 500;
  margin-bottom: 8px;
}
.metric-value {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 32px;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 6px;
}
.metric-hint {
  font-size: 12px;
  color: var(--grey-500);
}

.admin-section {
  background: var(--paper);
  border: 1px solid var(--grey-300);
  padding: 24px;
}
.admin-section-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 20px;
  color: var(--ink);
  margin: 0 0 16px;
}

/* Activity list */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.activity-row {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--grey-100);
}
.activity-row:last-child { border-bottom: none; }
.activity-row-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grey-300);
  margin-top: 8px;
  flex-shrink: 0;
}
.activity-row-icon.warn     { background: #e67e22; }
.activity-row-icon.critical { background: var(--red); }
.activity-row-icon.info     { background: var(--grey-500); }
.activity-row-body { flex: 1; min-width: 0; }
.activity-row-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 14px;
}
.activity-row-line strong { font-weight: 500; color: var(--ink); }
.activity-row-meta {
  font-size: 12px;
  color: var(--grey-500);
  margin-top: 2px;
}

/* Members toolbar */
.members-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.members-search {
  flex: 1;
  min-width: 240px;
  background: var(--paper);
  border: 1px solid var(--grey-300);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color var(--transition);
}
.members-search:focus { border-color: var(--accent); }
.members-filter {
  background: var(--paper);
  border: 1px solid var(--grey-300);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--ink);
  min-width: 130px;
}

.members-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}
.members-page-info {
  font-size: 12px;
  color: var(--grey-500);
}

/* Member drawer (right-side sliding panel) */
.member-drawer[hidden] { display: none !important; }
.member-drawer {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: block;
}
.member-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,0.4);
  backdrop-filter: blur(2px);
  animation: pageFadeIn 0.2s var(--ease-out) both;
}
.member-drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: clamp(360px, 50vw, 560px);
  min-width: 320px;
  max-width: 92vw;
  background: var(--paper);
  border-left: 1px solid var(--grey-300);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s var(--ease-out) both;
}
.drawer-resize-handle {
  position: absolute;
  top: 0; left: -4px; bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 10;
}
.drawer-resize-handle::after {
  content: '';
  position: absolute;
  top: 0; left: 3px; bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.15s;
}
.drawer-resize-handle:hover::after,
.drawer-resize-handle.dragging::after {
  background: var(--blue, #2563eb);
}
@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.member-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--grey-300);
}
.member-drawer-header h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 24px;
  color: var(--ink);
  margin: 0 0 4px;
}
.member-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 32px;
}

.drawer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  margin-bottom: 28px;
}
.drawer-stat-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey-500);
  font-weight: 500;
  margin-bottom: 6px;
}
.drawer-stat-value {
  font-size: 14px;
  color: var(--ink);
}
.drawer-section-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey-700);
  margin: 0 0 12px;
  padding-top: 12px;
  border-top: 1px solid var(--grey-100);
}
.drawer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}
.drawer-actions .btn { justify-content: flex-start; padding: 12px 16px; }
.drawer-action-row {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--grey-100);
}
.drawer-action-row-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
.drawer-action-row-controls .select-field { flex: 1; }

/* Session list */
.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--grey-100);
  gap: 16px;
}
.session-row:last-child { border-bottom: none; }
.session-row-info { flex: 1; min-width: 0; }
.session-row-device {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.session-row-meta {
  font-size: 12px;
  margin-top: 4px;
}

/* Audit action input narrow */
.audit-action-input { max-width: 200px; }

/* ── Share link modal ───────────────────────────────────────────────────────── */
.modal-wide        { max-width: 560px; width: 100%; }
.field-row         { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }
.copy-row          { display: flex; gap: 8px; align-items: stretch; }
.copy-row .field-input { flex: 1; }
.u-text-xs-mute    { font-size: 11px; color: var(--ink-3); margin: 6px 0 0; line-height: 1.45; }
.share-existing    { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; }
.share-row {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.share-row:last-child { border-bottom: none; }
.share-row-main    { flex: 1; min-width: 0; }
.share-row-url     {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: var(--ink); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.share-row-meta    { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.share-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-danger        { background: #c0392b; color: #fff; border-color: #c0392b; }
.btn-danger:hover  { background: #a93226; border-color: #a93226; }

/* ── Admin Overview: GlitchTip errors widget ───────────────────────────────── */
.admin-section-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.admin-section-link {
  font-size: 12px; color: var(--accent); text-decoration: none;
  white-space: nowrap;
}
.admin-section-link:hover { text-decoration: underline; }

.errors-summary {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; overflow: hidden;
}
.errors-head {
  padding: 10px 14px; background: #faf8f3; border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2);
}
.errors-empty {
  padding: 18px 14px; display: flex; gap: 10px; align-items: center;
  font-size: 13px; color: var(--ink-2);
}
.errors-empty-icon {
  width: 22px; height: 22px; border-radius: 50%;
  background: #e8f5ec; color: #1a5f35;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
}

.errors-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
  transition: background 0.15s;
}
.errors-row:last-child { border-bottom: none; }
.errors-row:hover { background: #faf8f3; }
.errors-row-main { flex: 1; min-width: 0; }
.errors-row-title {
  display: flex; gap: 8px; align-items: center;
  font-size: 13px; font-weight: 500;
}
.errors-row-title-text {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.errors-row-level {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px; letter-spacing: 0.05em;
  flex-shrink: 0;
  background: var(--black); color: var(--paper);
}
/* Subtle level differentiation — only fatal stands out via accent border */
.errors-row-level-fatal   { box-shadow: inset 0 0 0 1px var(--red); }
.errors-row-level-warning { background: var(--grey-700); }
.errors-row-level-info    { background: var(--grey-500); }
.errors-row-meta {
  font-size: 11px; color: var(--ink-3); margin-top: 4px;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.errors-row-arrow { font-size: 14px; color: var(--ink-3); flex-shrink: 0; }

/* ── Vault search ─────────────────────────────────────────────────────────── */
.topbar-search {
  flex: 1 1 auto;
  max-width: 380px;
  margin: 0 24px;
  position: relative;
  display: flex;
  align-items: center;
}
.vault-search-input {
  width: 100%;
  padding: 8px 32px 8px 12px;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #1a1a1a;
  background: #fafaf7;
  border: 1px solid #d6d6d6;
  border-radius: 2px;
  outline: none;
  transition: border-color 120ms;
}
.vault-search-input:focus { border-color: #8a6f48; background: #fff; }
.vault-search-input::placeholder { color: #8a8a8a; font-style: italic; }
.vault-search-clear {
  position: absolute;
  right: 6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: #8a8a8a;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}
.vault-search-clear:hover { background: #ebebe6; color: #1a1a1a; }

/* ── Activity drawer ──────────────────────────────────────────────────────── */
.modal-wide { max-width: 720px; width: 90vw; }
.activity-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 4px 0 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #ebebe6;
}
.activity-stat {
  background: #fafaf7;
  border: 1px solid #ebebe6;
  padding: 14px 16px;
  text-align: center;
}
.activity-stat-value {
  font-size: 22px;
  font-weight: 300;
  letter-spacing: -0.01em;
  color: #0a0a0a;
  margin-bottom: 4px;
}
.activity-stat-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #8a8a8a;
}
.activity-list {
  max-height: 50vh;
  overflow-y: auto;
}
.activity-event {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f3f3f1;
}
.activity-event:last-child { border-bottom: 0; }
.activity-event-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a6f48;
  margin-top: 7px;
  flex-shrink: 0;
}
.activity-event-icon[data-severity='warn']     { background: #d6a55b; }
.activity-event-icon[data-severity='critical'] { background: #c0392b; }
.activity-event-body { flex: 1 1 auto; min-width: 0; }
.activity-event-title {
  font-size: 14px;
  color: #1a1a1a;
  margin-bottom: 2px;
}
.activity-event-meta {
  font-size: 11px;
  color: #8a8a8a;
  letter-spacing: 0.02em;
}
@media (max-width: 640px) {
  .activity-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Multi-select + bulk download ─────────────────────────────────────────── */
.selection-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 32px;
  background: #f3f3f1;
  border-top: 1px solid #d6d6d6;
  border-bottom: 1px solid #d6d6d6;
}
.selection-count {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #1a1a1a;
  flex: 0 0 auto;
}
.file-row-select {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  flex: 0 0 32px;
}
.row-select {
  cursor: pointer;
  margin: 0;
}
.file-row { display: grid; grid-template-columns: 32px 24px 1fr 70px 95px 175px; }
.file-list-header { display: grid; grid-template-columns: 32px 24px 1fr 70px 95px 175px; }

/* ── File preview modal ───────────────────────────────────────────────────── */
.modal-fullscreen {
  align-items: stretch;
  justify-content: stretch;
  padding: 24px;
}
.preview-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #fff;
  border: 1px solid #d6d6d6;
}
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #ebebe6;
  flex: 0 0 auto;
}
.preview-title {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #1a1a1a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
  margin-right: 16px;
}
.preview-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.preview-body {
  flex: 1 1 auto;
  overflow: auto;
  background: #f3f3f1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.preview-iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-img    { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-media  { max-width: 100%; max-height: 100%; }
.preview-text   {
  background: #fff;
  border: 1px solid #ebebe6;
  padding: 16px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  width: 100%;
  max-width: 900px;
  max-height: 100%;
  overflow: auto;
  white-space: pre-wrap;
  margin: 0;
}

/* ── Admin drawer — Files section ── */
.drawer-files-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.drawer-upload-btn   { cursor: pointer; }
.drawer-files-list   { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.drawer-file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 6px;
  background: #f7f7f5; font-size: 13px;
}
.drawer-file-row:hover { background: #f0f0ec; }
.drawer-file-info     { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.drawer-file-name     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ink, #1a1a1a); }
.drawer-file-meta     { color: #888; font-size: 11px; }
.drawer-file-actions  { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.btn-xs               { padding: 3px 8px !important; font-size: 11px !important; }
.u-danger             { color: #c0392b !important; }

/* ── File preview button + clickable name ── */
.file-name-previewable {
  cursor: pointer;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-color: #aaa;
  text-underline-offset: 3px;
}
.file-name-previewable:hover {
  text-decoration-color: #333;
  color: #111;
}

/* ── Email Search page layout ───────────────────────────────────────────────── */
/* Override app-main to fixed height so the split pane fills the viewport */
.email-search-page .app-main {
  height: 100vh;
  overflow: hidden;
}

.email-search-header {
  flex: 0 0 auto;
  padding: 20px 28px 14px;
  border-bottom: 1px solid var(--grey-300);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.email-search-bar-wrap {
  display: flex;
  gap: 8px;
}

.email-search-input {
  flex: 1;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--grey-300);
  background: var(--bone);
  font-size: 13px;
  font-family: var(--sans);
  color: var(--ink);
  outline: none;
  transition: border-color var(--transition);
}
.email-search-input:focus { border-color: var(--accent); background: var(--paper); }

.email-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.select-sm, .input-sm {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--grey-300);
  background: var(--bone);
  font-size: 12px;
  font-family: var(--sans);
  color: var(--ink);
  outline: none;
}
.select-sm:focus, .input-sm:focus { border-color: var(--accent); }
.select-sm { padding-right: 28px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a8a8a'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }

.email-filter-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--grey-700);
  cursor: pointer;
  white-space: nowrap;
}

/* ── Split pane ─────────────────────────────────────────────────────────────── */
.email-split {
  flex: 1 1 auto;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.email-list-pane {
  width: 340px;
  flex: none;
  min-width: 220px;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
}
.email-split-handle {
  width: 5px;
  flex: none;
  cursor: col-resize;
  background: var(--grey-300);
  transition: background 0.15s;
  position: relative;
  z-index: 1;
}
.email-split-handle:hover,
.email-split-handle.dragging {
  background: var(--blue, #1a3570);
}

.email-list-meta {
  padding: 10px 16px;
  font-size: 11px;
  color: var(--grey-500);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--grey-100);
  flex: 0 0 auto;
}

#emailList {
  flex: 1 1 auto;
  overflow-y: auto;
}

.email-pagination {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--grey-300);
  font-size: 12px;
  color: var(--grey-700);
}

/* ── Email result rows ──────────────────────────────────────────────────────── */
.es-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-100);
  cursor: pointer;
  transition: background var(--transition);
  outline: none;
}
.es-row-check { margin-top: 3px; flex-shrink: 0; cursor: pointer; }
.es-row-body { flex: 1; min-width: 0; }
.es-row:hover       { background: var(--bone); }
.es-row-selected    { background: #f5f0eb !important; border-left: 3px solid var(--accent); padding-left: 13px; }

.es-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}
.es-from {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}
.es-date {
  font-size: 11px;
  color: var(--grey-500);
  white-space: nowrap;
  flex-shrink: 0;
}
.es-subject {
  font-size: 12px;
  color: var(--grey-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}
.es-row-bottom { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.es-account-tag {
  font-size: 10px;
  color: var(--grey-500);
  letter-spacing: 0.04em;
}
.es-folder-badge {
  font-size: 9px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 20px; flex-shrink: 0;
}
.es-folder-inbox { background: #e8f0fe; color: #1a3570; }
.es-folder-sent  { background: #e8f5e9; color: #2e7d32; }
.es-att-icon { color: var(--grey-500); flex-shrink: 0; }

/* Search-term highlighting — like marking a printed page with a yellow highlighter */
mark.es-mark {
  background: #fdea6b;
  color: var(--ink);
  padding: 0 1px;
  border-radius: 2px;
}

/* ── Email viewer pane ──────────────────────────────────────────────────────── */
.email-viewer-pane {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bone);
}

.email-viewer-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--grey-500);
  font-size: 13px;
  letter-spacing: 0.04em;
}

#emailViewer {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.email-viewer-header {
  flex: 0 0 auto;
  padding: 20px 28px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--grey-300);
}

.email-viewer-subject {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.3;
}

.email-viewer-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.vm-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--grey-700);
}
.vm-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-500);
  width: 50px;
  flex-shrink: 0;
}

.email-viewer-attachments {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bone);
  border: 1px solid var(--grey-300);
  font-size: 12px;
  color: var(--grey-700);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.es-att-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.es-att-link:hover { color: var(--ink); }
.es-att-size { color: var(--grey-500); font-size: 11px; }

.email-viewer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 28px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--grey-900);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--sans);
}

/* ── Import status banner ───────────────────────────────────────────────────── */
.email-import-status[hidden] { display: none; }
.email-import-status {
  position: fixed;
  bottom: 20px;
  right: 24px;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}


/* ── Email attachment chips ─────────────────────────────────────────────────── */
.email-viewer-attachments {
  flex-wrap: wrap;
  gap: 8px;
}
.es-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bone);
  border: 1px solid var(--grey-300);
  padding: 4px 8px;
  font-size: 12px;
  color: var(--grey-700);
  border-radius: 2px;
}
.es-att-chip svg { flex-shrink: 0; color: var(--grey-500); }
.es-att-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.es-att-size { color: var(--grey-500); font-size: 11px; white-space: nowrap; }
.es-att-btn {
  background: none;
  border: none;
  padding: 1px 6px;
  font-size: 11px;
  font-family: var(--sans);
  cursor: pointer;
  border-radius: 2px;
  transition: background var(--transition), color var(--transition);
}
.es-att-preview-btn { color: var(--accent); border: 1px solid var(--accent); }
.es-att-preview-btn:hover { background: var(--accent); color: var(--paper); }
.es-att-dl-btn { color: var(--grey-600); border: 1px solid var(--grey-300); font-size: 13px; }
.es-att-dl-btn:hover { background: var(--grey-100); color: var(--ink); }

/* ── Email attachment preview modal ─────────────────────────────────────────── */
.es-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.es-preview-overlay.u-hidden { display: none; }
.es-preview-box {
  background: var(--paper);
  display: flex;
  flex-direction: column;
  width: min(96vw, 1280px);
  height: 92vh;
  border: 1px solid var(--grey-300);
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}
.es-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--grey-300);
  flex-shrink: 0;
  gap: 12px;
}
.es-preview-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.es-preview-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.es-preview-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--grey-500);
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}
.es-preview-close:hover { color: var(--ink); }
.es-preview-body {
  flex: 1;
  overflow: auto;
  background: var(--grey-100);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.es-preview-iframe { width: 100%; height: 100%; border: 0; display: block; }
.es-preview-img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.es-preview-loading { font-size: 13px; color: var(--grey-500); }

/* ── File expiry badges ─────────────────────────────────────── */
.expiry-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 3px;
  background: #f0f0f0;
  color: #666;
  vertical-align: middle;
  margin-left: 4px;
  white-space: nowrap;
}
.expiry-badge.expiry-soon {
  background: #fff3cd;
  color: #856404;
}
.expiry-badge.expiry-expired {
  background: #f8d7da;
  color: #842029;
}

/* ── Admin drawer upload row ────────────────────────────────── */
.drawer-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-expiry-date {
  font-size: 0.75rem;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--text-mute, #666);
  background: transparent;
  cursor: pointer;
  max-width: 140px;
}
.input-expiry-date::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  cursor: pointer;
}

/* ── Forms tab ────────────────────────────────── */
.forms-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.admin-filter-select {
  padding: 6px 10px;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: white;
  cursor: pointer;
}
.table-empty {
  text-align: center;
  color: #999;
  padding: 24px;
}
.modal-body-pad {
  padding: 28px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.form-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--grey-500, #888);
}
.form-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink, #1a1a1a);
  background: var(--bg-2, #fafafa);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--blue, #1a3570);
  box-shadow: 0 0 0 3px rgba(26,53,112,0.08);
  background: #fff;
}
.form-input::placeholder {
  color: var(--grey-400, #bbb);
}
select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
textarea.form-input {
  height: auto;
  padding: 13px 14px;
  line-height: 1.55;
  resize: vertical;
}
input[type="number"].form-input {
  padding-right: 10px;
}
.form-textarea {
  resize: vertical;
}

/* ── Idle timeout warning ───────────────────────────────────────────── */
#idleWarningOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
#idleWarningOverlay[hidden] { display: none; }
#idleWarningBox {
  background: white;
  border-radius: 8px;
  padding: 40px 36px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
#idleWarningIcon {
  font-size: 36px;
  margin-bottom: 12px;
}
#idleWarningTitle {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #1a1a1a;
}
#idleWarningMsg {
  font-size: 14px;
  color: #555;
  margin-bottom: 24px;
  line-height: 1.6;
}
#idleCountdown {
  font-size: 16px;
  font-weight: 700;
  color: #c0392b;
}
#idleStayBtn {
  background: #1a1a1a;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 11px 28px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s;
}
#idleStayBtn:hover { opacity: .85; }

/* ── Forms tab: notification bubble ─────────────────────────────────────────── */
.notif-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #e53e3e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  margin-left: auto;
  letter-spacing: 0;
  line-height: 1;
}
.notif-bubble[hidden] { display: none; }

/* ── Forms tab: status badge opened ─────────────────────────────────────────── */
.status-badge-opened { background: #fffbeb; color: #92400e; }

/* ── Form detail modal ───────────────────────────────────────────────────────── */
.modal-wide { max-width: 720px; max-height: 86vh; overflow-y: auto; }
.fd-section { margin-bottom: 28px; }
.fd-section h3 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--grey-500); border-bottom: 1px solid var(--grey-200); padding-bottom: 6px; margin-bottom: 12px; }
.fd-row { display: flex; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--grey-100); font-size: 13px; }
.fd-row:last-child { border-bottom: none; }
.fd-label { width: 200px; flex-shrink: 0; color: var(--grey-500); font-size: 12px; }
.fd-val { flex: 1; color: var(--ink); font-weight: 500; word-break: break-word; }
.fd-actions { display: flex; gap: 10px; padding: 12px 0 20px; border-bottom: 1px solid var(--grey-100); margin-bottom: 20px; flex-wrap: wrap; }
.fd-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; text-decoration: none; }
.u-mono, .u-text-mono { font-family: 'SF Mono', Menlo, monospace; font-size: 12px; }

/* ── Send Form mode toggle ─────────────────────────────────────────────────── */
.send-form-toggle {
  display: flex;
  background: var(--bg-2, #f5f5f5);
  border: 1px solid var(--border, #e8e8e8);
  border-radius: 10px;
  overflow: hidden;
  padding: 4px;
  gap: 4px;
}
.sfg-btn {
  flex: 1;
  padding: 9px 0;
  background: none;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--grey-500, #888);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.sfg-btn.sfg-active {
  background: #fff;
  color: var(--ink, #1a1a1a);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.sfg-btn:not(.sfg-active):hover {
  color: var(--ink, #1a1a1a);
}

/* ── Send Form submit button ───────────────────────────────────────────────── */
#sendFormSubmit {
  width: 100%;
  height: 50px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: 10px;
  margin-top: 4px;
}

/* ── PIN modal & input ─────────────────────────────────────────────────────── */
.pin-input {
  font-size: 1.5rem;
  letter-spacing: 0.5rem;
  text-align: center;
  font-family: monospace;
  max-width: 140px;
}
.modal-sm { max-width: 380px; }
.pin-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}
.u-mt-12 { margin-top: 12px; }

/* ── Notifications ─────────────────────────────────────────────────────────── */
.notif-bell-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
}
.notif-bell-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: #555;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: background 0.15s;
}
.notif-bell-btn:hover { background: #f0f0f0; }
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: #e53e3e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}
.notif-badge.u-hidden { display: none; }

.notif-panel {
  position: fixed;
  top: 0; right: 0;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  background: #fff;
  border-left: 1px solid #e5e5e5;
  box-shadow: -4px 0 24px rgba(0,0,0,0.10);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.notif-panel.open { transform: translateX(0); }
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}
.notif-panel-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
.notif-header-actions { display: flex; gap: 8px; align-items: center; }
.notif-mark-all {
  font-size: 12px;
  color: #555;
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
}
.notif-mark-all:hover { background: #f5f5f5; }
.notif-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #555;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 4px;
}
.notif-close-btn:hover { background: #f0f0f0; }
.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #aaa;
  font-size: 14px;
  gap: 8px;
}
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
  color: inherit;
}
.notif-item:hover { background: #fafafa; }
.notif-item.unread { background: #f8f9ff; }
.notif-item.unread:hover { background: #f0f2ff; }
.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4f6ef7;
  flex-shrink: 0;
  margin-top: 6px;
}
.notif-item.read .notif-dot { background: transparent; }
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.notif-body  { font-size: 12px; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time  { font-size: 11px; color: #aaa; margin-top: 4px; }
.notif-icon  { flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.notif-icon-activated { background: #e6f4ea; }
.notif-icon-uploaded  { background: #e8f0fe; }
.notif-icon-lockout   { background: #fdecea; }
.notif-icon-form      { background: #fef7e0; }
.notif-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.2);
  z-index: 1999;
  display: none;
}
.notif-backdrop.open { display: block; }

@media (prefers-color-scheme: dark) {
  .notif-bell-btn { color: #aaa; }
  .notif-bell-btn:hover { background: #2a2a2a; }
  .notif-panel { background: #1a1a1a; border-color: #333; }
  .notif-panel-header { border-color: #333; }
  .notif-mark-all { color: #aaa; border-color: #444; }
  .notif-mark-all:hover { background: #2a2a2a; }
  .notif-item { border-color: #222; color: #ddd; }
  .notif-item:hover { background: #222; }
  .notif-item.unread { background: #1e2133; }
  .notif-item.unread:hover { background: #252840; }
  .notif-body { color: #999; }
  .notif-time { color: #666; }
  .notif-backdrop { background: rgba(0,0,0,0.5); }
}

/* ── Help page ──────────────────────────────────────────────────────────────── */
.help-guide-heading {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  padding: 40px 32px 0;
}
.help-section-body { max-width: 620px; }
.help-section-body p { font-size: 14px; line-height: 1.7; margin-bottom: 12px; }
.help-section-body ul, .help-section-body ol { padding-left: 20px; margin-bottom: 12px; }
.help-section-body li { font-size: 14px; line-height: 1.7; margin-bottom: 6px; }


/* ── Upload-request dropzone ───────────────────────────────────────────────── */
.upload-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  border: 1px dashed var(--grey-300);
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  padding: 16px;
  font-size: 13px;
  color: var(--grey-500);
  transition: border-color 0.15s, background 0.15s;
}
.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--black);
  background: #f5f5f5;
}

/* ── Request files modal — flush-to-edge fix + square corners (scoped, per request) ── */
#requestFilesModal .modal { border-radius: 0; }
#requestFilesModal > .modal > p,
#requestFilesModal #reqCreatePane,
#requestFilesModal #reqResultPane,
#requestFilesModal #reqExistingWrap {
  padding-left: 32px;
  padding-right: 32px;
}

/* ── Request files modal — existing-links list (.share-row is shared markup
   with the Share modal, where the row genuinely displays a copyable URL and
   monospace + single-line ellipsis makes sense). Here the row shows a plain
   summary line (recipient + expiry), not a URL, so the borrowed monospace
   styling read as out of place next to the rest of the modal's normal type.
   Scoped override, not a change to the shared .share-row-url rule. ── */
#requestFilesModal .share-row-url {
  font-family: var(--sans);
  font-size: 13px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.4;
}
#requestFilesModal .share-row {
  align-items: flex-start;
  padding: 12px 0;
}
#requestFilesModal .share-row-actions {
  padding-top: 1px;
}

/* ── Share link modal — same flush-to-edge fix + square corners as Request
   files (scoped, per request — see the comment on #requestFilesModal above
   for why this is scoped instead of changed on the shared .modal class). ── */
#shareModal .modal { border-radius: 0; }
#shareModal > .modal > p,
#shareModal #shareCreatePane,
#shareModal #shareResultPane,
#shareModal #shareExistingWrap {
  padding-left: 32px;
  padding-right: 32px;
}

/* ── Activity modal — same treatment ─────────────────────────────────────── */
#activityModal .modal { border-radius: 0; }
#activityModal #activityStats,
#activityModal #activityUploadNote,
#activityModal #activityList {
  padding-left: 32px;
  padding-right: 32px;
}

/* ── Select-all header checkbox ────────────────────────────────────────────── */
.select-all-checkbox { cursor: pointer; margin: 0; }

/* ── Move to folder modal ──────────────────────────────────────────────────── */
.move-folder-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--grey-300);
  border-radius: 6px;
}
.move-folder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--grey-100);
  font-size: 13px;
  color: var(--ink);
}
.move-folder-row:last-child { border-bottom: none; }
.move-folder-row:hover { background: #f5f5f5; }
.move-folder-row .folder-icon { color: var(--accent); flex-shrink: 0; }
.move-folder-empty {
  padding: 24px;
  text-align: center;
  color: var(--grey-500);
  font-size: 13px;
}

/* ── Drag & drop files onto folders ────────────────────────────────────────── */
.file-row.dragging,
.file-card.dragging { opacity: 0.4; }
.file-row.drop-target,
.file-card.drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: rgba(138,111,72,0.1);
}

/* ── Trash toolbar button — active state ───────────────────────────────────── */
#trashViewBtn.active { border-color: var(--accent); color: var(--accent); background: rgba(138,111,72,0.08); }

/* ── Email list selection toolbar ──────────────────────────────────────────── */
.es-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--grey-100);
  flex: 0 0 auto;
}
.es-select-all-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--grey-500);
  letter-spacing: 0.05em;
  cursor: pointer;
}
.es-select-all-label input { cursor: pointer; margin: 0; }

/* ── Team Feedback page ────────────────────────────────────────────────────── */
.feedback-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 32px 32px 0;
}
.feedback-title { font-family: var(--serif); font-size: 28px; font-weight: 400; margin-bottom: 4px; }

.feedback-tabs {
  display: flex;
  gap: 4px;
  padding: 20px 32px 0;
  border-bottom: 1px solid var(--grey-100);
}
.feedback-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 4px 12px;
  margin-right: 20px;
  font-size: 13px;
  color: var(--grey-500);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.feedback-tab:hover { color: var(--ink); }
.feedback-tab.active { color: var(--ink); border-bottom-color: var(--accent); }

.feedback-list { padding: 24px 32px 48px; display: flex; flex-direction: column; gap: 14px; max-width: 780px; }
.feedback-empty { color: var(--grey-500); font-style: italic; padding: 32px 0; }

.feedback-item {
  border: 1px solid var(--grey-100);
  border-radius: 6px;
  padding: 18px 20px;
  background: var(--paper);
}
.feedback-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.feedback-item-subject { font-size: 15px; font-weight: 500; flex: 1; min-width: 0; }
.feedback-item-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--grey-700);
  white-space: pre-wrap;
  margin-bottom: 10px;
}
.feedback-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.feedback-item-meta { font-size: 11px; color: var(--grey-500); }
.feedback-item-resolved { font-size: 11px; color: var(--green); margin-top: 6px; }

.feedback-type-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 0;
}
.feedback-type-badge.bug        { background: #fdf2f2; color: var(--red); }
.feedback-type-badge.suggestion { background: #eef4fb; color: #2b5a8c; }

.feedback-screenshot-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  margin-bottom: 10px;
}
.feedback-screenshot-link:hover { text-decoration: underline; }

.feedback-screenshot-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.feedback-screenshot-preview img {
  max-width: 160px;
  max-height: 110px;
  border: 1px solid var(--grey-100);
  border-radius: 4px;
  object-fit: cover;
}

.fb-lightbox-modal { max-width: 90vw; width: auto; padding: 0; }
.fb-lightbox-img { max-width: 90vw; max-height: 80vh; display: block; margin: 0 auto; }

@media (max-width: 700px) {
  .feedback-header, .feedback-tabs, .feedback-list { padding-left: 16px; padding-right: 16px; }
}
