:root {
  --bg: #07140e;
  --card: #10261a;
  --raised: #163222;
  --line: rgba(186, 220, 170, 0.14);
  --text: #f4f7f2;
  --muted: #8b9d90;
  --lime: #b6ff3c;
  --danger: #ff4d4d;
  --on-lime: #07140e;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  padding: 0.7rem 1.15rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.logo {
  width: 48px;
  height: 48px;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  background: transparent;
}

.brand h1 {
  margin: 0;
  color: var(--text);
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.brand h1 span { color: var(--lime); }

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.tabs a {
  color: var(--text);
  text-decoration: none;
  background: var(--card);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.2;
}

.tabs a.active {
  background: var(--lime);
  color: var(--on-lime);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 0.22rem;
}

.nav-label { display: none; }

.nav a {
  color: var(--text);
  text-decoration: none;
  background: var(--card);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.2;
}

.nav a.active {
  background: var(--lime);
  color: var(--on-lime);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-left: auto;
  flex-shrink: 0;
}

.clock { text-align: right; }
.clock p { margin: 0; }
.clock-time {
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
}

.sync-status {
  color: var(--muted);
  font-size: 0.75rem;
}

.sync-status.stale { color: var(--danger); }

button.logout {
  padding: 0.45rem 0.8rem;
  font-size: 0.82rem;
}

.panel.login-panel {
  max-width: 380px;
  margin: 3rem auto 1rem;
}

.login-panel h1 { margin-top: 0; }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.login-form .error {
  margin: 0;
  min-height: 1.2em;
}

.cashier {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.7rem 0.28rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.86rem;
  font-weight: 650;
  white-space: nowrap;
}

.cashier select {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 650;
  width: auto;
  max-width: 10rem;
  padding: 0.2rem 1.15rem 0.2rem 0;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--lime) 50%), linear-gradient(135deg, var(--lime) 50%, transparent 50%);
  background-position: calc(100% - 5px) 58%, calc(100% - 0px) 58%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.cashier select:focus {
  outline: none;
  border: 0;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
}

main {
  padding: 0.4rem 1.25rem 2rem;
  max-width: 1500px;
  margin: 0 auto;
}

h1, h2, h3 {
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  letter-spacing: -0.03em;
}

h1 { margin: 0.4rem 0 1.1rem; font-size: 1.7rem; }
h2 { margin: 1.4rem 0 0.7rem; font-size: 1.2rem; }
h3 { margin: 0 0 0.7rem; font-size: 1rem; }

main a { color: var(--lime); }

button,
.btn,
.product-btn,
.inv-btn,
.zest-btn {
  background: var(--lime);
  color: var(--on-lime);
  border: 0;
  border-radius: 12px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.product-btn.secondary,
button.secondary {
  background: var(--raised);
  color: var(--text);
}

button:disabled,
.inv-btn:disabled { opacity: 0.45; cursor: not-allowed; }

input,
select,
textarea {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0c1c14;
  color: var(--text);
  font: inherit;
  max-width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(182, 255, 60, 0.35);
  border-color: var(--lime);
}

input[type="checkbox"] { accent-color: var(--lime); }

.zest-form { max-width: 820px; }

.panel,
.inv-panel,
.zest-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 1.2rem;
  margin: 0 0 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.9rem;
}

.total {
  color: var(--lime);
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
}

.muted { color: var(--muted); }
.error,
.field-validation-error,
.validation-summary-errors { color: var(--danger); }

table,
.product-table,
.inv-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
}

th,
td,
.product-table th,
.product-table td,
.inv-table th,
.inv-table td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inv-table th,
.inv-table td { text-align: right; white-space: nowrap; }
.inv-table th:first-child,
.inv-table td:first-child { text-align: left; }

form.inline,
.inv-row,
.product-toolbar,
.product-actions,
.zest-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.inv-row { align-items: end; margin-top: 0.4rem; }
h1 + form.inv-row { margin-bottom: 1.25rem; }
.inv-row label,
.zest-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.zest-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.zest-field input:not([type="checkbox"]),
.zest-field select { width: 100%; }

.product-toolbar { justify-content: space-between; margin: 0 0 1rem; }
.product-actions form { display: inline; }
.product-thumb {
  width: 64px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--raised);
}

.inv-scroll,
.table-scroll { overflow-x: auto; }
.inv-warning { color: #ffb020; }
.inv-alert {
  padding: 0.7rem 0.9rem;
  margin: 0 0 0.8rem;
  background: var(--raised);
  border-radius: 10px;
}

.wide-form { max-width: 1100px; }
.line-table select,
.line-table input { width: 100%; }
.line-table td { vertical-align: middle; }
.status-received { color: var(--lime); font-weight: 700; }
.status-draft { color: var(--muted); font-weight: 700; }
.status-void { color: var(--danger); font-weight: 700; }

code {
  background: var(--raised);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.page-head h1,
.page-head h2 { margin-bottom: 0.25rem; }
.page-head p { margin: 0; }

.report-actions,
.day-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem;
}

.day-form { margin-bottom: 1rem; }
.report-actions label,
.day-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
}

main a.day-link {
  color: inherit;
  text-decoration: none;
}

.sales-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 0.9rem;
  align-items: start;
}

.product-sales {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.product-sale-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.product-sale-top span { color: var(--lime); font-weight: 700; }
.product-sales p { margin: 0.25rem 0 0; }

.sale-track {
  height: 8px;
  margin-top: 0.4rem;
  border-radius: 999px;
  background: var(--raised);
  overflow: hidden;
}

.sale-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--lime);
}

.day-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 520px;
  overflow: auto;
}

.day-link {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: var(--raised);
}

.day-link strong { color: var(--lime); }
.day-link.active { outline: 1px solid var(--lime); }

.revenue-panel h2 { margin-bottom: 0.2rem; }

.rev-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  height: 220px;
  margin-top: 1rem;
}

.rev-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
}

.rev-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #d6ff7a, var(--lime));
  min-height: 0;
}

.rev-bar.is-empty {
  height: 3px !important;
  background: var(--raised);
}

.rev-label {
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .topbar-main { align-items: flex-start; }
  .header-right { gap: 0.55rem; }
  main { padding: 0.4rem 0.8rem 1.5rem; }
  .sales-layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .clock-time,
  #clock-date { display: none; }
  .clock { max-width: 5.5rem; }
  .brand h1,
  .brand p { white-space: nowrap; }
}

@media print {
  .topbar { display: none !important; }
  body { background: white; color: black; }
  main { padding: 0; max-width: none; }
}
