:root {
  --bg-page: #F7F8FA;
  --bg-surface: #FFFFFF;
  --bg-sidebar: #1B2332;
  --bg-sidebar-hover: #253044;
  --bg-sidebar-active: #2D3A50;
  --text-primary: #1A1D23;
  --text-secondary: #5F6B7A;
  --text-on-dark: #E2E6EC;
  --text-muted: #9CA3AF;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-soft: #EFF6FF;
  --success: #059669;
  --success-soft: #ECFDF5;
  --warning: #D97706;
  --warning-soft: #FFFBEB;
  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --location-bg: #E0F2F1;
  --location-text: #0D9488;
  --location-border: #99D7D3;
  --location-multi-bg: var(--warning-soft);
  --location-multi-text: var(--warning);
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --divider: #F3F4F6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --focus-ring: 0 0 0 3px rgba(37,99,235,0.25);
  --topbar-bg: rgba(247,248,250,0.92);
  --theme-transition: 180ms ease;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --sidebar-w: 320px;
  --sidebar-min: 240px;
  --sidebar-max: 480px;
  --transition-resize: 200ms;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html.theme-dark {
  --bg-page: #0F1419;
  --bg-surface: #1A1F26;
  --bg-sidebar: #1A1F26;
  --bg-sidebar-hover: #23282F;
  --bg-sidebar-active: #2A3038;
  --text-primary: #E6EAEF;
  --text-secondary: #9BA3AC;
  --text-on-dark: #E6EAEF;
  --text-muted: #6B7280;
  --accent: #4C7FE8;
  --accent-hover: #3B6DD6;
  --accent-soft: rgba(76, 127, 232, 0.15);
  --success: #10B981;
  --success-soft: rgba(16, 185, 129, 0.15);
  --warning: #F59E0B;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger: #EF4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --location-bg: rgba(20, 184, 166, 0.18);
  --location-text: #5EEAD4;
  --location-border: rgba(45, 212, 191, 0.4);
  --location-multi-bg: rgba(245, 158, 11, 0.18);
  --location-multi-text: #FCD34D;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --divider: rgba(255, 255, 255, 0.06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --focus-ring: 0 0 0 3px rgba(76, 127, 232, 0.35);
  --topbar-bg: rgba(26, 31, 38, 0.85);
  color-scheme: dark;
}

html {
  color-scheme: light;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

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

body {
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-page);
}

body,
.sidebar,
.topbar,
.client-summary,
.password-card,
.doc-card,
.search-dropdown,
.search-recent,
.search-filters,
.result-card,
.contact-card,
.login-card,
.login-field input,
.btn,
.logout-btn,
.pagination-btn,
input,
select {
  transition: background-color var(--theme-transition),
              color var(--theme-transition),
              border-color var(--theme-transition),
              box-shadow var(--theme-transition);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

input, select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--bg-surface);
  color: var(--text-primary);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

svg.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg.icon-sm { width: 14px; height: 14px; }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
              width var(--transition-resize) ease;
}

.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 101;
  transition: background-color 0.2s ease;
  background: transparent;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.is-resizing {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.05) 0%,
    rgba(255,255,255,0.15) 50%,
    rgba(255,255,255,0.05) 100%
  );
}

.sidebar-resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 40px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 1px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.is-resizing::after {
  opacity: 1;
}

html.theme-dark .sidebar-resize-handle:hover,
html.theme-dark .sidebar-resize-handle.is-resizing {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.03) 0%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0.03) 100%
  );
}

body.is-resizing {
  cursor: col-resize;
  user-select: none;
}

.sidebar-header { padding: 20px 20px 16px; }

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  letter-spacing: -0.5px;
}

.logo-text {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.3px;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -2px;
  /* Removed from HTML per Maya's UX analysis - kept for reference */
}

.search-wrapper { position: relative; margin-bottom: 12px; }

.search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.search-input::placeholder { color: rgba(255,255,255,0.5); }

.search-input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.14);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: rgba(255,255,255,0.5);
}

