:root {
  color-scheme: light;
  --background: #f7f3ea;
  --surface: #ffffff;
  --surface-muted: #efe7da;
  --text: #241c16;
  --text-muted: #766b60;
  --border: #ded3c4;
  --primary: #9a4f2d;
  --primary-text: #ffffff;
  --accent: #d7a441;
  --success: #397a45;
  --danger: #b53b35;
  --info: #2f6f8f;
  --shadow-soft: 0 12px 34px rgba(36, 28, 22, 0.1);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  min-height: 100vh;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

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

.brand {
  font-weight: 800;
  letter-spacing: 0;
}

.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  height: 44px;
  justify-content: center;
  padding: 0 18px;
}

.button-primary {
  background: var(--primary);
  color: var(--primary-text);
}

.button-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.button-danger {
  background: rgba(181, 59, 53, 0.1);
  border-color: rgba(181, 59, 53, 0.18);
  color: var(--danger);
}

.button-compact {
  height: 38px;
  padding: 0 12px;
}

.landing {
  margin: 0 auto;
  max-width: 1160px;
  min-height: 100vh;
  padding: 24px;
}

.landing-nav {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.landing-hero {
  align-items: center;
  display: grid;
  gap: 56px;
  grid-template-columns: minmax(0, 1fr) 420px;
  min-height: calc(100vh - 92px);
}

.landing-copy h1,
.auth-panel h1,
.page-heading h1,
.empty-state h1 {
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.12;
  margin: 0 0 18px;
}

.landing-copy p,
.auth-panel p,
.page-heading p,
.empty-state p {
  color: var(--text-muted);
  font-size: 18px;
  margin: 0 0 28px;
}

.workflow-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 12px;
  padding: 18px;
}

.workflow-step {
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  padding: 18px;
}

.workflow-step span {
  align-items: center;
  background: var(--accent);
  border-radius: 999px;
  display: inline-flex;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  margin-bottom: 12px;
  width: 28px;
}

.workflow-step strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

.workflow-step p {
  color: var(--text-muted);
  margin: 0;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  max-width: 460px;
  padding: 32px;
  width: 100%;
}

.auth-panel .brand {
  display: inline-block;
  margin-bottom: 32px;
}

.auth-panel h1 {
  font-size: 38px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.auth-links {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.auth-links a {
  color: var(--primary);
}

label span {
  color: var(--text-muted);
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

input {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font: inherit;
  height: 46px;
  padding: 0 14px;
  width: 100%;
}

select {
  appearance: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font: inherit;
  height: 46px;
  padding: 0 14px;
  width: 100%;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-muted);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.78;
}

input:focus,
select:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(154, 79, 45, 0.16);
}

.alert {
  border-radius: var(--radius-md);
  font-weight: 700;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.alert-danger {
  background: rgba(181, 59, 53, 0.1);
  color: var(--danger);
}

.alert-success {
  background: rgba(57, 122, 69, 0.12);
  color: var(--success);
}

.admin-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
}

.system-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.system-sidebar {
  background: #17120f;
  color: #fff;
  padding: 24px;
}

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

.system-nav a {
  align-items: center;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  font-weight: 760;
  gap: 10px;
  padding: 10px 12px;
}

.system-nav a.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.system-nav-icon {
  display: none;
}

.system-main {
  min-width: 0;
}

.system-topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.system-topbar span {
  color: var(--text-muted);
  display: block;
  font-size: 14px;
}

.system-content {
  padding: 28px 24px;
}

.system-action-grid,
.system-card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: grid;
  gap: 14px;
  padding: 20px;
}

.content-card strong {
  font-size: 20px;
  line-height: 1.2;
}

.content-card p,
.content-card span {
  color: var(--text-muted);
}

.system-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.system-row {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 12px;
  grid-template-columns: 70px minmax(220px, 1.2fr) minmax(180px, 1fr) 110px 110px minmax(220px, 0.8fr);
  padding: 14px 16px;
}

.subscription-row {
  grid-template-columns: 70px minmax(220px, 1.2fr) 140px 120px minmax(170px, 0.8fr) 140px;
}

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

