:root {
  --ink: #17221b;
  --muted: #69736c;
  --paper: #f4f2ec;
  --card: #fffefa;
  --line: #dedfd8;
  --green: #28563b;
  --green-dark: #183b29;
  --green-soft: #e5eee7;
  --amber: #b7791f;
  --amber-soft: #fff2d9;
  --blue: #3f6f88;
  --blue-soft: #e5f0f5;
  --red: #a34b42;
  --red-soft: #f8e7e4;
  --shadow: 0 14px 36px rgba(29, 42, 33, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% -20%, rgba(40, 86, 59, 0.11), transparent 30%),
    var(--paper);
  font-family: "DM Sans", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.topbar {
  height: 76px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  background: rgba(255, 254, 250, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark,
.auth-mark {
  display: grid;
  place-items: center;
  color: #f5efe1;
  background: var(--ink);
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  letter-spacing: -0.08em;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 15px;
}

.brand > span:last-child {
  display: grid;
  gap: 1px;
}

.brand strong {
  font-family: "Manrope", sans-serif;
  font-size: 17px;
  letter-spacing: -0.03em;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.service-state {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px;
  border: 1px solid #cddbcf;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 13px;
  font-weight: 700;
}

.service-state.offline {
  color: var(--red);
  border-color: #ecd0cb;
  background: var(--red-soft);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4b9d68;
  box-shadow: 0 0 0 4px rgba(75, 157, 104, 0.14);
}

.offline .pulse-dot {
  background: var(--red);
  box-shadow: none;
}

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 9px;
}

.icon-button,
.refresh-button,
.avatar-button {
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
}

.icon-button,
.avatar-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.icon-button {
  font-size: 22px;
}

.icon-button.muted {
  color: #a7aaa5;
  text-decoration: line-through;
}

.refresh-button {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

.refresh-button.loading span {
  animation: spin 0.8s linear infinite;
}

.avatar-button {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

main {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 44px 0 60px;
}

.dashboard-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

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

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

h1 {
  max-width: 700px;
  margin-bottom: 10px;
  font-family: "Manrope", sans-serif;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.03;
  letter-spacing: -0.055em;
}

.heading-copy {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.clock-card {
  min-width: 130px;
  padding: 16px 19px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 254, 250, 0.7);
  text-align: right;
}

.clock-card span {
  display: block;
  font-family: "Manrope", sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.clock-card small {
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 32px 0 26px;
}

.metric-card {
  min-height: 106px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 254, 250, 0.82);
}

.metric-icon {
  width: 47px;
  height: 47px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  font-size: 21px;
  font-weight: 800;
}

.metric-new .metric-icon {
  color: var(--amber);
  background: var(--amber-soft);
}

.metric-progress .metric-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.metric-ready .metric-icon {
  color: var(--green);
  background: var(--green-soft);
}

.metric-time .metric-icon {
  color: #795c37;
  background: #eee6d9;
}

.metric-card div {
  display: grid;
}

.metric-card strong {
  font-family: "Manrope", sans-serif;
  font-size: 27px;
  letter-spacing: -0.04em;
}

.metric-card div span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.toolbar {
  min-height: 64px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.filter-tabs {
  display: flex;
  gap: 4px;
  align-self: stretch;
}

.filter-tab {
  padding: 0 15px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.filter-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.filter-tab span {
  margin-left: 5px;
  padding: 2px 7px;
  color: #fff;
  background: var(--green);
  border-radius: 999px;
  font-size: 11px;
}

.search-field {
  width: min(310px, 100%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.search-field span {
  color: var(--muted);
  font-size: 21px;
}

.search-field input {
  width: 100%;
  height: 42px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

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

.order-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.order-card.updating {
  pointer-events: none;
  opacity: 0.68;
}

.order-accent {
  height: 5px;
  background: var(--amber);
}

.status-in-progress .order-accent {
  background: var(--blue);
}

.status-completed .order-accent {
  background: var(--green);
}

.status-discard .order-accent {
  background: var(--red);
}

.order-header {
  padding: 20px 20px 12px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.order-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.order-code {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 999px;
  color: #8b5c16;
  background: var(--amber-soft);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-in-progress .status-badge {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-completed .status-badge {
  color: var(--green);
  background: var(--green-soft);
}

.status-discard .status-badge {
  color: var(--red);
  background: var(--red-soft);
}

.table-number {
  margin: 8px 0 0;
  font-family: "Manrope", sans-serif;
  font-size: 25px;
  letter-spacing: -0.04em;
}

.wait-time {
  min-width: 55px;
  text-align: right;
}

.wait-time strong,
.wait-time span {
  display: block;
}

.wait-time strong {
  font-family: "Manrope", sans-serif;
  font-size: 20px;
}

.wait-time span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.customer-row {
  min-height: 30px;
  margin: 0 20px;
  padding-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.customer-initial {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
  font-size: 10px;
  font-weight: 800;
}

.items-list {
  padding: 5px 20px 10px;
}

.order-item {
  padding: 13px 0;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  border-bottom: 1px dashed #dedfd8;
}

.order-item:last-child {
  border-bottom: 0;
}

.item-quantity {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 800;
}

.item-copy {
  min-width: 0;
}

.item-copy strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.item-copy span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.item-status-select {
  max-width: 96px;
  padding: 6px 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-size: 10px;
  font-weight: 700;
}

.eta-panel {
  margin: 0 20px;
  padding: 13px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.eta-panel > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.eta-options {
  display: flex;
  gap: 5px;
}

.eta-options button {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.eta-options button.active {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.order-actions {
  padding: 14px 20px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  background: #f8f7f2;
  border-top: 1px solid var(--line);
}

.action-primary,
.action-secondary,
.action-menu {
  min-height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.action-primary {
  color: #fff;
  border: 1px solid var(--green);
  background: var(--green);
}

.action-primary.progress-action {
  border-color: var(--blue);
  background: var(--blue);
}

.action-secondary,
.action-menu {
  border: 1px solid var(--line);
  background: #fff;
}

.action-secondary {
  color: var(--green);
}

.action-menu {
  width: 42px;
  color: var(--muted);
}

.empty-state,
.error-state {
  min-height: 340px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.empty-check {
  width: 58px;
  height: 58px;
  margin-bottom: 18px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 25px;
}

.empty-state h2,
.error-state strong {
  margin-bottom: 7px;
  font-family: "Manrope", sans-serif;
  font-size: 20px;
}

.empty-state p,
.error-state p {
  max-width: 390px;
  margin-bottom: 0;
  color: var(--muted);
}

.error-state button {
  margin-top: 18px;
  padding: 10px 17px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--green);
  cursor: pointer;
  font-weight: 700;
}

footer {
  min-height: 64px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.6);
  font-size: 12px;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(rgba(20, 33, 25, 0.92), rgba(20, 33, 25, 0.96)),
    radial-gradient(circle at 25% 20%, #6e9278, transparent 35%);
}

.auth-card {
  width: min(430px, 100%);
  padding: clamp(28px, 5vw, 44px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: #fffefa;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.24);
}

.auth-mark {
  width: 52px;
  height: 52px;
  margin-bottom: 26px;
  border-radius: 16px;
}

.auth-card h2 {
  margin-bottom: 9px;
  font-family: "Manrope", sans-serif;
  font-size: 34px;
  letter-spacing: -0.045em;
}

.auth-card > p:not(.eyebrow, .auth-error) {
  margin-bottom: 24px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-card label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.auth-card input {
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
}

.auth-card input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(40, 86, 59, 0.12);
}

.auth-card button {
  width: 100%;
  height: 49px;
  margin-top: 14px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--green);
  cursor: pointer;
  font-weight: 800;
}

.auth-error {
  margin: 11px 0 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: grid;
  gap: 8px;
}

.toast {
  max-width: 360px;
  padding: 13px 16px;
  color: #fff;
  border-radius: 11px;
  background: var(--ink);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  font-weight: 700;
  animation: toast-in 0.24s ease-out;
}

.toast.error {
  background: var(--red);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 1120px) {
  .order-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .service-state {
    display: none;
  }

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

  .toolbar {
    align-items: stretch;
    flex-direction: column-reverse;
    border-bottom: 0;
  }

  .filter-tabs {
    min-height: 50px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
  }

  .filter-tab {
    white-space: nowrap;
  }

  .search-field {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .topbar {
    height: 68px;
    padding: 0 14px;
  }

  .brand small,
  .refresh-button {
    display: none;
  }

  main {
    width: min(100% - 24px, 1480px);
    padding-top: 28px;
  }

  .dashboard-heading {
    align-items: flex-start;
  }

  .clock-card {
    display: none;
  }

  .metrics {
    gap: 9px;
    margin-top: 24px;
  }

  .metric-card {
    min-height: 90px;
    padding: 13px;
    gap: 10px;
  }

  .metric-icon {
    width: 39px;
    height: 39px;
    border-radius: 11px;
  }

  .metric-card strong {
    font-size: 22px;
  }

  .metric-card div span {
    font-size: 11px;
  }

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

  footer {
    padding: 18px;
    align-items: flex-start;
    flex-direction: column;
  }
}