.search-shortcut {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  color: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 3px;
  padding: 2px 6px;
  pointer-events: none;
  background: rgba(255,255,255,0.03);
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 400px;
  overflow-y: auto;
  color: var(--text-primary);
  display: none;
}

.search-dropdown.open { display: block; }

.search-group-label {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.search-result {
  padding: 8px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.1s;
}

.search-result:hover,
.search-result.focused { background: var(--accent-soft); }

.search-result-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--divider);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-result-icon svg { width: 14px; height: 14px; color: var(--text-secondary); }

.search-result-icon.client-icon { background: var(--accent-soft); }

.search-result-icon.client-icon svg { color: var(--accent); }

.search-result-text { min-width: 0; }

.search-result-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-viewall {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  text-align: center;
  border-top: 1px solid var(--border);
}

.search-viewall:hover { background: var(--accent-soft); }

.advanced-search-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 38px;
  margin: 0 20px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.advanced-search-btn:hover {
  background: rgba(255,255,255,0.10);
  border-color: var(--accent);
  color: #fff;
}

.advanced-search-btn:active {
  background: rgba(255,255,255,0.14);
  border-color: var(--accent);
}

.advanced-search-btn .icon {
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,0.7);
  transition: color 0.15s;
}

.advanced-search-btn:hover .icon {
  color: var(--accent);
}

.client-filter {
  padding: 0 20px 8px;
}

.client-filter-input {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-size: 11px;
  transition: border-color 0.15s, background 0.15s;
}

.client-filter-input:focus {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
}

.client-filter-input::placeholder {
  color: rgba(255,255,255,0.3);
}

/* Client facets removed per Maya's UX analysis - kept for reference */
.client-facets {
  display: none; /* Removed from UI */
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
}

.client-facet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
}

.client-facet input {
  width: 14px;
  height: 14px;
}

.client-list-header {
  padding: 0 20px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.client-list-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}

.client-list-count {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
}

.client-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 16px 24px 16px;
  scroll-padding-top: 40px;
}

.client-list::-webkit-scrollbar {
  width: 6px;
}

.client-list::-webkit-scrollbar-track {
  background: transparent;
}

.client-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  transition: background 0.2s ease;
}

.client-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.client-letter-group { margin-bottom: 4px; }

.client-letter {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 8px 16px 6px 16px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.6);
}

.client-letter-title { font-size: 10px; }

.client-letter-count {
  display: none;
}

.client-item {
  display: block;
  padding: 8px 16px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  transition: background-color 0.15s ease-out,
              padding-left 0.15s ease-out,
              box-shadow 0.15s ease-out;
}

.client-item:hover {
  background: var(--bg-sidebar-hover);
  text-decoration: none;
  padding-left: 18px;
}

.client-item.active {
  background: var(--bg-sidebar-active);
  border-left: 3px solid var(--accent);
  padding-left: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.client-item:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5);
}

.client-item:focus-visible {
  outline: 2px solid #2563EB;
  outline-offset: 2px;
}

.client-item:focus:not(:focus-visible) {
  box-shadow: none;
}

.client-item-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.95);
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.client-item-counts {
  display: none;
}

.count-badge {
  display: none;
}

/* Main */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left var(--transition-resize) ease;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  position: relative;
}

.sidebar-toggle:hover { background: var(--divider); }

.sidebar-toggle-bars {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 20px;
  height: 20px;
}

.sidebar-toggle .bar {
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 250ms cubic-bezier(0.4, 0, 0.2, 1),
              width 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-open .sidebar-toggle .bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
  width: 20px;
}

body.sidebar-open .sidebar-toggle .bar:nth-child(2) {
  opacity: 0;
}

body.sidebar-open .sidebar-toggle .bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
  width: 20px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--text-muted); }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }

