/* ========================================
   工作台 - 多用户版 粉色系主题
   PC + 手机响应式 + 登录页面
   ======================================== */

/* ===== CSS Variables ===== */
:root {
  --bg-primary: #fdf2f8;
  --bg-card: #ffffff;
  --bg-sidebar: linear-gradient(180deg, #be185d 0%, #9d174d 100%);
  --bg-sidebar-solid: #be185d;
  --bg-hover: #fce7f3;
  --bg-input: #fdf2f8;
  --text-primary: #831843;
  --text-secondary: #be185d;
  --text-light: #f9a8d4;
  --text-inverse: #fff;
  --border: #fbcfe8;
  --border-strong: #f9a8d4;

  --accent: #ec4899;
  --accent-light: #f472b6;
  --accent-dark: #db2777;
  --accent-bg: #fce7f3;

  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --info: #3b82f6;
  --info-bg: #dbeafe;

  --gradient-primary: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
  --gradient-accent: linear-gradient(135deg, #f472b6 0%, #fbcfe8 100%);
  --gradient-sidebar: linear-gradient(180deg, #be185d 0%, #9d174d 100%);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  --shadow: 0 2px 8px rgba(236, 72, 153, 0.06), 0 1px 3px rgba(236, 72, 153, 0.04);
  --shadow-md: 0 6px 16px rgba(236, 72, 153, 0.1), 0 2px 6px rgba(236, 72, 153, 0.06);
  --shadow-lg: 0 12px 24px rgba(236, 72, 153, 0.12), 0 4px 8px rgba(236, 72, 153, 0.08);
  --shadow-pink: 0 4px 12px rgba(236, 72, 153, 0.2);

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --sidebar-w: 220px;
  --mobile-header-h: 52px;
  --mobile-nav-h: 56px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

input, select, button { font-family: inherit; font-size: inherit; }

/* ===== Auth Page ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 50%, #f9a8d4 100%);
  padding: 20px;
  padding-top: calc(20px + var(--safe-top));
}

.auth-card {
  background: #fff;
  border-radius: 24px;
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-logo {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 28px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  background: var(--accent-bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
}

.auth-tab.active {
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow);
}

.auth-field {
  text-align: left;
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.auth-submit {
  width: 100%;
  margin-top: 8px;
}

.auth-hint {
  margin-top: 16px;
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
}

/* ===== Layout ===== */
.app {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  padding: 24px 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  color: #fff;
}

.logo-icon { font-size: 28px; }
.logo-text { font-size: 20px; font-weight: 800; }

.nav { flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 4px;
}

.nav-item:hover { color: #fff; background: rgba(255,255,255,0.1); }
.nav-item.active { background: rgba(255,255,255,0.2); color: #fff; }
.nav-icon { font-size: 20px; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 16px;
}

.user-info {
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-xs);
}

.theme-btn, .logout-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-radius: var(--radius-xs);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 8px;
  text-align: left;
}

.theme-btn:hover, .logout-btn:hover { background: rgba(255,255,255,0.2); }

.date-display {
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  text-align: center;
  margin-top: 8px;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 28px 32px;
  max-width: calc(100% - var(--sidebar-w));
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

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

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-label { font-size: 13px; color: var(--text-light); margin-bottom: 8px; }
.stat-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.stat-label-row .stat-label { margin-bottom: 0; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); }
.stat-value.accent { color: var(--accent); }
.stat-value.success { color: var(--success); }
.stat-value.danger { color: var(--danger); }
.stat-value.warning { color: var(--warning); }
.stat-value.masked {
  letter-spacing: 2px;
  user-select: none;
  cursor: pointer;
}
.stat-sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.stat-sub.masked { user-select: none; cursor: pointer; }
.amount-toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  transition: var(--transition);
}
.amount-toggle-btn:hover {
  color: var(--accent);
  background: var(--accent-bg);
}

/* ===== Cards ===== */
.checkin-card, .records-section, .chart-section, .person-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ===== Forms ===== */
.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-size: 14px;
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
  min-width: 120px;
}

.form-control:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

.form-control-sm {
  padding: 6px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-input);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}

.form-action { justify-content: flex-end; flex-direction: row; align-items: flex-end; gap: 8px; }

.finance-form .form-group { flex: 1; min-width: 140px; }

.combobox-wrap { width: 100%; }
.combobox-wrap .form-control { width: 100%; }

.filter-controls { display: flex; gap: 12px; }

/* ===== Buttons ===== */
.btn-primary {
  padding: 10px 24px;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-pink);
  white-space: nowrap;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  padding: 10px 24px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

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

.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
}

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

