@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0f1115;
  --panel: #181b20;
  --panel-2: #1e2228;
  --panel-solid: #14171c;
  --border: rgba(255, 255, 255, .08);
  --border-hover: rgba(96, 165, 250, .55);
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --accent-light: #60a5fa;
  --orange: #ea580c;
  --green: #22c55e;
  --red: #ef4444;
  --text: #f2f4f7;
  --text-dim: #9aa3b0;
  --glow: 0 0 18px rgba(59, 130, 246, .28);
  --glow-strong: 0 0 24px rgba(59, 130, 246, .42);
  --grad-corner: radial-gradient(120% 140% at 100% 0%, rgba(59, 130, 246, .18), transparent 60%), var(--panel);
  --radius: 14px;
  --radius-sm: 8px;
  --transition: all .3s ease-in-out;
  --font: 'Inter', 'Poppins', 'Roboto', system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: radial-gradient(60% 50% at 100% 0%, rgba(59, 130, 246, .08), transparent 70%), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px;
  background: var(--panel-solid);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.brand-logo {
  width: 38px; height: 38px; flex: none; border-radius: 10px; box-shadow: var(--glow);
}
.brand-logo img { display: block; width: 100%; height: 100%; border-radius: inherit; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-weight: 700; letter-spacing: .5px; font-size: 16px; }
.brand-text span { font-size: 11px; color: var(--text-dim); }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-dim); padding: 0 10px 6px; }

