/* ================================================
   dPass Web — Styles
   ================================================ */

/* --- Theme Variables --- */
:root,
[data-theme="dark"] {
  --bg-0: #0b0f19;
  --bg-1: #111827;
  --bg-2: #1f2937;
  --bg-3: #374151;
  --bg-hover: #293548;
  --text-1: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --border: #1e293b;
  --border-light: #334155;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-muted: rgba(59,130,246,.12);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --warning: #eab308;
  --shadow: 0 4px 24px rgba(0,0,0,.35);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.25);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --transition: .18s ease;
}

[data-theme="light"] {
  --bg-0: #f1f5f9;
  --bg-1: #ffffff;
  --bg-2: #f8fafc;
  --bg-3: #e2e8f0;
  --bg-hover: #e0e7ef;
  --text-1: #0f172a;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-muted: rgba(37,99,235,.08);
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --warning: #ca8a04;
  --shadow: 0 4px 24px rgba(0,0,0,.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; height: 100%; height: 100dvh; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-0);
  color: var(--text-1);
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}
a { color: var(--accent); text-decoration: none; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }
input, textarea, select { font-size: 16px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* --- Utility --- */
.hidden { display: none !important; }
.text-secondary { color: var(--text-2); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: .5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* --- View container --- */
.view { display: none; width: 100%; height: 100vh; height: 100dvh; }
.view:not(.hidden) { display: flex; }

/* ================================================
   LOGIN VIEW
   ================================================ */
#login-view,
#free-plan-view {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-0);
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem 2rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo svg { margin-bottom: .75rem; }
.login-logo h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; }
.login-logo p { font-size: .9rem; }

/* Login footer */
.login-footer {
  margin-top: 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.login-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.login-footer-links a {
  color: var(--text-3);
  font-size: .75rem;
  text-decoration: none;
  transition: color var(--transition);
}
.login-footer-links a:hover { color: var(--accent); }
.login-footer-dot { color: var(--border-light); font-size: .6rem; }
.login-footer-copy {
  font-size: .68rem;
  color: var(--text-3);
  opacity: .6;
}

/* SSO buttons */
.sso-buttons { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.sso-btn {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  width: 100%; padding: .65rem 1rem;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; font-size: .88rem; font-weight: 500;
  color: var(--text); cursor: pointer; transition: border-color .18s, background .18s;
}
.sso-btn:hover { border-color: var(--sso-color, var(--accent)); background: rgba(255,255,255,.04); }
.sso-btn svg { flex-shrink: 0; }
[data-theme="light"] .sso-btn { background: #fff; border-color: #e2e8f0; color: #1e293b; }
[data-theme="light"] .sso-btn:hover { border-color: var(--sso-color, var(--accent)); background: #f8fafc; }
.sso-divider {
  display: flex; align-items: center; gap: .75rem;
  margin: .75rem 0; color: var(--text-3); font-size: .78rem;
}
.sso-divider::before, .sso-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Auth tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: .6rem 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-3);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.auth-tab:hover { color: var(--text-2); }
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Plan badges */
.plan-badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  vertical-align: middle;
}
.plan-free { background: rgba(100,116,139,.15); color: #94a3b8; }
.plan-premium { background: rgba(59,130,246,.15); color: #60a5fa; }
.plan-families { background: rgba(139,92,246,.15); color: #a78bfa; }
.plan-teams { background: rgba(234,179,8,.15); color: #facc15; }

/* Plan management cards */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-top: 1rem;
}
.plan-card {
  padding: 1.25rem;
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
}
.plan-card:hover { border-color: var(--accent); background: var(--bg-hover); }
.plan-card.plan-current { border-color: var(--accent); }
.plan-card.plan-unavailable { opacity: .5; cursor: not-allowed; }
.plan-card-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .2rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.plan-card-price {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: .35rem;
}
.plan-card-price span { font-size: .8rem; font-weight: 400; color: var(--text-3); }
.plan-card-features {
  font-size: .78rem;
  color: var(--text-3);
  line-height: 1.5;
  flex: 1;
}
.plan-current-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: .15rem .45rem;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
}
.plan-action-row {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.plan-cancel-link {
  font-size: .85rem;
  color: var(--text-3);
  cursor: pointer;
  border: none;
  background: none;
  transition: color var(--transition);
}
.plan-cancel-link:hover { color: var(--danger); }

/* Limit warning banner */
.limit-bar {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  line-height: 1.45;
  margin: .25rem .25rem .5rem;
}
.limit-bar > svg { flex-shrink: 0; }
.limit-bar > span { flex: 1; }
.limit-bar.limit-warn {
  background: rgba(234,179,8,.08);
  border: 1px solid rgba(234,179,8,.2);
  color: var(--warning);
}
.limit-bar.limit-full {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.2);
  color: var(--danger);
}
.limit-bar strong { color: inherit; }
.limit-bar-track {
  width: 60px;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.limit-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .3s ease;
}
.limit-bar a { color: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.feature-gated {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .6rem;
  background: rgba(234,179,8,.08);
  border: 1px solid rgba(234,179,8,.2);
  border-radius: var(--radius-sm);
  font-size: .75rem;
  color: var(--warning);
  margin-top: .25rem;
}

/* ================================================
   MAIN LAYOUT
   ================================================ */
#main-view {
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  height: var(--topbar-h);
  padding: 0 1rem;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 20;
}
.menu-toggle { display: flex; z-index: 25; position: relative; flex-shrink: 0; }
.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 480px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: .5rem .75rem .5rem 2.25rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  transition: border var(--transition);
}
.search-input:focus { border-color: var(--accent); outline: none; }
.search-input::placeholder { color: var(--text-3); }
.top-bar-actions { display: flex; gap: .5rem; margin-left: auto; align-items: center; }

/* Admin link */
.admin-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  background: rgba(139,92,246,.1);
  border: 1px solid rgba(139,92,246,.25);
  border-radius: 999px;
  color: #a78bfa;
  font-size: .72rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: .02em;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.admin-link:hover { background: rgba(139,92,246,.2); border-color: rgba(139,92,246,.5); text-decoration: none; }
.admin-link svg { flex-shrink: 0; }

/* Icon buttons */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--bg-3); color: var(--text-1); }

/* Account menu dropdown */
.acct-menu { position: relative; }
.acct-avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border);
  background: linear-gradient(135deg, var(--accent), #8b5cf6); color: #fff;
  font-size: .8rem; font-weight: 700; display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.acct-avatar:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.acct-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 240px;
  background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.2); overflow: hidden; z-index: 100;
  animation: acctDdIn .15s ease;
}
@keyframes acctDdIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; } }
.acct-dd-header { padding: .85rem 1rem; }
.acct-dd-name { font-size: .85rem; font-weight: 600; color: var(--text-1); }
.acct-dd-email { font-size: .72rem; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.acct-dd-divider { height: 1px; background: var(--border); margin: 0; }
.acct-dd-item {
  display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem 1rem;
  background: none; border: none; color: var(--text-2); font-size: .82rem; cursor: pointer;
  transition: background .1s, color .1s; text-align: left; font-family: inherit;
}
.acct-dd-item:hover { background: var(--bg-2); color: var(--text-1); }
.acct-dd-item svg { flex-shrink: 0; }
.acct-dd-danger { color: #ef4444; }
.acct-dd-danger:hover { background: rgba(239,68,68,.08); color: #f87171; }

/* Sidebar */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .85rem 1rem .5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -.01em;
}
.sidebar-logo svg { flex-shrink: 0; }
.sidebar.collapsed .sidebar-logo span { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: .85rem .25rem .5rem; }
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 15;
  transition: transform .25s ease;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: .5rem;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .55rem .75rem;
  min-height: 44px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: .875rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-1); }