.btn-delete {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-delete:hover { background: var(--danger); color: #fff; }

.btn-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
}

/* ===== Person List ===== */
.person-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.person-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--accent-bg);
  border-radius: 20px;
  font-size: 14px;
  color: var(--accent-dark);
  font-weight: 500;
}

.person-tag .remove {
  cursor: pointer;
  opacity: 0.6;
  font-weight: 700;
}

.person-tag .remove:hover { opacity: 1; color: var(--danger); }

/* ===== Chart ===== */
.chart-range { display: flex; gap: 4px; }

.range-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
}

.range-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.chart-wrap { height: 360px; position: relative; }

/* ===== Table ===== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  background: var(--accent-bg);
  color: var(--text-secondary);
  font-weight: 700;
  text-align: left;
  padding: 12px 16px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table td {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  color: var(--text-primary);
}

.data-table tr:hover td { background: var(--bg-hover); }

/* Pivot Table */
.pivot-table th:first-child,
.pivot-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: inherit;
}
.pivot-table th:first-child { background: var(--accent-bg); }
.pivot-table tbody tr:hover td:first-child { background: var(--bg-hover); }

.pivot-table .weight-cell {
  cursor: pointer;
  transition: var(--transition);
  border-radius: 6px;
}
.pivot-table .weight-cell:hover { background: var(--accent-bg) !important; }

.weight-change { font-size: 12px; font-weight: 600; }
.weight-change.up { color: var(--danger); }
.weight-change.down { color: var(--success); }
.weight-change.flat { color: var(--text-light); }

.cell-unit { font-size: 11px; font-weight: 400; color: var(--text-light); margin-left: 2px; }

