:root {
  color-scheme: light;
  --ink: #142033;
  --muted: #64748b;
  --surface: #ffffff;
  --surface-soft: #f8fbfd;
  --soft: #eaf3f7;
  --brand: #10446f;
  --brand-bright: #1977a3;
  --teal: #0f8a92;
  --accent: #d6a33e;
  --accent-soft: #fff4d8;
  --line: #cfdee6;
  --good: #168052;
  --bad: #b3404a;
  --shadow: 0 12px 28px rgba(20, 32, 51, 0.10);
  --shadow-strong: 0 18px 42px rgba(20, 32, 51, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eaf5f8 0%, #f7fafc 34%, #eef4f7 100%);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
}

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

.app-shell {
  min-height: 100vh;
  padding: 14px 14px 82px;
}

.app-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 12px;
  align-items: center;
  max-width: 1220px;
  margin: 0 auto 14px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 12px;
  background:
    linear-gradient(135deg, #0b2f55 0%, #14618d 56%, #0f8a92 100%);
  box-shadow: var(--shadow-strong);
}

.header-nav-icon,
.account-button,
.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  font-size: 23px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.header-nav-icon:hover,
.header-nav-icon:focus,
.account-button:hover,
.account-button:focus {
  background: rgba(255, 255, 255, 0.24);
  outline: 0;
}

.app-header h1 {
  margin: 0 0 2px;
  font-size: 24px;
  color: #fff;
  font-weight: 850;
}

.app-header p {
  margin: 0;
  color: #d7edf8;
  font-size: 13px;
}

.account-menu-wrap {
  position: relative;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  min-width: 190px;
  padding: 6px;
  border: 1px solid #c7dce8;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-strong);
}

.account-menu button {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.account-menu button:hover,
.account-menu button:focus {
  background: #e8f4fb;
  outline: 0;
}

.page {
  max-width: 1220px;
  margin: 0 auto;
}

.is-hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 12px;
}

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

.user-layout {
  max-width: 460px;
}

.panel {
  padding: 13px;
  border: 1px solid rgba(207, 222, 230, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 253, 255, 0.98));
  box-shadow: var(--shadow);
}

#admin-page .is-collapsed > :not(.panel-title):not(.card-list) {
  display: none;
}

#admin-page .is-popup-open {
  position: fixed;
  top: 76px;
  left: 50%;
  z-index: 30;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 116px);
  overflow: auto;
  transform: translateX(-50%);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28);
}

#admin-page .is-popup-open > .card-list {
  display: none;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.form-actions .ghost-action {
  min-width: 88px;
}

.settings-panel {
  max-width: 760px;
  margin: 0 auto;
}

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

.settings-grid label:first-child,
.settings-grid label:nth-child(5),
.settings-grid label:nth-child(7) {
  grid-column: 1 / -1;
}

.entry-panel {
  align-self: start;
}