.nav-item.active { background: var(--accent-muted); color: var(--accent); font-weight: 600; }
.nav-item svg { flex-shrink: 0; }
.nav-count {
  margin-left: auto;
  font-size: .75rem;
  color: var(--text-3);
  min-width: 20px;
  text-align: right;
}
.nav-divider { height: 1px; background: var(--border); margin: .4rem .75rem; }
.nav-section-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: .5rem .75rem .15rem; }
.sidebar.collapsed .nav-section-label { display: none; }

/* Sidebar collapsed (desktop) */
.sidebar.collapsed {
  width: 56px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar.collapsed::-webkit-scrollbar { display: none; }
.sidebar.collapsed .sidebar-nav { padding: .5rem .25rem; }
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: .55rem 0;
  position: relative;
}
.sidebar.collapsed .nav-item > span { display: none; }
.sidebar.collapsed .nav-item > .nav-count {
  display: flex;
  position: absolute;
  top: 2px;
  right: 2px;
  margin: 0;
  min-width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  font-weight: 700;
  background: var(--bg-3);
  border-radius: 999px;
  padding: 0 3px;
  color: var(--text-2);
}
.sidebar.collapsed .nav-item.active > .nav-count { background: var(--accent-muted); color: var(--accent); }
.sidebar.collapsed .nav-item > .nav-count:empty { display: none; }
.sidebar.collapsed .nav-divider { margin: .4rem .35rem; }
.sidebar.collapsed .nav-item[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  padding: .3rem .6rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .78rem;
  color: var(--text-1);
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
}
.content { transition: margin-left .25s ease; }
.sidebar-collapsed .content { margin-left: 56px; }

/* Content */
.content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  flex-shrink: 0;
}
.content-header h2 { font-size: 1.2rem; font-weight: 600; }

