/* La Mensa admin panel */
:root {
  --bg: #f4f5f7; --panel: #fff; --line: #e4e6ea; --ink: #1c1f26; --muted: #6b7280; --sidebar: #17151a; --sidebar-2: #221f26;
  --accent: #9c3a25; --accent-2: #7f2e1c; --gold: #c8a55a; --green: #1f7a4d; --amber: #b7791f; --red: #b42318; --blue: #1d4ed8;
  --radius: 8px; --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5rem; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }

/* Layout */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: #c7c2cc; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar__brand { padding: 1.4rem 1.4rem 1rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar__brand b { display: block; font-family: Georgia, serif; font-size: 1.45rem; color: #fff; }
.sidebar__brand span { font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.sidebar__group { padding: 1.1rem 1rem .3rem; font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: #6f6a78; }
.sidebar a.nav { display: flex; align-items: center; gap: .7rem; padding: .55rem 1rem; margin: 1px .6rem; border-radius: 6px; font-size: .88rem; transition: .15s; }
.sidebar a.nav:hover { background: var(--sidebar-2); color: #fff; }
.sidebar a.nav.active { background: var(--accent); color: #fff; }
.sidebar a.nav svg { width: 17px; height: 17px; opacity: .85; flex: none; }
.sidebar .badge { margin-left: auto; }
.sidebar__foot { margin-top: auto; padding: 1rem; border-top: 1px solid rgba(255,255,255,.06); font-size: .82rem; }
.sidebar__foot a { display: block; padding: .3rem 0; }
.sidebar__foot a:hover { color: #fff; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 2rem; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar__title { display: flex; align-items: center; gap: .6rem; }
.topbar__title .crumb { color: var(--muted); }
.topbar__actions { display: flex; align-items: center; gap: .6rem; }
.content { padding: 1.8rem 2rem 4rem; max-width: 1400px; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: .25s; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vw rgba(0,0,0,.35); }
  .menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: 1rem; padding-right: 1rem; }
}

/* Cards & grids */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card__head { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card__body { padding: 1.2rem; }
.card + .card { margin-top: 1.4rem; }
.grid { display: grid; gap: 1.2rem; }
.grid--2 { grid-template-columns: 1fr 1fr; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid--form { grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 1000px) { .grid--2, .grid--3, .grid--form { grid-template-columns: 1fr; } }
.stat { padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .2rem; }
.stat__label { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat__value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat__hint { font-size: .78rem; color: var(--muted); }
.stat--accent .stat__value { color: var(--accent); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; border-radius: 6px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 500; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { background: #f7f7f8; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-2); }
.btn--dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--danger { color: var(--red); }
.btn--danger:hover { background: #fdecec; border-color: #f3c0bc; }
.btn--sm { padding: .35rem .7rem; font-size: .8rem; }
.btn--icon { padding: .4rem; }
.btn svg { width: 15px; height: 15px; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: #fafafb; font-weight: 600; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fbfbfc; }
.table .actions { display: flex; gap: .35rem; justify-content: flex-end; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table a.row-link { font-weight: 500; }
.table a.row-link:hover { color: var(--accent); }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #eee; }
.thumb--lg { width: 90px; height: 64px; }
.empty { padding: 3rem 1rem; text-align: center; color: var(--muted); }

/* Badges */
.badge { display: inline-block; padding: .18rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; line-height: 1.4; background: #eceef2; color: #4b5563; }
.badge--green { background: #e3f3ea; color: var(--green); }
.badge--amber { background: #fdf1dc; color: var(--amber); }
.badge--red { background: #fdecec; color: var(--red); }
.badge--blue { background: #e5ecfb; color: var(--blue); }
.badge--gold { background: #f6efdc; color: #7a5a17; }
.badge--dark { background: var(--ink); color: #fff; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #cbd0d8; margin-right: .4rem; }
.dot--on { background: var(--green); }

/* Forms */
.field { margin-bottom: 1rem; }
.field label, .label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .35rem; color: #374151; }
.field .hint { font-size: .76rem; color: var(--muted); margin-top: .3rem; }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field input[type=date], .field input[type=datetime-local], .field input[type=url], .field input[type=tel], .field select, .field textarea {
  width: 100%; padding: .55rem .75rem; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; color: var(--ink); background: #fff; transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(156,58,37,.12); }
.field textarea { min-height: 110px; resize: vertical; }
.field textarea.tall { min-height: 320px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.field .error { color: var(--red); font-size: .78rem; margin-top: .3rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-row--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) { .form-row, .form-row--3 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: .55rem; font-size: .88rem; padding: .35rem 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.switch { position: relative; display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .88rem; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { width: 38px; height: 22px; border-radius: 999px; background: #d1d5db; position: relative; transition: .2s; flex: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .switch__track { background: var(--green); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.form-actions { display: flex; gap: .6rem; align-items: center; padding-top: 1rem; border-top: 1px solid var(--line); margin-top: .5rem; }
.image-preview { width: 100%; max-width: 260px; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); margin-bottom: .6rem; background: #eee; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters .input { width: auto; min-width: 200px; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; font-size: .85rem; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--accent); border-color: var(--accent); }

/* Repeater */
.repeater { display: grid; gap: .6rem; }
.repeater__row { display: grid; grid-template-columns: 1fr 140px auto; gap: .5rem; align-items: center; }
.repeater__row input { width: 100%; padding: .5rem .7rem; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; }
.course { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; background: #fafafb; }
.course__head { display: flex; gap: .6rem; align-items: center; margin-bottom: .6rem; }
.course__head input { flex: 1; }
.course-items { display: grid; gap: .45rem; }
.course-item { display: grid; grid-template-columns: 1.2fr 2fr 90px auto; gap: .45rem; }
.course-item input, .course__head input, .course textarea { padding: .45rem .65rem; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; font-size: .85rem; background: #fff; }
.course textarea { width: 100%; min-height: 40px; margin-bottom: .6rem; }
@media (max-width: 700px) { .course-item { grid-template-columns: 1fr 1fr; } .repeater__row { grid-template-columns: 1fr 1fr auto; } }

/* Alerts */
.alert { padding: .8rem 1rem; border-radius: 6px; margin-bottom: 1.2rem; font-size: .88rem; border: 1px solid; }
.alert--success { background: #e3f3ea; border-color: #b6dcc6; color: #14532d; }
.alert--error { background: #fdecec; border-color: #f3c0bc; color: #7f1d1d; }
.alert ul { margin: .3rem 0 0 1.1rem; padding: 0; }

/* Detail view */
.detail dl { display: grid; grid-template-columns: 160px 1fr; gap: .6rem 1rem; margin: 0; }
.detail dt { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; padding-top: .15rem; }
.detail dd { margin: 0; }
.message-body { white-space: pre-wrap; background: #fafafb; border: 1px solid var(--line); border-radius: 6px; padding: 1rem; line-height: 1.6; }

/* Pagination */
.pagination { display: flex; gap: .3rem; list-style: none; padding: 0; margin: 1.2rem 0 0; justify-content: flex-end; }
.pagination a, .pagination span { display: inline-block; min-width: 34px; text-align: center; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: .82rem; }
.pagination .active span { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination .disabled span { opacity: .4; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--sidebar); padding: 1rem; }
.login__card { width: 100%; max-width: 400px; background: #fff; border-radius: 12px; padding: 2.2rem; box-shadow: 0 30px 60px rgba(0,0,0,.35); }
.login__brand { text-align: center; margin-bottom: 1.6rem; }
.login__brand b { display: block; font-family: Georgia, serif; font-size: 1.9rem; }
.login__brand span { font-size: .7rem; letter-spacing: .25em; text-transform: uppercase; color: var(--accent); }

/* Gallery grid */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.gallery-grid figure { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.gallery-grid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.gallery-grid figcaption { padding: .6rem .8rem; font-size: .8rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.dropzone { border: 2px dashed #cbd0d8; border-radius: var(--radius); padding: 1.5rem; text-align: center; color: var(--muted); }
