:root {
  --leaf-950: #2b1b0c;
  --leaf-900: #3b2610;
  --leaf-850: #472e14;
  --leaf-800: #55371a;
  --leaf-700: #8a5a1c;
  --leaf-600: #c47a22;
  --leaf-100: #f6e4c8;
  --leaf-50: #fbf3e4;
  --cream: #faf6ec;
  --paper: #fffdf7;
  --sand: #efe5d2;
  --line: #e6ddcb;
  --ink: #2a2016;
  --ink-soft: #5a4c3c;
  --muted: #7c6f60;
  --orange: #d9822b;
  --orange-soft: #fbe8cc;
  --amber: #9a5b06;
  --amber-soft: #fdf3d7;
  --red: #a92a20;
  --red-soft: #fbe9e6;
  --blue-soft: #edf2f7;
  --shadow-sm: 0 1px 2px rgba(42, 32, 22, 0.05), 0 10px 30px -22px rgba(42, 32, 22, 0.35);
  --shadow: 0 28px 70px -32px rgba(43, 27, 12, 0.4);
  --font-sans: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --radius: 18px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 95% -5%, rgba(217, 130, 43, 0.09), transparent 65%),
    radial-gradient(700px 420px at -5% 100%, rgba(194, 104, 13, 0.07), transparent 60%),
    var(--cream);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.icon {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 28px);
}

.boot-screen,
.loading-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

.boot-screen p,
.loading-screen p {
  margin: 0;
  font-size: 0.9rem;
}

.boot-logo {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  background: var(--leaf-800);
  color: #f8f0de;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.boot-logo .icon {
  width: 34px;
  height: 34px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(85, 55, 26, 0.18);
  border-top-color: var(--leaf-700);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.72rem 1.15rem;
  font-weight: 650;
  font-size: 0.9rem;
  line-height: 1.1;
  white-space: nowrap;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--leaf-800);
  color: #fff;
  box-shadow: 0 10px 20px -12px rgba(85, 55, 26, 0.7);
}

.btn-primary:hover:not(:disabled) {
  background: var(--leaf-900);
}

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover:not(:disabled) {
  border-color: #cfc3ac;
  background: #fffdf8;
}

.btn-soft {
  background: var(--leaf-50);
  border-color: var(--leaf-100);
  color: var(--leaf-900);
}

.btn-soft:hover:not(:disabled) {
  background: var(--leaf-100);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(59, 38, 16, 0.06);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
}

.btn-danger:hover:not(:disabled) {
  background: #f6d7d3;
}

.btn-sm {
  padding: 0.52rem 0.8rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.9rem 1.4rem;
  font-size: 0.98rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

.btn-icon.btn-sm {
  width: 34px;
  height: 34px;
}

.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
  position: relative;
}

.btn.is-loading > * {
  visibility: hidden;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-secondary.is-loading::after,
.btn-ghost.is-loading::after,
.btn-soft.is-loading::after {
  border-color: rgba(59, 38, 16, 0.2);
  border-top-color: var(--leaf-800);
}

.btn-heart {
  color: var(--red);
}

/* ===== Forms ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field > label,
.label {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: #a6aca3;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--leaf-600);
  box-shadow: 0 0 0 4px rgba(217, 130, 43, 0.12);
}

.input:disabled {
  background: #f5f1e6;
  color: var(--muted);
}

.textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.45;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1.5 5 5 5-5' fill='none' stroke='%236f7c72' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.2rem;
}

.rut-input {
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.hint {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid #f2cdc8;
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font-size: 0.82rem;
  line-height: 1.35;
}

.form-error:empty {
  display: none;
}

.form-error .icon {
  margin-top: 0.1rem;
}

.checkbox-line {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  margin-top: 0.1rem;
  accent-color: var(--leaf-700);
}

/* ===== Common atoms ===== */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--leaf-700);
}

.eyebrow.on-dark {
  color: #e6cfa6;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  padding: 0.24rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  background: var(--leaf-50);
  color: var(--leaf-900);
  border: 1px solid var(--leaf-100);
}

.pill.is-orange {
  background: var(--orange-soft);
  border-color: #f2d6ae;
  color: #8a4a06;
}

.pill.is-red {
  background: var(--red-soft);
  border-color: #f2cdc8;
  color: var(--red);
}

.pill.is-muted {
  background: #f2eee3;
  border-color: #e5decd;
  color: var(--muted);
}