/* Special view: block layout so sticky headers work inside scroll container */
.content-body.scrollable {
  display: block;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Reusable full-page view container for special views */
.view-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  width: 100%;
}
.view-page-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-0);
  padding: 1.75rem 0 0;
}
.view-page-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: .25rem;
}
.view-page-sub {
  font-size: .85rem;
  color: var(--text-3);
  line-height: 1.5;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.view-page-header .view-page-title:last-child {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.content-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.content-body > .empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Item List */
.item-list {
  width: 320px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: .5rem;
  flex-shrink: 0;
}
.item-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .75rem;
  min-height: 52px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.item-card:hover { background: var(--bg-hover); }
.item-card.active { background: var(--accent-muted); }
.item-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-2);
}
.item-card.active .item-card-icon { background: var(--accent); color: #fff; }
.item-card-info { flex: 1; min-width: 0; }
.item-card-title {
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-card-sub {
  font-size: .78rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-card-star {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: .7rem;
  color: var(--warning);
}
.item-card-actions {
  display: flex;
  gap: .2rem;
  opacity: 0;
  transition: opacity .15s;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: .25rem;
}
.item-card:hover .item-card-actions { opacity: 1; }
.item-copy-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--bg-3);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  padding: 0;
}
.item-copy-btn:hover { background: var(--accent); color: #fff; }
.item-card-favicon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.item-card-favicon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}
.item-card-favicon img[src=""], .item-card-favicon img:not([src]) { display: none; }
.pw-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: .35rem;
  vertical-align: middle;
  flex-shrink: 0;
}
.travel-banner {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  background: rgba(234,179,8,.1);
  border-bottom: 1px solid rgba(234,179,8,.2);
  color: #facc15;
  font-size: .8rem;
  font-weight: 500;
}
.travel-banner svg { flex-shrink: 0; }
.travel-banner .btn { margin-left: auto; font-size: .72rem; padding: .15rem .5rem; min-height: 0; }
.travel-hide-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  color: var(--text-3);
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: 6px;
  transition: background .15s;
  border: none;
  background: none;
}
.travel-hide-toggle:hover { background: var(--bg-hover); }
.travel-hide-toggle.active { color: #facc15; }

/* Item Detail */
.item-detail {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 1rem;
  color: var(--text-3);
}
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.detail-title { font-size: 1.35rem; font-weight: 600; }
.detail-category {
  display: inline-block;
  padding: .2rem .6rem;
  background: var(--accent-muted);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: .3rem;
}
.detail-actions { display: flex; gap: .5rem; }
.detail-fields { display: flex; flex-direction: column; gap: .1rem; }
.detail-field {
  display: flex;
  align-items: center;
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
}
.detail-field:last-child { border-bottom: none; }
.field-label {
  width: 120px;
  flex-shrink: 0;
  font-size: .8rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .03em;
  font-weight: 500;
}
.field-value {
  flex: 1;
  font-size: .9rem;
  word-break: break-all;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.field-value a { color: var(--accent); }
.field-value a:hover { text-decoration: underline; }
.field-hidden {
  font-family: monospace;
  letter-spacing: .15em;
  color: var(--text-3);
}
.field-actions { display: flex; gap: .25rem; margin-left: auto; flex-shrink: 0; }
.field-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.field-btn:hover { background: var(--bg-3); color: var(--text-1); }

/* Password History */
.history-section {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
}
.history-toggle {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  padding: .35rem .5rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  letter-spacing: .02em;
}
.history-toggle:hover { background: var(--bg-hover); color: var(--text-1); }
.history-toggle svg { transition: transform var(--transition); }
.history-toggle.open svg { transform: rotate(90deg); }
.history-entries { margin-top: .5rem; }
.history-entry {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .65rem .75rem;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  margin-bottom: .35rem;
  border: 1px solid var(--border);
}
.history-date {
  font-size: .7rem;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: .02em;
}
.history-field {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
}
.history-field-name {
  color: var(--text-3);
  text-transform: capitalize;
  min-width: 70px;
  font-size: .75rem;
}
.history-field-value {
  font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--text-2);
  letter-spacing: .03em;
  flex: 1;
  word-break: break-all;
}
.history-field-value.masked {
  letter-spacing: .15em;
  color: var(--text-3);
}
.history-field-actions {
  display: flex;
  gap: .15rem;
  margin-left: auto;
  flex-shrink: 0;
}
.history-empty {
  font-size: .8rem;
  color: var(--text-3);
  padding: .5rem 0;
  font-style: italic;
}
.history-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  color: var(--accent);
  font-size: .65rem;
  font-weight: 600;
  padding: .1rem .4rem;
  border-radius: 999px;
  min-width: 18px;
}

/* Detail tags */
.detail-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.tag-badge {
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500;
}

