:root {
  --bg: #eef4ef;
  --surface: rgba(251, 255, 252, 0.92);
  --surface-strong: #fcfffd;
  --border: rgba(24, 52, 44, 0.12);
  --text: #17342c;
  --muted: #60796f;
  --accent: #146356;
  --accent-soft: #bfe0d5;
  --accent-alt: #c46b3d;
  --shadow: 0 18px 45px rgba(24, 52, 44, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(191, 224, 213, 0.75), transparent 24%),
    radial-gradient(circle at top right, rgba(196, 107, 61, 0.14), transparent 22%),
    linear-gradient(180deg, #f8fcf9 0%, var(--bg) 100%);
}

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

img,
canvas {
  display: block;
  max-width: 100%;
}

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

input,
textarea,
select {
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
}

textarea {
  resize: vertical;
}

label {
  display: block;
  color: var(--muted);
  font-size: 0.96rem;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 0;
  flex: 1 0 auto;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 100vh;
  padding: 2rem 1.5rem;
  border-right: 1px solid rgba(24, 52, 44, 0.08);
  background: rgba(247, 252, 249, 0.86);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-block;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  margin: 0.75rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.nav {
  display: grid;
  gap: 0.65rem;
  margin-top: 2rem;
}

.nav a {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid transparent;
  transition: 0.2s ease;
}

.nav a:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 99, 86, 0.18);
}

.content {
  padding: 2rem;
  display: grid;
  gap: 1.5rem;
}

.panel,
.hero-card,
.stat-card,
.step-card {
  border: 1px solid rgba(24, 52, 44, 0.08);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  gap: 2rem;
  padding: 2rem;
}

.hero-card h1,
.header-row h1 {
  margin: 0.35rem 0 0.6rem;
  font-size: clamp(2rem, 3vw, 3.5rem);
  line-height: 1.05;
}

.hero-card p,
.header-row p,
.panel p {
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: currentColor;
}

.auth-grid,
.stats-grid,
.preview-grid,
.two-column,
.editor-grid {
  display: grid;
  gap: 1.25rem;
}

.auth-grid,
.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.two-column,
.editor-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
}

.preview-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.stack {
  display: grid;
  gap: 1.25rem;
}

.panel,
.step-card,
.stat-card {
  padding: 1.35rem;
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.header-row,
.panel-header,
.submit-row,
.template-card-head,
.template-actions,
.meal-slot-header,
.menu-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel-header {
  margin-bottom: 1rem;
}

.header-row {
  flex-wrap: wrap;
}

.table-row .template-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.9rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #1d8b77);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(20, 99, 86, 0.22);
}

.button:hover {
  filter: brightness(1.02);
}