.hypo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--leaf-100);
  color: var(--leaf-900);
  border-radius: 999px;
  padding: 0.18rem 0.45rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.hypo-badge .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.normal-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.14rem 0.38rem;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.kcal {
  font-size: 0.7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 0.83rem;
  line-height: 1.4;
  margin: 1rem 0;
}

.banner .icon {
  margin-top: 0.1rem;
}

.banner .btn {
  margin-left: auto;
  flex: none;
}

.banner.is-warning {
  background: var(--amber-soft);
  border-color: #f0d79f;
  color: #764507;
}

.banner.is-offline {
  background: var(--blue-soft);
  border-color: #d8e1e8;
  color: #334155;
}

.banner.is-info {
  background: var(--leaf-50);
  border-color: var(--leaf-100);
  color: var(--leaf-900);
}

.banner.is-error {
  background: var(--red-soft);
  border-color: #f2cdc8;
  color: var(--red);
}

.inline-link {
  font-weight: 700;
  color: var(--leaf-800);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ===== Login ===== */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.92fr);
  gap: clamp(14px, 2.4vw, 30px);
  padding: clamp(14px, 2.4vw, 32px);
}

.login-brand {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  padding: clamp(26px, 4vw, 56px);
  background:
    radial-gradient(600px 400px at 85% 15%, rgba(244, 198, 119, 0.14), transparent 65%),
    linear-gradient(150deg, var(--leaf-950), var(--leaf-800) 62%, #6a4520);
  color: #f9f4e8;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  opacity: 0.35;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
  pointer-events: none;
}

.brand-lockup {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #f8f0de;
  color: var(--leaf-900);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.6);
}

.brand-mark .icon {
  width: 27px;
  height: 27px;
  stroke-width: 1.6;
}

.brand-lockup strong {
  display: block;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
}

.brand-lockup small {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e6cfa6;
}

.login-brand-main {
  position: relative;
  z-index: 2;
  margin-top: clamp(28px, 6vh, 64px);
  max-width: 560px;
}

.login-brand-main h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.5rem, 5.4vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin: 0.5rem 0 1.1rem;
}

.login-brand-main h1 em {
  color: #f4c677;
  font-style: italic;
}

.login-brand-main p {
  color: #efdfc4;
  font-size: clamp(0.94rem, 1.2vw, 1.06rem);
  max-width: 34rem;
  line-height: 1.55;
}

.login-benefits {
  position: relative;
  z-index: 2;
  list-style: none;
  padding: 0;
  margin: auto 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 420px;
}

.login-benefits li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.88rem;
  color: #f3e8d3;
}

.login-benefits .benefit-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.13);
  display: grid;
  place-items: center;
  color: #f4c677;
  flex: none;
}

.login-benefits .benefit-icon .icon {
  width: 17px;
  height: 17px;
}

.login-art {
  position: absolute;
  right: -60px;
  bottom: -40px;
  width: min(52%, 500px);
  opacity: 0.95;
  pointer-events: none;
}

.login-art svg {
  width: 100%;
  height: auto;
  display: block;
}

.login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 2vw, 36px);
}

.login-card {
  width: min(430px, 100%);
  background: var(--paper);
  border: 1px solid rgba(230, 221, 203, 0.9);
  border-radius: 28px;
  padding: clamp(24px, 3.4vw, 38px);
  box-shadow: var(--shadow);
}

.login-mobile-brand {
  display: none;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.3rem;
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 4px;
  border-radius: 999px;
  background: #f3eddf;
  margin-bottom: 1.6rem;
}

.login-tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 0.55rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.login-tab .icon {
  width: 15px;
  height: 15px;
}

.login-tab.is-active {
  background: var(--paper);
  color: var(--leaf-900);
  box-shadow: 0 3px 10px -4px rgba(59, 38, 16, 0.3);
}

.login-form h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  margin: 0 0 0.35rem;
  line-height: 1.1;
}

.login-form > p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.3rem;
  line-height: 1.45;
}

.login-form .field {
  margin-bottom: 1rem;
}

.login-form .input {
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
}

.login-actions {
  margin-top: 1.3rem;
}

