/* ===========================================================================
   BMC Access Vault — premium wallet-system design system
   Public entry: public/css/app.css
   =========================================================================== */

:root {
  /* Brand */
  --black: #0a0a0a;
  --white: #ffffff;

  /* Surface tones — warm, slightly tinted for premium feel */
  --bg: #f6f3ed;
  --bg-2: #ece8df;
  --surface: #ffffff;
  --surface-2: #faf7f1;
  --surface-3: #f4f0e7;

  /* Borders — subtly tinted to add depth without harshness */
  --border: #e6e0d3;
  --border-2: #d6cfbf;
  --border-dark: #b6ad9a;
  --border-strong: #1f1d1c;

  /* Text */
  --text: #15140f;
  --text-light: #5b574e;
  --muted: #a19b8f;

  /* Accent — deep forest emerald (security + finance) */
  --accent: #047857;
  --accent-hover: #065f46;
  --accent-active: #054e3a;
  --accent-soft: #ecfdf5;
  --accent-tint: #d1fae5;
  --accent-glow: rgba(4, 120, 87, 0.12);
  --accent-shadow: 0 8px 24px rgba(4, 120, 87, 0.18), 0 2px 6px rgba(4, 120, 87, 0.1);

  /* Semantic */
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-tint: #fecaca;
  --success: #047857;
  --warn: #a16207;
  --warn-soft: #fffbeb;

  /* Geometry */
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --bottom-nav-h: 64px;

  /* Radii — modern premium feel without losing seriousness */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* Typography */
  --font: 'Jost', 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;

  /* Shadows — layered for true depth */
  --shadow-xs: 0 1px 2px rgba(15, 14, 12, 0.05);
  --shadow-sm: 0 2px 4px rgba(15, 14, 12, 0.05), 0 1px 2px rgba(15, 14, 12, 0.04);
  --shadow: 0 4px 12px rgba(15, 14, 12, 0.06), 0 1px 3px rgba(15, 14, 12, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 14, 12, 0.1), 0 4px 12px rgba(15, 14, 12, 0.05);
  --shadow-xl: 0 24px 60px rgba(15, 14, 12, 0.14), 0 8px 24px rgba(15, 14, 12, 0.06);

  /* Focus ring — visible, accessible */
  --focus-ring: 0 0 0 3px rgba(4, 120, 87, 0.25);

  /* Touch */
  --touch-target: 44px;

  /* Easing */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ BASE ============ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  font-weight: 400;
  background:
    radial-gradient(ellipse at top, rgba(255, 255, 255, 0.6) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

input,
select,
textarea,
button {
  font-family: var(--font);
  font-size: 14px;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

::placeholder {
  color: var(--muted);
  font-weight: 400;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: var(--r-full);
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--border-dark);
  background-clip: content-box;
  border: 2px solid transparent;
}

::selection {
  background: var(--accent-tint);
  color: var(--accent-active);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ============ AUTH ============ */

#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(4, 120, 87, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 100%, rgba(255, 200, 100, 0.04) 0%, transparent 50%);
}

/* Auth pages (login / register / activate) center the card in the viewport,
   both axes, and stay comfortably padded on small screens. Applied via
   <body class="auth-page"> so login.html and register.html share one rule
   instead of each shipping ad-hoc inline body styles. */
body.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 440px;
  /* min-width:0 lets the card shrink below the intrinsic min-content width of
     its children (e.g. the space-between footer) so it never overflows a
     narrow viewport. Without it a flex item defaults to min-width:auto and
     refuses to shrink, pushing the card off-screen on phones. */
  min-width: 0;
  margin: auto;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  position: relative;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
}

.auth-header {
  background: linear-gradient(180deg, #18171a 0%, #0a0a0a 100%);
  padding: 28px 28px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.auth-header::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(4, 120, 87, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.auth-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--white) 0%, #f4f3ef 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--black);
  flex-shrink: 0;
  border-radius: var(--r-sm);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.auth-logo-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--white);
  line-height: 1.2;
}

.auth-logo-sub {
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6a6660;
  margin-top: 3px;
}

.auth-body {
  padding: 28px;
}

.auth-title {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 4px;
}

.auth-sub {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 24px;
  line-height: 1.55;
}

.auth-footer {
  border-top: 1px solid var(--border);
  padding: 14px 28px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--surface-2);
}

.auth-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid var(--accent-glow);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.auth-link:hover {
  color: var(--accent-active);
  border-color: var(--accent);
}

.req-list {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 12px 16px;
  margin-bottom: 18px;
  border-radius: var(--r-sm);
}

.req-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
  transition: color 0.2s var(--ease);
}
.req-item:last-child {
  margin-bottom: 0;
}
.req-item.met {
  color: var(--success);
}
.req-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-2);
  flex-shrink: 0;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.req-item.met .req-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.15);
}

.info-row {
  background: linear-gradient(180deg, #f3f7fa 0%, #eaf0f6 100%);
  border: 1px solid #d8e4ee;
  border-left: 3px solid #6b8caf;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.6;
  border-radius: var(--r-sm);
}
.info-row strong {
  color: var(--text);
  font-weight: 600;
}

/* ============ APP LAYOUT ============ */

#app-screen {
  display: none;
  min-height: 100vh;
}

#sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background:
    radial-gradient(ellipse at top, rgba(4, 120, 87, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, #18181a 0%, #0a0a0a 100%);
  display: flex;
  flex-direction: column;
  z-index: 300;
  transition: transform 0.3s var(--ease);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sb-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sb-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--white) 0%, #ece9e1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--black);
  flex-shrink: 0;
  border-radius: var(--r-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.sb-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--white);
  line-height: 1.2;
}

.sb-sub {
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6a6660;
  margin-top: 3px;
}

.sb-nav {
  flex: 1;
  padding: 10px 12px;
  overflow-y: auto;
}

.sb-section {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #5a564f;
  padding: 14px 8px 6px;
  display: block;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #908a82;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  border-radius: var(--r-md);
  user-select: none;
  min-height: var(--touch-target);
  position: relative;
}

.sb-item:hover {
  color: #e6e2da;
  background: rgba(255, 255, 255, 0.04);
}

.sb-item.active {
  color: var(--white);
  background: linear-gradient(180deg, rgba(4, 120, 87, 0.18) 0%, rgba(4, 120, 87, 0.1) 100%);
  box-shadow: inset 0 0 0 1px rgba(4, 120, 87, 0.3);
}

.sb-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sb-item .icon {
  width: 18px;
  height: 18px;
  opacity: 0.75;
  flex-shrink: 0;
  transition: opacity 0.15s var(--ease);
}

.sb-item.active .icon,
.sb-item:hover .icon {
  opacity: 1;
}

.sb-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.08);
  color: #a8a39b;
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--r-full);
}

.sb-item.active .sb-badge {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
}

.sb-user {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 12px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.03);
}

.sb-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a2a2c 0%, #1a1a1c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #d8d4cc;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.sb-uname {
  font-size: 13px;
  color: #e6e2da;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.sb-urole {
  font-size: 9px;
  color: #6a6660;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
  font-weight: 500;
}

.sb-logout {
  color: #6a6660;
  cursor: pointer;
  padding: 6px;
  transition: color 0.15s var(--ease);
  font-size: 14px;
  flex-shrink: 0;
  min-width: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-radius: var(--r-sm);
}
.sb-logout:hover {
  color: var(--accent-tint);
  background: rgba(4, 120, 87, 0.08);
}

#sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
  z-index: 299;
  backdrop-filter: blur(2px);
}

#main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

#menu-btn {
  display: none;
  width: var(--touch-target);
  height: var(--touch-target);
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  flex-shrink: 0;
  margin-left: -10px;
  border-radius: var(--r-sm);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
#menu-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.topbar-title {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

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

.topbar-search {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 9px 14px;
  width: 220px;
  border-radius: var(--r-md);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}

.topbar-search:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--focus-ring);
}

.topbar-search input {
  border: none;
  background: none;
  outline: none;
  width: 100%;
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
}

#content {
  flex: 1;
  padding: 28px;
}

/* ============ BOTTOM NAV ============ */

#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 14, 12, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 200;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bn-items {
  display: flex;
  height: 64px;
}

.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #6a6660;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.18s var(--ease);
  position: relative;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
}

.bn-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 30%;
  right: 30%;
  height: 2px;
  background: transparent;
  transition: background 0.18s var(--ease);
  border-radius: 0 0 2px 2px;
}

.bn-item.active {
  color: var(--accent-tint);
}
.bn-item.active::after {
  background: var(--accent);
}

.bn-item .bn-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease);
}

.bn-item.active .bn-icon {
  transform: translateY(-2px);
}

.bn-item .bn-label {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
  line-height: 1;
}

.bn-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 9px);
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1.5px 5px;
  border-radius: var(--r-full);
  min-width: 16px;
  text-align: center;
  line-height: 14px;
  border: 1.5px solid #0a0a0a;
}

/* ============ PAGES ============ */

.page {
  display: none;
}
.page.active {
  display: block;
  animation: fadeUp 0.25s var(--ease);
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ============ DASHBOARD ============ */

.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  padding: 20px 22px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-2);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 30px;
  font-weight: 300;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
}

.stat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.dot-green {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.dash-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.panel-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}

.panel-head h3 {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-light);
}

.log-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background 0.12s var(--ease);
}
.log-item:last-child {
  border-bottom: none;
}
.log-item:hover {
  background: var(--surface-2);
}

.log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.log-msg {
  color: var(--text);
  line-height: 1.5;
}

.log-time {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
}

.log-user {
  font-weight: 500;
  color: var(--text);
}

.quick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s var(--ease);
  gap: 12px;
}
.quick-item:hover {
  background: var(--surface-2);
}
.quick-item:last-child {
  border-bottom: none;
}
.qi-name {
  font-weight: 500;
  font-size: 13.5px;
  color: var(--text);
}
.qi-cat {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.qi-tag {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--border);
  color: var(--text-light);
  white-space: nowrap;
  background: var(--surface-2);
  border-radius: var(--r-xs);
}

