:root {
  --bg: #f6f7f9;
  --ink: #18212f;
  --muted: #687386;
  --line: #dfe4eb;
  --panel: #ffffff;
  --accent: #0f8b8d;
  --accent-strong: #09686a;
  --warn: #b45309;
  --danger: #b42318;
  --ok: #147a46;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.sidebar {
  background: #111827;
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

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

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.9);
}

.brand strong, .brand small { display: block; }
.brand small { color: #b9c2d0; margin-top: 4px; }

nav { display: grid; gap: 8px; }
.nav {
  border: 0;
  background: transparent;
  color: #d6deea;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
}
.nav.active, .nav:hover { background: #243044; color: #fff; }

main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.title-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.top-logo {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
  flex: 0 0 auto;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
.topbar p, .hint { color: var(--muted); margin-top: 6px; }

.upload, .primary, .ghost, .status-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 40px;
}

.upload {
  background: var(--accent);
  color: #fff;
  white-space: nowrap;
}
.upload input { display: none; }
.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.primary:hover, .upload:hover { background: var(--accent-strong); }
.ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.small { padding: 8px 12px; min-height: 34px; }

.view { display: none; }
.view.active { display: block; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.04);
}

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

input, select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  min-width: 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 10px;
  min-height: 150px;
}

.product-card strong { font-size: 16px; line-height: 1.35; }
.meta { color: var(--muted); font-size: 13px; }
.price { color: var(--accent-strong); font-size: 22px; font-weight: 800; }

.checkout { position: sticky; top: 18px; }
.cart-items {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  min-height: 140px;
}
.cart-items.empty {
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.qty {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qty button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.total-row {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.total-row strong { font-size: 26px; }

.payment-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}
.payment-box svg { width: 190px; height: 190px; }

.table-wrap { overflow: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 700; font-size: 13px; }
td button { margin-right: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  color: #fff;
  background: var(--warn);
}
.badge.done { background: var(--ok); }
.badge.cancel { background: var(--danger); }

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(460px, calc(100vw - 28px));
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.24);
}
dialog::backdrop { background: rgba(17, 24, 39, 0.42); }
dialog form { padding: 20px; }
.fields { display: grid; gap: 12px; margin: 16px 0; }
.field { display: grid; gap: 6px; }
.field label { color: var(--muted); font-size: 13px; }
menu {
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #111827;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(17, 24, 39, 0.24);
}
.hidden { display: none; }

@media (max-width: 920px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 5; padding: 14px; }
  nav { grid-template-columns: repeat(4, 1fr); }
  .nav { text-align: center; padding: 10px 6px; }
  .brand small { display: none; }
  .brand-logo { width: 44px; height: 44px; }
  main { padding: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .split { grid-template-columns: 1fr; }
  .checkout { position: static; }
}

@media (max-width: 560px) {
  nav { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 24px; }
  .top-logo { width: 56px; height: 56px; }
  .section-head { align-items: stretch; flex-direction: column; }
  .upload { width: 100%; text-align: center; }
}