.login-help {
  margin: 1.3rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

.login-footer {
  margin-top: 1.2rem;
  text-align: center;
  font-size: 0.72rem;
  color: #9aa49b;
}

.login-install {
  margin-top: 1rem;
  width: min(430px, 100%);
}

.login-install .btn {
  width: 100%;
}

.install-slot {
  display: inline-flex;
  align-items: center;
}

.install-slot:empty {
  display: none;
}

/* ===== Top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250, 246, 236, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(230, 221, 203, 0.8);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.65rem clamp(14px, 4vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.app-brand .brand-badge {
  width: 41px;
  height: 41px;
  border-radius: 14px;
  background: var(--leaf-800);
  color: #f8f0de;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 6px 16px -10px rgba(59, 38, 16, 0.8);
}

.app-brand .brand-badge .icon {
  width: 23px;
  height: 23px;
  stroke-width: 1.6;
}

.brand-text {
  min-width: 0;
}

.brand-text strong {
  display: block;
  font-size: 0.92rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.brand-text small {
  display: block;
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.1rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.26rem 0.65rem 0.26rem 0.28rem;
  min-width: 0;
}

.user-chip .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--leaf-100);
  color: var(--leaf-900);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.78rem;
  flex: none;
}

.user-chip .user-detail {
  min-width: 0;
  line-height: 1.15;
}

.user-chip .user-detail strong {
  display: block;
  font-size: 0.78rem;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip .user-detail small {
  display: block;
  font-size: 0.64rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--leaf-900);
  color: #f4ead7;
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.admin-chip .icon {
  width: 14px;
  height: 14px;
}

.offline-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #eef2f6;
  color: #475569;
  border: 1px solid #dbe3ea;
  border-radius: 999px;
  padding: 0.32rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.offline-pill .icon {
  width: 14px;
  height: 14px;
}

/* ===== Person view ===== */
.person-shell {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 3.5vw, 36px) clamp(14px, 4vw, 24px) 80px;
  flex: 1;
}

.week-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.75fr);
  gap: 1.2rem;
  align-items: center;
  background:
    radial-gradient(400px 240px at 95% 0%, rgba(244, 198, 119, 0.16), transparent 70%),
    linear-gradient(145deg, var(--leaf-900), var(--leaf-800));
  color: #f9f4e8;
  border-radius: 28px;
  padding: clamp(22px, 4vw, 38px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.week-hero::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  right: -70px;
  bottom: -100px;
  pointer-events: none;
}

.week-hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 4.6vw, 3.2rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0.35rem 0 0.6rem;
}

.week-hero h1 em {
  color: #f4c677;
  font-style: italic;
}

.week-hero p {
  margin: 0;
  color: #efdfc4;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 34rem;
}

.progress-card {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 1.1rem 1.15rem;
  position: relative;
  z-index: 1;
}

.progress-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.progress-number {
  font-family: var(--font-display);
  font-size: 2.2rem;
  line-height: 1;
}

.progress-number span {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: #efdfc4;
}

.progress-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b9d6c3;
  font-weight: 700;
}

.progress-track {
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
  margin: 0.8rem 0 0.65rem;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f4c677, #f1d9a8);
  transition: width 0.45s ease;
}

.progress-legend {
  display: flex;
  gap: 0.8rem;
  color: #efdfc4;
  font-size: 0.7rem;
  flex-wrap: wrap;
}

.progress-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f4c677;
}

.legend-dot.is-pending {
  background: rgba(255, 255, 255, 0.4);
}

.person-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin: 1.6rem 0 1rem;
}

.week-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem;
}

.week-switcher .week-label {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0 0.65rem;
  white-space: nowrap;
}

.week-switcher .icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
}

.week-switcher .icon-btn:hover:not(:disabled) {
  background: var(--leaf-50);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  transition: background 0.16s ease, border-color 0.16s ease;
}

.icon-btn:hover:not(:disabled) {
  background: var(--leaf-50);
  border-color: var(--leaf-100);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

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

.day-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.day-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(15px, 3vw, 22px);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.day-card.is-today {
  border-color: var(--leaf-600);
  box-shadow:
    0 0 0 3px rgba(217, 130, 43, 0.08),
    var(--shadow-sm);
}

.day-card.is-free {
  background: rgba(255, 253, 247, 0.55);
  box-shadow: none;
}

.day-card.is-free .day-head {
  margin-bottom: 0;
}

.day-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.95rem;
}

.date-badge {
  width: 51px;
  height: 55px;
  border-radius: 15px;
  background: var(--leaf-50);
  color: var(--leaf-900);
  border: 1px solid var(--leaf-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex: none;
}

.date-badge span {
  font-size: 0.59rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--leaf-700);
}