.table-hint { font-size: 12px; color: var(--text-light); margin-bottom: 8px; }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-default { background: #f1f5f9; color: #64748b; }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-type-fixed { background: #dcfce7; color: #16a34a; }
.badge-type-demand { background: #dbeafe; color: #2563eb; }
.badge-public { background: #f0fdf4; color: #16a34a; }
.badge-private { background: #fef3c7; color: #d97706; }

/* ===== Privacy Toggle Switch ===== */
.privacy-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.privacy-toggle input { display: none; }
.privacy-slider {
  width: 36px;
  height: 20px;
  background: #e2e8f0;
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.privacy-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.privacy-toggle input:checked ~ .privacy-slider {
  background: var(--accent);
}
.privacy-toggle input:checked ~ .privacy-slider::after {
  transform: translateX(16px);
}
.privacy-label-text {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Toggle privacy button in table */
.btn-toggle-privacy {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-toggle-privacy:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

/* Action column - buttons in one row */
.th-action { min-width: 180px; }
.action-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.privacy-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.btn-edit {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-edit:hover { background: var(--accent); color: #fff; }

/* ===== Admin Page ===== */
.admin-form-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-form-row .form-control { min-width: 120px; }
.admin-form-row .btn-primary { white-space: nowrap; flex-shrink: 0; }

/* ===== Profile Center ===== */
.profile-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.profile-info-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.profile-info-row:last-child { border-bottom: none; }
.profile-label {
  width: 120px;
  font-size: 14px;
  color: var(--text-light);
  flex-shrink: 0;
}
.profile-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== Alert Banner ===== */
.alert-banner {
  background: linear-gradient(135deg, #fce7f3, #fdf2f8);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-banner strong { color: var(--danger); }
.alert-banner .alert-item { margin-top: 4px; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-light); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-text { font-size: 14px; }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(190, 24, 93, 0.25);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: 20px;
}

.modal-overlay.show { display: flex; }

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.color-modal { max-width: 380px; }

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

.modal-header h3 { font-size: 18px; font-weight: 700; color: var(--text-primary); }

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; }

/* ===== Color Picker ===== */
.color-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.color-preset {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 3px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.color-preset:hover { transform: scale(1.1); }
.color-preset.active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent), var(--shadow-md); }
.color-preset.active::after { content: '✓'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #fff; font-size: 20px; font-weight: 700; }

.color-custom label { display: block; font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }

.color-custom-row { display: flex; gap: 8px; align-items: center; }

.color-custom-row input[type="color"] {
  width: 44px; height: 40px;
  border: 2px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  background: none;
}

.color-custom-row input[type="text"] { flex: 1; text-transform: uppercase; }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}

.toast.success { background: var(--success); color: #fff; }
.toast.warning { background: var(--warning); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.info { background: var(--accent); color: #fff; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== Mobile Header ===== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--mobile-header-h);
  padding-top: var(--safe-top);
  background: var(--bg-sidebar);
  color: #fff;
  align-items: center;
  justify-content: space-between;
  padding-left: 16px;
  padding-right: 16px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(190, 24, 93, 0.2);
}

.mobile-header-icon { font-size: 22px; }
.mobile-header-title { font-size: 17px; font-weight: 700; flex: 1; margin-left: 8px; }
.mobile-header-right { display: flex; gap: 4px; }

.header-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.header-btn:hover { background: rgba(255,255,255,0.25); }

/* ===== Demand expense stats ===== */
.expense-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 8px;
}
.expense-panel {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.expense-panel h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-secondary);
}
.expense-bars { display: flex; flex-direction: column; gap: 8px; }
.expense-bar-row {
  display: grid;
  grid-template-columns: 52px 1fr 88px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.expense-bar-label { color: var(--text-secondary); white-space: nowrap; }
.expense-bar-track {
  height: 8px;
  background: var(--bg-hover);
  border-radius: 999px;
  overflow: hidden;
}
.expense-bar-fill {
  height: 100%;
  background: var(--danger);
  border-radius: 999px;
  min-width: 4px;
}
.expense-bar-fill.cat { background: var(--accent); }
.expense-bar-value {
  text-align: right;
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .expense-stats-grid { grid-template-columns: 1fr; }
  .expense-bar-row { grid-template-columns: 44px 1fr 76px; }
}

/* ===== Fridge ===== */
.fridge-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fridge-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  transition: var(--transition);
}

.fridge-item:hover { box-shadow: var(--shadow); }
.fridge-item.is-empty { opacity: 0.65; }

.fridge-item-main { flex: 1; min-width: 0; }
.fridge-item-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.fridge-item-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.fridge-item-category {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 2px 8px;
  border-radius: 999px;
}
.fridge-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-light);
}

.fridge-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.qty-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition);
}
.qty-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}
.qty-value {
  min-width: 64px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}
.qty-value.qty-low { color: var(--warning); }
.qty-value.qty-empty { color: var(--text-light); }
.qty-unit {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-light);
}

.fridge-item-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.btn-text.danger { color: var(--danger); }

@media (max-width: 768px) {
  .fridge-item {
    flex-wrap: wrap;
    gap: 12px;
  }
  .fridge-item-main { width: 100%; }
  .fridge-item-qty { order: 2; }
  .fridge-item-actions {
    order: 3;
    flex-direction: row;
    margin-left: auto;
  }
}

/* ===== Mobile Nav ===== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--mobile-nav-h);
  padding-bottom: var(--safe-bottom);
  background: #fff;
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 8px rgba(236, 72, 153, 0.06);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-light);
  font-size: 11px;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: var(--radius-xs);
  transition: var(--transition);
}

.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-icon { font-size: 20px; }
.mobile-nav-label { font-weight: 600; }

/* ===== Responsive: Mobile ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .mobile-header { display: flex; }
  .mobile-nav { display: flex; }

  .main-content {
    margin-left: 0;
    padding: calc(var(--mobile-header-h) + 20px + var(--safe-top)) 16px calc(var(--mobile-nav-h) + 20px + var(--safe-bottom)) 16px;
    max-width: 100%;
  }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 22px; }

  .checkin-card, .records-section, .chart-section, .person-section { padding: 16px; }

  .form-row { flex-direction: column; gap: 12px; }
  .form-group { width: 100%; }
  .form-control { width: 100%; min-width: 0; font-size: 16px; }
  .form-action { width: 100%; }
  .form-action .btn-primary { flex: 1; }

  .finance-form .form-group { min-width: 0; }

  .admin-form-row { flex-direction: column; gap: 8px; }
  .admin-form-row .form-control { width: 100%; min-width: 0; font-size: 16px; }
  .admin-form-row .btn-primary { width: 100%; }

  .filter-controls { flex-direction: column; gap: 8px; width: 100%; }
  .filter-controls .form-control-sm { width: 100%; }

  .chart-wrap { height: 260px; }
  .chart-range .range-btn { padding: 4px 8px; font-size: 12px; }

  .data-table th, .data-table td { padding: 10px 12px; font-size: 13px; }
  .pivot-table th, .pivot-table td { min-width: 72px; }

  .section-header h2 { font-size: 16px; }

  .toast-container { top: auto; right: 16px; left: 16px; bottom: calc(90px + var(--safe-bottom)); }
  .toast { min-width: 0; width: 100%; padding: 10px 16px; font-size: 13px; }

  .auth-card { padding: 32px 24px; }
  .auth-title { font-size: 24px; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
  .color-presets { grid-template-columns: repeat(4, 1fr); }
}