.breadcrumb a,
.breadcrumb-current {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content {
  padding: 32px 32px 48px;
  max-width: 960px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.stats-bar {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.empty-state svg { width: 48px; height: 48px; color: var(--text-muted); margin-bottom: 16px; }
.empty-state h2 { font-size: 18px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 360px; margin: 0 auto; }
.empty-state .shortcut { display: inline-block; margin-top: 12px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 3px; font-size: 12px; color: var(--text-muted); }

/* Detail */
.client-detail-header { margin-bottom: 24px; }

.client-detail-name { font-size: 24px; font-weight: 600; margin-bottom: 6px; }

.client-detail-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.client-detail-stats .stat-chip { display: inline-flex; align-items: center; gap: 5px; }

.back-link {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  position: relative;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.tab:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(37,99,235,0.08);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.tab-count { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-left: 4px; }

.placeholder-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.placeholder-card h3 { font-size: 16px; margin-bottom: 8px; }

/* Client Summary */
.client-summary {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
}

.client-summary-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--divider);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.client-summary-body {
  padding: 16px 20px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.client-summary-section + .client-summary-section { margin-top: 16px; }

.client-summary-section h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.client-summary-list {
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.client-summary-toggle {
  font-size: 11px;
  color: var(--accent);
}


/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: all 0.15s ease-out;
}

.btn svg { width: 14px; height: 14px; }

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(0);
}

.btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: transparent;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
  padding: 6px 8px;
}

.btn-ghost:hover { color: var(--accent); background: var(--divider); }

.btn.is-disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--border);
  color: var(--text-muted);
}

/* Detail Loading/Error */
.detail-loading {
  display: grid;
  gap: 10px;
}

.detail-loading .loading-card {
  height: 64px;
  border-radius: var(--radius-md);
  background: var(--divider);
  animation: pulse 1.4s ease-in-out infinite;
}