.date-badge strong {
  font-family: var(--font-display);
  font-size: 1.48rem;
  font-weight: 600;
  margin-top: 0.18rem;
}

.is-today .date-badge {
  background: var(--leaf-800);
  border-color: var(--leaf-800);
  color: #fff;
}

.is-today .date-badge span {
  color: #b9d6c3;
}

.day-head h2 {
  font-size: 0.98rem;
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
}

.day-head p {
  margin: 0.18rem 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.today-pill {
  margin-left: auto;
  flex: none;
  background: var(--leaf-100);
  color: var(--leaf-900);
  border-radius: 999px;
  padding: 0.24rem 0.55rem;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dish-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dish-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.78rem 0.85rem;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.dish-option:hover:not(:disabled) {
  border-color: var(--leaf-600);
  background: var(--leaf-50);
}

.dish-option.is-selected {
  border-color: var(--leaf-700);
  background: var(--leaf-50);
  box-shadow: inset 0 0 0 1px var(--leaf-700);
}

.dish-option:disabled {
  cursor: not-allowed;
}

.dish-option:disabled:not(.is-selected) {
  opacity: 0.62;
}

.radio-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.8px solid #c9d2ca;
  display: grid;
  place-items: center;
  flex: none;
  color: #fff;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.radio-dot .icon {
  width: 12px;
  height: 12px;
  stroke-width: 3;
  opacity: 0;
}

.is-selected .radio-dot {
  background: var(--leaf-700);
  border-color: var(--leaf-700);
}

.is-selected .radio-dot .icon {
  opacity: 1;
}

.dish-main {
  flex: 1;
  min-width: 0;
}

.dish-name {
  display: block;
  font-weight: 650;
  font-size: 0.9rem;
  line-height: 1.3;
}

.dish-desc {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dish-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.18rem;
  flex: none;
}

.day-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.lock-note {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}

.lock-note .icon {
  width: 13px;
  height: 13px;
}

.day-footer .btn {
  margin-left: auto;
}

.absence-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f4f1e8;
  border: 1px dashed #d8ceba;
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 0.55rem;
}

.absence-banner .icon {
  color: var(--muted);
}

.absence-banner strong {
  color: var(--ink);
}

.absence-banner .btn {
  margin-left: auto;
}

.free-day {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.free-day .icon {
  width: 15px;
  height: 15px;
}

.empty-inline {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  font-size: 0.82rem;
  color: var(--muted);
  background: #fcfaf3;
}

.pending-note {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: var(--orange);
  font-weight: 700;
}

.page-footnote {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.5;
}

.empty-state {
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 22px;
  padding: clamp(28px, 5vw, 48px);
  text-align: center;
  color: var(--muted);
}

.empty-state .empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: var(--leaf-50);
  color: var(--leaf-800);
  display: grid;
  place-items: center;
  margin: 0 auto 1rem;
}

.empty-state .empty-icon .icon {
  width: 26px;
  height: 26px;
}

.empty-state h2 {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
}

.empty-state p {
  font-size: 0.87rem;
  max-width: 28rem;
  margin: 0 auto 1.1rem;
}

/* ===== Admin ===== */
.admin-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 clamp(14px, 4vw, 28px) 80px;
  flex: 1;
}

.admin-nav {
  border-bottom: 1px solid var(--line);
  background: rgba(250, 246, 236, 0.6);
}

.admin-nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(14px, 4vw, 28px);
  display: flex;
  gap: 0.1rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-nav-inner::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 0.8rem;
  font-size: 0.83rem;
  font-weight: 650;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-tab .icon {
  width: 16px;
  height: 16px;
}

.nav-tab:hover {
  color: var(--ink);
}

.nav-tab.is-active {
  color: var(--leaf-900);
  border-color: var(--leaf-800);
}

.admin-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.6rem 0 1rem;
}

.admin-page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.6vw, 2.7rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0.2rem 0 0;
}

.admin-page-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 46rem;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.admin-week-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.admin-week-bar .week-switcher {
  background: var(--paper);
}

