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

:root {
  --sage: #8B9E7E;
  --sage-dark: #6B7E5E;
  --sage-light: #C5D1BC;
  --sage-pale: #E8EDE4;
  --cream: #FAF8F5;
  --warm: #F5F0EB;
  --sand: #D4C5B2;
  --text: #2C3027;
  --text-soft: #5A6153;
  --text-muted: #8A9082;
  --sky: #A8C4D6;
  --sky-pale: #E4EEF3;
  --white: #FFFFFF;
  --red: #C0392B;
  --red-pale: #FADBD8;
  --border: rgba(139, 158, 126, 0.15);
  --shadow-sm: 0 1px 3px rgba(44, 48, 39, 0.04);
  --shadow-md: 0 4px 16px rgba(44, 48, 39, 0.06);
  --shadow-lg: 0 12px 40px rgba(44, 48, 39, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text);
  background: var(--cream);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Auth Pages ─── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--cream);
  position: relative;
}
.auth-page::before {
  content: '';
  position: absolute;
  top: -10%;
  right: -15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--sage-pale) 0%, transparent 70%);
  border-radius: 50%;
}
.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 3rem;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.auth-card .logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.75rem;
  color: var(--sage);
  text-align: center;
  margin-bottom: 0.5rem;
}
.auth-card .logo span { color: var(--text); }
.auth-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  font-weight: 400;
}
.auth-card h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  text-align: center;
}

/* ─── Forms ─── */
.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 0.4rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--cream);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(139, 158, 126, 0.15);
}
.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--sage);
  color: white;
}
.btn-primary:hover {
  background: var(--sage-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-secondary {
  background: var(--sage-pale);
  color: var(--sage);
}
.btn-secondary:hover {
  background: var(--sage-light);
}
.btn-danger {
  background: var(--red-pale);
  color: var(--red);
}
.btn-danger:hover {
  background: #F1948A;
  color: white;
}
.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--warm);
}
.btn-full { width: 100%; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }

/* ─── App Layout ─── */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 260px;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
}
.sidebar .logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--sage);
  margin-bottom: 0.25rem;
}
.sidebar .logo span { color: var(--text); }
.sidebar .user-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.sidebar-link:hover {
  background: var(--sage-pale);
  color: var(--text);
}
.sidebar-link.active {
  background: var(--sage);
  color: white;
}
.sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.sidebar-link .count {
  margin-left: auto;
  font-size: 0.75rem;
  background: rgba(0,0,0,0.06);
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  font-weight: 600;
}
.sidebar-link.active .count {
  background: rgba(255,255,255,0.2);
}
.sidebar-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
}

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 2rem 2.5rem;
  max-width: 1000px;
}

/* ─── Page Headers ─── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.page-header h1 {
  font-family: 'Syne', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.page-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* ─── Dashboard ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.stat-card .stat-icon svg { width: 22px; height: 22px; }
.stat-card:nth-child(1) .stat-icon { background: var(--sage-pale); color: var(--sage); }
.stat-card:nth-child(2) .stat-icon { background: var(--sky-pale); color: #6A9AB8; }
.stat-card:nth-child(3) .stat-icon { background: #F0E8DE; color: #A8916E; }
.stat-card:nth-child(4) .stat-icon { background: #F3E8F0; color: #9B7A91; }
.stat-card .stat-count {
  font-family: 'Syne', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ─── Welcome Card ─── */
.welcome-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2.5rem;
  border: 1px solid var(--border);
  text-align: center;
  margin-bottom: 2rem;
}
.welcome-card h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.welcome-card p {
  color: var(--text-soft);
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto 1.5rem;
  line-height: 1.7;
}

/* ─── Item Cards (List View) ─── */
.items-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.item-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.15s;
  cursor: pointer;
}
.item-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--sage-light);
}
.item-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.item-icon.accounts { background: var(--sage-pale); color: var(--sage); }
.item-icon.documents { background: var(--sky-pale); color: #6A9AB8; }
.item-icon.contacts { background: #F0E8DE; color: #A8916E; }
.item-icon.instructions { background: #F3E8F0; color: #9B7A91; }
.item-icon svg { width: 20px; height: 20px; }
.item-info { flex: 1; min-width: 0; }
.item-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.1rem;
}
.item-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.item-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  background: var(--sage-pale);
  color: var(--sage);
  font-weight: 600;
  text-transform: capitalize;
  flex-shrink: 0;
}
.item-badge.trusted {
  background: #D5F5E3;
  color: #1E8449;
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 1rem;
  opacity: 0.5;
}
.empty-state h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 48, 39, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 1.5rem 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--warm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}
.modal-close:hover {
  background: var(--sage-pale);
  color: var(--text);
}
.modal-body {
  padding: 1.5rem;
}
.modal-footer {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ─── Alerts ─── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.alert-error {
  background: var(--red-pale);
  color: var(--red);
  border: 1px solid rgba(192, 57, 43, 0.15);
}
.alert-success {
  background: #D5F5E3;
  color: #1E8449;
  border: 1px solid rgba(30, 132, 73, 0.15);
}

/* ─── Link ─── */
.link {
  color: var(--sage);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}
.link:hover {
  text-decoration: underline;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .mobile-nav {
    display: flex !important;
  }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .main-content { padding: 1.5rem; }
  .auth-card { padding: 2rem 1.5rem; }
}

/* ─── Mobile Nav ─── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 0.5rem;
  z-index: 100;
  justify-content: space-around;
}
.mobile-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-family: inherit;
  cursor: pointer;
  border-radius: 8px;
}
.mobile-nav button.active {
  color: var(--sage);
}
.mobile-nav button svg {
  width: 22px;
  height: 22px;
}

/* ─── Checkbox ─── */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--sage);
}

/* ─── Spinner ─── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Confirm dialog ─── */
.confirm-text {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* ─── Paywall ─── */
.paywall-page {
  background: linear-gradient(135deg, var(--cream) 0%, var(--sage-pale) 100%);
}
.paywall-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  text-align: center;
}
.paywall-card .logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--sage);
  margin-bottom: 1.5rem;
}
.paywall-card .logo span { color: var(--text); }
.paywall-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--sage-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  color: var(--sage);
}
.paywall-card h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.paywall-sub {
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}
.paywall-price {
  margin-bottom: 1.5rem;
}
.price-amount {
  font-family: 'Syne', sans-serif;
  font-size: 3rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.price-period {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 400;
}
.paywall-features {
  list-style: none;
  text-align: left;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.paywall-features li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.9rem;
  color: var(--text-soft);
}
.pf-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--sage-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--sage);
}
.paywall-cta {
  font-size: 1rem;
  padding: 0.9rem 2rem;
  border-radius: 100px;
  text-decoration: none;
  margin-bottom: 0.75rem;
  display: block;
}
.paywall-cta:hover {
  background: var(--sage-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(139, 158, 126, 0.3);
}
.paywall-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.paywall-logout {
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* ─── Trial Banner ─── */
.trial-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--sage-pale) 0%, #E4EEF3 100%);
  border: 1px solid var(--sage-light);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}
.trial-banner-text {
  font-size: 0.9rem;
  color: var(--text);
}
.trial-banner-text strong {
  color: var(--sage-dark);
}
.trial-banner-btn {
  text-decoration: none;
  white-space: nowrap;
  border-radius: 100px;
}
