:root {
  color-scheme: light;
  --ink: #161a36;
  --muted: #676c87;
  --line: #dfe2ee;
  --page: #f7f8fc;
  --panel: #ffffff;
  --brand: #1d247d;
  --brand-strong: #151b65;
  --accent: #ff7417;
  --accent-strong: #e85f08;
  --danger: #b93737;
  font-family: Inter, Segoe UI, Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #eef0fa;
  color: var(--brand-strong);
}

button.secondary:hover {
  background: #dfe3f5;
}

button.ghost {
  background: transparent;
  color: var(--danger);
}

button.danger {
  background: #f4dfdf;
  color: var(--danger);
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  min-height: 42px;
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 116, 23, 0.16);
  outline: 0;
}

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

[dir="auto"] {
  unicode-bidi: plaintext;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  align-content: start;
  background: var(--brand);
  color: #fff;
  display: grid;
  gap: 28px;
  padding: 28px 22px;
}

.brand-block {
  display: grid;
  gap: 18px;
}

.brand-logo {
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  display: block;
  max-width: 170px;
  padding: 12px;
  width: 100%;
}

.sidebar h1 {
  font-size: 30px;
  line-height: 1.08;
  margin: 8px 0 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.nav-tabs {
  display: grid;
  gap: 10px;
}

.nav-tab {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  justify-content: start;
  text-align: left;
}

.nav-tab.active,
.nav-tab:hover {
  background: #fff;
  color: var(--brand-strong);
}

.rate-box {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 16px;
}

.rate-box span {
  color: #d9dcf4;
  font-size: 13px;
}

.rate-box strong {
  font-size: 24px;
}

.sync-status {
  align-items: center;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #fff;
  display: flex;
  font-size: 13px;
  font-weight: 800;
  min-height: 40px;
  padding: 0 12px;
}

.sync-status::before {
  background: var(--accent);
  border-radius: 999px;
  content: "";
  height: 8px;
  margin-right: 9px;
  width: 8px;
}

.sync-status[data-state="online"]::before {
  background: #42d47d;
}

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

.page {
  display: none;
}

.page.active {
  display: grid;
  gap: 22px;
}

.page-header {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.page-header h2 {
  font-size: 34px;
  margin: 5px 0 0;
}

.inline-form,
.toolbar,
.redemption-form,
.actions-row {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-form input {
  width: 190px;
}

.toolbar input {
  max-width: 440px;
}

.content-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
}

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

.panel-title {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.panel-title h3 {
  font-size: 17px;
  margin: 0;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.holder-list,
.history-list {
  display: grid;
  gap: 10px;
}

.holder-item,
.history-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.holder-item {
  background: #fbfcff;
  cursor: pointer;
}

.holder-item.active {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.holder-item strong,
.history-item strong {
  font-size: 15px;
}

.holder-heading {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.holder-edit {
  min-height: 32px;
  padding: 0 12px;
}

.meta-line {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 12px;
}

.history-actions,
.daily-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.history-actions button,
.daily-actions button,
.daily-header button {
  min-height: 34px;
  padding: 0 12px;
}

.daily-view {
  display: grid;
  gap: 12px;
}

.daily-header {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
}

.daily-rows {
  display: grid;
  gap: 10px;
}

.empty-state {
  color: var(--muted);
  padding: 18px 4px;
}

.hidden {
  display: none !important;
}

.redemption-workspace {
  display: grid;
  gap: 16px;
}

.mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.segmented-option input {
  position: absolute;
  opacity: 0;
}

.segmented-option span {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  min-height: 42px;
  padding: 0 16px;
}

.segmented-option input:checked + span {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.date-row {
  max-width: 220px;
}

.redemption-form label {
  min-width: 220px;
}

.import-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.import-row span {
  color: var(--muted);
  font-size: 13px;
}

.file-button {
  align-items: center;
  background: #eef0fa;
  border-radius: 7px;
  color: var(--brand-strong);
  cursor: pointer;
  display: inline-flex;
  font-size: 15px;
  min-height: 42px;
  padding: 0 16px;
}

.file-button input {
  display: none;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

#printArea {
  display: none;
}

.voucher {
  color: #000;
  direction: rtl;
  font-family: Arial, Tahoma, sans-serif;
  padding: 4mm 0;
  text-align: center;
  width: 55mm;
}

.voucher h2 {
  font-size: 18px;
  margin: 0 0 3.5mm;
}

.voucher .amount {
  font-size: 25px;
  font-weight: 800;
  margin: 4mm 0;
  padding: 2mm 0;
}

.voucher p {
  font-size: 14px;
  font-weight: 700;
  margin: 2mm 0;
}

.voucher-break {
  border-top: 1px dashed #000;
  height: 5mm;
  width: 55mm;
}

.report {
  color: #000;
  font-family: Arial, sans-serif;
  padding: 14mm;
}

.report h2 {
  margin: 0 0 3mm;
}

.report table {
  min-width: 0;
}

.report th,
.report td {
  border: 1px solid #999;
  padding: 7px;
}

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

  .sidebar {
    padding: 20px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  main {
    padding: 20px;
  }

  .page-header {
    align-items: stretch;
    display: grid;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  #printArea,
  #printArea * {
    visibility: visible;
  }

  #printArea {
    display: block;
    left: 0;
    position: absolute;
    top: 0;
  }

  @page {
    margin: 0;
    size: auto;
  }
}