/* ============ SECURITY: REVEALED PASSWORD INDICATOR ============ */
/* Amber tint + countdown badge shown whenever a password is unmasked.
   The .copied flash (emerald) is for SUCCESSFUL copy (instant); the
   .sec-revealed treatment is for ACTIVE-EXPOSURE (sustained + countdown). */

.sec-revealed {
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.05) 0%, rgba(217, 119, 6, 0.10) 100%) !important;
  border-color: rgba(161, 98, 7, 0.40) !important;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.10);
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}

.sec-countdown {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn);
  background: var(--warn-soft);
  padding: 4px 9px;
  border: 1px solid rgba(161, 98, 7, 0.30);
  border-radius: var(--r-xs);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
  font-family: inherit;
}
.sec-countdown::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
  animation: secPulse 1.4s var(--ease) infinite;
}
.sec-countdown:hover {
  background: rgba(217, 119, 6, 0.16);
  border-color: var(--warn);
  color: #7a4804;
}
@keyframes secPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.2); opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .sec-countdown::before { animation: none; }
}

/* Flex wrapper for password row in the data-table — gives the reveal
   span + copy icon + countdown a clean horizontal arrangement. */
.pw-row-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pw-row-field .td-pw { flex: 1; min-width: 0; }

/* ============ VIEW-PASSWORD MODAL (read-only) ============ */

.vp-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 10px;
  position: relative;
  transition: border-color 0.15s var(--ease);
}
.vp-field:last-child { margin-bottom: 0; }
.vp-field:hover { border-color: var(--border-2); }
.vp-field-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.vp-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
}
.vp-field-value {
  font-size: 14px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
  word-break: break-all;
}
.vp-field-value.prose {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.6;
}
.vp-field-value a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-glow);
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.vp-field-value a:hover {
  color: var(--accent-active);
  border-color: var(--accent);
}
.vp-field-value.revealed {
  color: var(--text);
  font-weight: 500;
}
.vp-field-value.muted {
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-style: italic;
}
.vp-field-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.vp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.vp-grid .vp-field { margin-bottom: 0; }
.vp-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.vp-header-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-active) 100%);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 500;
  flex-shrink: 0;
  border-radius: var(--r-md);
  box-shadow: var(--accent-shadow);
  letter-spacing: 0.04em;
}
.vp-header-info { flex: 1; min-width: 0; }
.vp-header-name {
  font-size: 19px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
  word-break: break-word;
}
.vp-header-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 6px;
}
.vp-header-url {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  word-break: break-all;
}
.vp-empty {
  color: var(--muted);
  font-family: inherit;
  font-style: normal;
  font-size: 13px;
}

/* ============ PASSWORD ROW HOVER ACTIONS (desktop) ============ */

.data-table tbody tr .pw-row-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
  opacity: 0.7;
  transition: opacity 0.15s var(--ease);
}
.data-table tbody tr:hover .pw-row-actions { opacity: 1; }

/* ============ SHARED COMPONENTS ============ */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
  gap: 16px;
}

.page-title {
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.2;
}