.system-row-head {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.system-row strong,
.system-row small,
.system-row em {
  display: block;
}

.system-row small {
  color: var(--text-muted);
  font-size: 13px;
}

.system-row em,
.status-active,
.status-blocked {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  padding: 4px 8px;
}

.system-row em,
.status-active {
  background: rgba(57, 122, 69, 0.12);
  color: var(--success);
}

.status-blocked {
  background: rgba(181, 59, 53, 0.1);
  color: var(--danger);
}

.system-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.system-actions form {
  margin: 0;
}

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

.metrics-grid article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.metrics-grid strong {
  display: block;
  font-size: 36px;
  line-height: 1;
  margin-bottom: 8px;
}

.metrics-grid span {
  color: var(--text-muted);
  font-weight: 760;
}

.card-heading-row {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.compact-dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.compact-dl div {
  display: flex;
  justify-content: space-between;
}

.compact-dl dt {
  color: var(--text-muted);
  font-weight: 700;
}

.compact-dl dd {
  font-weight: 800;
  margin: 0;
}

.compact-feature-list {
  color: var(--text-muted);
  margin: 0;
  padding-left: 20px;
}

.form-grid-two,
.form-grid-three {
  display: grid;
  gap: 14px;
}

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

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

.checkbox-line {
  align-items: center;
  display: flex;
  gap: 10px;
}

.checkbox-line input {
  height: 20px;
  width: 20px;
}

.checkbox-line-bottom {
  align-self: end;
  min-height: 46px;
}

.compact-empty {
  box-shadow: none;
  grid-column: 1 / -1;
}

.admin-sidebar {
  background: var(--text);
  color: #fff;
  padding: 24px;
}

.admin-nav {
  display: grid;
  gap: 6px;
  margin-top: 28px;
}

.admin-nav a {
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.72);
  display: block;
  font-weight: 700;
  padding: 10px 12px;
}

.admin-nav a.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.admin-nav-icon {
  display: none;
}

.admin-main {
  min-width: 0;
}

.admin-topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-topbar span {
  color: var(--text-muted);
  display: block;
  font-size: 14px;
}

.admin-topbar-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.logout-form {
  margin: 0;
}

.icon-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  padding: 0;
  width: 44px;
}

.icon-button.is-active {
  background: var(--surface-muted);
  border-color: rgba(154, 79, 45, 0.25);
  color: var(--primary);
}

.icon-button img {
  height: 21px;
  width: 21px;
}

.admin-content {
  padding: 28px 24px calc(96px + env(safe-area-inset-bottom));
}

.page-heading h1,
.empty-state h1 {
  font-size: 36px;
}

.page-heading-row {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 24px;
}

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

.report-metrics {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric-card,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.metric-card span {
  color: var(--text-muted);
  font-weight: 700;
}

.metric-card strong {
  display: block;
  font-size: 38px;
  line-height: 1;
  margin: 18px 0 8px;
}

.metric-card p {
  color: var(--text-muted);
  margin: 0;
}

.dashboard-report-panel {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-top: 18px;
  padding: 20px;
}

.dashboard-report-panel h2 {
  font-size: 22px;
  line-height: 1.25;
  margin: 0 0 4px;
}

.dashboard-report-panel p {
  color: var(--text-muted);
  margin: 0;
}

.dashboard-report-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.data-panel,
.form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  overflow: hidden;
}

.data-table {
  display: grid;
}

.card-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(420px, 520px));
  margin-top: 22px;
}

.product-category-section {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.product-category-section:first-of-type {
  margin-top: 22px;
}

.category-heading-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  max-width: 1280px;
}

.category-heading-row h2 {
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
}

.category-heading-row span {
  color: var(--text-muted);
  font-weight: 800;
}

.category-heading-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.order-card-grid,
.broadcast-card-grid {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1280px;
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 20px;
  position: relative;
}

.admin-card:hover {
  border-color: rgba(154, 79, 45, 0.32);
  box-shadow: 0 10px 26px rgba(36, 28, 22, 0.08);
}

.card-link {
  border-radius: inherit;
  inset: 0;
  position: absolute;
  z-index: 1;
}

.card-heading,
.card-footer {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-width: 0;
}

.order-card,
.broadcast-card {
  align-items: center;
  grid-template-columns: minmax(220px, 0.35fr) minmax(0, 1fr);
}

.order-card .card-heading,
.broadcast-card .card-heading {
  align-items: center;
}

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

.plan-card .card-meta,
.broadcast-card .card-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.order-card .card-meta {
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1fr) minmax(140px, 0.45fr);
}

.card-meta span {
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 12px;
}