.workspace {
  min-width: 0;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.panel-title h2 {
  margin: 0;
  color: #0f3554;
  font-size: 16px;
  font-weight: 850;
}

.panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.print-action {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

.admin-section h3 {
  margin: 0;
  font-size: 13px;
}

.compact-title {
  margin-bottom: 6px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #526479;
  font-size: 12px;
  font-weight: 700;
}

.form-control {
  display: block;
  width: 100%;
  min-height: 34px;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid #cbdce5;
  border-radius: 6px;
  background: #fbfdff;
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea.form-control {
  min-height: 54px;
  resize: vertical;
}

.form-control:focus {
  border-color: var(--brand-bright);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(25, 119, 163, 0.14);
  outline: 0;
}

.password-field {
  position: relative;
  display: block;
  margin-top: 4px;
}

.password-field input {
  width: 100%;
  padding-right: 40px;
}

.password-field .form-control {
  margin-top: 0;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  width: 30px;
  height: 30px;
  min-height: 30px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus {
  border-color: #cbdce5;
  background: #eef8fb;
  color: var(--brand);
  outline: 0;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.two-col,
.money-grid,
.money-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.money-section {
  display: grid;
  gap: 6px;
}

.payment-row {
  align-items: end;
}

.reservation-row {
  display: grid;
  grid-template-columns: minmax(0, 0.62fr) minmax(128px, 0.38fr);
  gap: 8px;
  align-items: end;
}

.cruise-booking-row {
  grid-template-columns: minmax(110px, 0.7fr) minmax(180px, 1.3fr) minmax(116px, auto);
}

.reservation-number-field {
  max-width: 180px;
}

.next-cruise-field {
  margin-bottom: 8px;
}

.checkbox-field {
  display: flex;
  min-height: 34px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  color: var(--ink);
}

.checkbox-field input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.money-row.three-money {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.traveler-entry-list {
  display: grid;
  gap: 6px;
}

.points-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 240px) max-content;
  gap: 8px;
  align-items: end;
  margin-bottom: 6px;
}

.points-toolbar label {
  margin-bottom: 0;
}

.traveler-entry-row {
  display: grid;
  grid-template-columns: minmax(72px, .9fr) repeat(3, minmax(0, 1fr));
  gap: 5px;
  align-items: end;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.traveler-entry-row h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 11px;
}

.traveler-entry-row label {
  margin-bottom: 0;
}

.money-grid label,
.money-section label {
  margin-bottom: 6px;
  font-size: 11px;
}

.money-grid .form-control,
.money-section .form-control {
  min-height: 30px;
  padding: 4px 6px;
  font-size: 12px;
}

.primary-action,
.ghost-action,
.icon-action,
.row-action,
.nav-button {
  min-height: 34px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.primary-action {
  width: 100%;
  border: 0;
  background: linear-gradient(135deg, #10446f, #1977a3);
  color: #fff;
  box-shadow: 0 8px 16px rgba(16, 68, 111, 0.18);
}

.primary-action:hover,
.primary-action:focus {
  background: linear-gradient(135deg, #0c3559, #14698f);
}

.danger-action {
  background: #b91c1c;
}

.danger-action:hover,
.danger-action:focus {
  background: #7f1d1d;
}

.ghost-action {
  padding: 0 10px;
  border: 1px solid #cbdce5;
  background: #fff;
  color: #526479;
}

.compact-action {
  min-height: 30px;
  padding: 0 8px;
}

.ghost-action:hover,
.ghost-action:focus {
  border-color: var(--brand-bright);
  background: #eef8fb;
  color: var(--brand);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.summary-card {
  position: relative;
  min-height: 76px;
  padding: 10px;
  border: 1px solid rgba(207, 222, 230, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff, #f8fcfd);
  box-shadow: var(--shadow);
}

.summary-card::before {
  content: "";
  display: block;
  width: 34px;
  height: 3px;
  margin-bottom: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--teal));
}

.summary-card span,
.record-count {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: #0f3554;
  font-size: 18px;
}

.summary-card h3 {
  margin: 0 0 3px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-meta,
.level-meta {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.tier-total {
  margin-top: 3px;
}

.progress-track {
  height: 5px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--accent));
}

.good {
  color: var(--good);
}

.bad {
  color: var(--bad);
}

.empty-state {
  display: grid;
  min-height: 96px;
  place-items: center;
  border: 1px dashed #b8cbd5;
  border-radius: 8px;
  background: #f9fcfd;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.table-wrap {
  overflow: auto;
}

.ledger-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: fixed;
}

.ledger-table th,
.ledger-table td {
  padding: 5px 3px;
  border-top: 1px solid #d8e5eb;
  text-align: left;
  vertical-align: middle;
  font-size: 10px;
}

.ledger-table thead th {
  border-top: 0;
  color: #587084;
  font-size: 10px;
  text-transform: uppercase;
}

.ledger-table tbody tr {
  transition: background 0.14s ease;
}

.ledger-table tbody tr:hover {
  background: #f3fafc;
}

.ledger-table .numeric {
  text-align: right;
  white-space: nowrap;
}

.cell-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.cell-main > div:first-child {
  min-width: 0;
}

.ledger-table strong,
.ledger-table small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-table small,
.card-list p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.inline-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
}

.icon-action {
  display: grid;
  width: 22px;
  height: 22px;
  min-height: 22px;
  place-items: center;
  border: 1px solid #cbdce5;
  background: #fff;
  color: var(--brand);
  font-size: 13px;
  line-height: 1;
}

.danger-icon,
.row-action {
  border-color: #efcaca;
  color: var(--bad);
}

.row-action {
  width: 30px;
  min-height: 30px;
  border: 1px solid #efcaca;
  background: #fff;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 10px;
  padding: 3px;
  border: 1px solid #cbdce5;
  border-radius: 8px;
  background: var(--soft);
}

.segmented-control label {
  margin: 0;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: grid;
  min-height: 30px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.segmented-control input:checked + span {
  background: linear-gradient(135deg, var(--brand), var(--teal));
  color: #fff;
}

.dynamic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 6px;
  align-items: end;
  margin-bottom: 6px;
}

.dynamic-row.gambler-member-row {
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: start;
}

.dynamic-row.level-row,
.dynamic-row.ship-row,
.dynamic-row.program-perk-row {
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: start;
}

.dynamic-row.level-row {
  align-items: end;
}

.level-row-fields {
  display: grid;
  grid-template-columns: minmax(120px, 0.65fr) 88px minmax(170px, 1fr);
  gap: 8px;
  align-items: end;
}

.program-perk-fields {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(110px, 0.6fr);
  gap: 8px;
  align-items: end;
}

.multi-select {
  position: relative;
  align-self: end;
}

.multi-select summary {
  display: block;
  min-height: 34px;
  padding: 8px 28px 8px 10px;
  border: 1px solid #cbdce5;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-select summary::after {
  content: "⌄";
  position: absolute;
  right: 10px;
  color: var(--muted);
}

.multi-select-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 190px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #cbdce5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(18, 60, 105, 0.16);
}

.multi-select-menu .checkbox-field {
  margin: 0 0 6px;
}

.multi-select-actions {
  position: sticky;
  bottom: -8px;
  margin: 8px -8px -8px;
  padding: 8px;
  border-top: 1px solid #d8e5eb;
  background: #fff;
  text-align: right;
}

.empty-menu-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.gambler-member-fields {
  display: grid;
  gap: 8px;
}

.gambler-member-fields label {
  margin-bottom: 0;
}

.gambler-member-fields .member-number-input {
  min-height: 34px;
  font-size: 13px;
}

.dynamic-row.gambler-member-row .row-action {
  grid-column: 2;
  grid-row: 1;
}

.dynamic-row label {
  margin-bottom: 0;
}

.card-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.data-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px;
  border: 1px solid rgba(207, 222, 230, 0.95);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(20, 32, 51, 0.05);
}

.data-card h3 {
  margin: 0;
  font-size: 13px;
}

.data-card:hover {
  border-color: #b6d1dc;
  box-shadow: 0 8px 18px rgba(20, 32, 51, 0.08);
}

.entry-panel {
  border-top: 3px solid var(--accent);
}

.workspace .panel {
  border-top: 3px solid var(--teal);
}

#admin-page .panel:nth-child(odd) {
  border-top: 3px solid var(--accent);
}

#admin-page .panel:nth-child(even) {
  border-top: 3px solid var(--teal);
}

#user-page .panel {
  border-top: 3px solid var(--brand-bright);
}

