:root {
  --bg: #f5f6f8; --panel: #fff; --text: #1f2933; --muted: #6b7785; --line: #e3e6ea;
  --primary: #2f6fdb; --primary-d: #2459b3; --side: #1e2a3a; --side-t: #c7d0db;
  --red: #d64545; --orange: #e08a1e; --green: #2e9d5b; --blue: #2f6fdb; --purple: #7b5bd6; --gray: #8692a0;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif; font-size: 14px;
       color: var(--text); background: var(--bg); display: flex; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* layout */
.sidebar { width: 210px; flex-shrink: 0; background: var(--side); color: var(--side-t); display: flex; flex-direction: column;
           position: sticky; top: 0; height: 100vh; overflow-y: auto; }
body.vendor .sidebar { background: #23392f; }
.brand { padding: 18px 16px; font-size: 17px; font-weight: 700; }
.brand a { color: #fff; }
.supplier-name { padding: 0 16px 10px; color: #fff; font-size: 13px; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; padding: 0 8px; }
.nav-group { font-size: 11px; color: #7d8a99; margin: 14px 8px 4px; letter-spacing: .05em; }
.nav-link { color: var(--side-t); padding: 7px 10px; border-radius: 6px; }
.nav-link:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.nav-link.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 600; }
.me { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 8px; color: #fff; }
.content { flex: 1; padding: 24px 28px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions form { display: inline; }

/* panels */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: block; color: inherit; }
.stat:hover { text-decoration: none; border-color: var(--primary); }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat.warn .value { color: var(--orange); } .stat.danger .value { color: var(--red); }

/* table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #f0f2f5; font-weight: 600; font-size: 13px; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.row-danger td { background: #fdf0f0; } tr.row-warn td { background: #fff7ea; }
td.empty { text-align: center; color: var(--muted); padding: 24px; }
tfoot td { font-weight: 700; background: #fafbfc; }
td input, td select { width: 100%; min-width: 70px; }

/* forms */
.form { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.form label, .field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.form label.check { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=search], input[type=month], select, textarea {
  padding: 7px 9px; border: 1px solid #cdd3da; border-radius: 6px; font: inherit; background: #fff; }
textarea { min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b8cff5; border-color: var(--primary); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters form { display: flex; gap: 6px; align-items: center; }
.inline-form { display: inline-flex; gap: 4px; align-items: center; }
.inline-form input[type=number] { width: 80px; }

/* buttons */
.btn { display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid #cdd3da; background: #fff; color: var(--text);
       font: inherit; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { text-decoration: none; background: #f3f5f8; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-danger { color: var(--red); border-color: #efc4c4; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-ghost { background: transparent; color: inherit; border-color: rgba(255,255,255,.3); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-block { width: 100%; }

.chip { padding: 4px 11px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--text); font-size: 13px; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip:hover { text-decoration: none; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-gray { background: #eceff3; color: #56616e; } .badge-red { background: #fbe3e3; color: var(--red); }
.badge-orange { background: #fdefd9; color: #b26a0c; } .badge-green { background: #dff3e7; color: #1f7a45; }
.badge-blue { background: #e0eafb; color: var(--primary-d); } .badge-purple { background: #ebe5fb; color: var(--purple); }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-notice { background: #e3f4ea; color: #1f6b3f; border: 1px solid #bfe3cd; }
.alert-error { background: #fbe9e9; color: #a83232; border: 1px solid #f1c6c6; }
.alert-info { background: #e8f0fd; color: #24508f; border: 1px solid #c8daf7; }

/* meal plan calendar */
.plan-table th.meal { width: 64px; }
.plan-table td { vertical-align: top; min-width: 130px; font-size: 13px; }
.plan-table td.consumed { background: #f4faf6; }
.dish { padding: 2px 0; display: flex; justify-content: space-between; gap: 4px; align-items: center; }
.dish .course { color: var(--muted); font-size: 11px; margin-right: 4px; }
.dish.short .name { color: var(--red); }
details.swap summary { cursor: pointer; color: var(--primary); font-size: 11px; list-style: none; padding: 0 4px; border-radius: 4px; }
details.swap summary::-webkit-details-marker { display: none; }
details.swap summary:hover { background: #e8f0fd; }
details.swap[open] { background: #f7f9fc; padding: 4px; border-radius: 4px; }
details.swap form { display: flex; gap: 4px; margin-top: 4px; }
details.swap select { font-size: 12px; padding: 3px; min-width: 0; width: 100%; }
.day-head { display: flex; flex-direction: column; gap: 4px; }
.today { outline: 2px solid var(--primary); }
.weekend { color: var(--red); }

/* auth */
body.auth { align-items: center; justify-content: center; }
.auth-box { background: #fff; padding: 32px; border-radius: 12px; border: 1px solid var(--line); width: 360px; }
.auth-box .form { max-width: none; }

@media (max-width: 800px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .nav-group { display: none; }
  .content { padding: 16px; }
}
@media print {
  .sidebar, .actions, .filters, details.swap, .no-print { display: none !important; }
  .content { padding: 0; } .card { border: none; }
}

/* demo login */
.demo-login { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); }
.demo-title { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.demo-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.demo-buttons form { display: block; }
.demo-btn { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; text-align: center; }
.demo-btn strong { font-size: 14px; }
.demo-btn span { font-size: 11px; color: var(--muted); white-space: normal; }
.demo-btn:hover { border-color: var(--primary); background: #f3f7fe; }
.auth-box { width: 400px; }

/* diet substitutions / nutrition */
.sub-line { font-size: 11px; color: var(--purple); padding-left: 6px; line-height: 1.35; }
.dish .name.subst { color: var(--purple); font-weight: 600; }
.nut-ok { color: var(--green); } .nut-low { color: var(--orange); } .nut-high { color: var(--red); }
.bar { height: 6px; background: #eceff3; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.bar > span { display: block; height: 100%; background: var(--primary); }

.brand a, .auth-title { display: inline-flex; align-items: center; gap: 8px; }
.brand-icon { width: 26px; height: 26px; border-radius: 7px; }
.auth-title .brand-icon { width: 34px; height: 34px; border-radius: 9px; }
.subst-name { color: var(--purple); font-weight: 600; }

/* rooms */
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.room { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fafbfc; }
.room-head { font-size: 13px; margin-bottom: 6px; display: flex; gap: 6px; align-items: baseline; }
.room-person { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 13px; padding: 2px 0; }
.room-person .badge { margin-left: 2px; font-size: 11px; padding: 1px 6px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 4px 0 14px; }
.tab { padding: 8px 16px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 600; }
.tab:hover { text-decoration: none; color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.room-detail { padding: 4px 0; border-top: 1px dashed var(--line); }
.room-detail:first-of-type { border-top: none; }

/* signup / approvals */
.signup-link { text-align: center; font-size: 13px; color: var(--muted); margin: 14px 0 0; line-height: 1.7; }
.signup-link a { white-space: nowrap; }
.nav-badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.auth-box .form { gap: 10px; }
.supplier-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
form:has(input[value="dietitian"]:checked) .supplier-fields { display: none; }
