:root {
  color-scheme: dark;
  --navy: #050608;
  --blue: #31b7ff;
  --pale: rgba(49, 183, 255, 0.12);
  --ink: #f5f7fb;
  --line: rgba(255, 255, 255, 0.13);
  --red: #ff3158;
  --green: #5cff85;
  --yellow: #ffd84d;
  --panel: #0e1117;
  --panel-2: #151922;
  --muted: #aab3c2;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.38);
}

html {
  min-height: 100%;
  background: #050608;
}

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 49, 88, 0.14), transparent 28rem),
    radial-gradient(circle at 93% 8%, rgba(49, 183, 255, 0.14), transparent 30rem),
    linear-gradient(180deg, #050608 0%, #090b10 48%, #050608 100%);
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 6, 8, 0.88);
  backdrop-filter: blur(16px);
}

header::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--blue));
  opacity: 0.8;
}

.header-inner {
  width: min(1160px, calc(100% - 32px));
  min-height: 112px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #fff;
}

.brand img {
  width: 205px;
  height: 96px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

nav {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

nav form {
  display: block;
}

nav a,
header .link {
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
}

nav a:hover,
nav a:focus-visible,
header .link:hover,
header .link:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
}

header .link {
  min-height: auto;
}

main {
  width: min(1160px, 100%);
  padding-top: 52px;
}

footer {
  color: var(--muted);
}

footer a,
main a:not(.button):not(.card) {
  color: var(--blue);
}

h1,
h2,
h3,
label,
strong,
th {
  color: #fff;
}

p,
small {
  color: var(--muted);
}

section,
.card,
aside,
.table-wrap {
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(21, 25, 34, 0.96), rgba(14, 17, 23, 0.96));
  box-shadow: var(--shadow);
}

.auth {
  max-width: 560px;
}

.auth::before {
  display: block;
  width: 72px;
  height: 4px;
  margin-bottom: 22px;
  border-radius: 99px;
  content: "";
  background: linear-gradient(90deg, var(--red), var(--blue), var(--green));
}

input,
textarea,
select {
  border-color: rgba(255, 255, 255, 0.2);
  background: #090b10;
  color: #fff;
}

input::placeholder,
textarea::placeholder {
  color: #778291;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(49, 183, 255, 0.16);
}

button:not(.link),
.button {
  min-height: 44px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--red), var(--blue) 52%, var(--green));
  color: #050608;
  font-weight: 850;
}

button:not(.link):hover,
.button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.card:hover {
  border-color: var(--blue);
  box-shadow: 0 18px 55px rgba(49, 183, 255, 0.12);
}

.badge {
  background: rgba(49, 183, 255, 0.13);
  color: #8bd8ff;
}

.notice {
  margin-bottom: 20px;
  border: 1px solid rgba(49, 183, 255, 0.3);
  border-radius: 8px;
  background: rgba(49, 183, 255, 0.1);
  color: #d8f2ff;
}

.message,
th,
td,
.detail-item {
  border-color: var(--line);
}

.message.internal {
  background: rgba(255, 216, 77, 0.08);
}

.message p,
.detail-item,
td {
  color: #e5eaf1;
}

.detail-item b,
.form-section > p,
.muted {
  color: var(--muted);
}

tr.low td {
  background: rgba(255, 49, 88, 0.1);
}

.table-wrap td small,
.table-wrap td strong {
  display: block;
}

.table-wrap td small {
  margin-top: 4px;
  color: var(--muted);
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
}

.pagination a,
.pagination span,
.stock-add summary {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.page-actions form,
.stock-actions form {
  margin: 0;
}

button.danger,
a.button.danger {
  background: rgba(255, 49, 88, 0.14);
  border-color: rgba(255, 49, 88, 0.45);
  color: #ff9caf;
}

.epos-grid {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(500px, 1.6fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

.epos-results {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  max-height: 520px;
  overflow: auto;
}

button.epos-result {
  width: 100%;
  min-height: 0;
  padding: 11px;
  justify-self: stretch;
  text-align: left;
  background: rgba(49,183,255,.09);
  border-color: rgba(49,183,255,.28);
  color: #e8f6ff;
}

.epos-basket .table-wrap {
  max-height: 440px;
}

.epos-basket td input {
  min-width: 80px;
}

.epos-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #090b10;
}

.epos-total strong {
  font-size: 2rem;
}

.epos-receipt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--line);
}

.epos-receipt-head img {
  width: 190px;
  height: 85px;
  object-fit: contain;
}

.invoice-copy-label {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-weight: 700;
}

.sale-invoice-copy.customer-copy {
  display: none;
}

.invoice-footer {
  margin: 20px 0 0;
  text-align: center;
  color: var(--muted);
}

@media print {
  @page { size: A4; margin: 10mm; }
  header, footer, .page-actions, nav, form, button { display: none !important; }
  body, main { background: #fff !important; color: #000 !important; }
  main { width: 100%; max-width: none; padding: 0; }
  section, .table-wrap { box-shadow: none; border-color: #aaa; background: #fff; }
  h1,h2,h3,strong,th,td,p,small,.detail-item,.detail-item b { color: #000 !important; }
  .sale-print-actions, .sale-admin-actions { display: none !important; }
  .sale-invoice-copy { display: block !important; margin: 0; padding: 0; border: 0; }
  .sale-invoice-copy.shop-copy { break-after: page; page-break-after: always; }
  .sale-invoice-copy.customer-copy { break-after: auto; page-break-after: auto; }
  .sale-invoice-copy .epos-receipt-head { margin-bottom: 12px; padding-bottom: 8px; }
  .sale-invoice-copy .epos-receipt-head img { width: 170px; height: 68px; }
  .sale-invoice-copy .detail-grid { gap: 6px 12px; }
  .sale-invoice-copy .detail-item { padding: 7px; }
  .sale-invoice-copy .epos-total { margin: 10px 0; padding: 10px; background: #fff !important; }
  .sale-invoice-copy .epos-total strong { font-size: 1.5rem; }
  .sale-invoice-copy th, .sale-invoice-copy td { padding: 6px; }
}

.stock-add {
  margin: 20px 0;
}

.stock-add summary {
  display: inline-block;
  cursor: pointer;
  color: var(--blue);
  font-weight: 800;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 24px;
}

.history-stats div {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(21, 25, 34, 0.96), rgba(14, 17, 23, 0.96));
}

.history-stats b,
.history-stats span {
  display: block;
}

.history-stats b {
  font-size: 1.7rem;
}

.history-stats span {
  color: var(--muted);
}

.history-search {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
}

@media (max-width: 720px) {
  .epos-grid {
    grid-template-columns: 1fr;
  }
  .history-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-search {
    grid-template-columns: 1fr;
  }
  .header-inner {
    min-height: 0;
    padding: 10px 0 14px;
    align-items: flex-start;
    flex-direction: column;
  }

  .brand img {
    width: 170px;
    height: 78px;
  }

  nav {
    width: 100%;
    justify-content: flex-start;
  }

  main {
    padding-top: 30px;
  }
}