.form-note,
.status-message {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

#points-page .layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

#points-page .points-ledger-layout {
  display: block;
  width: 100%;
}

#points-page .points-ledger-layout .workspace,
#points-page .points-ledger-layout .workspace > .panel {
  width: 100%;
}

#points-page .points-entry-popup.is-collapsed {
  display: none;
}

#points-page .points-entry-popup.is-popup-open {
  position: fixed;
  top: 76px;
  left: 50%;
  z-index: 30;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 116px);
  overflow: auto;
  transform: translateX(-50%);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28);
}

#points-page .panel {
  padding: 8px;
}

#points-page .panel-title {
  margin-bottom: 6px;
}

#points-page .panel-title h2 {
  font-size: 14px;
}

#points-page label {
  margin-bottom: 5px;
  font-size: 10px;
}

#points-page .form-control {
  min-height: 28px;
  margin-top: 2px;
  padding: 3px 6px;
  font-size: 11px;
}

#points-page .segmented-control {
  margin-bottom: 6px;
  padding: 2px;
}

#points-page .segmented-control span {
  min-height: 26px;
  font-size: 11px;
}

#points-page .traveler-entry-list {
  gap: 5px;
  margin-bottom: 6px;
}

#points-page .traveler-entry-row {
  padding: 5px;
}

