/* ── Password visibility toggle ─────────────────────────────────────────────── */
.pw-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.pw-wrap input {
  width: 100%;
  box-sizing: border-box;
  padding-right: 40px !important;
  margin-bottom: 0 !important;   /* margin lives on the wrapper so top:50% stays centred */
}
/* Restore bottom spacing the input classes normally provide */
.pw-wrap:has(.auth-input)  { margin-bottom: 16px; }
.pw-wrap:has(.acct-input)  { margin-bottom: 14px; }
.pw-wrap:has(.modal-input) { margin-bottom: 20px; }
.pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  line-height: 1;
  opacity: .55;
  transition: opacity .15s, color .15s;
  user-select: none;
}
.pw-toggle:hover  { opacity: 1; color: var(--text); }
.pw-toggle:focus  { outline: none; }

/* ── Design tokens ──────────────────────────────────────────────────────────── */
:root {
  --bg:          #f5f3ee;
  --surface:     #ffffff;
  --surface-alt: #faf9f6;
  --text:        #1c1a17;
  --text-muted:  #7a746c;
  --accent:      #2b6840;
  --accent-lt:   #dff0e6;
  --accent-dark: #1e4d2f;
  --amber:       #c97d10;
  --amber-lt:    #fef3dd;
  --danger:      #b83230;
  --danger-lt:   #fce8e8;
  --border:      #e4dfd6;
  --sidebar-w:   200px;
  --shadow-sm:   0 2px 8px rgba(0,0,0,.06);
  --shadow-md:   0 6px 24px rgba(0,0,0,.10);
  --shadow-lg:   0 20px 60px rgba(0,0,0,.16);
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Outfit', system-ui, sans-serif;
}

/* ── Dark mode ──────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #0f1117;
  --surface:     #1a1f2e;
  --surface-alt: #232938;
  --text:        #e2e8f0;
  --text-muted:  #8892a4;
  --accent:      #3d8b5e;
  --accent-lt:   #1a3328;
  --accent-dark: #5db882;
  --amber:       #d4930a;
  --amber-lt:    #2a1f06;
  --danger:      #e05252;
  --danger-lt:   #2a1010;
  --border:      #2d3548;
  --shadow-sm:   0 2px 8px rgba(0,0,0,.3);
  --shadow-md:   0 6px 24px rgba(0,0,0,.4);
  --shadow-lg:   0 20px 60px rgba(0,0,0,.5);
}


/* ── Dark mode input fields (45% grey) ──────────────────────────────────────── */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #737373 !important;
  color: #f0f0f0 !important;
  border-color: #5a5a5a !important;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #c0c0c0 !important; }
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  background: #7a7a7a !important;
  border-color: var(--accent) !important;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background:  var(--bg);
  color:       var(--text);
  line-height: 1.5;
  min-height:  100vh;
}
a { color: var(--accent); text-decoration: none; }

