* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f4f6fb;
  color: #111827;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

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

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 12px;
  color: #6b7280;
}

.card {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 25px rgba(17, 24, 39, 0.06);
  margin-bottom: 16px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tab-button {
  border: 1px solid #c7d2e5;
  background: #f8fbff;
  color: #111827;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tab-button.active {
  background: #1f4ed8;
  color: #ffffff;
  border-color: #1f4ed8;
}

.app-footer {
  margin-top: 24px;
  padding: 12px 4px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
}

.footer-text {
  font-size: 12px;
  color: #6b7280;
}

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

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  background: #ffffff;
  color: #111827;
}

.hidden {
  display: none;
}

.hint {
  margin-top: 10px;
  font-size: 12px;
  color: #6b7280;
}

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

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: #e5e7eb;
}

.user-name {
  font-size: 16px;
  font-weight: 700;
}

.user-email {
  font-size: 12px;
  color: #6b7280;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.stat {
  background: #f3f4f6;
  border-radius: 12px;
  padding: 10px;
}

.stat-label {
  font-size: 11px;
  color: #6b7280;
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn.primary {
  background: #111827;
  color: #ffffff;
}

.btn.secondary {
  background: #f3f4f6;
  color: #111827;
}

.code-block {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 10px;
  font-size: 12px;
  overflow-x: auto;
}

.profile-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.measurements-list {
  display: grid;
  gap: 10px;
}

.measurement-row {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.measurement-date {
  font-size: 12px;
  color: #6b7280;
}

.measurement-values {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
}

.tracking-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.detail-title {
  font-size: 12px;
  font-weight: 700;
  color: #111827;
}

.tracking-row {
  display: grid;
  grid-template-columns: 110px 1fr 1fr;
  gap: 8px;
  font-size: 12px;
  color: #374151;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
}

.meal-entry {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  overflow: hidden;
}

.meal-entry + .meal-entry {
  margin-top: 8px;
}

.meal-entry-summary {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  cursor: pointer;
}

.meal-entry-summary::-webkit-details-marker {
  display: none;
}

.meal-entry-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.meal-entry-name {
  font-weight: 700;
  color: #111827;
}

.meal-entry-meta,
.meal-entry-macro {
  font-size: 12px;
  color: #4b5563;
}

.meal-entry-image-wrap {
  display: grid;
  justify-items: end;
}

.meal-entry-image {
  width: 88px;
  height: 88px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid #dbe2ee;
  background: #eef2f7;
}

.meal-entry-image-empty {
  display: grid;
  place-items: center;
  font-size: 11px;
  color: #6b7280;
  text-align: center;
  padding: 6px;
}

.meal-entry-detail {
  border-top: 1px solid #e5e7eb;
  background: #fff;
  padding: 10px;
}

.meal-steps {
  margin: 6px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #374151;
}

.diet-generator {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px;
  background: #f9fafb;
  margin-bottom: 14px;
}

.diet-subtabs {
  margin-bottom: 14px;
}

.diet-generator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.diet-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #374151;
}

.diet-field span {
  font-weight: 700;
}

.diet-checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: 12px;
  color: #374151;
}

.diet-generator-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.diet-textarea {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  resize: vertical;
  background: #ffffff;
  color: #111827;
  margin-top: 10px;
}

.diet-shopping-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.diet-shopping-actions {
  display: flex;
  align-items: end;
}

.diet-shopping-category {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  overflow: hidden;
}

.diet-shopping-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.diet-shopping-category-name {
  font-size: 13px;
  font-weight: 800;
  color: #111827;
}

.diet-shopping-category-total {
  font-size: 12px;
  font-weight: 700;
  color: #374151;
}

.diet-shopping-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-top: 1px solid #eef2f7;
  font-size: 12px;
  color: #374151;
}

.diet-shopping-item:first-child {
  border-top: none;
}

.diet-shopping-item-name {
  font-weight: 600;
}