#points-page .traveler-entry-row h3 {
  font-size: 10px;
}

#points-page .traveler-entry-row .form-control {
  min-height: 24px;
  padding: 2px 4px;
  font-size: 10px;
}

#points-page .primary-action,
#points-page .ghost-action {
  min-height: 28px;
  font-size: 11px;
}

#points-page .summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

#points-page .points-toolbar {
  grid-template-columns: minmax(150px, 220px) max-content;
  align-items: end;
}

#points-page .points-toolbar label {
  margin-bottom: 0;
}

#points-page .points-toolbar .ghost-action {
  align-self: end;
  min-width: 94px;
  min-height: 28px;
  padding: 0 6px;
  font-size: 10px;
}

#points-page .program-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
}

#points-page .summary-card {
  min-height: 52px;
  padding: 6px;
}

#points-page .summary-card span {
  font-size: 8px;
}

#points-page .summary-card strong {
  margin-top: 4px;
  font-size: 14px;
}

#points-page .ledger-table {
  min-width: 760px;
}

#points-page .ledger-table th:nth-child(1),
#points-page .ledger-table td:nth-child(1) {
  width: 13%;
}

#points-page .ledger-table th:nth-child(2),
#points-page .ledger-table td:nth-child(2) {
  width: 22%;
}

#points-page .ledger-table th:nth-child(3),
#points-page .ledger-table td:nth-child(3) {
  width: 10%;
}

#points-page .ledger-table th:nth-child(4),
#points-page .ledger-table td:nth-child(4) {
  width: 8%;
}

#points-page .ledger-table th:nth-child(n+5),
#points-page .ledger-table td:nth-child(n+5) {
  width: 8.2%;
}

#points-page .ledger-table th,
#points-page .ledger-table td {
  padding: 3px 2px;
  font-size: 9px;
}

#points-page .ledger-table thead th,
#points-page .ledger-table small {
  font-size: 8px;
}

#points-page .icon-action {
  width: 18px;
  height: 18px;
  min-height: 18px;
  font-size: 10px;
}

#home-page .layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

#home-page .home-ledger-layout {
  display: block;
  width: 100%;
}

#home-page .home-ledger-layout .workspace,
#home-page .home-ledger-layout .workspace > .panel {
  width: 100%;
}

#home-page .cruise-entry-popup.is-collapsed {
  display: none;
}

#home-page .cruise-entry-popup.is-popup-open {
  position: fixed;
  top: 76px;
  left: 50%;
  z-index: 30;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 116px);
  overflow: auto;
  transform: translateX(-50%);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28);
}

#home-page .panel {
  padding: 8px;
}

#home-page .panel-title {
  margin-bottom: 6px;
}

#home-page .panel-title h2 {
  font-size: 14px;
}

#home-page label {
  margin-bottom: 5px;
  font-size: 10px;
}

#home-page .form-control {
  min-height: 28px;
  margin-top: 2px;
  padding: 3px 6px;
  font-size: 11px;
}