/* ── App Shell ──────────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #1a2e22;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 8px;
}
.logo-img {
  max-width: 140px;
  max-height: 56px;
  object-fit: contain;
}
.logo-fallback { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 26px; }
.logo-text {
  font-family: var(--font-display);
  font-size: 15px;
  color: #fff;
  line-height: 1.25;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.65);
  font-size: 14px;
  font-weight: 500;
  transition: all .18s;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-icon { font-size: 18px; width: 22px; text-align: center; }
.nav-invite-badge {
  margin-left: auto;
  background: var(--amber);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ── Main Content ───────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}

/* ── Shared page header ─────────────────────────────────────────────────────── */
.page-header-bar {
  padding: 32px 32px 0;
  margin-bottom: 24px;
}
.page-heading {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: -.5px;
}
.page-sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .18s; white-space: nowrap;
}
.btn-primary { background: var(--accent);  color: #fff; }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: #8f1f1e; }
.btn-ghost   { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-ghost:hover   { border-color: var(--accent); color: var(--accent); }
.btn-start   { background: var(--accent); color: #fff; }
.btn-start:hover   { background: var(--accent-dark); }
.btn-finish  { background: var(--danger); color: #fff; }
.btn-finish:hover  { background: #8f1f1e; }
.btn-add     { background: var(--accent); color: #fff; }
.btn-add:hover     { background: var(--accent-dark); }
.btn-sm { font-size: 13px; padding: 7px 14px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
}
.badge-shopping { background: var(--accent-lt); color: var(--accent); }
.badge-store    { background: var(--accent-lt); color: var(--accent); }
.badge-new      { background: var(--amber); color: #fff; font-size: 10px; padding: 2px 8px; margin-left: 6px; }

/* ── Modals ─────────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
  z-index: 200;
}
.overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%; max-width: 430px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
.modal-icon  { font-size: 32px; margin-bottom: 10px; }
.modal-title { font-family: var(--font-display); font-size: 24px; margin-bottom: 6px; }
.modal-desc  { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; line-height: 1.55; }
.modal-label {
  display: block; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); margin-bottom: 7px;
}
.modal-input {
  width: 100%; padding: 13px 16px;
  font-family: var(--font-body); font-size: 15px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  outline: none; margin-bottom: 20px; background: var(--bg);
  transition: border-color .18s;
}
.modal-input:focus { border-color: var(--accent); background: #fff; }
.modal-btns { display: flex; gap: 10px; }
.modal-btns .btn { flex: 1; justify-content: center; }

/* ── Estimate note ──────────────────────────────────────────────────────────── */
.estimate-note {
  background: var(--accent-lt); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13px; margin-bottom: 14px; line-height: 1.65;
}

/* ── Context menu ───────────────────────────────────────────────────────────── */
.ctx-menu {
  position: absolute;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  min-width: 170px;
  z-index: 300;
  display: none;
  animation: modalIn .15s ease;
}
.ctx-menu.open { display: block; }
.ctx-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px;
  background: none; border: none; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14px;
  color: var(--text); cursor: pointer; text-align: left;
  transition: background .15s;
}
.ctx-item:hover { background: var(--bg); }
.ctx-item.ctx-danger { color: var(--danger); }
.ctx-item.ctx-danger:hover { background: var(--danger-lt); }
.ctx-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Home page ──────────────────────────────────────────────────────────────── */
.home-page { padding: 0 32px 60px; }
.new-list-form {
  display: flex; gap: 10px; margin-bottom: 0;
}
.new-list-form input {
  flex: 1; padding: 13px 18px;
  font-family: var(--font-body); font-size: 15px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; transition: border-color .18s;
}
.new-list-form input:focus { border-color: var(--accent); }
.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px;
}
.list-grid { display: flex; flex-direction: column; gap: 10px; max-width: 680px; }
.list-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); padding: 0;
  transition: all .2s; overflow: hidden;
  position: relative;
}
.list-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.list-card-link {
  flex: 1; padding: 18px 20px;
  display: block; color: var(--text);
  text-decoration: none; min-width: 0;
}
.list-name { font-family: var(--font-display); font-size: 19px; }
.list-date { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.list-menu-btn {
  background: none; border: none; cursor: pointer;
  font-size: 22px; color: var(--text-muted);
  padding: 18px 16px; line-height: 1;
  transition: color .15s;
  flex-shrink: 0;
}
.list-menu-btn:hover { color: var(--text); }
.empty-state { color: var(--text-muted); font-style: italic; padding: 12px 0; }
.list-card-trashed { opacity: .75; }
.list-card-trashed .list-card-link { cursor: default; pointer-events: none; }
.trash-card-actions { display:flex; gap:6px; padding:0 12px; flex-shrink:0; }

/* ── Sidebar user block ─────────────────────────────────────────────────────
   Lives here (not auth.css) so it applies on every page, not just /account.
────────────────────────────────────────────────────────────────────────── */
.sidebar-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 8px;
  gap: 6px;
}
.sidebar-username {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  transition: color .15s;
}
.sidebar-username:hover { color: #fff; }

/* Avatar — shared geometry (span = letter, img = photo) */
.user-avatar {
  width: 150px; height: 150px;
  border-radius: 50%; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.15);
}
span.user-avatar {
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 52px; font-weight: 700;
}
img.user-avatar { object-fit: cover; display: block; }

.user-name-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: calc(var(--sidebar-w) - 20px);
  text-align: center;
}
.signout-link {
  color: rgba(255,255,255,.45); font-size: 13px;
  text-decoration: none; padding: 3px 8px; border-radius: 6px;
  transition: color .15s;
}
.signout-link:hover { color: rgba(255,255,255,.9); }
.nav-admin { border-top: 1px solid rgba(255,255,255,.1); margin-top: 8px; padding-top: 8px; }

/* ── Mobile top bar ─────────────────────────────────────────────────────────── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 54px;
  background: #1a2e22;
  align-items: center;
  padding: 0 16px;
  z-index: 98;
  gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.burger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px; height: 36px;
  background: none; border: none;
  cursor: pointer; padding: 4px; flex-shrink: 0;
}
.burger-btn span {
  display: block;
  height: 2px; width: 22px;
  background: rgba(255,255,255,.8);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.mobile-topbar-logo {
  font-family: var(--font-display);
  font-size: 17px;
  color: #fff;
  letter-spacing: -.2px;
}

/* ── Sidebar backdrop (mobile) ──────────────────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}
.sidebar-backdrop.open { display: block; }

@media (max-width: 640px) {
  .mobile-topbar { display: flex; }
  .burger-btn    { display: flex; }
  .main-content  { margin-left: 0; padding-top: 54px; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    z-index: 100;
  }
  .sidebar.open { transform: translateX(0); }
}

/* ── Sidebar footer + theme toggle ─────────────────────────────────────────── */
.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar .theme-toggle-btn {
  border-color: rgba(255,255,255,.18);
  background: transparent;
}
.sidebar .theme-toggle-btn:hover {
  border-color: rgba(255,255,255,.35);
  background: rgba(255,255,255,.06);
}
.theme-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.theme-toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.theme-toggle-title {
  font-size: 14px;
  font-weight: 600;
}
.theme-toggle-sub {
  font-size: 12px;
  color: var(--text-muted);
}
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .18s;
  box-shadow: var(--shadow-sm);
}
.theme-toggle-btn:hover {
  border-color: var(--accent);
  background: var(--surface-alt);
  transform: translateY(-1px);
}
.theme-toggle-btn:active { transform: translateY(0); }
/* Sun: visible in light mode */
.theme-sun-icon  { display: flex; align-items: center; }
.theme-moon-icon { display: none; align-items: center; }
/* Moon: visible in dark mode */
[data-theme="dark"] .theme-sun-icon  { display: none; }
[data-theme="dark"] .theme-moon-icon { display: flex; }

/* ── Inline custom emojis (global) ──────────────────────────────────────────── */
.inline-emoji { height: 25px; width: 25px; display: inline-block; vertical-align: middle; margin: 0 2px; }