/* Tag color palette */
.tag-c0  { background: rgba(59,130,246,.15);  color: #60a5fa; }
.tag-c1  { background: rgba(168,85,247,.15);  color: #c084fc; }
.tag-c2  { background: rgba(236,72,153,.15);  color: #f472b6; }
.tag-c3  { background: rgba(239,68,68,.15);   color: #f87171; }
.tag-c4  { background: rgba(249,115,22,.15);  color: #fb923c; }
.tag-c5  { background: rgba(234,179,8,.15);   color: #facc15; }
.tag-c6  { background: rgba(34,197,94,.15);   color: #4ade80; }
.tag-c7  { background: rgba(20,184,166,.15);  color: #2dd4bf; }
.tag-c8  { background: rgba(6,182,212,.15);   color: #22d3ee; }
.tag-c9  { background: rgba(99,102,241,.15);  color: #818cf8; }
.tag-c10 { background: rgba(244,114,182,.15); color: #f9a8d4; }
.tag-c11 { background: rgba(132,204,22,.15);  color: #a3e635; }

[data-theme="light"] .tag-c0  { background: rgba(59,130,246,.12);  color: #2563eb; }
[data-theme="light"] .tag-c1  { background: rgba(168,85,247,.12);  color: #7c3aed; }
[data-theme="light"] .tag-c2  { background: rgba(236,72,153,.12);  color: #db2777; }
[data-theme="light"] .tag-c3  { background: rgba(239,68,68,.12);   color: #dc2626; }
[data-theme="light"] .tag-c4  { background: rgba(249,115,22,.12);  color: #ea580c; }
[data-theme="light"] .tag-c5  { background: rgba(234,179,8,.12);   color: #a16207; }
[data-theme="light"] .tag-c6  { background: rgba(34,197,94,.12);   color: #16a34a; }
[data-theme="light"] .tag-c7  { background: rgba(20,184,166,.12);  color: #0d9488; }
[data-theme="light"] .tag-c8  { background: rgba(6,182,212,.12);   color: #0891b2; }
[data-theme="light"] .tag-c9  { background: rgba(99,102,241,.12);  color: #4f46e5; }
[data-theme="light"] .tag-c10 { background: rgba(244,114,182,.12); color: #be185d; }
[data-theme="light"] .tag-c11 { background: rgba(132,204,22,.12);  color: #4d7c0f; }

/* Detail meta */
.detail-meta {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: .78rem;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

/* Detail notes */
.detail-notes {
  margin-top: 1rem;
  padding: .75rem 1rem;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  white-space: pre-wrap;
  color: var(--text-2);
  line-height: 1.5;
}

/* TOTP display */
.totp-wrap {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
}
.totp-code {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 1.25rem;
  letter-spacing: .2em;
  font-weight: 600;
}
.totp-timer {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.totp-timer svg {
  width: 32px;
  height: 32px;
  transform: rotate(-90deg);
}
.totp-timer-bg {
  fill: none;
  stroke: var(--bg-3);
  stroke-width: 3;
}
.totp-timer-fill {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke .3s ease;
}
.totp-timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-2);
}
.totp-color-green { color: var(--success); }
.totp-color-yellow { color: var(--warning); }
.totp-color-red { color: var(--danger); }
.totp-stroke-green { stroke: var(--success); }
.totp-stroke-yellow { stroke: var(--warning); }
.totp-stroke-red { stroke: var(--danger); }

/* Password strength bar */
.strength-bar-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .35rem;
}
.strength-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}
.strength-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .3s ease, background .3s ease;
}
.strength-label { font-size: .75rem; font-weight: 500; min-width: 70px; }

/* ================================================
   BUTTONS
   ================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1rem;
  min-height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-3); color: var(--text-1); }
.btn-secondary:hover:not(:disabled) { background: var(--border-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-3); color: var(--text-1); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-lg { padding: .65rem 1.5rem; font-size: 1rem; }

/* ================================================
   FORMS
   ================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: 1rem;
}
.form-label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-2);
}
.form-input,
.form-select,
.form-textarea {
  padding: .55rem .75rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  transition: border var(--transition);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  outline: none;
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-3); }
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-select { cursor: pointer; }
.form-row { display: flex; gap: .75rem; }
.form-row > .form-group { flex: 1; }
.form-error { color: var(--danger); font-size: .8rem; margin-top: .25rem; }
.form-hint { color: var(--text-3); font-size: .78rem; }

.password-input-row {
  display: flex;
  gap: .5rem;
  align-items: stretch;
}
.password-input-row .password-input-wrap { flex: 1; }
.password-input-wrap {
  position: relative;
  display: flex;
}
.password-input-wrap .form-input { flex: 1; padding-right: 2.5rem; }
.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}
.password-toggle-btn:hover { color: var(--accent); }
.btn-generate {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: 0 .75rem;
  background: var(--accent-muted);
  border: 1px solid rgba(59,130,246,.25);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition);
}
.btn-generate:hover { background: rgba(59,130,246,.2); border-color: var(--accent); }
.btn-generate svg { width: 13px; height: 13px; }

/* Checkbox / toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .4rem 0;
}
.toggle-row label { font-size: .875rem; color: var(--text-2); cursor: pointer; }
.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-3);
  border-radius: 11px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Tag input */
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .4rem .5rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 38px;
  align-items: center;
  cursor: text;
}
.tag-input-wrap:focus-within { border-color: var(--accent); }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
}
.tag-chip-remove {
  cursor: pointer;
  display: flex;
  align-items: center;
  opacity: .6;
}
.tag-chip-remove:hover { opacity: 1; }
.tag-input {
  border: none;
  background: transparent;
  color: var(--text-1);
  outline: none;
  flex: 1;
  min-width: 80px;
  font-size: .85rem;
}

/* ================================================
   MODAL
   ================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
}
.modal.modal-wide {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 600; }
.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1;
  min-height: 0;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ================================================
   TOAST
   ================================================ */
/* Idle warning */
.idle-warning {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 300;
  display: flex;
  justify-content: center;
  padding: .75rem 1rem;
  transform: translateY(-100%);
  opacity: 0;
  transition: transform .35s cubic-bezier(.4,0,.2,1), opacity .35s ease;
  pointer-events: none;
}
.idle-warning.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.idle-warning-inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem .65rem .85rem;
  background: var(--bg-1);
  border: 1px solid rgba(234,179,8,.35);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.4), 0 0 0 1px rgba(234,179,8,.1);
  max-width: 520px;
  width: 100%;
}
.idle-warning-icon {
  flex-shrink: 0;
  color: var(--warning);
  display: flex;
}
.idle-warning-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  font-size: .85rem;
  line-height: 1.3;
}
.idle-warning-text strong { color: var(--text-1); font-weight: 600; }
.idle-warning-text span { color: var(--text-3); font-size: .75rem; }
.idle-warning-actions {
  display: flex;
  gap: .35rem;
  flex-shrink: 0;
}
#idle-countdown {
  display: inline-block;
  min-width: 1.4em;
  text-align: center;
  color: var(--warning);
  font-variant-numeric: tabular-nums;
}

.toast-container {
  position: fixed;
  top: calc(.75rem + env(safe-area-inset-top, 0));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  z-index: 200;
  pointer-events: none;
  width: 100%;
  max-width: 460px;
  padding: 0 1rem;
}
.toast {
  padding: .75rem 1rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: .85rem;
  line-height: 1.4;
  color: var(--text-1);
  pointer-events: auto;
  animation: toastIn .3s cubic-bezier(.4,0,.2,1);
  display: flex;
  align-items: center;
  gap: .6rem;
}
.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.toast-msg { flex: 1; }
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
}
.toast-close:hover { color: var(--text-1); background: rgba(255,255,255,.06); }
.toast.success { border-color: rgba(34,197,94,.3); background: linear-gradient(135deg, rgba(34,197,94,.08), var(--bg-1) 60%); }
.toast.error { border-color: rgba(239,68,68,.3); background: linear-gradient(135deg, rgba(239,68,68,.08), var(--bg-1) 60%); }
.toast.info { border-color: rgba(59,130,246,.3); background: linear-gradient(135deg, rgba(59,130,246,.08), var(--bg-1) 60%); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast-exit { animation: toastOut .25s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px) scale(.97); }
}

/* ================================================
   UPGRADE BANNER
   ================================================ */
.upgrade-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: .85rem 1.5rem;
  font-size: .9rem;
  font-weight: 500;
  animation: bannerIn .4s ease;
  box-shadow: 0 4px 20px rgba(59,130,246,.3);
}
.upgrade-banner strong { font-weight: 700; }
.upgrade-banner-close {
  position: absolute;
  right: 1rem;
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color .15s;
}
.upgrade-banner-close:hover { color: #fff; }
@keyframes bannerIn {
  from { opacity: 0; transform: translateY(-100%); }
  to { opacity: 1; transform: translateY(0); }
}
.upgrade-banner-exit {
  animation: bannerOut .3s ease forwards;
}
@keyframes bannerOut {
  to { opacity: 0; transform: translateY(-100%); }
}

/* ================================================
   SPECIAL VIEWS
   ================================================ */

/* Security Dashboard */
/* Security Dashboard — Enhanced */
.sec-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.sec-ring-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}
.sec-ring { width: 100%; height: 100%; }
.sec-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.sec-ring-num { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.sec-ring-sub { font-size: .65rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.sec-header-info { flex: 1; }

.sec-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.sec-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem .75rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.sec-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.sec-card-icon { margin-bottom: .35rem; }
.sec-card-num { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.sec-card-label { font-size: .68rem; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; margin-top: .15rem; }

.sec-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .5rem;
  overflow: hidden;
}
.sec-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  cursor: pointer;
  font-size: .9rem;
  transition: background var(--transition);
}
.sec-panel-header:hover { background: var(--bg-hover); }
.sec-panel-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  padding: 0 .4rem;
}
.sec-chevron { transition: transform var(--transition); }
.sec-panel.open .sec-chevron { transform: rotate(180deg); }
.sec-panel-body {
  display: none;
  padding: 0 1rem .75rem;
}
.sec-panel.open .sec-panel-body { display: block; }

@media (max-width: 600px) {
  .sec-cards { grid-template-columns: repeat(2, 1fr); }
  .sec-header { flex-direction: column; text-align: center; }
}


.security-section { margin-bottom: 1.5rem; }
.security-section h3 {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.security-issue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .75rem;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  margin-bottom: .3rem;
  font-size: .85rem;
  cursor: pointer;
  transition: background var(--transition);
}
.security-issue:hover { background: var(--bg-hover); }
.security-issue-label { color: var(--text-3); font-size: .78rem; }

/* Tags view */
.tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: 1rem;
}
.tag-card {
  padding: .5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity var(--transition), border-color var(--transition), filter var(--transition);
  font-size: .875rem;
  font-weight: 500;
}
.tag-card:hover { filter: brightness(1.15); border-color: currentColor; }
.tag-card.active { border-color: currentColor; font-weight: 600; filter: brightness(1.2); }

/* Recycle bin item */
.recycle-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .75rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.recycle-item:hover { background: var(--bg-hover); }
.recycle-item-info { flex: 1; min-width: 0; }
.recycle-item-title { font-size: .875rem; font-weight: 500; }
.recycle-item-meta { font-size: .78rem; color: var(--text-3); }
.recycle-item-actions { display: flex; gap: .35rem; }

/* Settings */
/* Settings cards */
.set-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: .5rem;
}
.set-profile {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  margin-bottom: .75rem;
}
.set-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  flex-shrink: 0;
}
.set-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-bottom: .5rem;
}
.set-card-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: .75rem;
  color: var(--text-1);
}
.set-card-head svg { color: var(--accent); flex-shrink: 0; }

@media (max-width: 600px) {
  .set-grid { grid-template-columns: 1fr; }
  .set-profile { flex-direction: column; align-items: center; text-align: center; }
}

.settings-section {
  margin-bottom: 2rem;
}
.settings-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 0;
}
.settings-row label { font-size: .9rem; }
.settings-row .form-input { width: 80px; text-align: center; }

/* Segmented toggle (theme) */
.seg-toggle {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg-btn {
  padding: .35rem .85rem;
  font-size: .8rem;
  font-weight: 500;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.seg-btn:hover { color: var(--text-2); }
.seg-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Settings slider controls */
.slider-setting {
  padding: .5rem 0;
}
.slider-setting-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .4rem;
}
.slider-setting-header label { font-size: .88rem; color: var(--text-1); }
.slider-val {
  font-size: .82rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 55px;
  text-align: right;
}
.setting-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) 50%, var(--bg-3) 50%, var(--bg-3) 100%);
}
.setting-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: pointer;
  margin-top: -5px;
  transition: transform .15s, box-shadow .15s;
}
.setting-range::-webkit-slider-thumb:hover { transform: scale(1.2); box-shadow: 0 0 0 4px rgba(59,130,246,.2); }
.setting-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: transparent;
}
.setting-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: pointer;
}
.setting-range::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-3);
}
.setting-range::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--accent);
}