#home-page textarea.form-control {
  min-height: 42px;
}

#home-page .money-section,
#home-page .money-row,
#home-page .money-grid,
#home-page .two-col {
  gap: 5px;
}

#home-page .money-section label,
#home-page .money-grid label {
  margin-bottom: 4px;
  font-size: 9px;
}

#home-page .money-section .form-control,
#home-page .money-grid .form-control {
  min-height: 26px;
  padding: 2px 5px;
  font-size: 10px;
}

#home-page .primary-action,
#home-page .ghost-action {
  min-height: 28px;
  font-size: 11px;
}

#home-page .summary-grid {
  gap: 6px;
  margin-bottom: 6px;
}

#home-page .summary-card {
  min-height: 54px;
  padding: 6px;
}

#home-page .summary-card span {
  font-size: 8px;
}

#home-page .summary-card strong {
  margin-top: 4px;
  font-size: 14px;
}

#home-page .ledger-table {
  min-width: 620px;
}

#home-page .ledger-table th:nth-child(1),
#home-page .ledger-table td:nth-child(1) {
  width: 26%;
}

#home-page .ledger-table th:nth-child(2),
#home-page .ledger-table td:nth-child(2) {
  width: 11%;
}

#home-page .ledger-table th:nth-child(3),
#home-page .ledger-table td:nth-child(3) {
  width: 4%;
}

#home-page .ledger-table th:nth-child(4),
#home-page .ledger-table td:nth-child(4) {
  width: 10%;
}

#home-page .ledger-table th:nth-child(n+5),
#home-page .ledger-table td:nth-child(n+5) {
  width: 12.25%;
}

#home-page .ledger-table th,
#home-page .ledger-table td {
  padding: 3px 2px;
  font-size: 9px;
}

#home-page .ledger-table thead th,
#home-page .ledger-table small {
  font-size: 8px;
}

#home-page .icon-action {
  width: 18px;
  height: 18px;
  min-height: 18px;
  font-size: 10px;
}

.status-message {
  margin: 10px 0 0;
  font-weight: 800;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.48);
}

.confirm-dialog {
  width: min(340px, 100%);
  padding: 14px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.confirm-dialog h2 {
  margin: 0 0 6px;
  font-size: 16px;
}

.confirm-dialog p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.member-field-grid {
  display: grid;
  gap: 6px;
}

.inline-delete-form {
  display: inline-flex;
  margin: 0;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border-top: 1px solid rgba(207, 222, 230, 0.86);
  background: rgba(248, 252, 253, 0.96);
  box-shadow: 0 -10px 24px rgba(20, 32, 51, 0.10);
  backdrop-filter: blur(10px);
}

.nav-button {
  border: 1px solid #cbdce5;
  background: #fff;
  color: #526479;
  display: grid;
  place-items: center;
  text-decoration: none;
}

.nav-button.is-active {
  border-color: var(--brand-bright);
  background: linear-gradient(135deg, var(--brand), var(--teal));
  color: #fff;
  box-shadow: 0 8px 16px rgba(16, 68, 111, 0.18);
}

.account-menu a {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.account-menu a:hover,
.account-menu a:focus {
  background: #e8f4fb;
  outline: 0;
}

.auth-page {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(10, 47, 85, .92), rgba(20, 97, 141, .74), rgba(15, 138, 146, .42)),
    url("../login-casino-cruise.png") center / cover no-repeat fixed;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 460px) 1fr;
  padding: 24px;
}

.auth-panel {
  align-self: center;
  max-width: 440px;
}

.brand-lockup {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.brand-lockup h1 {
  margin: 0 0 3px;
  color: #0f3554;
  font-size: 24px;
}

.brand-lockup p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 16px 0;
  padding: 3px;
  border: 1px solid #cbdce5;
  border-radius: 8px;
  background: var(--soft);
}