.diet-shopping-item-grams {
  font-weight: 800;
  color: #111827;
}

.diet-plan-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  padding: 12px;
}

.diet-plan-card + .diet-plan-card {
  margin-top: 8px;
}

.diet-plan-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.diet-plan-meta {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.diet-plan-slots {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.diet-plan-day {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  padding: 10px;
}

.diet-plan-day-title {
  font-size: 13px;
  font-weight: 800;
  color: #111827;
  margin-bottom: 8px;
  text-transform: capitalize;
}

.diet-plan-day-slots {
  display: grid;
  gap: 8px;
}

.diet-plan-slot {
  display: grid;
  grid-template-columns: 90px 64px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  padding: 8px 10px;
}

.diet-plan-slot-type {
  font-size: 11px;
  font-weight: 800;
  color: #1d4ed8;
}

.diet-plan-slot-name {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}

.diet-plan-slot-meta {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

.diet-plan-slot-image-wrap {
  display: grid;
  justify-items: center;
}

.diet-plan-slot-image {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid #dbe2ee;
  background: #eef2f7;
}

.diet-plan-slot-image-empty {
  display: grid;
  place-items: center;
  font-size: 10px;
  color: #6b7280;
  text-align: center;
  padding: 4px;
}

.diet-modal-content {
  position: relative;
  z-index: 2;
  width: min(760px, 92vw);
  max-height: 85vh;
  overflow: auto;
  background: #ffffff;
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.diet-swap-search {
  width: 100%;
}

.diet-swap-list {
  display: grid;
  gap: 8px;
}

.diet-swap-row {
  display: grid;
  grid-template-columns: 64px 1fr auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  background: #f9fafb;
}

.diet-swap-name {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}

.diet-swap-meta {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
}

.diet-swap-image-wrap {
  display: grid;
  justify-items: center;
}

.diet-swap-image {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid #dbe2ee;
  background: #eef2f7;
}

.diet-swap-image-empty {
  display: grid;
  place-items: center;
  font-size: 10px;
  color: #6b7280;
  text-align: center;
  padding: 4px;
}

.diet-kcal-delta-up {
  color: #b42318;
  font-weight: 800;
}

.diet-kcal-delta-down {
  color: #15803d;
  font-weight: 800;
}

.diet-kcal-delta-same {
  color: #374151;
  font-weight: 700;
}

.photo-gallery {
  display: grid;
  gap: 16px;
}

.photo-group-title {
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}

.photo-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.photo-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #e5e7eb;
}

.photo-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 999;
}

.photo-modal.hidden {
  display: none;
}

.photo-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
}

.photo-modal-content {
  position: relative;
  z-index: 2;
  max-width: 90vw;
  max-height: 85vh;
  background: #111827;
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.photo-modal-content img {
  max-width: 80vw;
  max-height: 65vh;
  object-fit: contain;
  border-radius: 12px;
  background: #0f172a;
}

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

.admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  min-width: 220px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 2fr;
  gap: 12px;
}

.admin-list,
.admin-detail {
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.admin-list-header,
.admin-detail-header {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
}

.admin-list-body {
  max-height: 360px;
  overflow-y: auto;
}

.admin-user-row {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  cursor: pointer;
}

.admin-user-row:hover {
  background: #eef2ff;
}

.admin-user-row.active {
  background: #e0e7ff;
}

.admin-user-name {
  font-size: 13px;
  font-weight: 600;
}

.admin-user-email {
  font-size: 11px;
  color: #6b7280;
}

.admin-detail-body {
  padding: 12px;
  font-size: 12px;
  color: #374151;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.detail-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid #eef2f7;
}

.detail-label {
  font-size: 11px;
  color: #6b7280;
}

.detail-value {
  font-size: 13px;
  font-weight: 600;
}

.detail-section {
  margin-top: 10px;
}

.detail-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.detail-empty {
  font-size: 12px;
  color: #6b7280;
}