/* Password generator (in modal) */
.gen-output {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem .75rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: .95rem;
  word-break: break-all;
  line-height: 1.4;
}
.gen-output-text { flex: 1; user-select: all; }

/* Send items */
.send-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: .35rem;
}
.send-item.expired { opacity: .5; }
.send-item-info { flex: 1; display: flex; flex-direction: column; gap: .15rem; }
.send-item-info strong { font-size: .88rem; }
.send-item-actions { display: flex; gap: .35rem; flex-shrink: 0; }

/* Attachments */
.attachments-section {
  margin-top: .75rem;
  padding-top: 0;
}
.attachments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
}
.att-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .6rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: .3rem;
  font-size: .82rem;
}
.att-item svg { flex-shrink: 0; color: var(--text-3); }
.att-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { color: var(--text-3); font-size: .72rem; flex-shrink: 0; }
.att-empty {
  font-size: .8rem;
  color: var(--text-3);
  padding: .6rem 0;
}
.att-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .7rem;
  background: var(--accent-muted);
  border: 1px solid rgba(59,130,246,.25);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.att-upload-btn:hover { background: rgba(59,130,246,.2); border-color: var(--accent); }

/* Custom fields in form */
.cf-row {
  display: flex;
  gap: .35rem;
  align-items: center;
  margin-bottom: .35rem;
  max-width: 100%;
}
.cf-row .form-input { margin: 0; min-width: 0; flex: 1; }
.cf-row .cf-name { flex: 0 1 120px; }
.cf-row .form-select { margin: 0; flex-shrink: 0; width: 85px; }
.cf-remove { font-size: 1.1rem; color: var(--text-3); background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 4px; flex-shrink: 0; }
.cf-remove:hover { color: var(--danger); background: var(--bg-2); }
@media (max-width: 480px) {
  .cf-row { flex-wrap: wrap; }
  .cf-row .cf-name { flex: 1 1 100%; }
  .cf-row .cf-type { flex: 0 0 auto; }
  .cf-row .cf-value { flex: 1 1 0; min-width: 0; }
}