.detail-error {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

/* Passwords */
.password-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.password-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  padding: 16px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.password-card > * { grid-column: 1; }

.password-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.password-location {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px 3px 8px;
  background: var(--location-bg);
  border: 1px solid var(--location-border);
  border-radius: 999px;
  color: var(--location-text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.password-location-icon {
  flex-shrink: 0;
  color: var(--location-text);
  opacity: 0.8;
}

.password-location-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.password-location--multiple {
  background: var(--location-multi-bg);
  border-color: var(--warning);
  color: var(--location-multi-text);
}

.password-location--multiple .password-location-icon {
  color: var(--location-multi-text);
}

.password-username {
  font-size: 12px;
  color: var(--text-secondary);
}

.password-source {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.password-value-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.password-value {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 14px;
  background: var(--divider);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.password-value.masked {
  letter-spacing: 2px;
  color: var(--text-muted);
}

.password-countdown {
  font-size: 12px;
  color: var(--warning);
}

.password-timer {
  grid-column: 1 / -1;
  height: 3px;
  background: var(--divider);
  border-radius: 999px;
  overflow: hidden;
}

.password-timer-bar {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transition: width 0.6s linear;
}

.password-actions {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

/* ===== Inline Password Masking ===== */

.inline-secret {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--divider);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: inherit;
  line-height: inherit;
  cursor: pointer;
  user-select: none;
  min-height: 24px;
  transition: border-color 150ms ease, background 200ms ease-out;
}

.inline-secret:hover {
  border-color: var(--accent);
}

.inline-secret:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.inline-secret:focus:not(:focus-visible) {
  outline: none;
}

.inline-secret.is-revealed {
  background: var(--accent-soft);
  border-color: var(--accent);
  flex-wrap: wrap;
}

.inline-secret-value {
  font-family: inherit;
  font-size: inherit;
  color: var(--text-primary);
  white-space: nowrap;
  transition: color 150ms ease, letter-spacing 150ms ease;
}

.inline-secret:not(.is-revealed) .inline-secret-value {
  letter-spacing: 2px;
  color: var(--text-muted);
}

.inline-secret-countdown {
  font-family: var(--font-family);
  font-size: 11px;
  color: var(--warning);
  white-space: nowrap;
  margin-left: 2px;
  animation: fadeIn 200ms ease-out;
}

.inline-secret:not(.is-revealed) .inline-secret-countdown {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: translateX(0); }
}

.inline-secret-timer {
  flex-basis: 100%;
  height: 3px;
  background: var(--divider);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}

.inline-secret:not(.is-revealed) .inline-secret-timer {
  display: none;
}

.inline-secret-timer-bar {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transition: width 1s linear;
}

.inline-secret-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid transparent;
  color: var(--text-muted);
  background: transparent;
  padding: 0;
}

.inline-secret-copy .icon {
  width: 12px;
  height: 12px;
}

.inline-secret-copy:hover {
  border-color: var(--border);
  color: var(--accent);
  background: #fff;
}

.inline-secret-copy.is-copied {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-soft);
}

.inline-secret-location {
  display: inline-flex;
  align-items: baseline;
  padding: 1px 5px;
  margin-left: 3px;
  background: var(--location-bg);
  border-radius: 3px;
  color: var(--location-text);
  font-size: 10px;
  font-weight: 500;
  font-family: var(--font-family);
  line-height: 1.4;
  max-width: 60px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: baseline;
}

.inline-secret-location--multiple {
  background: var(--location-multi-bg);
  color: var(--location-multi-text);
}

@media (max-width: 768px) {
  .inline-secret {
    padding: 4px 10px;
    min-height: 28px;
  }

  .password-location {
    max-width: 200px;
    font-size: 11px;
    padding: 2px 8px 2px 6px;
  }

  .inline-secret-location {
    font-size: 9px;
    max-width: 50px;
  }
}

@media (max-width: 480px) {
  .inline-secret-value {
    white-space: normal;
    word-break: break-all;
  }

  .password-location {
    max-width: 150px;
  }

  .inline-secret-location {
    font-size: 9px;
    max-width: 40px;
    padding: 1px 4px;
  }
}

@media print {
  .inline-secret {
    cursor: default !important;
    pointer-events: none !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
  }
  
  .inline-secret-value {
    letter-spacing: 2px !important;
    color: #666 !important;
  }
  
  .inline-secret-value::before {
    content: '••••••••' !important;
  }
  
  .inline-secret-countdown,
  .inline-secret-timer,
  .inline-secret-copy {
    display: none !important;
  }
}

@media (prefers-contrast: high) {
  .inline-secret {
    border: 2px solid currentColor;
  }
  
  .inline-secret.is-revealed {
    border-color: LinkText;
  }
}

@media (prefers-reduced-motion: reduce) {
  .inline-secret,
  .inline-secret-value,
  .inline-secret-countdown,
  .inline-secret-timer-bar {
    transition: none !important;
    animation: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .sidebar,
  .topbar,
  .client-summary,
  .password-card,
  .doc-card,
  .search-dropdown,
  .search-recent,
  .search-filters,
  .result-card,
  .contact-card,
  .login-card,
  .login-field input,
  .btn,
  .logout-btn,
  .pagination-btn,
  input,
  select,
  .theme-toggle .icon {
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

table td .inline-secret,
table th .inline-secret {
  vertical-align: baseline;
}

h1 .inline-secret,
h2 .inline-secret,
h3 .inline-secret,
h4 .inline-secret,
h5 .inline-secret,
h6 .inline-secret {
  font-size: 0.8em;
  vertical-align: middle;
}

.inline-secret * {
  box-sizing: border-box;
}

/* Documents */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.doc-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.doc-card-title {
  font-size: 14px;
  font-weight: 600;
}

.doc-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.doc-snippet {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.doc-snippet .inline-secret {
  font-size: 12px;
  padding: 2px 8px;
  vertical-align: baseline;
}

.doc-snippet .inline-secret-location {
  font-size: 9px;
  max-width: 50px;
  padding: 1px 4px;
}

.doc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Contacts */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.contact-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.contact-group-header {
  padding: 10px 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.contact-group-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--divider);
}

.contact-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow 0.2s;
}

.contact-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

.contact-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.contact-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.contact-detail-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.contact-detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.contact-detail-value {
  font-size: 14px;
  color: var(--text-primary);
}

.contact-detail-row a {
  color: var(--accent);
  text-decoration: none;
}

.contact-detail-row a:hover { text-decoration: underline; }

.contact-copy-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-surface);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.contact-copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.contact-copy-btn.is-copied {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-soft);
}

.contact-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--divider);
}