.tab {
  display: grid;
  min-height: 32px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.tab.is-active {
  background: linear-gradient(135deg, var(--brand), var(--teal));
  color: #fff;
}

.auth-form,
.forgot-box form {
  display: grid;
  gap: 10px;
}

.auth-form button,
.forgot-box button {
  margin-top: 2px;
}

.forgot-box {
  margin-top: 14px;
}

.notice {
  margin: 10px 0;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.notice-error {
  border: 1px solid #efcaca;
  background: #fff1f2;
  color: var(--bad);
}

.notice-success {
  border: 1px solid #bbebd2;
  background: #eefbf4;
  color: var(--good);
}

.activity-list {
  display: grid;
  gap: 8px;
}

.activity-item {
  display: grid;
  grid-template-columns: 170px 110px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(207, 222, 230, 0.95);
  border-radius: 8px;
  background: #fff;
}

.activity-item time,
.activity-item span {
  color: var(--muted);
  font-size: 12px;
}

.server-footer {
  max-width: 1220px;
  margin: 12px auto 0;
  padding: 0 4px 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 620px) {
  .auth-shell {
    display: block;
    padding: 10px;
  }

  .activity-item {
    grid-template-columns: 1fr;
  }
}

.offline-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.offline-card {
  max-width: 420px;
  text-align: center;
}

.offline-card .brand-mark {
  margin: 0 auto 16px;
}

@media (max-width: 980px) {
  .layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 8px 8px 78px;
  }

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

  .settings-grid label {
    grid-column: 1 / -1;
  }

  .app-header h1 {
    font-size: 19px;
  }

  .app-header p {
    font-size: 12px;
  }

  .summary-grid,
  .money-grid {
    grid-template-columns: 1fr;
  }

  .ledger-table {
    min-width: 680px;
  }

  .app-header {
    gap: 9px;
    padding: 9px;
  }

  .header-nav-icon,
  .account-button {
    width: 40px;
    height: 40px;
  }
}

@media print {
  @page {
    margin: 0.35in;
  }

  body {
    background: #fff;
    color: #111827;
  }

  .app-shell {
    min-height: 0;
    padding: 0;
  }

  .app-header,
  .bottom-nav,
  .entry-panel,
  .account-menu,
  .points-toolbar,
  .inline-actions,
  .icon-action,
  .print-action {
    display: none !important;
  }

  body.print-mode .page {
    display: none !important;
    max-width: none;
  }

  body.print-home #home-page,
  body.print-points #points-page {
    display: block !important;
  }

  body.print-home #home-page .layout,
  body.print-points #points-page .layout {
    display: block;
  }

  body.print-home #home-page .workspace,
  body.print-points #points-page .workspace {
    display: block;
  }

  .panel {
    padding: 0;
    border: 0;
    background: #fff;
    box-shadow: none;
  }

  .panel-title {
    margin-bottom: 10px;
    border-bottom: 2px solid #111827;
    padding-bottom: 5px;
  }

  .panel-title h2 {
    color: #111827;
    font-size: 16px;
  }

  .summary-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
  }

  .summary-card {
    min-height: 0;
    padding: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    box-shadow: none;
  }

  .summary-card::before {
    display: none;
  }

  .summary-card strong {
    color: #111827;
    font-size: 13px;
  }

  .summary-card span,
  .record-count,
  .summary-meta,
  .level-meta {
    color: #475569;
  }

  .table-wrap {
    overflow: visible;
  }

  .ledger-table {
    width: 100%;
    min-width: 0 !important;
    table-layout: fixed;
  }

  .ledger-table th,
  .ledger-table td {
    border-color: #cbd5e1;
    color: #111827;
    font-size: 8px !important;
    padding: 3px 2px !important;
  }

  .ledger-table thead th {
    color: #334155;
    font-size: 8px !important;
  }

  .ledger-table strong,
  .ledger-table small {
    white-space: normal;
  }

  .empty-state {
    min-height: 40px;
    border-color: #cbd5e1;
    background: #fff;
    color: #475569;
  }
}
