:root {
  --ink: #17211f;
  --muted: #60706b;
  --brand: #176b5b;
  --brand-2: #e2a93b;
  --line: #d8e0dc;
  --surface: #f7f9f6;
  --chart-bg: #ffffff;
}

body {
  background: var(--surface);
  color: var(--ink);
}

body[data-theme="dark"] {
  --ink: #eef5f2;
  --muted: #aab7b2;
  --brand: #51b89f;
  --brand-2: #f0c15a;
  --line: #33423e;
  --surface: #101614;
  --chart-bg: #18211e;
}

body[data-theme="blue"] {
  --brand: #225ea8;
  --brand-2: #19a7ce;
  --surface: #f3f7fb;
}

body[data-theme="contrast"] {
  --ink: #000;
  --muted: #111;
  --brand: #000;
  --brand-2: #ffd400;
  --line: #000;
  --surface: #fff;
}

.app-nav {
  background: var(--brand);
}

.brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 2px;
}

.navbar .nav-link.active {
  background: rgb(255 255 255 / 16%);
  border-radius: 6px;
}

.app-context-bar {
  background: color-mix(in srgb, var(--brand), #fff 88%);
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(120deg, #176b5b, #2f5d7c 56%, #463f5f);
}

.login-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr 380px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgb(0 0 0 / 20%);
}

.brand-block {
  min-height: 420px;
  padding: 48px;
  color: #fff;
  background:
    linear-gradient(180deg, rgb(0 0 0 / 6%), rgb(0 0 0 / 52%)),
    url("../images/market.svg") center bottom / 92% auto no-repeat;
}

.brand-block h1 {
  max-width: 9ch;
  margin: 38px 0 20px;
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.brand-block p:last-child {
  max-width: 520px;
  font-size: 18px;
  line-height: 1.45;
}

.login-form {
  padding: 42px;
  align-self: center;
}

.panel,
.metric,
.pos-main,
.pos-side {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.card,
.list-group-item {
  border-color: var(--line);
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .list-group-item {
  background: #18211e;
  color: var(--ink);
}

body[data-theme="dark"] .panel,
body[data-theme="dark"] .metric,
body[data-theme="dark"] .pos-main,
body[data-theme="dark"] .pos-side,
body[data-theme="dark"] .modal-content,
body[data-theme="dark"] .table {
  background: #18211e;
  color: var(--ink);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 26px;
}

.metric-link {
  color: var(--ink);
  display: block;
  min-height: 100%;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.metric-link:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: 0 14px 28px rgb(0 0 0 / 8%);
}

.metric-danger {
  border-color: #dc3545;
  background: #fff5f5;
}

.metric-danger span,
.metric-danger strong {
  color: #b02a37;
}

body[data-theme="dark"] .metric-danger {
  background: #32191d;
  border-color: #dc3545;
}

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

.metric.is-selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand), transparent 82%);
}

.filters-bar {
  display: grid;
  grid-template-columns: 1fr 160px 160px auto;
  gap: 10px;
  align-items: end;
}

.pos-shell {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px;
}

.pos-main,
.pos-side {
  min-height: calc(100vh - 120px);
}

.totals div,
.summary,
.pay-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.totals .grand {
  font-size: 24px;
  border-bottom: 0;
}

.quick-cash {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-chart {
  width: 100%;
  height: 180px;
}

.cash-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 700;
}

.cash-status.is-open {
  background: #e8f7ef;
  color: #145c35;
}

.cash-status.is-closed {
  background: #fff2d8;
  color: #825300;
}

.action-buttons {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.action-buttons form {
  display: inline;
}

.theme-picker {
  width: 140px;
}

.tenant-logo-thumb {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tenant-logo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pos-customer-results {
  max-height: 230px;
  overflow: auto;
}

.report-list {
  max-width: 520px;
}

.report-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

.report-card,
.report-link {
  color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}

.report-card:hover,
.report-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgb(0 0 0 / 8%);
}

.voucher {
  max-width: 320px;
  margin: 0 auto;
  font-size: 13px;
}

.voucher-head {
  text-align: center;
}

.voucher-head h1 {
  font-size: 18px;
  margin: 6px 0 2px;
}

.voucher-head p {
  margin: 2px 0;
}

.voucher-warning {
  border: 1px solid var(--ink);
  padding: 8px;
  text-align: center;
  font-weight: 800;
  margin: 10px 0;
}

.voucher table {
  width: 100%;
}

.voucher td:last-child {
  text-align: right;
}

.voucher p {
  display: flex;
  justify-content: space-between;
  margin: 5px 0;
}

.voucher-total {
  font-size: 16px;
  font-weight: 800;
}

@media print {
  .app-nav,
  .app-context-bar,
  .theme-picker {
    display: none !important;
  }

  body {
    background: #fff !important;
  }

  .panel,
  .card {
    border-color: #ccc !important;
    box-shadow: none !important;
  }
}

@media (max-width: 900px) {
  .login-panel,
  .pos-shell {
    grid-template-columns: 1fr;
  }

  .brand-block {
    min-height: 260px;
  }

  .filters-bar {
    grid-template-columns: 1fr;
  }
}