.contact-warning {
  font-size: 13px;
  color: var(--warning);
  font-style: italic;
  margin-top: 8px;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; }

/* Document Viewer */
.doc-viewer {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.doc-viewer.open { display: flex; }

.doc-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.doc-viewer-panel {
  position: relative;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(1200px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

.doc-viewer-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 8px;
  border-bottom: 1px solid var(--divider);
}

.doc-viewer-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.doc-viewer-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.doc-viewer-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.doc-viewer-actions {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--divider);
}

.doc-viewer-tools {
  display: flex;
  gap: 8px;
  padding: 8px 20px 12px;
  border-bottom: 1px solid var(--divider);
  flex-wrap: wrap;
}

.doc-viewer-main {
  display: flex;
  min-height: 0;
  flex: 1;
}

.doc-viewer-toc {
  width: 220px;
  padding: 16px;
  border-right: 1px solid var(--divider);
  background: #fafbfc;
  overflow-y: auto;
}

.doc-toc-link {
  display: block;
  padding: 6px 8px;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.doc-toc-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.doc-toc-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.doc-toc-empty {
  font-size: 12px;
  color: var(--text-muted);
}

.doc-viewer-body {
  overflow-y: auto;
  padding: 24px 32px 32px;
  flex: 1;
}

.doc-viewer-content {
  max-width: 800px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
}

.doc-viewer-content p { margin-bottom: 14px; }

.doc-viewer-content a {
  color: var(--accent);
  text-decoration: underline;
}

.doc-viewer-content h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 28px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--divider);
}

.doc-viewer-content h2:first-child {
  margin-top: 0;
}

.doc-viewer-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 10px;
}

.doc-section {
  margin-bottom: 24px;
}

.doc-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.doc-section-title {
  margin: 0;
}

.doc-section-toggle {
  font-size: 12px;
}

.doc-section-body.hidden {
  display: none;
}

.doc-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 14px 0 8px;
}

.doc-kv {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--divider);
}

.doc-kv-list {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 2fr;
  gap: 10px 20px;
  padding: 16px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 16px 0;
}

.doc-kv-list dt {
  font-weight: 600;
  color: var(--text-secondary);
}

.doc-kv-list dd {
  margin: 0;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  color: var(--text-primary);
}

.doc-table-wrap {
  overflow-x: auto;
  margin: 16px 0 20px;
}

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

.doc-table th {
  background: var(--divider);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border-strong);
  font-weight: 600;
}

.doc-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.doc-table tr:hover { background: #f9fafb; }

.doc-code {
  background: #1f2937;
  color: #f9fafb;
  padding: 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.6;
  margin: 16px 0 20px;
}

.doc-list {
  padding-left: 22px;
  margin: 10px 0 16px;
}

.doc-list li {
  margin-bottom: 6px;
}

.doc-kv-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.doc-kv-value { color: var(--text-primary); }

.doc-empty { color: var(--text-muted); }

.doc-print-header {
  display: none;
}

.doc-print-container {
  display: none;
}

/* ===== Tab Filter ===== */
.tab-filter {
  position: relative;
  margin-bottom: 12px;
}

.tab-filter-input {
  width: 100%;
  height: 36px;
  padding: 0 80px 0 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: var(--bg-surface);
  color: var(--text-primary);
}

.tab-filter-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.tab-filter-input::placeholder {
  color: var(--text-muted);
}

.tab-filter-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.tab-filter-clear {
  position: absolute;
  right: 62px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: none;
  align-items: center;
  justify-content: center;
}

.tab-filter-clear:hover {
  color: var(--text-primary);
  background: var(--divider);
}

.tab-filter.has-value .tab-filter-clear {
  display: flex;
}

.tab-filter-count {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
  white-space: nowrap;
}

/* Location Filter */
.location-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 8px 0;
}

.location-filter-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.location-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.location-pill {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.location-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.location-pill-active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.location-pill-active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: white;
}