.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-dim); font-weight: 500; text-align: left;
  transition: var(--transition);
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav-item[aria-current="page"] {
  color: var(--text); background: rgba(59, 130, 246, .12);
  border-color: rgba(59, 130, 246, .3); box-shadow: inset 2px 0 0 var(--accent-light);
}
.nav-item[aria-current="page"] svg { color: var(--accent-light); }
.nav-text { flex: 1; }
.badge {
  min-width: 24px; padding: 2px 8px; border-radius: 999px; text-align: center;
  font-size: 11px; font-weight: 600; background: rgba(59, 130, 246, .2); color: var(--accent-light);
}
.sidebar-foot {
  margin-top: auto; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; font-size: 11px; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

.main { padding: 24px 28px 40px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { flex: 1 1 200px; min-width: 0; }
.page-title h1 { font-size: 22px; font-weight: 600; }
.title-row { display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; }
.welcome { font-size: 15px; color: var(--text-dim); }
.welcome strong { color: var(--accent-light); font-weight: 600; }
.page-title p { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

.search { position: relative; flex: 0 1 340px; min-width: 180px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.search input {
  width: 100%; padding: 10px 14px 10px 38px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border); outline: none; transition: var(--transition);
}
.search input:focus { border-color: var(--border-hover); box-shadow: var(--glow); }
.search input::placeholder { color: var(--text-dim); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-weight: 600; font-size: 13px;
  text-decoration: none; white-space: nowrap; transition: var(--transition);
}
.btn:hover { border-color: var(--border-hover); box-shadow: var(--glow); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.primary { background: var(--accent-strong); border-color: rgba(255, 255, 255, .12); }
.btn.primary:hover { background: #1d4ed8; box-shadow: var(--glow-strong); }
.btn.key { background: var(--orange); border-color: transparent; }
.btn.key:hover { background: #f97316; border-color: transparent; box-shadow: 0 0 18px rgba(234, 88, 12, .4); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, .04); }
.btn.ghost.done { color: var(--green); border-color: rgba(34, 197, 94, .5); }
.btn.danger { background: rgba(239, 68, 68, .15); color: #fca5a5; border-color: rgba(239, 68, 68, .4); }
.btn.danger:hover { background: var(--red); color: #fff; border-color: var(--red); box-shadow: 0 0 18px rgba(239, 68, 68, .4); }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent;
  color: var(--text-dim); transition: var(--transition);
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, .06); border-color: var(--border); }
.icon-btn.danger:hover { color: #fca5a5; background: rgba(239, 68, 68, .15); border-color: rgba(239, 68, 68, .4); }

/* ---------- Information grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 160px;
  padding: 18px; text-align: left; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .45); transition: var(--transition); cursor: pointer;
}
.card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 140% at 100% 0%, rgba(59, 130, 246, .2), transparent 60%);
  opacity: 0; transition: opacity .3s ease-in-out;
}
.card:hover { border-color: var(--border-hover); box-shadow: var(--glow), 0 4px 18px rgba(0, 0, 0, .45); transform: translateY(-1px); }
.card:hover::after { opacity: 1; }
.card h3 { margin: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.card .preview {
  color: var(--text-dim); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--text-dim); }
.pill {
  max-width: 60%; padding: 3px 10px; border-radius: 999px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  background: rgba(59, 130, 246, .2); color: var(--accent-light);
}

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: min(400px, 100%); display: flex; flex-direction: column; align-items: stretch; padding: 32px 28px;
  border-radius: var(--radius); background: var(--grad-corner); border: 1px solid var(--border);
  box-shadow: 0 12px 48px rgba(0, 0, 0, .6);
}
.auth-card .brand-logo { width: 52px; height: 52px; align-self: center; margin-bottom: 16px; border-radius: 14px; }
.auth-card h1 { text-align: center; font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.auth-sub { text-align: center; margin: 4px 0 22px; color: var(--text-dim); font-size: 13px; }
.auth-card .lbl:first-of-type { margin-top: 0; }
.auth-card .field-error { margin: 10px 0 0; }
.input.select {
  appearance: none; cursor: pointer; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa3b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.select option { background: var(--panel); color: var(--text); }
.btn.full { width: 100%; margin-top: 22px; padding: 12px 16px; }
.nav-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.nav-bottom + .sidebar-foot { margin-top: 6px; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.settings-card { display: flex; flex-direction: column; padding: 22px; background: var(--grad-corner); }
.settings-card h2 { margin-bottom: 6px; font-size: 16px; }
.settings-card .users-note { margin-bottom: 4px; }
.settings-card .lbl { margin-top: 16px; }
.settings-card .small-gap { margin-top: 6px; margin-bottom: 0; font-size: 12px; }
.settings-card .field-value { white-space: normal; }
.settings-actions { display: flex; justify-content: flex-end; margin-top: 22px; }
.dialog-note { margin-top: 12px; }

/* ---------- User manager ---------- */
.users-note { font-size: 13px; }
#view-users .users-note { margin-bottom: 14px; }
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 18px;
  border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border); transition: var(--transition);
}
.user-row:hover { border-color: var(--border-hover); box-shadow: var(--glow); }
.user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text span { font-size: 12px; color: var(--text-dim); }
.user-pills { display: flex; gap: 6px; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px; text-align: left;
  border-radius: var(--radius); background: var(--grad-corner); border: 1px solid var(--border);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .45); transition: var(--transition);
}
button.stat { cursor: pointer; }
button.stat:hover { border-color: var(--border-hover); box-shadow: var(--glow), 0 4px 18px rgba(0, 0, 0, .45); transform: translateY(-1px); }
.stat-icon { width: 36px; height: 36px; display: grid; place-items: center; margin-bottom: 8px; border-radius: 10px; background: rgba(59, 130, 246, .15); color: var(--accent-light); }
.stat-num { font-size: 32px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }

.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.panel { padding: 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border); }
.panel h2 { margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.row-list { display: flex; flex-direction: column; gap: 8px; }
.row-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left;
  border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border); transition: var(--transition);
}
button.row-item:hover { border-color: var(--border-hover); box-shadow: var(--glow); }
.row-icon { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px; background: rgba(59, 130, 246, .15); color: var(--accent-light); }
.row-icon.ok { background: rgba(34, 197, 94, .15); color: var(--green); }
.row-icon.warn { background: rgba(234, 88, 12, .18); color: #fb923c; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-text span { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.ok { background: rgba(34, 197, 94, .18); color: #4ade80; }
.pill.warn { background: rgba(234, 88, 12, .2); color: #fb923c; }

@media (max-width: 960px) { .dash-grid { grid-template-columns: 1fr; } }

/* ---------- Password generator ---------- */
.gen { padding: 26px; background: var(--grad-corner); }
.gen .lbl { margin-top: 0; }
.gen-len { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.gen-len .lbl { margin: 0; }
.gen-len output { font-size: 20px; font-weight: 700; color: var(--accent-light); }
.range { width: 100%; margin: 0 0 22px; accent-color: var(--accent); cursor: pointer; }

.toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 28px; }
.toggle {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 14px; cursor: pointer;
  border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border); transition: var(--transition);
}
.toggle:hover { border-color: var(--border-hover); }
.toggle input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch { position: relative; flex: none; width: 40px; height: 22px; border-radius: 999px; background: #2a2f38; transition: var(--transition); }
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: var(--transition);
}
.toggle input:checked + .switch { background: var(--accent-strong); box-shadow: var(--glow); }
.toggle input:checked + .switch::after { transform: translateX(18px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.t-text { display: flex; flex-direction: column; line-height: 1.3; }
.t-text strong { font-weight: 600; }
.t-text small { font-size: 12px; color: var(--text-dim); font-family: var(--mono); }

.gen-result { display: flex; flex-direction: column; gap: 12px; }
.gen-pass {
  display: block; padding: 20px 22px; min-height: 72px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border-hover); box-shadow: var(--glow);
  font-family: var(--mono); font-size: 26px; line-height: 1.4; letter-spacing: .5px;
  overflow-wrap: anywhere; user-select: all;
}
.gen-actions { display: flex; justify-content: flex-end; gap: 10px; }
.gen-actions .btn { padding: 10px 16px; font-size: 13px; }

/* ---------- Sharing ---------- */
.pills { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.pill.share { display: inline-flex; align-items: center; gap: 5px; max-width: 140px; background: rgba(59, 130, 246, .12); }
.pill.share svg { width: 12px; height: 12px; }
.icon-btn.active { color: var(--accent-light); }
.share-list { display: flex; flex-direction: column; gap: 10px; }
.row-actions .pill { max-width: 130px; }

/* ---------- Password list ---------- */
.pw-table { display: flex; flex-direction: column; gap: 10px; }
.pw-head, .pw-row {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) minmax(0, 1.3fr) 250px;
  gap: 14px; align-items: center; padding: 12px 18px;
}
.pw-head { padding-top: 0; padding-bottom: 0; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
.pw-row {
  position: relative; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border);
  transition: var(--transition);
}
.pw-row:hover { border-color: var(--border-hover); box-shadow: var(--glow); }
.site-btn {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0; text-align: left;
  background: none; border: 0; border-radius: var(--radius-sm);
}
.avatar {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border-radius: 10px; font-weight: 700; text-transform: uppercase;
  background: var(--grad-corner); border: 1px solid var(--border); color: var(--accent-light);
}
.site-text { min-width: 0; display: flex; flex-direction: column; }
.site-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-text span { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-btn:hover strong { color: var(--accent-light); }
.cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cell-label { display: none; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
.cell-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.masked { letter-spacing: 3px; color: var(--text-dim); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

/* ---------- Empty state ---------- */
.empty {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 56px 20px; border-radius: var(--radius); border: 1px dashed var(--border); background: var(--panel);
}
.empty svg { width: 34px; height: 34px; color: var(--accent-light); }
.empty h3 { margin: 4px 0 0; font-size: 16px; }
.empty p { color: var(--text-dim); max-width: 340px; }
.empty .btn { margin-top: 8px; }

/* ---------- Dialogs ---------- */
dialog {
  width: min(640px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px);
  padding: 0; border: 0; background: transparent; color: var(--text); overflow: visible;
}
dialog.small { width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5, 7, 10, .72); backdrop-filter: blur(4px); }
dialog[open] { animation: pop .25s cubic-bezier(.22, 1, .36, 1); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.modal {
  display: flex; flex-direction: column; max-height: calc(100vh - 32px); margin: 0;
  background: var(--grad-corner); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0, 0, 0, .6);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); }
.muted { color: var(--text-dim); line-height: 1.5; }

.lbl { display: block; margin: 16px 0 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
.lbl:first-child { margin-top: 0; }
.lbl em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; opacity: .7; }
.lbl-row { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.lbl-row .lbl { margin: 0; }
.input {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border); outline: none; transition: var(--transition);
}
.input:focus { border-color: var(--border-hover); box-shadow: var(--glow); }
.input::placeholder { color: #5d6573; }
textarea.input { resize: vertical; line-height: 1.5; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 46px; }
.input-wrap .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.field-error { margin-top: 6px; font-size: 12px; color: #fca5a5; }
.input.invalid { border-color: var(--red); }

.codes { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.code-row { display: flex; gap: 8px; }
.code-row .input { font-family: var(--mono); }

/* ---------- Detail view ---------- */
.detail-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-label { margin-bottom: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
.field-row { display: flex; align-items: flex-start; gap: 8px; }
.field-value {
  flex: 1; min-width: 0; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border);
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55;
}
.field-value.mono { font-family: var(--mono); }
.field-value.tall { max-height: 46vh; overflow-y: auto; }
.field-actions { display: flex; gap: 6px; flex: none; }
.code-list { display: flex; flex-direction: column; gap: 8px; }
.modal-foot .spacer { flex: 1; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  min-width: 220px; max-width: 340px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--panel-solid); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .55); font-size: 13px; animation: slide .3s ease-out;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.leaving { opacity: 0; transform: translateX(16px); transition: var(--transition); }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* Password rows stack into cards when the table gets cramped */
@media (max-width: 1180px) {
  .pw-head { display: none; }
  .pw-row { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .pw-row .site-btn { grid-column: 1; grid-row: 1; }
  .pw-row .row-actions { grid-column: 2; grid-row: 1; }
  .pw-row .cell { grid-column: 1 / -1; }
  .cell-label { display: block; width: 78px; flex: none; }
}

/* ---------- Tablet ---------- */
@media (max-width: 960px) {
  .app { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding: 16px 10px; align-items: center; }
  .brand { padding: 4px 0 16px; }
  .brand-text, .nav-label, .nav-text, .sidebar-foot span:last-child { display: none; }
  .nav-item { position: relative; justify-content: center; padding: 12px; width: 48px; }
  .nav-item .badge { position: absolute; top: 2px; right: 0; min-width: 18px; padding: 1px 5px; font-size: 10px; }
  .sidebar-foot { padding: 10px; border: 0; }
  .nav-bottom { align-items: center; }
  .main { padding: 20px; }
}

/* ---------- Phone ---------- */
@media (max-width: 640px) {
  .app { display: block; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 50; height: auto;
    flex-direction: row; justify-content: space-around; padding: 8px 12px;
    border-right: 0; border-top: 1px solid var(--border);
  }
  .brand, .sidebar-foot { display: none; }
  .nav-item { width: auto; flex: 1; }
  .nav-bottom { margin-top: 0; flex-direction: row; flex: 1 1 0; }
  .user-row { flex-wrap: wrap; }
  .main { padding: 16px 16px 90px; }
  .search { flex-basis: 100%; order: 3; }
  .topbar #addBtn { flex: none; }
  .toasts { right: 16px; left: 16px; bottom: 80px; }
  .toast { max-width: none; }
  .modal-foot { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
