@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #4F46E5;
  --primary-light: #EEF2FF;
  --primary-dark: #3730A3;
  --amber: #F59E0B;
  --amber-light: #FFFBEB;
  --green: #10B981;
  --green-light: #ECFDF5;
  --red: #EF4444;
  --red-light: #FEF2F2;
  --blue: #3B82F6;
  --blue-light: #EFF6FF;
  --sidebar-bg: #FFFFFF;
  --sidebar-width: 220px;
  --topbar-h: 60px;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --text: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); }

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo img {
  width: 100%;
  max-height: 70px;
  object-fit: contain;
  border-radius: 8px;
}

.sidebar-nav { flex: 1; padding: 12px 8px; }

.nav-section {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item .icon { font-size: 16px; min-width: 20px; text-align: center; }

.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); }

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--red);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  transition: background 0.15s;
}
.logout-btn:hover { background: var(--red-light); }

/* ── MAIN ── */
.main { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.content { padding: 24px; flex: 1; }

.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.page-header p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── STAT CARDS ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
}

.stat-card .s-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .s-value {
  font-size: 26px;
  font-weight: 700;
  margin: 8px 0 4px;
}

.stat-card .s-sub { font-size: 12px; }

.stat-card.green .s-value { color: var(--green); }
.stat-card.green .s-sub { color: var(--green); }
.stat-card.red .s-value { color: var(--red); }
.stat-card.red .s-sub { color: var(--red); }
.stat-card.amber .s-sub { color: var(--amber); }
.stat-card.blue .s-sub { color: var(--blue); }

/* ── CARD ── */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: #F8FAFC;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFBFC; }

.empty-row td { text-align: center; padding: 48px; color: var(--text-muted); font-size: 14px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { filter: brightness(0.9); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { filter: brightness(0.9); }
.btn-warning { background: var(--amber); color: white; }
.btn-outline { background: white; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: none; border: none; color: var(--text-muted); padding: 6px 10px; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; border-radius: 6px; }

/* ── FORMS ── */
.form-group { margin-bottom: 14px; }
label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--text); }

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: white;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

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

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.modal {
  background: white;
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-lg { max-width: 680px; }

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: #FAFBFC; border-radius: 0 0 14px 14px; }

/* ── BADGE ── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green { background: var(--green-light); color: #065F46; }
.badge-red { background: var(--red-light); color: #991B1B; }
.badge-amber { background: #FFFBEB; color: #92400E; }
.badge-blue { background: var(--blue-light); color: #1E40AF; }
.badge-purple { background: var(--primary-light); color: var(--primary-dark); }
.badge-gray { background: #F1F5F9; color: #475569; }

/* ── ALERT ── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert-success { background: var(--green-light); color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger { background: var(--red-light); color: #991B1B; border: 1px solid #FECACA; }
.alert-info { background: var(--blue-light); color: #1E40AF; border: 1px solid #BFDBFE; }

/* ── UNREAD BADGE ── */
.unread-dot { display: inline-block; width: 8px; height: 8px; background: var(--red); border-radius: 50%; margin-left: 4px; vertical-align: middle; }

/* ── MENU GRID ── */
.menu-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.menu-day { background: white; padding: 0; }
.menu-day-header { background: #F8FAFC; padding: 10px 12px; font-size: 12px; font-weight: 700; color: var(--text); text-align: center; border-bottom: 1px solid var(--border); }
.menu-meal { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; min-height: 72px; }
.menu-meal:last-child { border-bottom: none; }
.menu-meal:hover { background: #F8FAFC; }
.menu-meal-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.menu-meal-items { font-size: 12px; color: var(--text); }

/* ── INBOX ── */
.inbox-item { padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.inbox-item:hover { background: #FAFBFC; }
.inbox-item.unread { background: #EEF2FF; border-left: 3px solid var(--primary); }

/* ── LOGIN ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 40%, #1E3A5F 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { max-width: 160px; border-radius: 10px; }

/* ── UTILS ── */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.spinner { border: 3px solid #E2E8F0; border-top: 3px solid var(--primary); border-radius: 50%; width: 22px; height: 22px; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { text-align: center; padding: 60px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .menu-grid { grid-template-columns: 1fr; }
}