.page-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ============ BUTTONS (premium) ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.18s var(--ease);
  white-space: nowrap;
  min-height: var(--touch-target);
  border-radius: var(--r-md);
  position: relative;
  border: 1px solid transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(180deg, #18181a 0%, #0a0a0a 100%);
  color: var(--white);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 4px 12px rgba(0, 0, 0, 0.14),
    0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #1f1f22 0%, #131313 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 6px 16px rgba(0, 0, 0, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-accent {
  background: linear-gradient(180deg, #059669 0%, var(--accent) 100%);
  color: var(--white);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 4px 14px rgba(4, 120, 87, 0.28),
    0 1px 2px rgba(4, 120, 87, 0.12);
}

.btn-accent:hover:not(:disabled) {
  background: linear-gradient(180deg, #047857 0%, var(--accent-hover) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 8px 22px rgba(4, 120, 87, 0.36),
    0 2px 6px rgba(4, 120, 87, 0.18);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

.btn-outline:hover {
  border-color: var(--text);
  background: var(--surface-2);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-light);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: linear-gradient(180deg, var(--danger) 0%, #991b1b 100%);
  color: white;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16) inset,
    0 4px 14px rgba(185, 28, 28, 0.28),
    0 1px 2px rgba(185, 28, 28, 0.12);
}
.btn-danger:hover:not(:disabled) {
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 8px 22px rgba(185, 28, 28, 0.36),
    0 2px 6px rgba(185, 28, 28, 0.2);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 11.5px;
  min-height: 36px;
  border-radius: var(--r-sm);
}
.btn-xs {
  padding: 6px 11px;
  font-size: 10.5px;
  min-height: 32px;
  border-radius: var(--r-sm);
  letter-spacing: 0.06em;
}

.btn-block {
  width: 100%;
}

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-search {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 14px;
  flex: 1;
  min-width: 180px;
  border-radius: var(--r-md);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.filter-search:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.filter-search input {
  border: none;
  background: none;
  outline: none;
  width: 100%;
  color: var(--text);
  font-size: 13.5px;
}

.filter-select {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 12px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  min-width: 160px;
  height: var(--touch-target);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%235b574e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.filter-select:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.scrollable {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  min-width: 640px;
}

.data-table th {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 13px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13.5px;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background 0.12s var(--ease);
}

.data-table tbody tr:hover td {
  background: var(--surface-2);
}

.td-name {
  font-weight: 500;
  color: var(--text);
}
.td-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.td-pw {
  font-family: var(--mono);
  letter-spacing: 0.04em;
  color: var(--text-light);
  cursor: pointer;
  font-size: 13.5px;
}
.td-pw.revealed {
  color: var(--text);
}
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 9px;
  border: 1px solid;
  border-radius: var(--r-xs);
}
.tag-admin {
  border-color: #d4d4d4;
  color: #5a5a5a;
  background: #f4f4f4;
}
.tag-editor {
  border-color: var(--accent-tint);
  color: var(--accent-active);
  background: var(--accent-soft);
}
.tag-member {
  border-color: var(--border);
  color: var(--muted);
  background: var(--surface-2);
}
.tag-view {
  border-color: #d4dceb;
  color: #42597b;
  background: #eef3fa;
}

.access-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.access-pill {
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-light);
  border-radius: var(--r-xs);
}

.copy-btn {
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid transparent;
  transition: all 0.15s var(--ease);
  min-width: 30px;
  text-align: center;
  border-radius: var(--r-xs);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Shared Lucide-style copy icon. There are TWO glyphs inside every .copy-btn
   / .copy-btn-inline: the copy glyph and the check glyph. Only one is
   visible at a time — when the click handler flips the .copied class on the
   source element, the check glyph appears + the copy glyph disappears. */
.copy-glyph,
.check-glyph {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  stroke: currentColor;
  transition: color 0.18s var(--ease), transform 0.18s var(--ease);
}
.check-glyph {
  display: none;
  stroke-width: 2.6;
}
.copy-btn {
  /* Lay out the text + glyph inline so the icon sits flush on the right. */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}
.copy-btn .copy-glyph {
  opacity: 0.55;
  transition: opacity 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.copy-btn:hover .copy-glyph {
  opacity: 1;
  color: var(--accent);
  transform: scale(1.08);
}

/* Inline copy buttons in the password table — always visible (touch-friendly)
   and slightly smaller than the existing copy-btn so 3-4 of them fit in one row. */
.copy-btn-inline {
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  font-size: 13px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  transition: all 0.15s var(--ease);
  flex-shrink: 0;
  user-select: none;
  background: transparent;
}
.copy-btn-inline .copy-glyph { width: 14px; height: 14px; }
.copy-btn-inline:hover {
  color: var(--accent);
  border-color: var(--accent-tint);
  background: var(--accent-soft);
}
.copy-btn-inline:hover .copy-glyph {
  transform: scale(1.08);
}

/* Copied state — the check glyph slides in, copy glyph fades out. The class
   is added by main.js after a successful clipboard write and removed after
   ~1.5s. Emerald accent confirms the success visually without overlapping
   with the global toast. */
.copy-btn.copied,
.copy-btn-inline.copied {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.copy-btn.copied .copy-glyph,
.copy-btn-inline.copied .copy-glyph { display: none; }
.copy-btn.copied .check-glyph,
.copy-btn-inline.copied .check-glyph {
  display: inline-block;
  animation: copyFlash 0.42s var(--ease);
}
@keyframes copyFlash {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .copy-btn.copied .check-glyph,
  .copy-btn-inline.copied .check-glyph { animation: none; }
}

/* ============ ACCESS MATRIX ============ */

.access-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 520px;
}
.access-matrix th {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--surface-2);
}
.access-matrix td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.access-matrix tr:last-child td {
  border-bottom: none;
}
.access-select {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 10px;
  color: var(--text);
  outline: none;
  width: 100%;
  cursor: pointer;
  font-size: 12.5px;
  min-height: 34px;
  border-radius: var(--r-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.access-select:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* ============ LOG ============ */

.log-full-item {
  display: grid;
  grid-template-columns: 160px 1fr 100px;
  gap: 14px;
  align-items: start;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s var(--ease);
}
.log-full-item:last-child {
  border-bottom: none;
}
.log-full-item:hover {
  background: var(--surface-2);
}
.lf-time {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.55;
}
.lf-event {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.lf-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.lf-actor {
  font-weight: 500;
  margin-right: 4px;
  color: var(--text);
}
.lf-changes {
  margin-top: 8px;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid #6b8caf;
  border-radius: var(--r-sm);
}
.lf-change-row {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.7;
}
.lf-change-row .old {
  color: var(--danger);
  text-decoration: line-through;
  font-size: 11px;
  margin-right: 4px;
}
.lf-change-row .new {
  color: var(--success);
  font-size: 11px;
  margin-left: 4px;
}
.lf-type {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}

/* ============ LOG: DATE FILTER + PAGINATION ============ */

/* Pagination container — shared by #log-pager and #pw-pager.
   Inner pieces (.lp-info / .lp-pages / .lp-btn / .lp-ellipsis / .lp-size)
   are reused so the styling lives in one place. */
#pw-pager,
.log-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  flex-wrap: wrap;
}
#pw-pager {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  margin-top: -1px;
  /* When the pager is alone (no card parent) give it a soft border-shadow. */
  box-shadow: var(--shadow-xs);
}
#pw-pager:empty { display: none; }

.filters-tight {
  margin-bottom: 10px;
  align-items: center;
}

.filter-date-pair {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 280px;
}

.fd-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}

.filter-date {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 12px;
  color: var(--text);
  outline: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  min-height: var(--touch-target);
  border-radius: var(--r-md);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  -webkit-appearance: none;
  appearance: none;
  color-scheme: light;
  min-width: 140px;
}
.filter-date:hover:not(:focus) {
  border-color: var(--border-2);
}
.filter-date:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.fd-arrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  user-select: none;
}

.preset-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.preset-btn {
  padding: 7px 13px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-light);
  cursor: pointer;
  border-radius: var(--r-full);
  transition: all 0.15s var(--ease);
  min-height: 32px;
}
.preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.preset-btn.active {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: var(--white);
  border-color: var(--accent);
  box-shadow: var(--accent-shadow);
}

/* ---- Pagination bar ---- */

.log-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  flex-wrap: wrap;
}

