/* ============================================================
   PassVault — Claude UI inspired theme
   ============================================================ */
:root {
  --bg: #f5f4ef;
  --bg-2: #edeae2;
  --panel: #fbfbf9;
  --card: #ffffff;
  --accent: #d97757;          /* Claude terracotta */
  --accent-dark: #c96443;
  --accent-soft: #f6e3dc;
  --text: #34251c;
  --muted: #8a7a6e;
  --line: #e6e1d8;
  --shadow: 0 6px 24px rgba(52, 37, 28, 0.08);
  --shadow-sm: 0 2px 8px rgba(52, 37, 28, 0.06);
  --radius: 14px;
  --radius-sm: 10px;
}

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

body {
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  font-family: inherit;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-2); }
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.85rem; }
.btn-danger { color: #b3261e; }
.btn-danger:hover { background: #fbeae8; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Auth screen ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(circle at top, #f0e9e2 0%, var(--bg) 60%);
}
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 2.2rem 2.4rem;
  width: 100%;
  max-width: 420px;
}
.auth-logo { text-align: center; margin-bottom: 1.6rem; }
.logo-mark { font-size: 2.4rem; display: inline-block; }
.logo-mark.small { font-size: 1.4rem; }
.auth-logo h1 {
  font-size: 1.8rem;
  color: var(--text);
  letter-spacing: -0.5px;
}
.tagline { color: var(--muted); margin-top: 0.2rem; font-size: 0.95rem; }

.auth-form h2 { font-size: 1.2rem; margin-bottom: 1.1rem; color: var(--text); }
.auth-form label { display: block; margin-bottom: 1rem; }
.auth-form label span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.auth-form input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  outline: none;
}
.auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-form .btn { margin-top: 0.4rem; }
.auth-alt { text-align: center; margin-top: 1rem; color: var(--muted); font-size: 0.9rem; }
.auth-alt a { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-alt a:hover { text-decoration: underline; }

.auth-msg {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: #b3261e;
  min-height: 1.4rem;
}
.preview-note {
  margin-top: 1.4rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--accent-soft);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

/* ---------- App screen ---------- */
.app-screen { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.6rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 0.5rem; }
.brand { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.3px; }
.topbar-right { display: flex; align-items: center; gap: 0.8rem; }
.user-badge {
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ---------- 3-column layout ---------- */
.col {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1.2rem;
  min-height: 0;
}
.col-categories {
  width: 240px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.col-subcategories {
  width: 300px;
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
}
.col-items {
  flex: 1;
  background: var(--bg);
}
.col-edit {
  width: 320px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
}
.col-edit .form-grid { grid-template-columns: 1fr; }
.col-edit .entry-form { margin: 0; }
.col-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.col-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.col-sub { font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; }
.col-foot { margin-top: auto; padding-top: 1.2rem; }
.col-empty { color: var(--muted); font-size: 0.85rem; text-align: center; padding: 1.2rem 0.5rem; }

/* ---------- Stack lists (categories & sub-categories) ---------- */
.stack-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  list-style: none;
}
.stack-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  transition: all 0.12s ease;
}
.stack-item:hover { background: var(--bg-2); }
.stack-item.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-left: 3px solid var(--accent);
}
.stack-icon { font-size: 1.15rem; }
.stack-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.stack-main { word-break: break-word; }
.stack-meta { font-weight: 500; color: var(--muted); font-size: 0.78rem; }
.sec-hint {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--bg-2);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  display: block;
}

/* ---------- Cards & forms ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.4rem;
}
.card h3 { font-size: 1.05rem; margin-bottom: 1rem; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.count-badge {
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}
.form-grid label span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.form-grid input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
  outline: none;
}
.form-grid input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-group { display: flex; gap: 0.4rem; }
.input-group input { flex: 1; }
.form-actions { margin-top: 1rem; display: flex; gap: 0.6rem; }

/* ---------- Saved entries (vertical stack) ---------- */
.entries-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.entry-form { margin: 0; }
.entry-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.entry-card:hover { border-color: #d6cfc2; box-shadow: var(--shadow-sm); }
.entry-field {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}
.entry-field:last-of-type { border-bottom: none; }
.field-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.field-value {
  font-size: 1rem;
  font-weight: 600;
  word-break: break-all;
}
.field-value .pwd-txt {
  font-family: "Consolas", monospace;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}
.card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}
.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 1.4rem;
  font-size: 0.9rem;
}
.pwd-txt { font-family: "Consolas", monospace; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Security pill / topbar ---------- */
.security-pill {
  background: #ecf6ee;
  color: #1f7a3d;
  border: 1px solid #bfe3c9;
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* ---------- Sidebar head + icon button ---------- */
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0 0.6rem;
}
.side-head .side-title { margin-bottom: 0; }
.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--accent);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.icon-btn:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Remove ("−") button inside rows ---------- */
.icon-btn-remove {
  width: 22px;
  height: 22px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  flex-shrink: 0;
  margin-left: 0.5rem;
  padding: 0;
}
.icon-btn-remove:hover { color: #b3261e; background: #fbeae8; border-color: #f0c8c2; }

/* Let the category name expand so the "−" sits at the far right */
.stack-item > .stack-main { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Add card in sub-category grid ---------- */
.add-card {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 120px;
}
.add-card:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.add-card .plus-lg { font-size: 1.7rem; }
.add-card .add-label { font-weight: 600; font-size: 0.95rem; }

/* ---------- Detail view action buttons ---------- */
.detail-actions {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(52, 37, 28, 0.35);
}
.modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.6rem 1.8rem;
  width: 100%;
  max-width: 420px;
  margin: 1.2rem;
}
.modal-card h3 { margin-bottom: 1rem; }
.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-card label { display: block; margin-bottom: 1rem; }
.modal-card label span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
.modal-card input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  outline: none;
}
.modal-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modal-hint { font-size: 0.8rem; color: var(--muted); margin: -0.4rem 0 1rem; }
.auth-multiline { margin-top: 1rem; text-align: center; font-size: 0.9rem; color: #b3261e; min-height: 1.4rem; white-space: pre-line; }

/* ---------- Custom category chip (in sidebar) ---------- */
.custom-tag {
  font-size: 0.65rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  margin-left: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Modal type picker ---------- */
.modal-type { margin: 0.4rem 0 1rem; }
.m-type-label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }
.type-options { display: flex; gap: 0.6rem; }
.type-opt {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  transition: all 0.15s ease;
}
.type-opt:hover { border-color: var(--accent); }
.type-opt input { margin-top: 0.2rem; }
.modal-card .type-opt > span { font-weight: 700; font-size: 0.9rem; color: var(--text); display: block; margin-bottom: 0; }
.modal-card .type-opt small { font-weight: 500; color: var(--muted); font-size: 0.74rem; }
.type-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .app-screen { height: auto; overflow: visible; }
  .app-body { flex-direction: column; overflow: visible; }
  .col { width: 100%; overflow: visible; border-right: none; border-bottom: 1px solid var(--line); padding: 1rem; }
  .col-items { border-bottom: none; }
  .col-edit { border-left: none; }
  .form-grid { grid-template-columns: 1fr; }
}
.category-head-actions{display:flex;align-items:center;gap:6px}.stack-item > .stack-main{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}