.card-meta strong {
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.card-meta small {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.card-actions {
  position: relative;
  z-index: 2;
}

.admin-card .button {
  height: 40px;
  padding: 0 14px;
}

.admin-card .product-cell p,
.admin-card .stacked-cell p {
  white-space: normal;
}

.data-row {
  align-items: center;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 16px;
  padding: 14px 16px;
}

.data-row:first-child {
  border-top: 0;
}

.product-table .data-row {
  grid-template-columns: minmax(260px, 1fr) 110px 130px 72px 110px 210px;
}

.date-table .data-row {
  grid-template-columns: minmax(200px, 1fr) minmax(250px, 1.1fr) 150px 120px minmax(280px, auto);
}

.menu-table .data-row {
  grid-template-columns: minmax(220px, 1fr) 110px 130px 100px 80px 110px minmax(180px, auto);
}

.order-table .data-row {
  grid-template-columns: minmax(170px, 0.9fr) minmax(180px, 1fr) minmax(190px, 1fr) 110px 120px 130px;
}

.order-items-table .data-row {
  grid-template-columns: minmax(220px, 1fr) 190px 120px 130px 120px 110px;
}

.manual-order-items-table .data-row {
  grid-template-columns: minmax(260px, 1fr) 120px 120px 130px;
}

.baking-summary-table .data-row {
  grid-template-columns: minmax(240px, 1fr) 120px 130px 130px 130px;
}

.top-products-table .data-row {
  grid-template-columns: minmax(220px, 1fr) 90px 120px 120px;
}

.sales-by-date-table .data-row {
  grid-template-columns: minmax(140px, 1fr) 90px 120px 120px;
}

.broadcast-table .data-row {
  grid-template-columns: minmax(240px, 1fr) 130px 120px 160px 150px 120px;
}

.broadcast-recipient-table .data-row {
  grid-template-columns: minmax(220px, 1fr) 150px 130px 150px minmax(180px, 0.9fr);
}

.data-row-head {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.product-cell {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.product-cell img,
.image-placeholder,
.current-image img {
  border-radius: var(--radius-sm);
  height: 52px;
  object-fit: cover;
  width: 52px;
}

.image-placeholder {
  align-items: center;
  background: var(--surface-muted);
  color: var(--primary);
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
}

.product-cell strong {
  display: block;
}

.product-cell p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 2px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  padding: 5px 9px;
}

.status-on {
  background: rgba(57, 122, 69, 0.12);
  color: var(--success);
}

.status-off {
  background: rgba(118, 107, 96, 0.14);
  color: var(--text-muted);
}

.status-draft {
  background: rgba(118, 107, 96, 0.14);
  color: var(--text-muted);
}

.status-open {
  background: rgba(57, 122, 69, 0.12);
  color: var(--success);
}

.status-closed {
  background: rgba(47, 111, 143, 0.12);
  color: var(--info, #2f6f8f);
}

.status-new {
  background: rgba(47, 111, 143, 0.12);
  color: var(--info, #2f6f8f);
}

.status-confirmed {
  background: rgba(57, 122, 69, 0.12);
  color: var(--success);
}

.status-changed {
  background: rgba(154, 91, 0, 0.12);
  color: #7a4a00;
}

.status-ready {
  background: rgba(215, 164, 65, 0.18);
  color: #7a5715;
}

.status-completed {
  background: rgba(215, 164, 65, 0.18);
  color: #7a5715;
}

.status-cancelled {
  background: rgba(181, 59, 53, 0.12);
  color: var(--danger);
}

.status-scheduled {
  background: rgba(47, 111, 143, 0.12);
  color: var(--info, #2f6f8f);
}

.status-sending,
.status-pending {
  background: rgba(215, 164, 65, 0.18);
  color: #7a5715;
}

.status-sent {
  background: rgba(57, 122, 69, 0.12);
  color: var(--success);
}

.status-failed {
  background: rgba(181, 59, 53, 0.12);
  color: var(--danger);
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions form {
  margin: 0;
}

.form-panel {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.admin-form {
  display: grid;
  gap: 18px;
  max-width: 820px;
}

.compact-admin-form {
  max-width: 680px;
}

.compact-form-panel {
  gap: 14px;
  padding: 16px;
}

.compact-form-panel .form-grid {
  gap: 12px;
}

.compact-form-panel textarea {
  min-height: 84px;
}

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

.form-field textarea {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font: inherit;
  min-height: 112px;
  padding: 12px 14px;
  resize: vertical;
  width: 100%;
}

.form-field textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(154, 79, 45, 0.16);
}

.checkbox-field {
  align-items: center;
  display: inline-flex;
  gap: 10px;
}

.checkbox-field input {
  height: 18px;
  width: 18px;
}

.checkbox-field span {
  color: var(--text);
  font-size: 16px;
  margin: 0;
}

.current-image {
  align-items: center;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  font-weight: 700;
}

.form-actions {
  display: flex;
  gap: 10px;
}

.settings-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 760px);
}

.readonly-input,
.readonly-code {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 14px;
}

.readonly-code {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: block;
  line-height: 1.45;
  overflow-wrap: anywhere;
  padding: 12px 14px;
}

.token-preview {
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.legal-page {
  background: var(--background);
}

.legal-document {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 16px;
  margin: 32px auto;
  max-width: 760px;
  padding: 28px;
}

.legal-document h1,
.legal-document p {
  margin: 0;
}

.legal-content {
  display: grid;
  gap: 14px;
}

.legal-content h1,
.legal-content h2,
.legal-content p,
.legal-content ul {
  margin: 0;
}

.legal-content h2 {
  font-size: 22px;
}

.legal-content ul {
  padding-left: 20px;
}

.legal-links {
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding-top: 16px;
}

.legal-links a {
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
}

.filter-form {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.8fr) minmax(200px, 1fr) auto;
}

.report-filter-form {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 1fr) auto auto;
}

.sales-filter-form {
  grid-template-columns: minmax(150px, 0.4fr) minmax(150px, 0.4fr) auto auto;
}

.report-filter-panel {
  margin-bottom: 18px;
}

.report-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.report-panel-heading {
  border-bottom: 1px solid var(--border);
  padding: 16px;
}

.report-panel-heading h2 {
  font-size: 20px;
  line-height: 1.25;
  margin: 0;
}

.report-empty-note {
  color: var(--text-muted);
  padding: 18px;
}

.broadcast-detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.42fr);
  margin-bottom: 18px;
}

.broadcast-preview {
  max-width: 820px;
}

.message-preview {
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: normal;
}

.message-preview strong,
.broadcast-preview strong {
  display: block;
  margin-bottom: 10px;
}

.broadcast-send-form {
  margin-top: 18px;
}

.broadcast-send-form .button {
  width: 100%;
}

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

.order-filter-panel {
  margin-bottom: 18px;
}

.manual-order-date-form {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 1fr) auto;
  max-width: 720px;
}

.manual-order-summary {
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 2px;
  padding: 12px 14px;
}

.manual-order-summary span {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 800;
}

.manual-order-products {
  display: grid;
  gap: 12px;
}

.manual-order-products-heading {
  display: grid;
  gap: 3px;
}

.manual-order-products-heading span {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}

.order-detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  margin-bottom: 18px;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.detail-card h2 {
  font-size: 20px;
  line-height: 1.25;
  margin: 0 0 14px;
}

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

.detail-card-heading h2 {
  margin: 0;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.detail-list div {
  display: grid;
  gap: 4px;
}

.detail-list dt {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
}

.order-items-panel {
  margin-bottom: 18px;
}

.add-order-item-panel {
  margin-bottom: 18px;
}

.add-order-item-form {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 1fr) 140px auto;
}

.line-quantity-form {
  align-items: center;
  display: flex;
  gap: 8px;
}

.line-quantity-form .compact-input {
  width: 72px;
}

.order-actions-panel {
  align-items: start;
  grid-template-columns: minmax(0, 1fr);
}

.status-action-form {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 320px) auto;
  max-width: 540px;
}