.button-secondary {
  background: linear-gradient(135deg, var(--accent-alt), #dd8757);
  box-shadow: 0 10px 24px rgba(196, 107, 61, 0.22);
}

.button-muted {
  color: var(--text);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: none;
  border: 1px solid rgba(24, 52, 44, 0.1);
}

.button-danger {
  background: linear-gradient(135deg, #a62c2c, #d94747);
  box-shadow: 0 10px 24px rgba(166, 44, 44, 0.22);
}

.button-small {
  padding: 0.6rem 0.95rem;
  font-size: 0.9rem;
}

.button-full {
  width: 100%;
}

.flash {
  padding: 1rem 1.2rem;
  border-radius: 18px;
  border: 1px solid transparent;
}

.flash-success {
  background: rgba(108, 170, 121, 0.14);
  border-color: rgba(108, 170, 121, 0.25);
}

.flash-error {
  background: rgba(182, 75, 75, 0.13);
  border-color: rgba(182, 75, 75, 0.2);
}

.flash-warning {
  background: rgba(214, 145, 56, 0.13);
  border-color: rgba(214, 145, 56, 0.22);
}

.form-grid,
.meal-grid,
.layout-controls,
.template-list,
.steps {
  display: grid;
  gap: 1rem;
}

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

.full-width {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1.9rem;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.logo-preview {
  margin: 1rem 0 1.25rem;
}

.logo-preview img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 24px;
  border: 1px solid var(--border);
}

.template-list {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
}

.template-upload-help {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.template-upload-help.compact .readonly-card {
  min-height: 0;
  padding: 0.8rem 0.95rem;
}

.guide-frame {
  width: 100%;
  min-height: 720px;
  border: 1px solid rgba(24, 52, 44, 0.08);
  border-radius: 20px;
  background: #fff;
}

.template-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 100%;
  padding: 0.8rem;
  border: 1px solid rgba(24, 52, 44, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
  overflow: hidden;
}

.template-card-default {
  border-color: rgba(20, 99, 86, 0.26);
  background:
    linear-gradient(180deg, rgba(20, 99, 86, 0.08), rgba(255, 255, 255, 0.9)),
    rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 30px rgba(20, 99, 86, 0.12);
}

.template-thumbs {
  display: grid;
  grid-template-columns: 1fr 0.56fr;
  gap: 0.5rem;
  margin: 0.15rem 0 0;
}

.template-thumbs img {
  width: 100%;
  height: 128px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(24, 52, 44, 0.08);
}

.template-card-head {
  align-items: flex-start;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.template-card-head strong {
  flex: 1 1 120px;
  font-size: 0.98rem;
  line-height: 1.2;
}

.template-card .inline-badges {
  gap: 0.35rem;
  margin-bottom: 0;
}

.template-card .badge {
  font-size: 0.69rem;
  padding: 0.18rem 0.42rem;
}

.template-card .template-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 0.45rem;
  margin-top: auto;
}

.template-card .template-actions a,
.template-card .template-actions form {
  min-width: 0;
}

.template-card .template-actions form {
  display: flex;
  margin: 0;
}

.template-card .template-actions .button {
  width: 100%;
  min-height: 38px;
  padding: 0.45rem 0.7rem;
  line-height: 1.05;
  text-align: center;
  white-space: normal;
  box-shadow: 0 8px 20px rgba(20, 99, 86, 0.14);
}

.template-card .template-actions form:first-child,
.template-card .template-actions form:last-child {
  grid-column: 1 / -1;
}

.button-disabled,
.button:disabled {
  opacity: 0.72;
  cursor: default;
  filter: none;
  box-shadow: none;
}

.badge {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(20, 99, 86, 0.1);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-outline {
  background: transparent;
  border: 1px solid rgba(20, 99, 86, 0.18);
}

.template-radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.template-radio-grid.is-collapsed {
  display: none;
}

.template-radio {
  position: relative;
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid rgba(24, 52, 44, 0.08);
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
}

.template-radio input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.template-radio span {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.template-radio img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 18px;
}

.template-radio:has(input:checked) {
  border-color: rgba(20, 99, 86, 0.42);
  box-shadow: 0 0 0 3px rgba(20, 99, 86, 0.12);
}

.selected-template-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(20, 99, 86, 0.14);
  background: rgba(255, 255, 255, 0.72);
}

.selected-template-card strong,
.info-section-card h3 {
  display: block;
  margin-bottom: 0.2rem;
}

.selected-template-card span {
  color: var(--muted);
  font-size: 0.92rem;
}

.menu-builder-panel {
  max-width: 1080px;
}

.compact-form-grid {
  grid-template-columns: repeat(2, minmax(0, 280px));
  justify-content: flex-start;
}

.menu-day-card {
  border-radius: 20px;
  border: 1px solid rgba(24, 52, 44, 0.08);
  background: rgba(255, 255, 255, 0.62);
  overflow: hidden;
}

.menu-day-header h3,
.panel h2 {
  margin: 0;
}

.menu-day-header span {
  color: var(--muted);
}

.menu-day-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.menu-day-heading {
  display: grid;
  gap: 0.2rem;
}

.menu-day-heading strong {
  font-size: 1.05rem;
}

.menu-day-heading small {
  color: var(--muted);
  font-size: 0.92rem;
}

.menu-day-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
}

.menu-day-summary {
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  background: rgba(20, 99, 86, 0.08);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
}

.menu-day-icon {
  min-width: 1.35rem;
  color: var(--accent);
  font-size: 1.45rem;
  font-weight: 700;
  text-align: center;
}

.menu-day-body {
  display: none;
  padding: 0 1rem 1rem;
}

.menu-day-card.open {
  border-color: rgba(20, 99, 86, 0.18);
  box-shadow: 0 12px 28px rgba(20, 99, 86, 0.08);
}

.menu-day-card.open .menu-day-body {
  display: block;
}

.meal-grid {
  margin-top: 0;
}

.meal-slot {
  padding: 0;
  border-radius: 18px;
  border: 1px solid rgba(24, 52, 44, 0.08);
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

.meal-slot-header {
  margin-bottom: 0;
}

.meal-slot-toggle {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.meal-slot-title {
  display: grid;
  gap: 0.15rem;
}

.meal-slot-title small {
  color: var(--muted);
  font-size: 0.86rem;
}

.meal-slot-icon {
  min-width: 1.1rem;
  text-align: center;
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
}

.meal-slot-body {
  display: none;
  padding: 0 0.9rem 0.9rem;
}

.meal-slot.open .meal-slot-body {
  display: grid;
  gap: 0.7rem;
}

.table {
  display: grid;
  gap: 0.75rem;
}

.table-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
}

.readonly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.two-column .readonly-grid {
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.two-column .readonly-grid .readonly-card {
  min-height: 0;
  grid-template-columns: 220px 1fr;
  align-items: start;
}

.readonly-card {
  display: grid;
  gap: 0.4rem;
  min-height: 110px;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid rgba(24, 52, 44, 0.08);
  background: rgba(255, 255, 255, 0.68);
}

.readonly-card strong {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.readonly-card span {
  font-size: 1rem;
  line-height: 1.5;
}

.contact-panel {
  background:
    linear-gradient(135deg, rgba(20, 99, 86, 0.08), rgba(196, 107, 61, 0.1)),
    var(--surface);
}

.inline-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.table-head {
  font-weight: 700;
  background: transparent;
}

.compact-table .table-row {
  padding: 0.72rem 0.85rem;
}

.soft-panel .table-row {
  grid-template-columns: 1.1fr 0.9fr auto;
}

.admin-users-table .table-row {
  grid-template-columns: 1.3fr 1fr 0.8fr 0.85fr 0.9fr auto;
}

.admin-collapsible {
  padding: 0;
  overflow: hidden;
}

.admin-summary-trigger {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

.admin-summary-trigger::-webkit-details-marker {
  display: none;
}

.admin-collapsible[open] .admin-summary-trigger {
  border-bottom: 1px solid rgba(24, 52, 44, 0.08);
}

.admin-create-form {
  padding: 1.1rem 1.2rem 1.2rem;
}

.soft-panel {
  padding: 1rem;
}

.preview-grid canvas {
  width: 100%;
  border-radius: 22px;
  border: 1px solid rgba(58, 37, 20, 0.08);
  background: #fff;
}

.template-editor {
  position: relative;
  width: 100%;
  max-width: 720px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(24, 52, 44, 0.08);
  background: #fff;
}

.template-editor[data-format="square"] {
  aspect-ratio: 1;
}

.template-editor[data-format="story"] {
  aspect-ratio: 9 / 16;
}

.template-editor-background,
.template-editor-overlay {
  position: absolute;
  inset: 0;
}

.template-editor-background {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.editor-item {
  position: absolute;
  padding: 0.45rem 0.55rem;
  border-radius: 16px;
  border: 2px dashed rgba(20, 99, 86, 0.35);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  overflow: hidden;
  cursor: move;
  user-select: none;
  line-height: 1.18;
  --editor-day-title-color: var(--accent-alt);
}

.editor-box-item {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: solid;
  border-color: rgba(20, 99, 86, 0.35);
  background: rgba(20, 99, 86, 0.24);
}

.editor-box-label {
  font-size: 0.82em;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: rgba(23, 52, 44, 0.7);
  pointer-events: none;
}

.editor-resize-handle {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--accent-alt);
  cursor: nwse-resize;
}

.editor-item strong {
  display: inline-block;
  margin-bottom: 0.2rem;
  color: var(--editor-day-title-color);
}

.editor-item.active {
  border-color: rgba(196, 107, 61, 0.7);
  box-shadow: 0 0 0 3px rgba(196, 107, 61, 0.16);
}

.editor-logo-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: rgba(20, 99, 86, 0.12);
  color: var(--accent);
  font-weight: 700;
}

.editor-logo-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  pointer-events: none;
}

.control-group {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(24, 52, 44, 0.08);
  background: rgba(255, 255, 255, 0.55);
}

.control-group.active {
  border-color: rgba(196, 107, 61, 0.38);
  box-shadow: 0 0 0 3px rgba(196, 107, 61, 0.08);
}

.accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.accordion-icon {
  flex: 0 0 auto;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--accent);
}

.accordion-body {
  display: none;
  padding: 0 1.1rem 1rem;
}

.control-group.open .accordion-body {
  display: block;
}

.control-group label {
  margin-bottom: 0.8rem;
}

.control-group label:last-child {
  margin-bottom: 0;
}

.control-group input[type="color"] {
  min-height: 52px;
  padding: 0.35rem;
}

.checkbox-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.2rem;
}

.checkbox-control input {
  width: auto;
  margin: 0;
}

.logout-form {
  margin-top: auto;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-footer {
  padding: 1rem 1.5rem 1.4rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  border-top: 1px solid rgba(24, 52, 44, 0.08);
  background: rgba(247, 252, 249, 0.9);
}

.section-divider {
  margin: 1.4rem 0;
  border: 0;
  border-top: 1px solid rgba(24, 52, 44, 0.1);
}

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

  .sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(24, 52, 44, 0.08);
  }

  .two-column,
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .content {
    padding: 1rem;
  }

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

  .panel,
  .step-card,
  .stat-card,
  .hero-card {
    padding: 1rem;
  }

  .header-row,
  .panel-header,
  .template-card-head,
  .template-actions,
  .meal-slot-header,
  .menu-day-header,
  .menu-day-toggle {
    align-items: flex-start;
    flex-direction: column;
  }

  .menu-day-meta {
    width: 100%;
    justify-content: space-between;
  }

  .selected-template-card {
    flex-direction: column;
    align-items: flex-start;
  }
}
