:root {
  font-family: "Noto Sans Devanagari", "Nirmala UI", "Mangal", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2937;
  background: #f5f2ea;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

#root {
  min-height: 100vh;
}

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

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: #ffffff;
  background: #0f766e;
  font-size: 0.92rem;
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.96);
}

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

button.primary {
  background: #b45309;
}

button.secondary {
  color: #134e4a;
  background: #d9efea;
}

button.danger {
  color: #7f1d1d;
  background: #fee2e2;
}

input,
textarea,
select {
  width: 100%;
  border: 2px solid #d8d1c4;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  background: #ffffff;
  color: #111827;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 0.25rem;
  color: #4b5563;
  font-weight: 900;
}

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

h1 {
  margin-bottom: 0.4rem;
  font-size: clamp(2.2rem, 8vw, 4.25rem);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.3rem;
}

h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

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

th,
td {
  border-bottom: 1px solid #e5dfd3;
  padding: 0.8rem 0.45rem;
  text-align: left;
}

.app-shell {
  width: min(1600px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
}

.app-shell > main {
  flex: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0 0.45rem;
}

.topbar p {
  margin: 0;
  color: #4b5563;
  font-weight: 900;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.back-button {
  min-height: 38px;
}

.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  padding: 0;
  background: transparent;
  line-height: 0;
}

.home-link:hover {
  filter: none;
}

.brand-logo {
  display: block;
  width: clamp(120px, 11vw, 155px);
  height: auto;
  object-fit: contain;
}

.app-footer {
  margin-top: 1rem;
  border-top: 1px solid #e3dbcf;
  padding: 0.75rem 0 0.3rem;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.welcome {
  min-height: calc(100vh - 160px);
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(360px, 0.75fr);
  align-items: center;
  gap: 2rem;
}

.welcome-content {
  display: grid;
  justify-items: center;
  gap: 1.2rem;
  text-align: center;
}

.today-line {
  color: #6b7280;
  font-size: 1.2rem;
  font-weight: 900;
}

.home-actions {
  width: min(560px, 100%);
  display: grid;
  gap: 1rem;
}

.home-actions button {
  min-height: 86px;
  font-size: 1.3rem;
}

.home-visual {
  display: grid;
  gap: 0.65rem;
}

.home-kitchen-photo,
.auth-kitchen-photo {
  width: 100%;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.16);
}

.home-kitchen-photo {
  height: min(58vh, 520px);
}

.food-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.food-strip img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e3dbcf;
}

.menu-food-strip {
  margin-top: 0.75rem;
}

.screen-stack {
  display: grid;
  gap: 1rem;
}

.panel {
  border: 1px solid #e3dbcf;
  border-radius: 8px;
  padding: 0.65rem;
  background: #fffdf8;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.08);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.muted {
  margin: 0.15rem 0 0;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 800;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.full-button {
  width: 100%;
  margin-top: 0.45rem;
}

.menu-input {
  min-height: 250px;
  margin-bottom: 0.85rem;
  font-size: 1.15rem;
  line-height: 1.6;
}

.two-column,
.order-grid,
.summary-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.85fr) minmax(720px, 1.55fr);
  gap: 0.65rem;
  align-items: start;
}

.menu-preview-list {
  display: grid;
  gap: 0.55rem;
}

.menu-preview-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 0.55rem;
}

.paste-box {
  min-height: 330px;
  margin-top: 0.45rem;
  font-size: 0.95rem;
  line-height: 1.4;
}

.capture-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

.address-box {
  min-height: 54px;
}

.preview-panel {
  display: grid;
  gap: 0.5rem;
}

.total-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  min-height: 38px;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  color: #ffffff;
  background: #111827;
}

.warnings {
  border: 2px solid #f59e0b;
  border-radius: 8px;
  padding: 0.45rem;
  background: #fffbeb;
  color: #7c2d12;
  font-weight: 900;
}

.warnings p {
  margin: 0.2rem 0;
}

.error-line {
  margin: 0.75rem 0 0;
  border: 2px solid #f59e0b;
  border-radius: 8px;
  padding: 0.75rem;
  background: #fffbeb;
  color: #7c2d12;
  font-weight: 900;
}

.confidence-line {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: capitalize;
}

.confidence-high {
  border-color: #99f6e4;
}

.confidence-line.confidence-high {
  color: #0f766e;
}

.confidence-medium,
.needs-review {
  border-color: #f59e0b;
}

.confidence-line.confidence-medium {
  color: #b45309;
}

.confidence-low {
  border-color: #ef4444;
}

.confidence-line.confidence-low {
  color: #b91c1c;
}

.item-table {
  display: grid;
  gap: 0.3rem;
  overflow-x: auto;
}

.item-header,
.item-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(112px, 0.9fr) 82px 58px 78px 78px 78px minmax(120px, 1fr);
  gap: 0.3rem;
  align-items: center;
}

.item-header {
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 900;
}

.message-panel,
.message-box {
  display: grid;
}

.message-box {
  min-height: 118px;
  line-height: 1.28;
  font-size: 0.92rem;
}