/* ===== Tab Index - Removed per Maya's UX analysis ===== */
/* Users found A-Z navigation created unnecessary scrolling */
/* Tab filter input provides better UX for finding items */
.tab-index {
  display: none; /* Removed from UI */
  flex-wrap: wrap;
  gap: 2px;
  padding: 0 0 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--divider);
}

.tab-index-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: background 0.1s, color 0.1s;
  cursor: pointer;
}

.tab-index-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.tab-index-btn.active {
  background: var(--accent);
  color: white;
}

.tab-index-btn.disabled {
  color: var(--text-muted);
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

/* ===== Group Headers ===== */
.password-group,
.doc-group {
  display: flex;
  flex-direction: column;
}

.password-group {
  gap: 10px;
  margin-bottom: 8px;
}

.doc-group {
  gap: 12px;
  margin-bottom: 8px;
}

.password-group-header,
.doc-group-header {
  padding: 10px 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.password-group-header::after,
.doc-group-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--divider);
}

/* ===== Tab Empty State ===== */
.tab-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.tab-empty-state svg {
  display: block;
  margin: 0 auto 8px;
  width: 32px;
  height: 32px;
  color: var(--text-muted);
}

.tab-empty-state strong {
  color: var(--text-secondary);
}

/* Search (Full Page) */
.search-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.search-page-title {
  font-size: 24px;
  font-weight: 600;
}

.search-input-area {
  position: relative;
  margin-bottom: 12px;
}

.search-input-large {
  width: 100%;
  height: 56px;
  padding: 16px 16px 16px 46px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 18px;
  color: var(--text-primary);
  background: var(--bg-surface);
}

.search-input-large:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.search-icon-large {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.search-status {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.search-recent {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.search-recent h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.search-recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-recent button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-surface);
}

.search-recent button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.search-filters {
  padding: 20px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  display: grid;
  gap: 16px;
}

.filter-group-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.filter-radio-group {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

.filter-date-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-date {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.result-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  background: #fafcff;
}

.result-card.focused {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  background: var(--accent-soft);
}

.result-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--divider);
}

