:root {
  color-scheme: light;
  --ink: #18201b;
  --muted: #667063;
  --line: rgba(24, 32, 27, .12);
  --panel: rgba(255, 255, 255, .86);
  --panel-strong: #ffffff;
  --leaf: #287450;
  --leaf-2: #49a078;
  --wheat: #d99b35;
  --berry: #b2475d;
  --sky: #3d7ea6;
  --shadow: 0 18px 50px rgba(24, 32, 27, .14);
  --shadow-soft: 0 12px 34px rgba(24, 32, 27, .09);
  --danger: #b2475d;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(40, 116, 80, .13), transparent 34%),
    linear-gradient(215deg, rgba(217, 155, 53, .18), transparent 38%),
    linear-gradient(135deg, #f8faf4 0%, #eef5eb 42%, #f8f1e4 100%);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Manrope, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 38px;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 18px;
  align-items: center;
  min-height: 190px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .52)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='420' viewBox='0 0 900 420'%3E%3Cg fill='none' stroke='%23287450' stroke-opacity='.13' stroke-width='2'%3E%3Cpath d='M33 361C183 205 316 455 466 292S741 122 875 249'/%3E%3Cpath d='M11 253c122-73 205-69 315 12s202 95 331-19 166-101 231-60'/%3E%3Cpath d='M85 107c130 61 221 58 317-6s196-73 303 4 145 75 195 61'/%3E%3C/g%3E%3Cg fill='%23d99b35' fill-opacity='.18'%3E%3Cellipse cx='130' cy='92' rx='16' ry='48' transform='rotate(-32 130 92)'/%3E%3Cellipse cx='162' cy='108' rx='12' ry='42' transform='rotate(-18 162 108)'/%3E%3Cellipse cx='700' cy='318' rx='16' ry='52' transform='rotate(24 700 318)'/%3E%3Cellipse cx='738' cy='305' rx='12' ry='42' transform='rotate(38 738 305)'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  box-shadow: var(--shadow);
  animation: enter .55s ease both;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.38), transparent);
  transform: translateX(-100%);
  animation: shine 5.6s ease-in-out infinite;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--leaf);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 68px);
  line-height: .96;
}

h2 {
  margin: 0 0 16px;
  font-size: 24px;
}

h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

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

.grain-signal {
  display: grid;
  grid-template-columns: repeat(4, 20px);
  gap: 10px;
  align-items: end;
  justify-content: end;
  height: 132px;
}

.grain-signal span {
  display: block;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--wheat), var(--leaf));
  box-shadow: 0 14px 28px rgba(40, 116, 80, .18);
  transform-origin: bottom;
  animation: level 2.2s ease-in-out infinite;
}

.grain-signal span:nth-child(1) { height: 54%; animation-delay: 0s; }
.grain-signal span:nth-child(2) { height: 82%; animation-delay: .16s; }
.grain-signal span:nth-child(3) { height: 64%; animation-delay: .32s; }
.grain-signal span:nth-child(4) { height: 96%; animation-delay: .48s; }

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .58);
  backdrop-filter: blur(14px);
}

.tab {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  transition: transform .18s ease, color .18s ease, background .18s ease;
}

.tab:hover {
  transform: translateY(-1px);
}

.tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--leaf), var(--sky));
  box-shadow: 0 10px 24px rgba(40, 116, 80, .22);
}

.view {
  display: none;
  animation: enter .35s ease both;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

.panel,
.metric,
.list-row,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 34px rgba(24, 32, 27, .08);
}

.panel {
  padding: 18px;
}

.metric {
  position: relative;
  min-height: 112px;
  padding: 18px;
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 5px;
  background: currentColor;
  opacity: .22;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
}

.metric:nth-child(1) { color: var(--leaf); }
.metric:nth-child(2) { color: var(--wheat); }
.metric:nth-child(3) { color: var(--sky); }
.metric:nth-child(4) { color: var(--berry); }

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, .88);
  outline: none;
  transition: border .18s ease, box-shadow .18s ease, transform .18s ease;
}

input:focus,
select:focus {
  border-color: rgba(40, 116, 80, .55);
  box-shadow: 0 0 0 4px rgba(40, 116, 80, .1);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--leaf), var(--leaf-2));
  box-shadow: 0 12px 24px rgba(40, 116, 80, .2);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.btn.secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.warn {
  background: linear-gradient(135deg, var(--berry), var(--wheat));
}

