:root {
  --bg: #f5d385;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #5b4c3b;
  --ink-soft: rgba(91, 76, 59, 0.72);
  --line: rgba(91, 76, 59, 0.18);
  --brand: #5b4c3b;
  --brand-2: #453929;
  --accent: #f5d385;
  --danger: #7d443d;
  --warning: #7b6136;
  --success: #4f6045;
  --info: #5b4c3b;
  --shadow: 0 18px 48px rgba(91, 76, 59, 0.14);
  --radius: 8px;
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
}

body {
  min-width: 0;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.28), transparent 32rem),
    #f5d385;
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  background: #f5d385;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  width: min(100%, 1540px);
  height: auto;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 34px;
  margin: 0 auto;
  border-right: 0;
  background: rgba(245, 211, 133, 0.96);
  color: var(--brand);
  padding: 34px 40px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 2px solid rgba(91, 76, 59, 0.22);
  border-radius: 50%;
  background: #ffffff;
  object-fit: cover;
}

.brand strong,
.mail-status strong {
  display: block;
  font-size: 1rem;
  line-height: 1.2;
}

.brand span:not(.brand-mark),
.mail-status span {
  display: block;
  color: rgba(91, 76, 59, 0.72);
  font-size: 0.86rem;
}

.nav-list {
  display: flex;
  justify-self: end;
  align-items: center;
  gap: 0;
  border-radius: 999px;
  background: var(--brand);
  padding: 6px;
}

.nav-item {
  width: auto;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #ffffff;
  padding: 13px 18px;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item.is-active {
  border-color: #ffffff;
  background: #ffffff;
  color: var(--brand);
  outline: 0;
}

.mail-status {
  display: none;
  align-items: flex-start;
  gap: 10px;
  margin-top: auto;
  border: 1px solid rgba(91, 76, 59, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.45);
  padding: 14px;
}

.status-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
}

.status-dot--warning {
  background: var(--brand);
}

.main {
  min-width: 0;
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 28px 40px 84px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--brand);
  font-family: "Brush Script MT", "Segoe Script", "Lucida Handwriting", cursive;
  font-size: clamp(3rem, 5.4vw, 5.9rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 0.98;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.18rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.topbar-actions {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  gap: 12px;
  padding-top: 14px;
}

.date-control,
.search-control,
.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.date-control input,
.search-control input,
select,
.form-grid input,
.form-grid textarea {
  min-height: 48px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--ink);
  padding: 10px 12px;
}

.search-control input {
  width: min(34vw, 360px);
}

.button,
.icon-button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 800;
  padding: 11px 18px;
}

.button:hover,
.button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--brand);
  outline: 0;
}

.button--primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.button--primary:hover,
.button--primary:focus-visible {
  background: var(--brand-2);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card,
.panel {
  border: 1px solid rgba(91, 76, 59, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: none;
}

.stat-card {
  display: grid;
  gap: 6px;
  padding: 20px;
}

.stat-card span,
.stat-card small,
.panel-header p,
.muted {
  color: var(--ink-soft);
}

.stat-card strong {
  font-size: 2rem;
  line-height: 1;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.82fr);
  gap: 16px;
  align-items: start;
}

.workspace-grid--inbox {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header p {
  margin-bottom: 0;
}

.order-list,
.inbox-list,
.kitchen-list {
  display: grid;
  gap: 10px;
}

.order-row {
  display: grid;
  width: 100%;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: inherit;
  padding: 13px;
  text-align: left;
}

.order-row:hover,
.order-row:focus-visible,
.order-row.is-selected {
  border-color: var(--brand);
  outline: 0;
}

.order-time {
  color: var(--brand);
  font-size: 1.08rem;
  font-weight: 900;
}

.order-title {
  min-width: 0;
}

.order-title strong,
.order-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-title span {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.badge--new,
.badge--review {
  border: 1px solid rgba(91, 76, 59, 0.22);
  background: var(--accent);
  color: var(--brand);
}

.badge--checked,
.badge--confirmed {
  border: 1px solid rgba(91, 76, 59, 0.18);
  background: #ffffff;
  color: var(--brand);
}

.badge--production {
  background: rgba(91, 76, 59, 0.12);
  color: var(--brand);
}

.badge--ready,
.badge--done {
  background: var(--brand);
  color: #ffffff;
}

.badge--cancelled {
  border: 1px solid rgba(91, 76, 59, 0.28);
  background: #ffffff;
  color: var(--danger);
}

.detail-panel {
  position: sticky;
  top: 28px;
}

.empty-state {
  display: grid;
  min-height: 280px;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--ink-soft);
  text-align: center;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-head h2 {
  font-size: 1.4rem;
}

.detail-section {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.detail-section:last-child {
  padding-bottom: 0;
}

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

.meta-item {
  display: grid;
  gap: 3px;
}

.meta-item span {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.meta-item strong {
  overflow-wrap: anywhere;
}

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

.item-table th,
.item-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 4px;
  text-align: left;
  vertical-align: top;
}

.item-table th:last-child,
.item-table td:last-child {
  text-align: right;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-actions .button {
  min-height: 36px;
  padding: 8px 10px;
}

.email-box {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--brand);
  padding: 12px;
  white-space: pre-wrap;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.day-card {
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.day-card h3 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.day-card h3 span {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.calendar-order {
  border-left: 3px solid var(--brand);
  margin-top: 10px;
  padding-left: 8px;
}

.calendar-order strong,
.calendar-order span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-order span {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.inbox-email,
.kitchen-order {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  padding: 14px;
}

.inbox-email header,
.kitchen-order header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.inbox-email p,
.kitchen-order p {
  margin-bottom: 8px;
}

.error-queue {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.error-item {
  border: 1px solid rgba(91, 76, 59, 0.28);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 12px;
}

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

.settings-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.settings-list div {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.settings-list dt {
  color: var(--ink-soft);
  font-weight: 800;
}

.settings-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.modal {
  width: min(720px, calc(100vw - 24px));
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
}

.modal::backdrop {
  background: rgba(91, 76, 59, 0.48);
}

.modal-card {
  background: var(--surface);
  color: var(--ink);
  padding: 20px;
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header {
  margin-bottom: 16px;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 1.5rem;
}

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

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

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

  .sidebar {
    position: static;
    height: auto;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 24px 18px 16px;
  }

  .nav-list {
    justify-self: stretch;
    overflow-x: auto;
  }

  .nav-item {
    flex: 1 0 auto;
    text-align: center;
  }

  .mail-status {
    margin-top: 0;
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search-control input {
    width: 100%;
  }

  .workspace-grid,
  .workspace-grid--inbox,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 780px) {
  .main {
    padding: 16px;
  }

  .sidebar {
    padding: 16px;
  }

  .nav-list {
    justify-content: flex-start;
  }

  .stats-grid,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 3.2rem;
  }

  .order-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .order-row .badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .panel-header,
  .detail-head,
  .inbox-email header,
  .kitchen-order header {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .settings-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .stats-grid,
  .view:not(#view-kitchen),
  .panel-header .button {
    display: none !important;
  }

  .app-shell,
  .main {
    display: block;
    padding: 0;
  }

  #view-kitchen {
    display: block !important;
  }

  .panel {
    border: 0;
    box-shadow: none;
  }
}
