:root {
  --bg: #eef2f7;
  --bg-elevated: #ffffff;
  --ink: #152033;
  --muted: #5b6b82;
  --line: #d7e0ec;
  --line-strong: #c2cfdf;
  --accent: #1e4a8a;
  --accent-dark: #163a6e;
  --accent-soft: #e7eef8;
  --accent-ink: #ffffff;
  --accent-ring: rgb(30 74 138 / 18%);
  --positive: #1f7a4c;
  --positive-dark: #17633d;
  --positive-soft: #e8f6ee;
  --sidebar: #e8eef8;
  --sidebar-ink: #152033;
  --sidebar-muted: #5b6b82;
  --sidebar-hover: #dce6f4;
  --sidebar-active: #d0dcf0;
  --danger: #c62828;
  --danger-dark: #a11f1f;
  --danger-bg: #fdecea;
  --success: #1f7a4c;
  --success-bg: #e8f6ee;
  --error-bg: #fdecea;
  --info-bg: #f4f7fb;
  --shadow: 0 1px 2px rgb(21 32 51 / 5%);
  --radius: 12px;
  --sidebar-w: 300px;
  --topbar-h: 72px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --focus: 0 0 0 2px #fff, 0 0 0 4px var(--accent);
}

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

html {
  font-size: 18.5px;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a {
  color: var(--ink);
}

img {
  max-width: 100%;
}

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

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

/* ----- Login ----- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 70% 55% at 12% 18%, rgb(30 74 138 / 10%), transparent 58%),
    radial-gradient(ellipse 55% 45% at 88% 82%, rgb(31 122 76 / 8%), transparent 55%),
    linear-gradient(160deg, #e8eef8 0%, var(--bg) 45%, #e6edf6 100%);
}

.login-shell {
  width: min(100%, 52rem);
  display: grid;
  grid-template-columns: minmax(14rem, 0.9fr) minmax(0, 1.15fr);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgb(21 32 51 / 10%);
  overflow: hidden;
}

.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem 1.6rem;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  color: var(--sidebar-ink);
}

.login-aside__brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.login-aside__brand strong {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent);
}

.login-aside__brand span {
  font-size: 0.95rem;
  color: var(--sidebar-muted);
}

.login-aside__text {
  margin: 0;
  color: var(--sidebar-muted);
  font-size: 1rem;
  line-height: 1.55;
  max-width: 18rem;
}

.login-card {
  width: 100%;
  padding: 2.15rem 2rem 1.65rem;
  background: var(--bg-elevated);
}

.login-card__brand {
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 1.35rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.login-card__brand strong {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.login-card__brand span {
  font-size: 0.95rem;
  color: var(--muted);
}

.login-card__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-card h1 {
  margin: 0 0 0.4rem;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.login-card .lede {
  margin: 0 0 1.45rem;
  color: var(--muted);
  font-size: 1.02rem;
}

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

.login-card .btn {
  width: 100%;
  margin-top: 0.35rem;
  min-height: 3rem;
}

.login-card__footer {
  margin: 1.35rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.login-card__back {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
}

.login-card__back:hover {
  color: var(--accent);
}

.login-card__credit {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.login-card__credit a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.login-card__credit a:hover {
  color: var(--ink);
  text-decoration: underline;
}

@media (max-width: 760px) {
  .login-shell {
    grid-template-columns: 1fr;
    width: min(100%, 28rem);
  }

  .login-aside {
    display: none;
  }

  .login-card {
    padding: 1.75rem 1.4rem 1.35rem;
  }

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

  .login-card h1 {
    font-size: 1.5rem;
  }

  .login-card__footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ----- Shell ----- */

.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.admin-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 1.4rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__top {
  padding: 0.35rem 0.55rem 0.5rem;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.sidebar__brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.sidebar__brand-text strong {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent);
}

.sidebar__brand-text span {
  font-size: 0.92rem;
  color: var(--sidebar-muted);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar__label {
  margin: 0 0 0.45rem;
  padding: 0 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}

.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  color: #334155;
  padding: 0.85rem 0.9rem;
  border-radius: 10px;
  font-size: 1.08rem;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}

.sidebar__nav a svg {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  opacity: 0.8;
}

.sidebar__nav a:hover {
  background: var(--sidebar-hover);
  color: var(--ink);
}

.sidebar__nav a.is-active {
  background: var(--sidebar-active);
  color: var(--accent);
  font-weight: 700;
}

.sidebar__nav a.is-active svg {
  opacity: 1;
  color: var(--accent);
}

.sidebar__footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.sidebar__logout {
  appearance: none;
  border: 0;
  background: transparent;
  color: #4b5563;
  text-align: left;
  padding: 0.75rem 0.8rem;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 500;
  font-size: 1rem;
}

.sidebar__logout:hover {
  background: var(--sidebar-hover);
  color: var(--ink);
}

.sidebar__credit {
  margin: 0;
  padding: 0 0.75rem 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.sidebar__credit a {
  color: var(--muted);
  text-decoration: none;
}

.sidebar__credit a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.sidebar-backdrop {
  display: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--topbar-h);
  padding: 0.75rem 1.6rem;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar__menu {
  display: none;
}

.topbar__crumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  font-size: 1.02rem;
}

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

.topbar__crumb-sep {
  color: var(--line-strong);
}

.topbar__crumb strong {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.main {
  padding: 1.85rem 1.85rem 5.5rem;
  max-width: 1120px;
  width: 100%;
  flex: 1;
}

.admin-account {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 0.85rem 1.4rem 1.1rem;
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(10px);
  z-index: 4;
}

.admin-account__chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  max-width: min(100%, 28rem);
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--accent-soft);
}