.btn.danger {
  background: linear-gradient(135deg, var(--danger), #8f2f43);
}

.btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
}

.btn:active {
  transform: translateY(1px);
}

.list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 12px;
  animation: rowIn .28s ease both;
}

.list-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.worktop {
  background:
    linear-gradient(135deg, rgba(255,255,255,.95), rgba(255,255,255,.78)),
    radial-gradient(circle at 80% 0%, rgba(217, 155, 53, .14), transparent 32%);
}

.inline-field {
  min-width: 220px;
  margin-bottom: 0;
}

.search-field input {
  min-height: 48px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}

.product-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.compact-gallery {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.product-tile {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: rgba(255,255,255,.84);
  text-align: left;
  box-shadow: var(--shadow-soft);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}

.product-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(40, 116, 80, .34);
  background: #fff;
  box-shadow: 0 18px 40px rgba(24, 32, 27, .13);
}

.product-photo,
.row-photo,
.product-modal-image,
.product-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(24, 32, 27, .08);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(40, 116, 80, .12), rgba(217, 155, 53, .16)),
    #fff;
}

.product-photo {
  width: 76px;
  height: 76px;
}

.row-photo {
  width: 54px;
  height: 54px;
}

.product-photo img,
.row-photo img,
.product-modal-image img,
.product-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  color: var(--leaf);
  font-weight: 800;
  letter-spacing: .08em;
}

.product-info strong,
.product-info small {
  display: block;
}

.product-info small {
  margin-top: 5px;
  color: var(--muted);
}

.admin-workspace {
  padding: 14px;
}

.split-editor {
  display: grid;
  grid-template-columns: minmax(280px, .92fr) minmax(320px, .78fr);
  gap: 14px;
  align-items: start;
}

.smart-list {
  display: grid;
  gap: 8px;
  max-height: 680px;
  overflow: auto;
  padding-right: 4px;
}

.smart-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: rgba(255,255,255,.8);
  text-align: left;
  box-shadow: 0 8px 24px rgba(24, 32, 27, .06);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.smart-row:hover {
  transform: translateX(3px);
  border-color: rgba(40, 116, 80, .3);
  background: #fff;
}

.smart-row.as-card {
  cursor: default;
}

.smart-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.editor-card {
  position: sticky;
  top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--shadow-soft);
}

.product-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 12px;
}

.ingredient-mark,
.user-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--leaf), var(--sky));
  box-shadow: 0 10px 24px rgba(40, 116, 80, .18);
}

.user-avatar {
  background: linear-gradient(135deg, var(--sky), var(--berry));
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 32, 27, .38);
  backdrop-filter: blur(12px);
  animation: fadeIn .18s ease both;
}

.modal-card {
  position: relative;
  width: min(520px, 100%);
  max-height: min(760px, calc(100vh - 28px));
  overflow: auto;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255,255,255,.95);
  box-shadow: 0 28px 90px rgba(24, 32, 27, .28);
  animation: modalIn .22s ease both;
}

.modal-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.product-modal-head {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: center;
  padding-right: 30px;
  margin-bottom: 14px;
}

.product-modal-image {
  width: 120px;
  height: 120px;
}