.result-card-icon.doc { background: #EFF6FF; color: var(--accent); }
.result-card-icon.password { background: #FFF7ED; color: var(--warning); }
.result-card-icon.contact { background: #EFF6FF; color: var(--accent); }

.result-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.result-card-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.result-card-client {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: inline-flex;
}

.result-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.result-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.result-card-preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.result-card-preview mark,
.result-card-title mark {
  background: #FEF3C7;
  color: #92400E;
  padding: 1px 4px;
  border-radius: 3px;
}

.search-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.pagination-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-surface);
}

.pagination-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-ellipsis {
  padding: 6px 4px;
  color: var(--text-muted);
}

/* === Dark theme overrides === */
html.theme-dark .topbar {
  border-bottom: 1px solid var(--border-strong);
}

html.theme-dark .search-dropdown {
  background: #23282F;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}

html.theme-dark .search-result:hover,
html.theme-dark .search-result.focused {
  background: rgba(76, 127, 232, 0.12);
}

html.theme-dark .client-item.active {
  color: #fff;
}

html.theme-dark .client-list-title,
html.theme-dark .client-list-count {
  color: rgba(255, 255, 255, 0.5);
}

html.theme-dark .password-value {
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
}

html.theme-dark .password-value.masked {
  color: var(--text-muted);
}

html.theme-dark .password-timer {
  background: rgba(255, 255, 255, 0.04);
}

html.theme-dark .password-timer-bar {
  background: var(--warning);
}

html.theme-dark .login-overlay {
  background: var(--bg-page);
}

html.theme-dark .login-field input {
  background: rgba(0, 0, 0, 0.25);
}

html.theme-dark .login-field input:focus {
  background: rgba(0, 0, 0, 0.35);
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

html.theme-dark .inline-secret-copy:hover {
  background: rgba(255, 255, 255, 0.06);
}

html.theme-dark .result-card:hover {
  background: rgba(76, 127, 232, 0.08);
}

html.theme-dark .result-card.focused {
  background: rgba(76, 127, 232, 0.12);
}

html.theme-dark .result-card-icon.doc,
html.theme-dark .result-card-icon.contact {
  background: rgba(76, 127, 232, 0.18);
  color: #6B9BF5;
}

html.theme-dark .result-card-icon.password {
  background: rgba(245, 158, 11, 0.18);
  color: var(--warning);
}

html.theme-dark .result-card-badge {
  background: var(--accent-soft);
  color: #6B9BF5;
  border: 1px solid rgba(76, 127, 232, 0.25);
}

html.theme-dark mark,
html.theme-dark .search-result-preview mark,
html.theme-dark .result-card-title mark,
html.theme-dark .result-card-preview mark {
  background: rgba(245, 158, 11, 0.3);
  color: #FCD34D;
  padding: 2px 4px;
  border-radius: 3px;
}

html.theme-dark .doc-viewer-panel {
  background: var(--bg-surface);
}

html.theme-dark .doc-viewer-toc {
  background: rgba(0, 0, 0, 0.2);
}

html.theme-dark .doc-kv-list {
  background: rgba(0, 0, 0, 0.2);
  border-color: var(--border);
}

/* Utilities */
.hidden { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skeleton-group {
  padding: 12px 8px;
}

.skeleton-line {
  height: 40px;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.08) 0%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0.08) 100%
  );
  background-size: 200% 100%;
  border-radius: 6px;
  margin-bottom: 10px;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-line:nth-child(2) { width: 70%; }
.skeleton-line:nth-child(3) { width: 60%; }

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 0.9; }
  100% { opacity: 0.6; }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Enhanced Accessibility - Focus States ===== */
/* Focus visible for keyboard navigation */
.sidebar a:focus-visible,
.sidebar button:focus-visible,
.sidebar input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar a:focus:not(:focus-visible),
.sidebar button:focus:not(:focus-visible),
.sidebar input:focus:not(:focus-visible) {
  outline: none;
}

/* Mobile */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 90;
  -webkit-tap-highlight-color: transparent;
}

body.sidebar-open .overlay { opacity: 1; pointer-events: auto; }

body.sidebar-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  :root { --sidebar-w: 100vw; }
  .sidebar {
    width: var(--sidebar-w);
    max-width: 100vw;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.24);
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  :root { --sidebar-w: min(100vw, 420px); }
  .sidebar {
    width: var(--sidebar-w);
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.24);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  :root { --sidebar-w: 280px; }
  .content { padding: 20px 24px 40px; }
}

@media (min-width: 1025px) {
  :root { --sidebar-w: 320px; }
}