.lp-info {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  white-space: nowrap;
}
.lp-info strong {
  color: var(--text);
  font-weight: 600;
}

.lp-pages {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

.lp-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-light);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: all 0.15s var(--ease);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lp-btn:hover:not(:disabled):not(.lp-active) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.lp-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.lp-btn.lp-active {
  background: linear-gradient(180deg, #18181a 0%, #0a0a0a 100%);
  color: var(--white);
  border-color: var(--border-strong);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 2px 6px rgba(0, 0, 0, 0.18);
  cursor: default;
}
.lp-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--surface-2);
}

.lp-arrow {
  font-size: 14px;
  font-weight: 500;
}

.lp-ellipsis {
  color: var(--muted);
  font-size: 12.5px;
  padding: 0 4px;
  user-select: none;
  letter-spacing: 0.18em;
  font-weight: 500;
}

.lp-size {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}
.lp-size select {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 5px 26px 5px 8px;
  font-size: 11.5px;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--r-xs);
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%235b574e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s var(--ease);
}
.lp-size select:hover {
  border-color: var(--border-2);
}
.lp-size select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* Mobile pagination adjustments */
@media (max-width: 768px) {
  .filter-date-pair {
    width: 100%;
  }
  .filter-date {
    flex: 1;
    min-width: 0;
  }
  .preset-chips {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .preset-chips::-webkit-scrollbar {
    display: none;
  }
  .log-pager {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .lp-info {
    text-align: center;
  }
  .lp-pages {
    justify-content: center;
  }
  .lp-btn {
    min-width: 32px;
    height: 32px;
    font-size: 12px;
  }
  .lp-size {
    justify-content: center;
  }
}

/* ============ USERS ============ */

.users-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.user-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--r-lg);
  transition: box-shadow 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.user-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-2);
  transform: translateY(-1px);
}

.user-card-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 500;
  flex-shrink: 0;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}

.user-card-info {
  flex: 1;
  min-width: 0;
}
.user-card-name {
  font-weight: 500;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.user-card-email {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-card-meta {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.user-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-direction: column;
}

/* ============ CONTACTS ============ */

.ct-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  align-items: start;
}

.ct-cats-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  box-shadow: var(--shadow-xs);
}

.ct-cats-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-2);
}

.ct-cat-item {
  padding: 11px 16px;
  cursor: pointer;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s var(--ease);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--touch-target);
  font-weight: 400;
}
.ct-cat-item:last-child {
  border-bottom: none;
}
.ct-cat-item:hover {
  background: var(--surface-2);
}
.ct-cat-item.active {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: var(--white);
  font-weight: 500;
}

.ct-cat-count {
  font-size: 10.5px;
  color: var(--muted);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: var(--r-full);
  flex-shrink: 0;
  font-weight: 600;
}
.ct-cat-item.active .ct-cat-count {
  background: rgba(255, 255, 255, 0.22);
  color: var(--white);
}

.ct-cat-del {
  color: var(--muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  border-radius: var(--r-xs);
  transition: color 0.12s var(--ease), background 0.12s var(--ease);
}
.ct-cat-del:hover {
  color: var(--danger);
  background: var(--danger-soft);
}
.ct-cat-item.active .ct-cat-del {
  color: rgba(255, 255, 255, 0.6);
}

.ct-cat-add {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  background: var(--surface-2);
}
.ct-cat-add input {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 7px 10px;
  outline: none;
  color: var(--text);
  flex: 1;
  font-size: 12.5px;
  border-radius: var(--r-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.ct-cat-add input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.contact-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  padding: 18px;
  cursor: pointer;
  transition: all 0.18s var(--ease);
  position: relative;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

.contact-card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.cc-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.cc-initials {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface-3) 100%);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-light);
  flex-shrink: 0;
  border-radius: var(--r-sm);
}

.cc-name {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
}

.cc-role-title {
  font-size: 11.5px;
  color: var(--text-light);
  margin-top: 2px;
}

.cc-cat-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  padding: 3px 8px;
  color: var(--muted);
  margin-bottom: 10px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
}

.cc-field {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-light);
  margin-top: 6px;
}
.cc-field svg {
  flex-shrink: 0;
  opacity: 0.5;
}