.admin-week-bar .spacer {
  flex: 1;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.menu-hint {
  display: block;
  margin: 0.15rem 0 0.85rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.menu-hint .icon {
  width: 15px;
  height: 15px;
  color: var(--leaf-700);
  display: inline-block;
  vertical-align: -2px;
  margin-right: 0.25rem;
}

.menu-day {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.menu-day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.menu-day-head h2 {
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.2;
}

.menu-day-head p {
  margin: 0.15rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
}

.menu-status {
  flex: none;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
  background: #f2eee3;
  color: var(--muted);
}

.menu-status.is-complete {
  background: var(--leaf-100);
  color: var(--leaf-900);
}

.menu-row {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr) 72px;
  gap: 0.45rem;
  align-items: start;
  padding: 0.45rem;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.menu-row:hover {
  background: #fcf9f0;
}

.menu-row:focus-within {
  border-color: var(--leaf-100);
  background: #fcf9f0;
}

.menu-row.is-hypo {
  background: var(--leaf-50);
  border-color: var(--leaf-100);
}

.hypo-pick {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.66rem;
  font-weight: 750;
  color: var(--muted);
  padding-top: 0.55rem;
  line-height: 1.2;
  cursor: pointer;
}

.hypo-pick input {
  width: 15px;
  height: 15px;
  accent-color: var(--leaf-700);
  flex: none;
}

.type-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.2rem 0.4rem;
  background: #f2eee3;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.type-label.is-hypo {
  background: var(--leaf-100);
  color: var(--leaf-900);
}

.menu-fields {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.menu-fields .input {
  padding: 0.48rem 0.6rem;
  font-size: 0.82rem;
  border-radius: 8px;
}

.menu-fields .desc {
  font-size: 0.74rem;
}

.kcal-input {
  padding: 0.48rem 0.4rem !important;
  font-size: 0.78rem !important;
  border-radius: 8px;
  text-align: center;
}

.menu-day-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.4rem;
}

.menu-day-foot .btn {
  color: var(--muted);
  font-size: 0.72rem;
  padding: 0.35rem 0.5rem;
}

.save-bar {
  position: sticky;
  bottom: 12px;
  z-index: 20;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: rgba(255, 253, 247, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.7rem 0.9rem;
  box-shadow: 0 18px 50px -24px rgba(59, 38, 16, 0.4);
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.save-state.is-dirty {
  color: var(--amber);
  font-weight: 700;
}

.save-bar .spacer {
  flex: 1;
}

.save-bar .btn-primary {
  min-width: 150px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-label .icon {
  width: 14px;
  height: 14px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1.1;
  margin-top: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.stat-note {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.prod-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.prod-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow-sm);
}

.prod-card.is-today {
  border-color: var(--leaf-600);
}

.prod-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.prod-head h2 {
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.2;
}

.prod-head p {
  margin: 0.15rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
}

.prod-total {
  text-align: right;
  flex: none;
}

.prod-total strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1;
  font-weight: 600;
}

.prod-total span {
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

.prod-dish {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 0.6rem;
  margin-top: 0.65rem;
}

.prod-dish-name {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  line-height: 1.3;
  min-width: 0;
}

.prod-dish-name .text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prod-dish-name .hypo-badge {
  font-size: 0.55rem;
  padding: 0.12rem 0.35rem;
}

.prod-dish-count {
  font-weight: 800;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.bar {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 99px;
  background: #f2ece0;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--leaf-700), var(--leaf-600));
  border-radius: inherit;
  transition: width 0.4s ease;
}

.prod-foot {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  border-top: 1px dashed var(--line);
  margin-top: 0.8rem;
  padding-top: 0.6rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.prod-foot strong {
  color: var(--ink-soft);
}

.prod-detail {
  margin-top: 0.5rem;
}

.prod-detail summary {
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--leaf-800);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.prod-detail summary::-webkit-details-marker {
  display: none;
}

.prod-detail summary::after {
  content: "+";
  font-size: 0.9rem;
  line-height: 1;
}

.prod-detail[open] summary::after {
  content: "−";
}

.detail-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  max-height: 250px;
  overflow: auto;
}

.detail-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.74rem;
  padding: 0.18rem 0;
  border-bottom: 1px dotted #eee7d8;
}

.detail-list li:last-child {
  border-bottom: 0;
}

.detail-list .detail-name {
  font-weight: 600;
}

.detail-list .detail-status {
  color: var(--muted);
  text-align: right;
}

.detail-list .detail-status.is-dish {
  color: var(--leaf-800);
}

.detail-list .detail-status.is-absent {
  color: var(--red);
}

.detail-list .detail-status.is-unselected {
  color: var(--amber);
}

.warning-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--amber);
  font-size: 0.8rem;
  font-weight: 600;
}

.warning-inline .icon {
  width: 15px;
  height: 15px;
}

.people-toolbar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-box .icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  width: 17px;
  height: 17px;
}

.search-box .input {
  padding-left: 2.4rem;
  background: var(--paper);
}

.people-count {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.table-wrap {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: auto;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.data-table th {
  text-align: left;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.75rem 1rem;
  background: #fbf7ec;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #f1ebdd;
  font-size: 0.84rem;
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tr.is-inactive td {
  opacity: 0.58;
}

.person-name-cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 180px;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--leaf-100);
  color: var(--leaf-900);
  display: grid;
  place-items: center;
  font-size: 0.66rem;
  font-weight: 800;
  flex: none;
}

.person-name {
  font-weight: 650;
  line-height: 1.2;
}

.person-rut {
  font-size: 0.7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 0.1rem;
}

.workday-chips {
  display: flex;
  gap: 0.18rem;
}

.wd-chip {
  width: 21px;
  height: 21px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 0.58rem;
  font-weight: 850;
  background: #f2eee3;
  color: #aaa89f;
}

.wd-chip.is-on {
  background: var(--leaf-100);
  color: var(--leaf-900);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  justify-content: flex-end;
}

.row-actions .btn {
  padding: 0.34rem 0.5rem;
  font-size: 0.72rem;
  gap: 0.28rem;
  color: var(--ink-soft);
}

.row-actions .btn .icon {
  width: 14px;
  height: 14px;
}

.row-actions .btn.is-danger {
  color: var(--red);
}

.row-actions .btn.is-danger:hover {
  background: var(--red-soft);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.66rem;
  font-weight: 750;
  border-radius: 999px;
  padding: 0.2rem 0.48rem;
  background: var(--leaf-100);
  color: var(--leaf-900);
  white-space: nowrap;
}

.status-pill.is-inactive {
  background: #f2eee3;
  color: var(--muted);
}

.empty-table {
  padding: 2.4rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  align-items: start;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.2rem;
  box-shadow: var(--shadow-sm);
}

.panel.is-wide {
  grid-column: 1 / -1;
}

.panel h2 {
  font-size: 1rem;
  margin: 0 0 0.25rem;
}

.panel-desc {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1rem;
  line-height: 1.45;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.info-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.82rem;
}

.info-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px dotted var(--line);
  padding-bottom: 0.5rem;
}

.info-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.info-list span {
  color: var(--muted);
}

.info-list strong {
  text-align: right;
  font-weight: 650;
}

.data-note {
  margin-top: 0.8rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}

/* ===== Modals ===== */
dialog.modal {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(560px, calc(100vw - 24px));
  max-width: 100%;
  max-height: calc(100vh - 24px);
  margin: auto;
}

dialog.modal::backdrop {
  background: rgba(43, 27, 12, 0.48);
  backdrop-filter: blur(3px);
}

.modal-card {
  background: var(--paper);
  border-radius: 24px;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 24px);
}

.modal-head {
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
}

.modal-head h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  margin: 0;
  line-height: 1.15;
}