@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
  }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.24);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar {
    padding: 8px 16px;
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .breadcrumb {
    flex: 1 1 100%;
    order: 2;
  }

  .topbar-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    order: 3;
  }
  .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar-toggle { width: 44px; height: 44px; }
  .sidebar-resize-handle { display: none; }

  /* Tab index already hidden by display: none in main styles */
  .tab-index {
    display: none;
  }

  /* Stack stats vertically */
  .stats-bar {
    flex-direction: column;
    gap: 12px;
  }
  
  /* Reduce client detail stats */
  .client-detail-stats {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  /* Reduce tab padding */
  .tab {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  /* Filter inputs full width with better touch targets */
  .tab-filter-input,
  .client-filter-input,
  .search-input {
    height: 44px; /* iOS minimum for touch */
  }

  .client-item {
    min-height: 44px;
    padding: 12px 20px;
  }

  .content {
    padding: 20px 16px 32px;
    max-width: 100%;
  }

  .doc-viewer {
    padding: 12px;
  }

  .doc-viewer-panel {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: calc(100vh - 24px);
    margin: 0 auto;
    border-radius: var(--radius-lg);
  }

  .doc-viewer-toc {
    display: none;
  }

  .doc-viewer-body {
    padding: 20px;
  }

  .doc-viewer-content {
    max-width: 100%;
  }

  .doc-kv-list {
    grid-template-columns: 1fr;
  }

  .contact-card { padding: 12px; }
  .contact-name { font-size: 14px; }
  .contact-detail-row { font-size: 12px; }

  .search-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .search-filters {
    padding: 16px;
  }

  .filter-date-group {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .topbar-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-user {
    display: none;
  }

  .logout-btn {
    padding: 4px 8px;
    font-size: 11px;
  }

  .doc-viewer {
    padding: 0;
  }

  .doc-viewer-panel {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }
}

@media print {
  html.theme-dark {
    --bg-page: #FFFFFF;
    --bg-surface: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-muted: #555555;
    --border: #CCCCCC;
    --border-strong: #AAAAAA;
    --divider: #E5E5E5;
  }

  body > *:not(.doc-print-container) {
    display: none !important;
  }

  .doc-print-container {
    display: block !important;
    position: static !important;
    overflow: visible !important;
    max-height: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
  }

  @page {
    size: letter;
    margin: 20mm;
  }

  .doc-print-container {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 11pt;
    line-height: 1.5;
    color: black;
  }

  .doc-print-header {
    display: block !important;
    padding: 12pt 0 8pt;
    margin-bottom: 16pt;
    border-bottom: 2pt solid #333;
  }

  .doc-print-header h1 {
    font-size: 18pt;
    margin: 0 0 4pt;
  }

  .doc-print-header .meta {
    font-size: 10pt;
    color: #666;
  }

  .doc-print-container h2 {
    font-size: 16pt;
    margin-top: 16pt;
    margin-bottom: 6pt;
    page-break-after: avoid;
    border-bottom: 1pt solid #ccc;
    padding-bottom: 4pt;
  }

  .doc-print-container h3 {
    font-size: 13pt;
    margin-top: 12pt;
    margin-bottom: 6pt;
    page-break-after: avoid;
  }

  .doc-print-container p {
    margin-bottom: 8pt;
    orphans: 3;
    widows: 3;
  }

  .doc-print-container table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12pt;
    page-break-inside: avoid;
  }

  .doc-print-container th,
  .doc-print-container td {
    border: 1pt solid #999;
    padding: 6pt;
  }

  .doc-print-container pre {
    page-break-inside: avoid;
    border: 1pt solid #999;
    padding: 8pt;
    background: #f5f5f5 !important;
    font-family: "Courier New", monospace;
    font-size: 9pt;
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  .doc-print-container a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }

  .doc-print-footer {
    margin-top: 20pt;
    font-size: 9pt;
    color: #666;
    border-top: 1pt solid #ccc;
    padding-top: 6pt;
  }
}

/* === Login overlay === */

/* Hide sidebar and main instantly before JS loads to prevent content flash */
html.auth-pending .sidebar,
html.auth-pending .main {
  display: none !important;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-sidebar);
  transition: opacity 0.3s ease;
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px 32px;
  text-align: center;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.login-logo .logo-mark {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.login-logo .logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 13px;
}

.login-field {
  text-align: left;
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-page);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.login-field input::placeholder {
  color: var(--text-muted);
}

.login-error {
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  text-align: left;
}

.login-error.hidden {
  display: none;
}

.login-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 0.15s;
}

.login-btn:hover {
  background: var(--accent-hover);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Topbar user / logout */

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  background: var(--divider);
  color: var(--text-primary);
  border-color: var(--border);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle .icon {
  width: 16px;
  height: 16px;
  position: absolute;
  transition: opacity var(--theme-transition), transform var(--theme-transition);
}

.theme-toggle .icon-sun {
  opacity: 0;
  transform: scale(0.9) rotate(-10deg);
}

.theme-toggle .icon-moon {
  opacity: 1;
  transform: scale(1);
}

html.theme-dark .theme-toggle .icon-sun {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

html.theme-dark .theme-toggle .icon-moon {
  opacity: 0;
  transform: scale(0.9) rotate(10deg);
}

.topbar-user {
  font-size: 13px;
  color: var(--text-secondary);
}

.logout-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-family: var(--font-family);
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.logout-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}