.cc-tasks {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  line-height: 1.6;
}

.cc-tasks-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.cc-access-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid;
  border-radius: var(--r-xs);
}

.cc-access-public {
  border-color: var(--accent-tint);
  color: var(--accent-active);
  background: var(--accent-soft);
}
.cc-access-restricted {
  border-color: #f0d4c8;
  color: #853a16;
  background: #fef4ec;
}

/* ============ FORMS / MODALS ============ */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
  padding: 20px;
}
.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--surface);
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.22s var(--ease);
  border-radius: var(--r-lg);
  position: relative;
}
.modal-wide {
  max-width: 680px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.modal-title {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.modal-close {
  width: var(--touch-target);
  height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 20px;
  transition: all 0.15s var(--ease);
  margin: -8px -8px -8px 0;
  cursor: pointer;
  border-radius: var(--r-sm);
  background: transparent;
}
.modal-close:hover {
  color: var(--text);
  background: var(--surface-2);
}

.modal-body {
  padding: 22px 24px;
}

.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 7px;
}
.form-input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 11px 14px;
  outline: none;
  color: var(--text);
  font-weight: 400;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: var(--r-md);
}
.form-input:hover:not(:focus) {
  border-color: var(--border-2);
}
.form-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--focus-ring);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.5;
}

.pw-field {
  position: relative;
}
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 4px;
  bottom: 4px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  min-width: var(--touch-target);
  border-radius: var(--r-sm);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.pw-toggle:hover {
  color: var(--text);
  background: var(--surface-2);
}

.pw-strength {
  height: 4px;
  margin-top: 6px;
  background: var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
}
.pw-strength-bar {
  height: 100%;
  transition: width 0.3s var(--ease), background 0.3s var(--ease);
  border-radius: var(--r-full);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-light);
  border-radius: var(--r-full);
}
.chip .chip-remove {
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  margin-left: 2px;
  min-width: 22px;
  text-align: center;
  border-radius: var(--r-xs);
  transition: color 0.12s var(--ease);
}
.chip .chip-remove:hover {
  color: var(--danger);
}

/* ============ PASSWORD CARDS (mobile) ============ */

.pw-cards {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.pw-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  padding: 18px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}
.pw-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.pw-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}
.pw-card-name {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
}
.pw-card-url {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.pw-card-cat {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--border);
  color: var(--text-light);
  border-radius: var(--r-xs);
  background: var(--surface-2);
}
.pw-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.pw-card-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.pw-card-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  width: 110px;
  flex-shrink: 0;
}
.pw-card-val {
  font-size: 13.5px;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pw-card-val.mono {
  font-family: var(--mono);
  letter-spacing: 0.04em;
  color: var(--text-light);
}
.pw-card-val.mono.revealed {
  color: var(--text);
}
.pw-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.pw-card-actions .btn {
  flex: 1;
  justify-content: center;
}

/* Locked (no access) mobile card */
.pw-card-locked {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 18px;
  opacity: 0.78;
  position: relative;
  border-radius: var(--r-lg);
}
.pw-card-locked::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 8px,
    rgba(10, 10, 10, 0.012) 8px,
    rgba(10, 10, 10, 0.012) 9px
  );
  pointer-events: none;
  border-radius: inherit;
}
.pw-locked-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.pw-locked-name {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-light);
}
.pw-locked-url {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.pw-locked-body {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13.5px;
}
.pw-locked-icon {
  flex-shrink: 0;
  opacity: 0.4;
}
.pw-locked-btn {
  margin-top: 12px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--border-2);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--text-light);
  background: var(--surface);
  transition: all 0.15s var(--ease);
  border-radius: var(--r-sm);
}
.pw-locked-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Desktop locked row */
.tr-locked td {
  color: var(--muted) !important;
  background: var(--surface-2);
}
.tr-locked .td-name {
  color: var(--text-light) !important;
}

.access-request-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 11px;
  border: 1px solid var(--border-2);
  color: var(--text-light);
  cursor: pointer;
  background: var(--surface);
  transition: all 0.15s var(--ease);
  white-space: nowrap;
  border-radius: var(--r-sm);
}
.access-request-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.access-request-btn.requested {
  border-color: var(--accent-tint);
  color: var(--accent-active);
  background: var(--accent-soft);
  cursor: default;
}

.ar-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid #eed7c4;
  color: #853a16;
  background: #fef4ec;
  margin-left: 7px;
  border-radius: var(--r-xs);
}

/* ============ CHROME SYNC ============ */

