:root {
  --ethiopos-green: #078f3e;
  --ethiopos-yellow: #f5c300;
  --ethiopos-red: #da121a;
  --ethiopos-blue: #0f47af;
  --ethiopos-dark: #061a2f;
  --ethiopos-light: #f5f7fa;
  --ethiopos-white: #ffffff;
  --panel: #ffffff;
  --ink: #061a2f;
  --muted: #687383;
  --line: #dfe5ec;
  --soft-green: #e7f5ed;
  --soft-yellow: #fff7d1;
  --soft-red: #fde8e9;
  --soft-blue: #eaf0fb;
  font-family: Inter, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--ethiopos-light);
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
}

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

button, .file-btn {
  border: 0;
  background: var(--ethiopos-green);
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

button:hover, .file-btn:hover { filter: brightness(.94); }

button.ghost, .file-btn {
  color: var(--ethiopos-green);
  background: var(--soft-green);
}

button.danger { background: var(--ethiopos-red); }

button.icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.sidebar {
  min-height: 100vh;
  background: var(--ethiopos-dark);
  color: white;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 4px 6px;
}

.brand strong { display: block; font-size: 20px; }
.brand span, .plan-card span { display: block; color: #b8c6d5; font-size: 13px; }

.brand-mark {
  width: 52px;
  height: 52px;
  object-fit: contain;
  background: white;
  border-radius: 8px;
  padding: 3px;
}

nav { display: grid; gap: 4px; }

.nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #dce5ee;
  padding: 11px 12px;
}

.nav-btn:hover, .nav-btn.active {
  background: rgba(255, 255, 255, .1);
  color: white;
  box-shadow: inset 4px 0 0 var(--ethiopos-yellow);
}

.plan-card {
  margin-top: auto;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 4px;
}

.shell { min-width: 0; padding: 22px; }

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

h1, h2, h3 { margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 34px; }

.eyebrow {
  margin: 0 0 5px;
  color: var(--ethiopos-green);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .08em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.top-actions select { min-width: 190px; }

.file-btn {
  position: relative;
  overflow: hidden;
  display: inline-block;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.sync-pill, .user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 999px;
  color: #166534;
  background: #dcfce7;
  font-weight: 900;
  font-size: 12px;
}

.user-pill {
  color: var(--ethiopos-blue);
  background: var(--soft-blue);
}

.sync-pill.pending-sync { color: #92400e; background: #fef3c7; }
.sync-pill.sync-failed, .sync-pill.conflict { color: #991b1b; background: #fee2e2; }

.view { display: grid; gap: 18px; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.hero {
  position: relative;
  min-height: 430px;
  display: grid;
  align-items: center;
  padding: 42px;
  border-radius: 8px;
  overflow: hidden;
  color: var(--ethiopos-dark);
  background:
    linear-gradient(90deg, rgba(255,255,255,.94), rgba(255,255,255,.82)),
    url("ethiopos-horizontal-logo.png") right 38px center / min(760px, 62vw) auto no-repeat,
    white;
  border: 1px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 8px;
  background: linear-gradient(90deg, var(--ethiopos-green), var(--ethiopos-yellow), var(--ethiopos-red));
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 760px;
  display: grid;
  gap: 12px;
}

.hero-copy img {
  width: min(420px, 100%);
  height: auto;
  object-fit: contain;
}

.hero h2 {
  font-size: 44px;
  line-height: 1.08;
  max-width: 780px;
}

.hero p {
  margin: 0;
  max-width: 760px;
  color: #344454;
  font-size: 17px;
}

.hero-actions, .toolbar, .filters, .chip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar { justify-content: space-between; margin-bottom: 12px; }
.toolbar h3 { margin-right: auto; }

.chip {
  background: var(--soft-blue);
  color: var(--ethiopos-blue);
  padding: 8px 10px;
  font-size: 13px;
}

.stat {
  display: grid;
  gap: 5px;
}

.stat span, .muted, .stat small {
  color: var(--muted);
}

.stat strong {
  display: block;
  font-size: 27px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #eef2f6;
  color: #40505f;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
  background: #eef2f6;
  color: #40505f;
  white-space: nowrap;
}

.badge.ok { color: #166534; background: #dcfce7; }
.badge.warn { color: #92400e; background: #fef3c7; }
.badge.danger { color: #991b1b; background: #fee2e2; }

.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  align-items: start;
}

.pos-products, .cart-card {
  position: sticky;
  top: 16px;
}

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

.scan-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: min(520px, 100%);
}

.scanner-panel {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
}

.scanner-panel video {
  width: 100%;
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #020617;
  object-fit: cover;
}

.product-tile {
  min-height: 132px;
  text-align: left;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  display: grid;
  gap: 7px;
  align-content: start;
}

.product-tile:hover {
  background: var(--soft-green);
  color: var(--ethiopos-dark);
}

.cart-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 22px;
  font-weight: 900;
  margin: 12px 0;
}

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

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 12px;
}

.check-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.check-row input {
  width: auto;
}

.activity {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.activity li {
  list-style: none;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.chart { display: grid; gap: 9px; }

.bar {
  display: grid;
  grid-template-columns: 120px minmax(120px, 1fr) 100px;
  gap: 10px;
  align-items: center;
}

.bar span {
  height: 14px;
  background: var(--soft-blue);
  border-radius: 999px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--ethiopos-green), var(--ethiopos-blue));
  border-radius: inherit;
}

.price {
  display: block;
  color: var(--ethiopos-green);
  font-size: 24px;
  margin: 12px 0;
}

.plan.selected {
  border-color: var(--ethiopos-green);
  box-shadow: inset 0 0 0 2px var(--ethiopos-green);
}

.empty {
  text-align: center;
  padding: 28px;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 26, 47, .5);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 20;
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: white;
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.modal-head, .modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.modal-actions { justify-content: flex-end; }

.modal-body label .muted {
  font-weight: 600;
  text-transform: none;
  font-size: 11px;
  letter-spacing: 0;
}

.modal-body input:focus, .modal-body select:focus {
  outline: none;
  border-color: var(--ethiopos-green);
  box-shadow: 0 0 0 3px var(--soft-green);
}

.modal-body .form-grid + .form-grid,
.modal-body .form-grid + .check-row {
  margin-top: -4px;
}

.combo {
  position: relative;
}

.combo-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(6, 26, 47, .16);
  z-index: 40;
}

.combo-option {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
}

.combo-option:hover {
  background: var(--soft-green);
}

.combo-option + .combo-option {
  border-top: 1px solid var(--line);
}

.auth-mode .sidebar,
.auth-mode .shell {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  width: 100vw;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.94), rgba(255,255,255,.86)),
    url("ethiopos-horizontal-logo.png") center / min(900px, 86vw) auto no-repeat,
    var(--ethiopos-light);
}

.auth-card {
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(6, 26, 47, .14);
}

.auth-card img {
  width: min(320px, 100%);
  height: auto;
}

.auth-card h1 {
  font-size: 28px;
}

.auth-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-message {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ethiopos-blue);
  background: var(--soft-blue);
  font-weight: 800;
  font-size: 13px;
}

@media (max-width: 1120px) {
  body { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    min-height: auto;
    max-height: 60vh;
    overflow-y: auto;
  }
  nav { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
  .plan-card { display: none; }
  .topbar, .pos-layout {
    display: grid;
    grid-template-columns: 1fr;
  }
  .pos-products, .cart-card { position: static; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .shell { padding: 14px; }
  .topbar, .top-actions { align-items: stretch; }
  .top-actions > * { width: 100%; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .form-grid { grid-template-columns: 1fr; }
  .hero {
    min-height: auto;
    padding: 22px;
    background:
      linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.9)),
      url("ethiopos-icon.png") right 12px top 12px / 140px auto no-repeat,
      white;
  }
  .hero h2 { font-size: 31px; }
  .hero-copy img { width: 280px; }
  .bar { grid-template-columns: 82px 1fr; }
  .bar em { grid-column: 2; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); }
  .scan-tools { grid-template-columns: 1fr; }
}
