:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --warning: #d97706;
  --star: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 40px -8px rgba(15, 23, 42, 0.16);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-w: 276px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Consolas, monospace;
}

html[data-theme='dark'] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --surface-hover: #263449;
  --border: #1f2937;
  --border-strong: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.16);
  --danger: #ef4444;
  --danger-hover: #f87171;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 44px -8px rgba(0, 0, 0, 0.65);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Shared Buttons & Controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn:active {
  transform: scale(0.98);
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--surface-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-link {
  background: none;
  border: none;
  padding: 2px 4px;
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 600;
}

.btn-link:hover {
  text-decoration: underline;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.req {
  color: var(--danger);
}

input[type='text'],
input[type='password'],
input[type='url'],
input[type='search'],
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea {
  min-height: 70px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: var(--surface);
}

.input-with-action {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-action input {
  padding-right: 44px;
}

.input-with-action .icon-btn {
  position: absolute;
  right: 3px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-error {
  margin: 4px 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 500;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 12px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Auth Screen */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-header h1 {
  margin: 12px 0 4px;
  font-size: 1.42rem;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.auth-footer {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.storage-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
}

.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-badge.large {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.brand-badge svg {
  width: 22px;
  height: 22px;
}

.brand-badge.large svg {
  width: 28px;
  height: 28px;
}

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 40;
}

.sidebar-top {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
}

.brand-text-wrap {
  flex: 1;
  min-width: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.brand-tag {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  padding: 10px 10px 6px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.nav-item > span:first-of-type {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.nav-count {
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
}

.nav-item.active .nav-count {
  background: var(--primary);
  color: #ffffff;
}

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-footer .nav-item {
  justify-content: flex-start;
}

.danger-text {
  color: var(--danger) !important;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 35;
  backdrop-filter: blur(2px);
}

.mobile-only {
  display: none;
}

/* Main Content */
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hamburger-btn {
  display: none;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-soft);
  pointer-events: none;
}

.search-box input {
  padding-left: 38px;
  padding-right: 36px;
}

.search-shortcut {
  position: absolute;
  right: 10px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-family: var(--mono);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.view-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
}

.view-btn svg {
  width: 17px;
  height: 17px;
}

.view-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.sort-select {
  width: auto !important;
  min-width: 150px;
}

.tablet-add-btn {
  display: none;
}

/* Mobile / Tablet Horizontal Filter Chips */
.mobile-chips {
  display: none;
  gap: 8px;
  overflow-x: auto;
  padding-top: 10px;
  scrollbar-width: none;
}

.mobile-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 500;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Content */
.content {
  padding: 20px 24px 80px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.stat-pill-accent {
  margin-left: auto;
  background: var(--primary-soft);
  border-color: transparent;
}

.stat-pill-accent .stat-label {
  color: var(--primary);
  font-weight: 600;
}

.stat-label {
  color: var(--text-muted);
}

.stat-value {
  font-weight: 700;
  color: var(--text);
}

/* Grid Cards */
.entries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.entry-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.site-avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.card-title-wrap {
  flex: 1;
  min-width: 0;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.badge-cat {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.card-head-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.fav-btn.is-fav {
  color: var(--star);
}

.url-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.url-link {
  flex: 1;
  min-width: 0;
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.url-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.cred-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cred-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}

.cred-info {
  flex: 1;
  min-width: 0;
}

.cred-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cred-val {
  display: block;
  font-family: var(--mono);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.cred-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.copy-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
}

.copy-pill:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.copy-pill svg {
  width: 13px;
  height: 13px;
}

.card-notes {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.82rem;
  word-break: break-word;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-soft);
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

/* Table View */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.vault-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.vault-table th,
.vault-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.vault-table th {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface-2);
}

.vault-table tbody tr:last-child td {
  border-bottom: none;
}

.vault-table tbody tr:hover {
  background: var(--surface-hover);
}

.table-site-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 260px;
}

.table-site-cell .site-avatar {
  width: 34px;
  height: 34px;
  font-size: 0.9rem;
}

.table-site-text {
  min-width: 0;
}

.table-site-title {
  font-weight: 700;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-site-url {
  display: block;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-inline-cred {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
}

.table-inline-cred code {
  font-family: var(--mono);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon svg {
  width: 28px;
  height: 28px;
}

.empty-state h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.empty-state p {
  margin: 0 auto 18px;
  max-width: 420px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* FAB (Mobile only) */
.fab {
  display: none;
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-lg);
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.fab svg {
  width: 24px;
  height: 24px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  max-height: 92dvh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card.modal-sm {
  max-width: 400px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.info-box {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.info-box:last-child {
  margin-bottom: 0;
}

.info-box strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.94rem;
}

.info-box p {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.info-box p:last-child {
  margin-bottom: 0;
}

.lan-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lan-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.82rem;
  word-break: break-all;
}

.file-input {
  width: 100%;
  font-size: 0.86rem;
}

/* Password Strength */
.strength-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.strength-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.2s ease, background 0.2s ease;
}

.strength-text {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 380px;
}

.toast {
  background: #0f172a;
  color: #f8fafc;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.18s ease;
}

html[data-theme='dark'] .toast {
  background: #f1f5f9;
  color: #0f172a;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================================
   Tablet Breakpoint (<= 1024px)
   ================================ */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-flex;
  }

  .hamburger-btn {
    display: inline-flex;
  }

  .tablet-add-btn {
    display: inline-flex;
  }

  .mobile-chips {
    display: flex;
  }

  .topbar {
    padding: 12px 16px;
  }

  .content {
    padding: 16px 16px 88px;
  }

  .entries-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ================================
   Mobile / HP Breakpoint (<= 640px)
   ================================ */
@media (max-width: 640px) {
  .topbar {
    padding: 10px 12px;
  }

  .topbar-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .search-box {
    order: 2;
    flex-basis: 100%;
  }

  .search-shortcut {
    display: none;
  }

  .topbar-actions {
    margin-left: auto;
    gap: 6px;
  }

  .view-toggle,
  .tablet-add-btn {
    display: none;
  }

  .sort-select {
    min-width: 126px;
    font-size: 0.84rem;
    min-height: 38px;
    padding: 6px 8px;
  }

  .content {
    padding: 12px 12px 92px;
  }

  .stat-pill-accent {
    margin-left: 0;
  }

  .entries-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .fab {
    display: inline-flex;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
  }

  .auth-card {
    padding: 24px 18px;
  }
}
