:root {
  color-scheme: dark;
  --coffee: #24180f;
  --coffee-soft: #322116;
  --panel: #3b281d;
  --panel-line: #62452f;
  --cream: #f0e4c9;
  --muted: #c0aa91;
  --gold: #e3ad3e;
  --orange: #df843f;
  --rail-width: 68px;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--coffee);
  color: var(--cream);
  font-family: "Avenir Next", Avenir, "Trebuchet MS", sans-serif;
}

body {
  min-height: 100dvh;
  background-image:
    linear-gradient(rgba(229, 173, 62, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(229, 173, 62, 0.025) 1px, transparent 1px),
    radial-gradient(ellipse at 75% 0%, #452b1c 0%, transparent 44%);
  background-size: 48px 48px, 48px 48px, auto;
  background-attachment: fixed;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100dvh;
}

.side-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  width: var(--rail-width);
  flex-direction: column;
  align-items: center;
  border-right: 1px solid rgba(223, 132, 63, 0.14);
  background: rgba(32, 21, 14, 0.92);
  padding: 12px 8px;
}

.rail-brand,
.rail-link,
.rail-status {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  text-decoration: none;
}

.rail-brand {
  border: 1px solid rgba(227, 173, 62, 0.58);
  border-radius: 12px;
  background: #3b291d;
  color: var(--gold);
  font-size: 21px;
  font-weight: 800;
}

.rail-nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.rail-link {
  position: relative;
  border-radius: 11px;
  color: #b69a7b;
  transition: background-color 160ms ease, color 160ms ease;
}

.rail-link svg,
.tile-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.rail-link:hover,
.rail-link:focus-visible,
.rail-link.is-active {
  outline: none;
  background: #4a3020;
  color: var(--gold);
}

.rail-link.is-active::before {
  position: absolute;
  inset: 8px auto 8px -9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
  content: "";
}

.rail-footer {
  margin-top: auto;
}

.rail-status {
  border: 1px solid rgba(240, 228, 201, 0.28);
  border-radius: 50%;
  background: #d9a957;
  color: #382619;
  font-size: 12px;
  font-weight: 800;
}

.workspace {
  min-height: 100dvh;
  margin-left: var(--rail-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(223, 132, 63, 0.14);
  background: rgba(36, 24, 15, 0.9);
  padding: 0 28px;
  backdrop-filter: blur(12px);
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.topbar-brand img {
  display: block;
  width: 122px;
  max-width: 42vw;
  max-height: 34px;
  object-fit: contain;
  object-position: left center;
}

.topbar-context {
  color: var(--muted);
  font-size: 12px;
}

.topbar-context span {
  padding: 0 7px;
  color: var(--orange);
}

.dashboard {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 26px clamp(20px, 4vw, 58px) 24px;
}

.welcome-row {
  display: flex;
  min-height: 124px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(223, 132, 63, 0.19);
  padding: 0 4px 18px;
}

.eyebrow,
.tile-index,
.dashboard-footer {
  margin: 0;
  color: #c79a55;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.1px;
}

.welcome-row h1 {
  margin: 8px 0 5px;
  color: var(--cream);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 750;
  line-height: 1.12;
}

.welcome-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.workspace-section {
  padding-top: 26px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 0 4px 16px;
}

.section-heading h2 {
  margin: 4px 0 0;
  font-size: 21px;
  font-weight: 600;
}

.section-count {
  color: #9e8164;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.dashboard-grid {
  display: grid;
  grid-auto-rows: minmax(196px, auto);
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-tile {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(67, 45, 31, 0.96), rgba(48, 32, 22, 0.98));
  box-shadow: 0 12px 28px rgba(10, 6, 3, 0.17);
  color: var(--cream);
  padding: 19px 20px;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.dashboard-tile:hover,
.dashboard-tile:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 16px 34px rgba(10, 6, 3, 0.3);
  transform: translateY(-2px);
}

.tile-orders {
  grid-column: span 6;
  border-color: #d4a143;
  background: linear-gradient(145deg, #d8aa4f, #bd8334);
  color: #332316;
}

.tile-products {
  grid-column: span 5;
  border-color: #e8d9b8;
  background: linear-gradient(145deg, #f0e5ca, #dbca9f);
  color: #39291b;
}

.tile-contacts {
  grid-column: span 5;
  background: linear-gradient(145deg, #493020, #342218);
}

.tile-recipes {
  grid-column: span 5;
}

.tile-recipes {
  border-color: #89563b;
  background: linear-gradient(145deg, #573323, #392318);
}

.tile-lists {
  grid-column: span 7;
  grid-row: span 2;
  min-height: 406px;
  border-color: #d4a143;
  background: linear-gradient(145deg, #d8aa4f, #bd8334);
  color: #332316;
}

.tile-contacts {
  grid-column: span 6;
}

.tile-lists .tile-icon {
  color: #9a5d17;
}

.tile-lists .tile-copy strong {
  font-size: clamp(27px, 3vw, 36px);
}

.tile-lists .tile-index {
  color: currentColor;
}

.tile-lists .tile-label,
.tile-lists .tile-description {
  color: currentColor;
}

.tile-lists .tile-arrow {
  color: currentColor;
}

.tile-index {
  color: currentColor;
  opacity: 0.7;
}

.tile-index span {
  font-weight: 500;
}

.tile-icon {
  width: 24px;
  height: 24px;
  margin-top: auto;
  margin-bottom: 12px;
  color: var(--orange);
}

.tile-orders .tile-icon,
.tile-products .tile-icon {
  color: #9a5d17;
}

.tile-copy {
  display: grid;
  gap: 4px;
  padding-right: 30px;
}

.tile-label {
  font-size: 12px;
  opacity: 0.76;
}

.tile-copy strong {
  font-size: clamp(20px, 2.3vw, 27px);
  font-weight: 650;
  line-height: 1.15;
}

.tile-description {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.72;
}

.tile-arrow {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 16px;
  opacity: 0.76;
}

.dashboard-footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(223, 132, 63, 0.15);
  margin-top: 26px;
  padding: 14px 4px 0;
  font-size: 9px;
  opacity: 0.68;
}

@media (max-width: 900px) {
  .dashboard {
    padding-inline: 24px;
  }

  .tile-lists {
    grid-column: span 6;
    grid-row: span 2;
  }

  .tile-products,
  .tile-contacts,
  .tile-recipes,
  .tile-orders {
    grid-column: span 6;
  }
}

@media (max-width: 620px) {
  :root {
    --rail-width: 0px;
  }

  .side-rail {
    inset: auto 0 0;
    width: 100%;
    height: calc(62px + env(safe-area-inset-bottom));
    flex-direction: row;
    justify-content: center;
    border-top: 1px solid rgba(223, 132, 63, 0.22);
    border-right: 0;
    padding: 5px 8px env(safe-area-inset-bottom);
  }

  .rail-brand,
  .rail-footer {
    display: none;
  }

  .rail-nav {
    display: flex;
    width: min(100%, 440px);
    justify-content: space-between;
    gap: 2px;
    margin: 0;
  }

  .rail-link {
    width: 44px;
    height: 44px;
  }

  .rail-link.is-active::before {
    inset: -6px 10px auto;
    width: auto;
    height: 3px;
    border-radius: 0 0 3px 3px;
  }

  .workspace {
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 48px;
    padding: 0 17px;
  }

  .dashboard {
    padding: 23px 16px 18px;
  }

  .welcome-row {
    min-height: 104px;
    padding: 0 2px 14px;
  }

  .dashboard-grid {
    grid-auto-rows: minmax(160px, auto);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dashboard-tile {
    grid-column: span 1;
    grid-row: auto;
    min-height: 170px;
    padding: 14px;
  }

  .tile-lists,
  .tile-orders {
    grid-column: span 2;
    min-height: 190px;
  }

  .tile-index {
    font-size: 9px;
  }

  .tile-copy strong,
  .tile-lists .tile-copy strong {
    font-size: 20px;
  }

  .tile-copy {
    padding-right: 0;
  }

  .tile-arrow {
    right: 12px;
    bottom: 12px;
    width: 27px;
    height: 27px;
  }

  .dashboard-footer {
    font-size: 8px;
  }
}

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