.admin-account__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-account__chip strong {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  max-width: 40rem;
  font-size: 1.02rem;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.4rem;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

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

.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}

.stat strong {
  display: block;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat span {
  color: var(--muted);
  font-size: 0.95rem;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.quick-link {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  background: #fafafa;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.quick-link:hover {
  border-color: var(--line-strong);
  background: #f3f4f6;
}

.quick-link strong {
  font-size: 1.05rem;
  font-weight: 600;
}

.quick-link span {
  font-size: 0.92rem;
  color: var(--muted);
}

/* ----- Forms & buttons ----- */

.field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1.05rem;
  min-width: 0;
  width: 100%;
}

.field span,
.field > label {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  background: #fff;
  color: var(--ink);
  font-size: 1.05rem;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.field input[type="file"] {
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
}

.field input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  min-width: 1.15rem;
  padding: 0;
  accent-color: var(--positive);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: #7f97c2;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.field textarea {
  min-height: 130px;
  resize: vertical;
}

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

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.8rem 1.2rem;
  background: var(--positive);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
  font-size: 1.05rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn:hover {
  background: var(--positive-dark);
}

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

.btn--ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  font-weight: 600;
}

.btn--ghost:hover {
  background: #f8fafc;
  border-color: var(--line-strong);
}

.btn--danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn--danger:hover {
  background: var(--danger-dark);
  border-color: var(--danger-dark);
}