.modal-actions {
  justify-content: flex-end;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.recipe-row {
  display: grid;
  grid-template-columns: 1fr 140px 44px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.icon-btn {
  width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .84);
}

.login-panel {
  max-width: 430px;
  margin: 0 auto;
  padding: 20px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.admin-sidebar,
.admin-content {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 34px rgba(24, 32, 27, .08);
}

.admin-sidebar {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 7px;
  padding: 12px;
}

.admin-title {
  padding: 8px 8px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.admin-title strong,
.admin-title small {
  display: block;
}

.admin-title small {
  margin-top: 4px;
  color: var(--muted);
}

.admin-nav {
  position: relative;
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  transition: transform .18s ease, background .18s ease, border .18s ease, color .18s ease;
}

.admin-nav::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 9px;
  border-radius: 999px;
  background: currentColor;
  opacity: .34;
  vertical-align: 1px;
}

.admin-nav:hover {
  transform: translateX(2px);
  background: rgba(40, 116, 80, .07);
}

.admin-nav.active {
  color: #fff;
  background: linear-gradient(135deg, var(--leaf), var(--sky));
  box-shadow: 0 10px 22px rgba(40, 116, 80, .18);
}

.admin-nav.active::before {
  opacity: .95;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, .16);
}

.admin-nav.danger {
  color: #7f2637;
  border-color: rgba(178, 71, 93, .22);
  margin-top: 6px;
}

.admin-content {
  min-height: 430px;
  padding: 14px;
}

.section-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.section-header.compact {
  margin-bottom: 10px;
}

.section-header h2,
.section-header p {
  margin-top: 0;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.notice-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.notice-list div {
  border-left: 3px solid var(--leaf-2);
  padding: 8px 10px;
  background: rgba(40, 116, 80, .06);
  border-radius: 0 6px 6px 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.audit-list {
  max-height: 620px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  max-width: min(520px, calc(100% - 24px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(24, 32, 27, .92);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 14px);
  transition: opacity .22s ease, transform .22s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.empty,
.error-box {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, .5);
}

.error-box {
  color: #7f2637;
  border-color: rgba(178, 71, 93, .28);
}

@keyframes enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rowIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes level {
  0%, 100% { transform: scaleY(.78); filter: saturate(.92); }
  50% { transform: scaleY(1); filter: saturate(1.18); }
}

@keyframes shine {
  0%, 40% { transform: translateX(-120%); }
  70%, 100% { transform: translateX(120%); }
}

.admin-layout-pro {
  grid-template-columns: 265px minmax(0, 1fr);
}

.admin-layout-pro .admin-sidebar {
  gap: 14px;
  padding: 14px;
}

.admin-layout-pro .admin-title {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 8px 14px;
  margin-bottom: 0;
}

.admin-logo-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  background: linear-gradient(135deg, var(--leaf), var(--sky));
  box-shadow: 0 14px 26px rgba(40, 116, 80, .22);
}

.admin-nav-group {
  display: grid;
  gap: 6px;
}

.admin-nav-group > span {
  padding: 0 10px 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-layout-pro .admin-nav {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: center;
}

.admin-layout-pro .admin-nav::before {
  content: none;
}

.admin-layout-pro .admin-nav.active::before {
  content: "";
  position: absolute;
  left: -8px;
  width: 4px;
  height: 24px;
  border-radius: 999px;
  background: var(--leaf-2);
  box-shadow: 0 0 0 5px rgba(73, 160, 120, .13);
}

.nav-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  opacity: .72;
}

.admin-nav.active .nav-icon {
  opacity: 1;
}

.admin-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 4px 4px 14px;
  border-bottom: 1px solid var(--line);
}

.admin-topbar h2 {
  margin-bottom: 0;
}

.admin-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--leaf);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.admin-content-inner {
  animation: enter .28s ease both;
}

.admin-layout-pro .split-editor {
  grid-template-columns: minmax(300px, .78fr) minmax(420px, 1fr);
}

.master-pane {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255,255,255,.58);
}

.master-toolbar {
  margin-bottom: 10px;
}

.editor-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.editor-head h3 {
  margin-bottom: 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: #17603e;
  font-size: 12px;
  font-weight: 800;
  background: rgba(73, 160, 120, .16);
}

.status-chip.off {
  color: #7f2637;
  background: rgba(178, 71, 93, .14);
}

.product-editor-grid {
  display: grid;
  grid-template-columns: minmax(180px, .45fr) minmax(0, 1fr);
  gap: 14px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 18px, 1180px);
    padding-top: 10px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
    min-height: 210px;
    padding: 20px;
  }

  .grain-signal {
    position: absolute;
    right: 16px;
    bottom: 12px;
    height: 84px;
    opacity: .72;
  }

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

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-title {
    grid-column: 1 / -1;
  }

  .section-header,
  .settings-grid,
  .quick-actions,
  .split-editor,
  .product-editor-grid,
  .admin-topbar,
  .product-modal-head {
    grid-template-columns: 1fr;
  }

  .admin-layout-pro .admin-sidebar {
    gap: 8px;
  }

  .admin-nav-group {
    grid-column: 1 / -1;
  }

  .editor-card {
    position: static;
  }

  .product-gallery {
    grid-template-columns: 1fr;
  }

  .recipe-row {
    grid-template-columns: 1fr 96px 44px;
  }
}