.critical-actions {
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  padding-top: 18px;
}

.critical-actions .button {
  width: 100%;
}

.stacked-cell strong {
  display: block;
}

.stacked-cell p,
.muted-note {
  color: var(--text-muted);
  margin: 2px 0 0;
}

.inline-form {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 1fr) 160px auto;
}

.menu-add-form {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
}

.menu-product-picker {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.product-choice-list {
  display: grid;
  gap: 8px;
  max-height: 312px;
  overflow: auto;
  padding-right: 2px;
}

.product-choice {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
}

.product-choice.is-selected,
.product-choice:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(154, 79, 45, 0.12);
}

.product-choice input {
  flex: 0 0 auto;
  height: 18px;
  padding: 0;
  width: 18px;
}

.product-choice-body {
  color: var(--text);
  display: grid;
  font-size: inherit;
  font-weight: inherit;
  gap: 2px;
  margin: 0;
  min-width: 0;
}

.product-choice-body strong {
  overflow-wrap: anywhere;
}

.product-choice-body small {
  color: var(--text-muted);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.menu-add-side {
  display: grid;
  gap: 12px;
}

.menu-add-side .button {
  width: 100%;
}

.compact-input {
  height: 38px;
  padding: 0 10px;
}

.menu-row {
  margin: 0;
}

.menu-checkbox {
  margin: 0;
}

.offline-screen .auth-panel h1 {
  font-size: 38px;
}

@media (display-mode: standalone) {
  .admin-topbar {
    padding-top: calc(14px + env(safe-area-inset-top));
  }
}

@media (max-width: 820px) {
  .landing-hero,
  .admin-shell,
  .system-shell,
  .metric-grid,
  .report-metrics,
  .metrics-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .landing-hero {
    align-items: start;
    gap: 28px;
    padding-top: 56px;
  }

  .system-sidebar {
    bottom: 0;
    left: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    top: auto;
    z-index: 20;
  }

  .system-nav {
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 0;
    overflow-x: visible;
  }

  .system-sidebar .brand {
    display: none;
  }

  .system-nav a {
    align-items: center;
    display: flex;
    flex-direction: column;
    font-size: 11px;
    gap: 4px;
    justify-content: center;
    line-height: 1.15;
    min-height: 58px;
    min-width: 0;
    padding: 6px 2px;
    text-align: center;
    white-space: normal;
  }

  .system-nav-icon {
    display: block;
    filter: invert(1);
    flex: 0 0 auto;
    height: 22px;
    opacity: 0.72;
    width: 22px;
  }

  .system-nav a.is-active .system-nav-icon {
    opacity: 1;
  }

  .system-nav a span {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .system-topbar {
    padding: 12px 16px;
  }

  .system-content {
    padding: 22px 16px calc(96px + env(safe-area-inset-bottom));
  }

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

  .system-row,
  .subscription-row {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .system-row-head {
    display: none;
  }

  .admin-sidebar {
    bottom: 0;
    left: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    top: auto;
    z-index: 20;
  }

  .admin-sidebar .brand {
    display: none;
  }

  .admin-nav {
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-top: 0;
    overflow-x: visible;
  }

  .admin-nav a {
    align-items: center;
    display: flex;
    flex-direction: column;
    font-size: 11px;
    justify-content: center;
    line-height: 1.15;
    min-height: 58px;
    min-width: 0;
    padding: 6px 2px;
    text-align: center;
    white-space: normal;
  }

  .admin-nav-icon {
    display: block;
    filter: invert(1);
    flex: 0 0 auto;
    height: 22px;
    margin-bottom: 4px;
    opacity: 0.72;
    width: 22px;
  }

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

  .admin-nav a span {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .admin-topbar {
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
  }

  .admin-content {
    padding: 22px 16px calc(96px + env(safe-area-inset-bottom));
  }

  .card-grid {
    gap: 14px;
    grid-template-columns: 1fr;
    margin-top: 18px;
  }

  .admin-card {
    gap: 10px;
    padding: 12px;
  }

  .order-card,
  .broadcast-card {
    grid-template-columns: 1fr;
  }

  .card-heading,
  .card-footer {
    gap: 10px;
  }

  .card-meta,
  .plan-card .card-meta,
  .broadcast-card .card-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-meta span {
    padding: 8px 9px;
  }

  .card-meta strong {
    font-size: 15px;
  }

  .card-meta small {
    font-size: 12px;
  }

  .order-card .card-meta {
    grid-template-columns: 1fr;
  }

  .admin-card .button {
    height: 36px;
    padding: 0 12px;
  }

  .page-heading-row,
  .form-actions,
  .dashboard-report-panel,
  .dashboard-report-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading-row {
    margin-bottom: 22px;
  }

  .data-panel,
  .form-panel {
    margin-bottom: 18px;
  }

  .product-category-section,
  .product-category-section:first-of-type {
    gap: 12px;
    margin-top: 18px;
  }

  .product-table .data-row,
  .date-table .data-row,
  .menu-table .data-row,
  .order-table .data-row,
  .order-items-table .data-row,
  .manual-order-items-table .data-row,
  .baking-summary-table .data-row,
  .top-products-table .data-row,
  .sales-by-date-table .data-row,
  .broadcast-table .data-row,
  .broadcast-recipient-table .data-row,
  .data-row {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .data-row-head {
    display: none;
  }

  .data-row [data-label]::before {
    color: var(--text-muted);
    content: attr(data-label) ": ";
    font-weight: 800;
  }

  .row-actions {
    justify-content: flex-start;
  }

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

  .filter-form,
  .report-filter-form,
  .sales-filter-form,
  .manual-order-date-form,
  .add-order-item-form,
  .order-detail-grid,
  .broadcast-detail-grid,
  .settings-grid,
  .status-action-form {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

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

  .form-actions .button {
    width: 100%;
  }

  .inline-form {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .manual-order-items-table .data-row {
    gap: 10px;
    padding: 14px 12px;
  }

  .manual-order-items-table label[data-label] {
    display: grid;
    gap: 6px;
  }

  .manual-order-items-table .compact-input {
    width: 100%;
  }

  .menu-add-form {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .product-choice-list {
    max-height: 280px;
  }

  .product-choice {
    padding: 10px 12px;
  }
}