.chrome-banner {
  background: linear-gradient(180deg, #fffbe8 0%, #fff3d4 100%);
  border: 1px solid #e8d87a;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  border-radius: var(--r-sm);
}

.chrome-banner-text {
  flex: 1;
  font-size: 12.5px;
  color: #5a4a10;
  line-height: 1.55;
}
.chrome-banner-text strong {
  font-weight: 600;
  color: #3a2e08;
}

#chrome-cred-bridge {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ============ MISC ============ */

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
}
.empty-state .e-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.4;
}
.empty-state p {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.av-1 {
  background: linear-gradient(135deg, #e8e0d4 0%, #d8cdb8 100%);
  color: #5a4a3a;
}
.av-2 {
  background: linear-gradient(135deg, #d8e4e8 0%, #b8cdda 100%);
  color: #2a4a5a;
}
.av-3 {
  background: linear-gradient(135deg, #e4e8d8 0%, #c8d4b8 100%);
  color: #3a4a2a;
}
.av-4 {
  background: linear-gradient(135deg, #e8d8e4 0%, #d4b8ce 100%);
  color: #5a2a4a;
}
.av-5 {
  background: linear-gradient(135deg, #e8e8d8 0%, #d4d4b8 100%);
  color: #4a4a2a;
}

#toast-container {
  position: fixed;
  bottom: 88px;
  right: 18px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: linear-gradient(180deg, #1f1f22 0%, #0f0f10 100%);
  color: var(--white);
  padding: 13px 18px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  max-width: calc(100vw - 36px);
  animation: slideIn 0.28s var(--ease), fadeOut 0.32s ease 2.7s forwards;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.toast-success {
  background: linear-gradient(180deg, #059669 0%, var(--accent-active) 100%);
  border-color: var(--accent-active);
}
.toast-error {
  background: linear-gradient(180deg, #dc2626 0%, var(--danger) 100%);
  border-color: var(--danger);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ============ TOUR ============ */

#tour-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
}
#tour-backdrop.active {
  display: block;
}
.tour-spotlight {
  position: fixed;
  z-index: 2001;
  box-shadow: 0 0 0 9999px rgba(10, 10, 10, 0.6);
  pointer-events: none;
  transition: all 0.35s var(--ease);
  border-radius: var(--r-md);
}
.tour-card {
  position: fixed;
  background: var(--surface);
  z-index: 2002;
  width: min(330px, calc(100vw - 32px));
  box-shadow: var(--shadow-xl);
  pointer-events: all;
  transition: all 0.35s var(--ease);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.tour-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.tour-step-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.tour-title {
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text);
}
.tour-body {
  padding: 14px 20px;
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.65;
}
.tour-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-2);
}
.tour-dots {
  display: flex;
  gap: 6px;
}
.tour-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-2);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.tour-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}
.tour-actions {
  display: flex;
  gap: 8px;
}

/* ============ PENDING INVITES ============ */

.invite-list {
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 22px;
  border-radius: var(--r-lg);
  background: var(--surface);
}
.invite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  gap: 14px;
  flex-wrap: wrap;
}
.invite-item:last-child {
  border-bottom: none;
}
.invite-info {
  flex: 1;
  min-width: 0;
}
.invite-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}
.invite-email {
  font-size: 12px;
  color: var(--muted);
}
.invite-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* ============ MOBILE BOTTOM CATEGORIES ============ */

.ct-mobile-cats {
  display: none;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 8px;
}
.ct-mobile-cats::-webkit-scrollbar {
  display: none;
}
.ct-mobile-cat-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-light);
  transition: all 0.15s var(--ease);
  border-radius: var(--r-full);
}
.ct-mobile-cat-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.ct-mobile-cat-btn.active {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: var(--white);
  border-color: var(--accent);
  box-shadow: var(--accent-shadow);
}

/* ============ MOBILE LOG CARDS ============ */

.log-mobile-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s var(--ease);
}
.log-mobile-item:last-child {
  border-bottom: none;
}
.log-mobile-item:hover {
  background: var(--surface-2);
}
.log-mobile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.log-mobile-msg {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.45;
}
.log-mobile-time {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
}

.hide-xs {
  display: inline;
}

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

@media (max-width: 1200px) {
  .contacts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1024px) {
  .users-grid {
    grid-template-columns: 1fr;
  }
  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }
  #sidebar.open {
    transform: translateX(0);
  }
  #sb-overlay.open {
    display: block;
  }
  #menu-btn {
    display: flex;
  }
  #main {
    margin-left: 0;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  #topbar {
    padding: 0 18px;
  }
  .topbar-search {
    display: none;
  }
  #bottom-nav {
    display: flex;
  }
  #toast-container {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 12px);
    right: 12px;
    left: 12px;
    align-items: center;
  }
  .toast {
    max-width: none;
    width: 100%;
  }
  #content {
    padding: 20px;
  }
  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .dash-cols {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .contacts-grid {
    grid-template-columns: 1fr;
  }
  .ct-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .ct-cats-panel {
    position: static;
    display: none;
  }
  .ct-mobile-cats {
    display: flex;
  }
  .users-grid {
    grid-template-columns: 1fr;
  }
  .user-card-actions {
    flex-direction: row;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .page-title {
    font-size: 20px;
  }
  .page-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .table-wrap {
    display: none;
  }
  .pw-cards {
    display: flex;
  }
  .log-full-item {
    display: none;
  }
  .log-mobile-item {
    display: block;
  }
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    max-height: 96vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .stat-value {
    font-size: 26px;
  }
  .hide-xs {
    display: none;
  }
}

@media (max-width: 480px) {
  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  body.auth-page {
    padding: 16px;
    align-items: flex-start;
  }
  .auth-body {
    padding: 22px;
  }
  .btn {
    padding: 11px 16px;
    font-size: 12px;
  }
  .page-title {
    font-size: 18px;
  }
  #content {
    padding: 16px;
  }
  .stat-card {
    padding: 16px 18px;
  }
  .stat-value {
    font-size: 22px;
  }
  .filter-search,
  .filter-select {
    width: 100%;
  }
  .filters {
    flex-direction: column;
  }
}