.modal-head p {
  margin: 0.2rem 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.modal-body {
  padding: 1.1rem 1.3rem;
  overflow-y: auto;
}

.modal-foot {
  padding: 0.9rem 1.3rem;
  border-top: 1px solid var(--line);
  background: #fdfaf2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.modal-foot .spacer {
  flex: 1;
}

.workday-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
}

.workday-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.workday-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.workday-option span {
  display: grid;
  place-items: center;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.7rem;
  font-weight: 750;
  color: var(--muted);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.workday-option input:checked + span {
  background: var(--leaf-800);
  border-color: var(--leaf-800);
  color: #fff;
}

.workday-option input:focus-visible + span {
  outline: 2px solid var(--leaf-600);
  outline-offset: 2px;
}

.quick-days {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.quick-days button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  font-size: 0.7rem;
  color: var(--ink-soft);
}

.quick-days button:hover {
  background: var(--leaf-50);
}

.import-help {
  background: #fbf7ec;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 0.8rem;
}

.import-help code {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05rem 0.25rem;
  font-size: 0.72rem;
  white-space: nowrap;
}

.import-result {
  margin-top: 0.8rem;
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  font-size: 0.78rem;
  line-height: 1.45;
  background: var(--leaf-50);
  border: 1px solid var(--leaf-100);
}

.import-result.has-errors {
  background: var(--amber-soft);
  border-color: #f0d79f;
}

.import-result ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  max-height: 150px;
  overflow: auto;
}