.gen-mode-tabs {
  display: flex;
  gap: 0;
  margin-bottom: .75rem;
  border-bottom: 2px solid var(--border);
}
.gen-mode-tab {
  padding: .45rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-3);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.gen-mode-tab:hover { color: var(--text-2); }
.gen-mode-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.slider-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}
.slider-row label { width: 60px; font-size: .85rem; color: var(--text-2); }
.slider-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.slider-row .slider-value {
  width: 36px;
  text-align: center;
  font-size: .85rem;
  font-weight: 600;
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1024px) {
  .item-list { width: 260px; min-width: 220px; }
}

/* --- Sidebar backdrop (mobile) --- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--topbar-h);
  background: rgba(0,0,0,.5);
  z-index: 29;
  opacity: 0;
  transition: opacity .25s ease;
}
.sidebar-backdrop.visible { opacity: 1; }

/* --- Mobile back button (hidden by default) --- */
.mobile-back-btn {
  display: none;
  align-items: center;
  gap: .3rem;
  padding: .5rem .75rem;
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

@media (max-width: 768px) {
  .top-bar {
    gap: .5rem;
    padding: 0 .75rem;
    padding-left: max(.75rem, env(safe-area-inset-left, .75rem));
    padding-right: max(.75rem, env(safe-area-inset-right, .75rem));
  }
  .search-wrapper { min-width: 0; }
  /* Persistent icon-only rail (always visible) */
  .sidebar {
    width: 56px;
    transform: none;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    box-shadow: none;
    padding-bottom: env(safe-area-inset-bottom, 0);
    transition: width .25s cubic-bezier(.4,0,.2,1);
    z-index: 15;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar .sidebar-logo span { display: none; }
  .sidebar .sidebar-logo { justify-content: center; padding: .85rem .25rem .5rem; }
  .sidebar .sidebar-nav { padding: .5rem .25rem; }
  .sidebar .nav-section-label { display: none; }
  .sidebar .nav-item { justify-content: center; padding: .55rem 0; position: relative; }
  .sidebar .nav-item > span { display: none; }
  .sidebar .nav-item > .nav-count {
    display: flex; position: absolute; top: 2px; right: 2px; margin: 0;
    min-width: 16px; height: 16px; align-items: center; justify-content: center;
    font-size: .6rem; font-weight: 700; background: var(--bg-3);
    border-radius: 999px; padding: 0 3px; color: var(--text-2);
  }
  .sidebar .nav-item.active > .nav-count { background: var(--accent-muted); color: var(--accent); }
  .sidebar .nav-item > .nav-count:empty { display: none; }
  .sidebar .nav-divider { margin: .4rem .35rem; }
  .sidebar.collapsed { width: 56px; transform: none; overflow-x: hidden; overflow-y: auto; }

  /* Rail tooltip on pointer devices */
  .sidebar:not(.open) .nav-item[title]:hover::after {
    content: attr(title); position: absolute; left: 100%; top: 50%;
    transform: translateY(-50%); margin-left: 8px; padding: .3rem .6rem;
    background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px;
    font-size: .78rem; color: var(--text-1); white-space: nowrap;
    z-index: 100; pointer-events: none; box-shadow: var(--shadow-sm);
  }

  /* Expanded sidebar overlay (hamburger toggle) */
  .sidebar.open {
    width: min(280px, 80vw); z-index: 30;
    box-shadow: var(--shadow); overflow-y: auto;
  }
  .sidebar.open .sidebar-logo span { display: inline; }
  .sidebar.open .sidebar-logo { justify-content: flex-start; padding: .85rem 1rem .5rem; }
  .sidebar.open .sidebar-nav { padding: .5rem; }
  .sidebar.open .nav-section-label { display: block; }
  .sidebar.open .nav-item { justify-content: flex-start; padding: .55rem .75rem; position: static; }
  .sidebar.open .nav-item > span { display: inline; }
  .sidebar.open .nav-item > .nav-count {
    position: static; min-width: 20px; height: auto;
    font-size: .75rem; font-weight: 400; background: none;
    padding: 0; margin-left: auto; color: var(--text-3);
    border-radius: 0;
  }
  .sidebar.open .nav-item.active > .nav-count { background: none; color: var(--accent); }
  .sidebar.open .nav-divider { margin: .4rem .75rem; }

  .sidebar-backdrop.active { display: block; }
  .sidebar-collapsed .content { margin-left: 56px; }
  .content { margin-left: 56px; }
  .content-body { flex-direction: column; position: relative; }

  .item-list {
    width: 100%;
    min-width: unset;
    border-right: none;
    border-bottom: none;
    max-height: none;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Slide-in detail: only when paired with an item-list (list+detail views) */
  .item-list ~ .item-detail {
    position: absolute;
    inset: 0;
    background: var(--bg-0);
    z-index: 5;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    transition: transform .25s ease;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .item-list ~ .item-detail.mobile-active {
    transform: translateX(0);
  }

  /* Standalone detail panel (settings, security, etc.) — normal flow */
  .content-body > .item-detail:first-child {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .mobile-back-btn { display: flex; }

  .icon-btn { width: 44px; height: 44px; }
  .field-btn { width: 40px; height: 40px; }

  .toast-container { max-width: 100%; padding: 0 .75rem; }

  .modal-overlay { padding: .75rem; align-items: center; }
  .modal {
    max-height: calc(90vh - env(safe-area-inset-bottom, 0));
    max-height: calc(90dvh - env(safe-area-inset-bottom, 0));
    border-radius: var(--radius-lg);
    animation: modalFadeIn .25s ease;
  }
  .modal-body { padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0)); }
  @keyframes modalFadeIn {
    from { opacity: 0; transform: scale(.95); }
    to { opacity: 1; transform: scale(1); }
  }

  .plan-grid { grid-template-columns: 1fr; }

  .detail-field { flex-direction: column; align-items: flex-start; gap: .25rem; }
  .field-label { width: auto; }
  .field-value { width: 100%; }

  .settings-row { flex-wrap: wrap; gap: .5rem; }
  .recycle-item { flex-wrap: wrap; gap: .5rem; }
  .recycle-item-actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 480px) {
  .login-card { padding: 2rem 1.25rem; margin: 0 .75rem; }
  .content-header { padding: .75rem 1rem; }
  .content-header h2 { font-size: 1.05rem; }
  .form-row { flex-direction: column; gap: 0; }
  .detail-header { flex-direction: column; gap: .75rem; }
  .detail-actions { width: 100%; }
  .detail-actions .btn { flex: 1; justify-content: center; }
  .btn-lg { padding: .65rem 1rem; }
  .security-issue { flex-direction: column; align-items: flex-start; gap: .25rem; }
}

/* ================================================
   AUDIT LOG
   ================================================ */
.audit-page, .audit-inner {
  width: 100%;
}
.audit-header { margin-bottom: 1.25rem; }
.audit-desc { font-size: .88rem; color: var(--text-2); margin-bottom: 1rem; line-height: 1.5; }
.audit-filters {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.audit-filter-group { flex: 1; min-width: 140px; }
.audit-filter-group .form-label { font-size: .72rem; margin-bottom: .25rem; }
.audit-filter-group .form-input { font-size: .82rem; padding: .4rem .6rem; }
.audit-filter-actions {
  display: flex;
  gap: .35rem;
  align-items: center;
  flex-shrink: 0;
}
.audit-summary { font-size: .82rem; color: var(--text-2); margin-bottom: .6rem; min-height: 1.2em; }
.audit-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}
.audit-table thead { position: sticky; top: 0; z-index: 1; }
.audit-table th {
  text-align: left;
  padding: .5rem .75rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}
.audit-table td {
  padding: .45rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.audit-table tr:last-child td { border-bottom: none; }
.audit-table tr:hover { background: var(--bg-hover); }
.audit-cell-ts { white-space: nowrap; color: var(--text-3); font-variant-numeric: tabular-nums; }
.audit-cell-detail { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-cell-ip { color: var(--text-3); }
.audit-action-badge {
  display: inline-block;
  background: var(--accent-muted);
  color: var(--accent);
  padding: .1rem .45rem;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
.audit-pager {
  display: flex;
  gap: .35rem;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
  font-size: .82rem;
  color: var(--text-3);
}
.audit-pager-info {
  padding: 0 .75rem;
  font-weight: 500;
  color: var(--text-2);
}
.audit-pager .btn {
  min-width: 80px;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-1);
  color: var(--text-2);
  font-weight: 500;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.audit-pager .btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.audit-pager .btn:disabled { opacity: .4; cursor: default; }
.audit-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-3);
  font-size: .9rem;
}
.audit-empty svg { margin-bottom: .75rem; }

@media (max-width: 768px) {
  .audit-page, .audit-inner { padding: 0; }
  .audit-filters { flex-direction: column; gap: .5rem; }
  .audit-filter-group { min-width: 100%; }
  .audit-filter-actions { width: 100%; justify-content: flex-start; }
  .audit-col-ip { display: none; }
  .audit-table { min-width: 0; }
  .audit-cell-detail { max-width: 180px; }
}

@media (max-width: 480px) {
  .audit-table { font-size: .75rem; }
  .audit-table th, .audit-table td { padding: .35rem .5rem; }
  .audit-cell-detail { max-width: 120px; }
}

@media (max-width: 380px) {
  .acct-avatar { width: 32px; height: 32px; font-size: .7rem; }
  .login-logo h1 { font-size: 1.5rem; }
}