@media (min-width: 769px) {
  .ct-mobile-cats {
    display: none !important;
  }
  .pw-cards {
    display: none !important;
  }
  .log-mobile-item {
    display: none !important;
  }
  .log-full-item {
    display: grid !important;
  }
  #bottom-nav {
    display: none !important;
  }
}

@media (min-width: 1280px) {
  #content {
    padding: 32px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
  }
}

/* ============ 2FA / TOTP (security page + gate banner) ============ */

/* Soft-warning banner shown on the passwords page while the current user
   has not yet enrolled TOTP. Built in the same design language as the
   Chrome-sync banner so the two harmonize visually. */
.tfa-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #fff7e8 0%, #fcecd0 100%);
  border: 1px solid #e8d8a8;
  border-left: 3px solid #c87000;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: var(--r-sm);
  animation: fadeUp 0.3s var(--ease);
}

.tfa-banner svg {
  flex-shrink: 0;
}

.tfa-banner-text {
  flex: 1;
  font-size: 13px;
  color: #5a3a10;
  line-height: 1.55;
}
.tfa-banner-text strong {
  font-weight: 600;
  color: #3a2e08;
}

/* Per-user 2FA status pill (admin users page + own self-status panel). */
.tfa-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid;
  border-radius: var(--r-full);
  white-space: nowrap;
  font-family: inherit;
  cursor: default;
}
.tfa-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.tfa-pill-on {
  border-color: var(--accent-tint);
  background: var(--accent-soft);
  color: var(--accent-active);
}
.tfa-pill-off {
  border-color: #e8d4b8;
  background: #fef4ec;
  color: #8a4818;
}

/* Security page self-status body. Mirrors the existing "empty state"
   vars so admin and self look consistent on first paint. */
.tfa-self-status {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.tfa-self-status .tfa-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.4) inset;
}
.tfa-self-status .tfa-icon.on {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-active) 100%);
  color: var(--white);
}
.tfa-self-status .tfa-icon.off {
  background: linear-gradient(135deg, #f0e0c8 0%, #e0c8a0 100%);
  color: #6a4818;
}
.tfa-self-status .tfa-info {
  flex: 1;
  min-width: 200px;
}
.tfa-self-status .tfa-info .tfa-line {
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text);
  margin-bottom: 4px;
}
.tfa-self-status .tfa-info .tfa-sub {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}

/* QR-code frame inside the setup modal. Keeps the visual weight of
   the existing QR code clean enough that the scanner picks it up
   reliably even on a dim laptop screen. */
#tfa-qr-frame img {
  display: block;
  width: 200px;
  height: 200px;
}

#tfa-recovery-grid > div {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--r-xs);
  letter-spacing: 0.06em;
}
#tfa-recovery-grid > div::before {
  content: '·';
  color: var(--muted);
  font-weight: 700;
}

/* Per-user row inside the admin 2FA panel. Compact horizontal layout so
   the panel can hold ~10 users before forcing a vertical scroll. */
.tfa-admin-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tfa-admin-row:last-child {
  border-bottom: none;
}
.tfa-admin-row .tfa-admin-name {
  flex: 1;
  min-width: 140px;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--text);
}
.tfa-admin-row .tfa-admin-email {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
  flex: 0 1 220px;
  min-width: 160px;
}
.tfa-admin-row .tfa-admin-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Accessibility: ensure the warning banner remains tab-able when shown. */
.tfa-banner:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════
   Tags + access-granting UI (multi-select)
   ═══════════════════════════════════════════ */

/* Inline tag pills on password rows / cards. */
.pw-tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.pw-tag-pill {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}

/* User cards are clickable to open the access panel. */
.user-card.user-card-clickable { cursor: pointer; }
.user-card.user-card-clickable:hover {
  border-color: var(--accent-tint);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.user-card-manage-hint {
  font-size: 10px;
  color: var(--accent-active);
  margin-top: 6px;
}

/* Password picker list inside the user-access modal. */
.access-picker-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.access-picker-toolbar .filter-search { flex: 1; min-width: 160px; }
.access-picker-list {
  max-height: 46vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
}
.access-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.access-picker-row:last-child { border-bottom: none; }
.access-picker-row:hover { background: var(--surface-2); }
.access-picker-row input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; }
.access-picker-main { flex: 1; min-width: 0; }
.access-picker-name { font-size: 13px; font-weight: 500; }
.access-picker-sub { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.access-picker-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 12px; }
.access-picker-count {
  font-size: 11px;
  color: var(--muted);
  margin-right: auto;
}

/* Access matrix: selection layer + sticky action bar. */
.matrix-tag-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.matrix-action-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}
.matrix-action-bar .matrix-sel-info { font-size: 12px; color: var(--muted); margin-right: auto; }
.access-matrix th .matrix-col-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.access-matrix .matrix-cell-check { width: 15px; height: 15px; cursor: pointer; }