.compact-box {
  min-height: 52px;
}

.status-line {
  margin: 0;
  color: #0f766e;
  font-weight: 900;
}

.auth-screen {
  min-height: calc(100vh - 150px);
  display: grid;
  place-items: center;
  padding: 1rem 0;
}

.auth-layout {
  width: min(1050px, 100%);
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(360px, 520px);
  gap: 1rem;
  align-items: stretch;
}

.auth-visual {
  display: grid;
  gap: 0.65rem;
}

.auth-kitchen-photo {
  height: 430px;
}

.auth-card {
  display: grid;
  align-content: center;
  gap: 0.9rem;
  padding: 1rem;
}

.auth-screen > .auth-card {
  width: min(520px, 100%);
}

.auth-card h1 {
  margin-bottom: 0;
  font-size: 2.2rem;
}

.auth-note {
  margin: 0;
  color: #374151;
  font-size: 1.05rem;
  font-weight: 900;
}

.login-status {
  border: 1px solid #99f6e4;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  color: #134e4a;
  background: #ecfdf5;
  font-size: 0.9rem;
  font-weight: 900;
}

.login-status.logged-out {
  border-color: #fed7aa;
  color: #7c2d12;
  background: #fff7ed;
}

.login-panel,
.unsaved-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px) minmax(160px, 220px) auto;
  gap: 0.65rem;
  align-items: end;
  margin-bottom: 0.65rem;
}

.unsaved-panel {
  grid-template-columns: 1fr auto;
  align-items: center;
  border-color: #f59e0b;
  background: #fffbeb;
}

.unsaved-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.history-filters {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 0.55rem;
}

.history-table-wrap {
  overflow-x: auto;
}

.history-table {
  min-width: 1120px;
}

.history-table td {
  vertical-align: top;
}

.table-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 0.35rem;
}

.table-actions button {
  min-height: 38px;
  padding: 0.45rem 0.5rem;
  font-size: 0.8rem;
  line-height: 1.1;
}

.detail-panel {
  display: grid;
  gap: 0.65rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.status-history {
  border: 1px solid #ded8ce;
  border-radius: 8px;
  padding: 0.65rem;
  background: #ffffff;
}

.status-history p {
  margin: 0.15rem 0;
  font-weight: 800;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.metrics div {
  border: 1px solid #d8d1c4;
  border-radius: 8px;
  padding: 1rem;
  background: #f8fafc;
}

.metrics span {
  display: block;
  color: #64748b;
  font-weight: 900;
}

.metrics strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.75rem;
}

.delivery-list {
  display: grid;
  gap: 0.75rem;
}

.order-card,
.learning-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  border: 1px solid #ded8ce;
  border-radius: 8px;
  padding: 1rem;
  background: #ffffff;
}

.order-card p,
.learning-card p {
  margin-bottom: 0.25rem;
}

.order-card small,
.learning-card small {
  color: #475569;
}

.learning-list {
  display: grid;
  gap: 0.75rem;
}

.card-actions {
  display: grid;
  gap: 0.45rem;
  justify-items: end;
}

.print-ticket {
  display: none;
}

@media (min-width: 921px) {
  .order-grid .button-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .order-grid .button-row button {
    min-width: 0;
    padding-inline: 0.5rem;
    white-space: normal;
    line-height: 1.15;
  }

  .preview-panel > .button-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .preview-panel > .button-row button {
    min-height: 42px;
    font-size: 0.82rem;
  }
}

@media (max-width: 920px) {
  :root {
    font-size: 17px;
  }

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

  .home-link {
    align-self: flex-start;
  }

  .brand-logo {
    width: clamp(90px, 28vw, 120px);
  }

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

  .welcome,
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .home-visual {
    width: min(520px, 100%);
    justify-self: center;
  }

  .home-kitchen-photo,
  .auth-kitchen-photo {
    height: 260px;
  }

  .two-column,
  .order-grid,
  .summary-grid,
  .login-panel,
  .unsaved-panel,
  .history-filters,
  .detail-grid,
  .capture-fields,
  .menu-preview-row,
  .order-card {
    grid-template-columns: 1fr;
  }

  .item-header {
    display: none;
  }

  .item-row {
    grid-template-columns: 1fr 1fr;
    border: 1px solid #ded8ce;
    border-radius: 8px;
    padding: 0.6rem;
  }

  .paste-box,
  .message-box {
    min-height: 220px;
  }

  .button-row button {
    flex: 1 1 100%;
  }
}

@media print {
  @page {
    size: 80mm auto;
    margin: 4mm;
  }

  body {
    background: #ffffff;
  }

  .app-shell {
    display: none !important;
  }

  .print-ticket {
    display: block;
    width: 72mm;
    color: #000000;
    background: #ffffff;
    font-family: "Noto Sans Devanagari", "Nirmala UI", "Mangal", monospace;
    font-size: 12px;
    line-height: 1.35;
    white-space: pre-wrap;
  }

  .print-ticket pre {
    margin: 0;
    font: inherit;
    white-space: pre-wrap;
  }
}