.btn--sm {
  padding: 0.55rem 0.9rem;
  font-size: 0.95rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.status {
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background: var(--info-bg);
  border: 1px solid var(--line);
  font-size: 1rem;
}

.status[data-type='success'] {
  background: var(--success-bg);
  color: var(--success);
  border-color: #a7f3d0;
}

.status[data-type='error'] {
  background: var(--error-bg);
  color: var(--danger);
  border-color: #fecdca;
}

/* ----- Toasts (top-right) ----- */

.admin-toasts {
  position: fixed;
  top: calc(var(--topbar-h) + 0.85rem);
  right: 1.15rem;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  width: min(22rem, calc(100vw - 1.5rem));
  pointer-events: none;
}

.admin-toast {
  pointer-events: auto;
  margin: 0;
  padding: 1.05rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 12px 36px rgb(21 32 51 / 18%);
  opacity: 0;
  transform: translateX(1.1rem);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.admin-toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.admin-toast.is-leaving {
  opacity: 0;
  transform: translateX(0.85rem);
}

.admin-toast--info {
  background: #f4f7fb;
  border-color: #c2cfdf;
  color: var(--ink);
}

.admin-toast--success {
  background: var(--success-bg);
  border-color: #86d4ad;
  color: var(--success);
}

.admin-toast--error {
  background: var(--error-bg);
  border-color: #f5b5b0;
  color: var(--danger);
}

@media (max-width: 560px) {
  .admin-toasts {
    top: 0.85rem;
    right: 0.75rem;
    left: auto;
    width: min(22rem, calc(100vw - 1.5rem));
  }

  .admin-toast {
    font-size: 1.05rem;
    padding: 1rem 1.1rem;
  }
}

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

/* ----- Opening hours ----- */

.hours-row {
  display: grid;
  grid-template-columns: 8rem 9rem 1fr 1fr;
  gap: 0.85rem;
  align-items: end;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.hours-row:last-child {
  border-bottom: 0;
}

.hours-row__day {
  font-weight: 600;
  font-size: 1.02rem;
  padding-bottom: 0.65rem;
}

.hours-row__closed {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.hours-row .field {
  margin: 0;
}

/* ----- Lists ----- */

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

.menu-slot__badge {
  display: inline-block;
  margin: 0 0 0.55rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgb(30 74 138 / 14%);
  border-radius: 5px;
}

.menu-slot__current {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.menu-slot__current p {
  margin: 0.2rem 0;
  font-size: 1rem;
}

.menu-slot__form {
  margin-top: 0.2rem;
}

@media (max-width: 800px) {
  .menu-slots,
  .stats,
  .quick-links {
    grid-template-columns: 1fr;
  }
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--line);
}

.card-row:last-child {
  border-bottom: 0;
}

.card-row__media {
  width: 96px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f3f4f6;
}

.card-row__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-row__media-empty {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, #f3f4f6 25%, #e5e7eb 25%, #e5e7eb 50%, #f3f4f6 50%, #f3f4f6 75%, #e5e7eb 75%);
  background-size: 12px 12px;
}

.card-row__body {
  flex: 1 1 12rem;
  min-width: 0;
}

.card-row h3 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.card-row p {
  margin: 0.2rem 0;
  font-size: 0.95rem;
}

.card-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: flex-start;
}

.field--inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}

.field--inline span {
  color: var(--ink);
  margin: 0;
  font-size: 1rem;
}

.event-image-preview-wrap {
  margin: 0 0 1rem;
  width: 100%;
}

.event-image-preview {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f3f4f6;
}

/* ----- Modal (events create/edit) ----- */

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: 1rem;
  box-sizing: border-box;
}

.admin-modal[hidden] {
  display: none !important;
}

.admin-modal__backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  border: 0;
  padding: 0;
  background: rgb(21 32 51 / 48%);
  cursor: pointer;
}

.admin-modal__panel {
  position: relative;
  z-index: 1;
  width: min(34rem, calc(100vw - 2rem));
  max-height: min(90vh, 52rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elevated);
  box-shadow: 0 24px 64px rgb(21 32 51 / 22%);
  color: var(--ink);
}

body.admin-modal-open {
  overflow: hidden;
}

.dialog-body {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  padding: 1.5rem;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(90vh, 52rem);
  -webkit-overflow-scrolling: touch;
}

.dialog-body form {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.dialog-body h2 {
  margin: 0 0 1.15rem;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.25;
}

.dialog-body .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 860px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, var(--sidebar-w));
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 30;
    height: 100dvh;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgb(26 28 30 / 35%);
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  .topbar {
    padding-inline: 1rem;
  }

  .topbar__menu {
    display: inline-flex;
  }

  .main {
    padding: 1.15rem 1.1rem 5.25rem;
  }

  .admin-account {
    padding-inline: 1rem;
  }

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

  .hours-row__day,
  .hours-row__closed {
    grid-column: 1 / -1;
    padding-bottom: 0;
  }
}

body.admin-nav-open {
  overflow: hidden;
}