.file-drop {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.file-drop input[type="file"] {
  font-size: 0.78rem;
  max-width: 100%;
}

/* ===== Toasts ===== */
.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 84px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: min(390px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.72rem 0.8rem;
  border-radius: 13px;
  background: var(--leaf-950);
  color: #f7f3e8;
  font-size: 0.82rem;
  line-height: 1.35;
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.55);
  animation: toast-in 0.22s ease both;
}

.toast .icon {
  width: 16px;
  height: 16px;
  margin-top: 0.08rem;
}

.toast.is-error {
  background: #7e271f;
}

.toast.is-info {
  background: #334155;
}

.toast.is-warning {
  background: #80510a;
}

.toast-text {
  flex: 1;
}

.toast-action {
  border: 0;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  border-radius: 999px;
  padding: 0.22rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.toast-close {
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  padding: 0;
  line-height: 1;
  display: grid;
  place-items: center;
}

.toast-close .icon {
  width: 13px;
  height: 13px;
}

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

/* ===== Utility ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.noscript {
  padding: 1rem;
  background: var(--red-soft);
  color: var(--red);
  text-align: center;
}

.skeleton {
  border-radius: 12px;
  background: linear-gradient(90deg, #f0e9da 25%, #f8f3e8 37%, #f0e9da 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

:focus-visible {
  outline: 2px solid var(--leaf-600);
  outline-offset: 2px;
}

/* ===== Responsive ===== */
@media (max-width: 980px) {
  .login-shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
  }

  .login-brand {
    display: none;
  }

  .login-panel {
    min-height: calc(100vh - 32px);
    padding: 12px;
  }

  .login-mobile-brand {
    display: flex;
  }

  .login-card {
    border-radius: 26px;
  }

  .menu-grid,
  .prod-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .panel.is-wide {
    grid-column: auto;
  }

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

@media (max-width: 760px) {
  .week-hero {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .progress-card {
    padding: 0.9rem 1rem;
  }

  .login-art {
    display: none;
  }

  .menu-grid {
    grid-template-columns: 1fr;
  }

  .prod-grid {
    grid-template-columns: 1fr;
  }

  .data-table {
    min-width: 640px;
  }
}

@media (max-width: 560px) {
  .save-bar .hint {
    display: none;
  }

  .save-bar {
    gap: 0.5rem;
    bottom: 8px;
  }

  .save-bar .btn-primary {
    padding: 0.7rem 0.9rem;
  }

  .login-shell {
    padding: 0;
  }

  .login-panel {
    padding: 20px 14px;
    justify-content: flex-start;
    padding-top: max(24px, env(safe-area-inset-top));
  }

  .login-card {
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    max-width: 440px;
  }

  .login-tabs {
    margin-bottom: 1.3rem;
  }

  .login-form h2 {
    font-size: 1.55rem;
  }

  .login-form .input {
    font-size: 1rem;
    padding: 0.8rem 0.9rem;
  }

  .topbar-inner {
    padding: 0.55rem 12px;
  }

  .brand-text strong {
    max-width: 150px;
    font-size: 0.84rem;
  }

  .brand-text small {
    display: none;
  }

  .top-actions .install-slot .btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
  }

  .top-actions .install-slot .btn span {
    display: none;
  }

  .user-chip .user-detail {
    display: none;
  }

  .user-chip {
    padding: 0.22rem;
    border: 0;
    background: transparent;
  }

  .user-chip .avatar {
    width: 34px;
    height: 34px;
  }

  .offline-pill span {
    display: none;
  }

  .admin-chip span {
    display: none;
  }

  .week-hero {
    border-radius: 22px;
    padding: 20px;
  }

  .week-hero h1 {
    font-size: 2.1rem;
  }

  .person-shell {
    padding: 14px 12px 70px;
  }

  .person-toolbar {
    margin: 1.2rem 0 0.8rem;
  }

  .day-card {
    border-radius: 18px;
    padding: 14px;
  }

  .day-head {
    gap: 0.65rem;
  }

  .date-badge {
    width: 46px;
    height: 50px;
    border-radius: 13px;
  }

  .date-badge strong {
    font-size: 1.3rem;
  }

  .dish-option {
    padding: 0.7rem 0.72rem;
    gap: 0.6rem;
  }

  .dish-meta .kcal {
    display: none;
  }

  .dish-name {
    font-size: 0.86rem;
  }

  .dish-desc {
    max-width: 52vw;
  }

  .absence-banner {
    flex-wrap: wrap;
  }

  .absence-banner .btn {
    width: 100%;
    margin-left: 0;
  }

  .admin-page-head {
    margin-top: 1.2rem;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .menu-row {
    grid-template-columns: 1fr 68px;
    gap: 0.35rem;
  }

  .hypo-pick {
    grid-column: 1 / -1;
    padding-top: 0.1rem;
  }

  .menu-fields {
    grid-column: 1 / 2;
  }

  .kcal-input {
    grid-column: 2 / 3;
  }

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

  .stat-value {
    font-size: 1.6rem;
  }

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

  .admin-nav-inner {
    padding: 0 8px;
  }

  .nav-tab {
    padding: 0.75rem 0.6rem;
    font-size: 0.78rem;
  }

  .nav-tab .icon {
    display: none;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    bottom: 76px;
    max-width: none;
  }

  .modal-card {
    border-radius: 20px;
  }

  .workday-picker {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Print ===== */
@media print {
  @page {
    margin: 12mm;
  }

  body {
    background: #fff;
    color: #111;
    font-size: 11pt;
  }

  .topbar,
  .admin-nav,
  .no-print,
  .toast-stack,
  .banner,
  .page-actions,
  .admin-week-bar .week-switcher,
  .save-bar,
  .prod-detail summary,
  .page-footnote {
    display: none !important;
  }

  .admin-shell {
    padding: 0;
    width: 100%;
    max-width: none;
  }

  .admin-page-head {
    margin: 0 0 10px;
  }

  .admin-page-head h1 {
    font-size: 22pt;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .stat-card,
  .prod-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  .prod-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .prod-detail {
    display: block;
  }

  .detail-list {
    max-height: none;
    overflow: visible;
  }
}

/* Logo Tujina */
.brand-logo {
  display: block;
  height: 42px;
  width: auto;
  flex: none;
}
.brand-logo-card {
  display: block;
  background: #ffffff;
  border-radius: 14px;
  padding: 0.55rem 0.85rem;
  box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.6);
}
.brand-logo-card img {
  display: block;
  height: 54px;
  width: auto;
}
.login-mobile-brand .brand-logo {
  height: 52px;
}

/* Mesón: consulta por RUT */
.meson-form {
  display: flex;
  gap: 0.6rem;
  max-width: 560px;
  margin-bottom: 0.4rem;
}
.meson-input {
  flex: 1;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
}
.meson-result {
  max-width: 560px;
  margin-top: 1rem;
}
.meson-person {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.meson-person h2 {
  margin: 0;
}
.meson-person small {
  color: var(--muted);
}
.meson-today {
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  background: var(--leaf-50);
  border: 1px solid var(--leaf-100);
}
.meson-result.is-absent .meson-today,
.meson-result.is-rest .meson-today,
.meson-result.is-nomenu .meson-today {
  background: var(--sand);
  border-color: var(--line);
}
.meson-result.is-pending .meson-today {
  background: var(--amber-soft);
  border-color: #f0d79f;
}
.meson-dish {
  display: block;
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1.15;
  margin: 0.3rem 0;
}
.meson-today p {
  margin: 0 0 0.5rem;
  color: var(--ink-soft);
}
.meson-week-title {
  margin: 1.2rem 0 0.4rem;
  font-size: 0.95rem;
  color: var(--muted);
}
.meson-week {
  list-style: none;
  margin: 0;
  padding: 0;
}
.meson-week li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid var(--line);
}
.meson-week li.is-today {
  font-weight: 700;
  background: var(--leaf-50);
  border-radius: 8px;
  padding-inline: 0.6rem;
}
.meson-week li.is-rest,
.meson-week li.is-nomenu,
.meson-week li.is-absent,
.meson-week li.is-pending {
  color: var(--muted);
}
.meson-day small {
  color: var(--muted);
  font-weight: 400;
}
.meson-choice {
  text-align: right;
}
@media (max-width: 520px) {
  .brand-logo {
    height: 34px;
  }
  .meson-form {
    flex-direction: column;
  }
}

.meson-deliver {
  width: 100%;
  margin-top: 0.4rem;
  padding-block: 0.9rem;
  font-size: 1.1rem;
}
.meson-delivered {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 800;
  letter-spacing: 0.02em;
}
.meson-result.is-delivered .meson-today {
  background: #fff;
  border-color: var(--red);
}
