:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Noto Sans Thai", Tahoma, sans-serif;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #dbe4f0;
  --brand: #1f6feb;
  --brand-dark: #1557c0;
  --accent: #f59e0b;
  --danger: #e11d48;
  --ok: #16a34a;
  --warn: #f97316;
  --shadow: 0 18px 42px rgba(16, 24, 40, 0.10);
  --soft-blue: #eaf3ff;
  --soft-orange: #fff4e6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(31, 111, 235, 0.06), transparent 30vw),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 44%, #ffffff 100%);
  color: var(--ink);
  overflow-x: hidden;
}

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

button {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #2f80ed);
  color: white;
  cursor: pointer;
  font-weight: 700;
  padding: 10px 14px;
  box-shadow: 0 8px 18px rgba(31, 111, 235, 0.18);
}

button:hover {
  background: linear-gradient(135deg, var(--brand-dark), #1f6feb);
}

button.secondary {
  background: var(--soft-blue);
  color: var(--brand-dark);
  box-shadow: none;
}

button.light {
  background: #f3f7fb;
  color: var(--ink);
  box-shadow: none;
}

button.danger {
  background: #ffe4e9;
  color: var(--danger);
  box-shadow: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(16, 24, 40, 0.02);
}

input:focus,
select:focus,
textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.10);
  outline: none;
}

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

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  padding: 14px clamp(16px, 4vw, 36px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, #172033, #2563eb);
  color: white;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

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

.layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 36px);
}

.nav {
  align-self: start;
  position: sticky;
  top: 82px;
  display: grid;
  gap: 8px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  text-align: left;
}

.nav button.active {
  background: var(--brand);
  color: white;
}

.nav svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: currentColor;
}

.nav button[data-view="dashboard"] {
  --nav-icon: #f59e0b;
  --nav-soft: #fffbeb;
}

.nav button[data-view="rooms"] {
  --nav-icon: #14b8a6;
  --nav-soft: #ecfdf5;
}

.nav button[data-view="meters"] {
  --nav-icon: #8b5cf6;
  --nav-soft: #f5f3ff;
}

.nav button[data-view="bills"] {
  --nav-icon: #f97316;
  --nav-soft: #fff7ed;
}

.nav button[data-view="settings"] {
  --nav-icon: #2563eb;
  --nav-soft: #eff6ff;
}

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

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

.page-head h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 14px;
}

.card,
.stat,
.login-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-left: 4px solid var(--brand);
}

.stat strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

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

.stat.success {
  border-left-color: var(--ok);
}

.stat.soft {
  border-left-color: #94a3b8;
}

.stat.danger {
  border-left-color: var(--danger);
}

.card {
  padding: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.room-map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.floor-group {
  display: grid;
  gap: 10px;
}

.floor-group + .floor-group {
  margin-top: 18px;
}

.floor-group h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.room-tile {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.room-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.room-tile svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: currentColor;
  opacity: 0.72;
}

.room-tile strong,
.room-tile span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.room-tile strong {
  font-size: 20px;
}

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

.room-tile.occupied {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.room-tile.vacant {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.room-tile.repair {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.room-tile.occupied span,
.room-tile.vacant span,
.room-tile.repair span {
  color: currentColor;
  opacity: 0.78;
}

.room-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 10px;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-tabs button {
  background: #f1f5f9;
  color: var(--ink);
  padding: 8px 11px;
}

.filter-tabs button.active {
  background: var(--brand);
  color: white;
}

.follow-list {
  display: grid;
  gap: 10px;
}

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

.follow-item div {
  min-width: 0;
}

.follow-item strong,
.follow-item span {
  display: block;
  overflow-wrap: anywhere;
}

.follow-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.follow-item b {
  flex: 0 0 auto;
}

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

.room-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.room-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.room-card > div:first-child {
  min-width: 0;
}

.room-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.room-card strong,
.room-card p,
.room-card span {
  overflow-wrap: anywhere;
}

.room-card p {
  margin: 8px 0 4px;
  color: var(--ink);
  font-weight: 700;
}

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

.room-card.occupied {
  border-color: #bbf7d0;
}

.room-card.vacant {
  border-color: #bfdbfe;
}

.room-card.repair {
  border-color: #fecaca;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.form-grid .wide {
  grid-column: span 2;
}

.settings-stack {
  display: grid;
  gap: 14px;
}

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

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

.settings-save {
  justify-self: end;
}

.settings-section-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.add-room-details {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
}

.add-room-details summary {
  color: var(--brand);
  cursor: pointer;
  font-weight: 800;
}

.add-room-details[open] summary {
  margin-bottom: 10px;
}

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

.room-rent-grid label {
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr);
  padding: 8px;
}

.room-rent-grid span {
  color: var(--muted);
  font-weight: 700;
}

.room-add-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.delete-room-list {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.delete-room-list h3 {
  font-size: 14px;
  margin: 0 0 8px;
}

.delete-room-form {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.import-file-button {
  align-items: center;
  background: var(--brand);
  border: 0;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  min-height: 40px;
  padding: 0 14px;
}

.import-file-button input {
  display: none;
}

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

.quick-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin: 12px 0 16px;
}

.meter-toolbar {
  display: grid;
  grid-template-columns: 150px minmax(180px, 1fr) 140px 130px auto;
  gap: 12px;
  align-items: end;
}

.meter-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.meter-filters .active {
  background: var(--brand);
  color: white;
}

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

.meter-summary .stat {
  min-height: 74px;
  gap: 2px;
  padding: 10px 12px;
}

.meter-summary .stat strong {
  font-size: 22px;
}

.meter-summary .stat span,
.meter-summary .stat small {
  font-size: 12px;
  line-height: 1.25;
}

.meter-card {
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.meter-list {
  display: grid;
  min-width: 820px;
}

.meter-list-head,
.meter-row {
  display: grid;
  grid-template-columns: 80px repeat(4, minmax(78px, 1fr)) 78px minmax(150px, auto);
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
}

.meter-list-head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.meter-row {
  border-top: 1px solid var(--line);
}

.meter-row label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.meter-row input {
  min-width: 0;
}

.meter-row input[readonly],
.muted-input {
  background: #f8fafc;
  color: #94a3b8;
  cursor: default;
}

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

.meter-icon-button {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 8px;
}

.meter-icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #e2e8f0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.pill.ok {
  background: #dcfce7;
  color: #166534;
}

.pill.warn {
  background: #fef3c7;
  color: #92400e;
}

.pill.danger {
  background: #fee2e2;
  color: #991b1b;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.payment-form {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  gap: 6px;
  min-width: 190px;
}

.bill-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 260px);
  gap: 12px;
}

.bill-board {
  display: grid;
  gap: 16px;
}

.bill-room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.bill-room-tile {
  display: grid;
  gap: 5px;
  min-height: 98px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.bill-room-tile strong {
  font-size: 20px;
}

.bill-room-tile span {
  font-size: 15px;
  font-weight: 900;
}

.bill-room-tile small {
  color: var(--muted);
  font-weight: 800;
}

.bill-room-tile.paid {
  border-color: #86efac;
  background: #dcfce7;
}

.bill-room-tile.partial {
  border-color: #fde68a;
  background: #fef3c7;
}

.bill-room-tile.unpaid {
  border-color: #fecaca;
  background: #fee2e2;
}

.bill-room-tile.none {
  border-color: #e2e8f0;
  background: #f1f5f9;
  color: #64748b;
}

.bill-room-tile:disabled {
  opacity: 1;
}

.bill-detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.bill-detail-payment {
  min-width: 0;
}

.receipt-open-button {
  width: 100%;
  margin-top: 10px;
}

.bill-payment-actions {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.bill-detail-lines {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.bill-detail-lines div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}

.payment-history {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.payment-history h3 {
  margin: 0;
}

.payment-history-row {
  display: grid;
  grid-template-columns: 150px minmax(100px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.13), rgba(247, 250, 252, 0) 34%),
    linear-gradient(145deg, rgba(191, 164, 106, 0.09), rgba(247, 250, 252, 0) 38%),
    var(--bg);
}

.login-box {
  width: min(100%, 430px);
  padding: 28px;
}

.login-box h1 {
  margin: 24px 0 6px;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

.login-box p,
.hint,
.empty {
  color: var(--muted);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand strong {
  font-size: 18px;
  letter-spacing: 0.02em;
}

.login-brand span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
}

.login-submit {
  width: 100%;
  margin-top: 4px;
  padding: 13px 16px;
}

.login-note {
  display: grid;
  gap: 4px;
  margin-top: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--brand-dark);
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.login-note span {
  color: var(--brand-dark);
}

.forgot-text {
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.stack {
  display: grid;
  gap: 12px;
}

.notice {
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  background: #0f172a;
  color: white;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.42);
  padding: 18px;
}

.modal-panel {
  width: min(920px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-head h2,
.modal-head p {
  margin: 0;
}

.modal-head p {
  color: var(--muted);
  margin-top: 4px;
}

.close-x {
  width: 30px;
  height: 30px;
  min-height: 0;
  border-radius: 999px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

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

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.attachment-chip {
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
}

.attachment-chip.ok {
  background: #dcfce7;
  color: #166534;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

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

.bill-options .wide {
  grid-column: 1 / -1;
}

.checkbox-line {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 10px;
}

.checkbox-line input {
  flex: 0 0 auto;
  width: auto;
}

.extra-note {
  white-space: pre-wrap;
}

.meter-hint {
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 700;
  padding: 10px 12px;
}

.other-items {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.other-items-head,
.other-item-row {
  display: grid;
  gap: 10px;
}

.other-items-head {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 10px;
}

.other-item-row {
  grid-template-columns: minmax(0, 1fr) 130px auto;
  align-items: end;
  margin-top: 8px;
}

.empty.compact {
  margin: 0;
  padding: 6px 0 0;
}

.bill-panel {
  width: min(760px, 100%);
}

.capture-backdrop {
  place-items: stretch;
  background: #f8fafc;
  padding: 0;
}

.capture-backdrop .monthly-bill-panel {
  display: grid;
  align-content: start;
  position: relative;
  width: 100%;
  min-height: 100vh;
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 14px;
}

.monthly-bill-panel .modal-head {
  align-items: flex-start;
  margin-bottom: 14px;
}

.receipt-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 34px;
}

.receipt-print-mobile {
  display: none;
}

.monthly-bill-panel .close-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  font-size: 20px;
  z-index: 2;
}

.monthly-bill-panel .mobile-receipt {
  width: min(430px, 100%);
  margin: 0 auto;
}

.monthly-capture {
  border-color: #dbe7f3;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.receipt-copy {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 16px;
}

.receipt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.receipt-head strong,
.receipt-head span {
  display: block;
}

.receipt-head strong {
  font-size: 18px;
}

.receipt-head span,
.receipt-meta,
.receipt-note {
  color: var(--muted);
  font-size: 13px;
}

.receipt-head b {
  font-size: 18px;
}

.receipt-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin-top: 10px;
}

.receipt-items {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.receipt-items div,
.receipt-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.receipt-items div {
  border-bottom: 1px dashed var(--line);
  padding-bottom: 7px;
}

.receipt-items small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.receipt-total {
  align-items: center;
  margin-top: 12px;
  border-radius: 8px;
  background: #eff6ff;
  padding: 10px;
}

.receipt-total strong {
  font-size: 20px;
}

.refund-list {
  margin-top: 10px;
}

.final-total {
  background: #ecfdf3;
}

.receipt-note {
  margin: 12px 0 0;
  line-height: 1.45;
}

.receipt-sign {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
  font-size: 13px;
}

.print-sheet {
  display: none;
}

.print-frame {
  position: fixed;
  width: 0;
  height: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.cut-line {
  border-top: 1px dashed #94a3b8;
  color: var(--muted);
  font-size: 12px;
  margin: 10px 0;
  padding-top: 4px;
  text-align: center;
}

@media (max-width: 900px) {
  body {
    overflow-x: hidden;
  }

  .topbar {
    padding: 10px 14px;
  }

  .top-actions {
    display: none;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px 14px calc(92px + env(safe-area-inset-bottom));
  }

  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    border: 1px solid var(--line);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 16px 16px 0 0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    backdrop-filter: blur(12px);
  }

  .nav button {
    display: grid;
    place-items: center;
    gap: 3px;
    min-width: 0;
    border-radius: 12px;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
    padding: 7px 2px;
    white-space: normal;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
  }

  .nav button.active {
    background: #eff6ff;
    color: var(--brand);
  }

  .nav svg {
    width: 22px;
    height: 22px;
  }

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

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

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

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

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

  .meter-list-head {
    display: none;
  }

  .meter-row {
    grid-template-columns: 84px repeat(2, minmax(0, 1fr)) auto;
    align-items: end;
  }

  .meter-row .pill,
  .meter-actions {
    justify-self: start;
  }

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

@media (max-width: 560px) {
  .login-page {
    place-items: center;
    min-height: 100svh;
    padding: 16px;
  }

  .login-box {
    width: 100%;
    padding: 20px;
  }

  .login-box h1 {
    font-size: 28px;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    align-items: center;
    flex-direction: row;
  }

  .brand {
    min-width: 0;
  }

  .brand .hint {
    display: none;
  }

  .dashboard-stats {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 6px;
    max-width: none;
    width: 100%;
    margin: 0;
  }

  .stat {
    min-height: 82px;
    aspect-ratio: auto;
    grid-template-rows: auto 1fr auto;
    align-items: center;
    text-align: center;
    padding: 8px 4px;
    border-left-width: 0;
    border-top: 4px solid var(--brand);
  }

  .dashboard-stats .stat:nth-child(-n + 3) {
    grid-column: span 4;
  }

  .dashboard-stats .stat:nth-child(n + 4) {
    grid-column: span 3;
  }

  .stat strong {
    font-size: 17px;
    align-self: center;
    overflow-wrap: anywhere;
  }

  .stat span,
  .stat small {
    font-size: 10.5px;
    line-height: 1.25;
  }

  .stat.success {
    border-top-color: var(--ok);
  }

  .stat.soft {
    border-top-color: #94a3b8;
  }

  .stat.danger {
    border-top-color: var(--danger);
  }

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

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

  .settings-save {
    justify-self: stretch;
  }

  .settings-section-head {
    display: block;
  }

  .room-add-form {
    grid-template-columns: 1fr;
  }

  .delete-room-form {
    grid-template-columns: 1fr;
  }

  .backup-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .import-file-button {
    justify-content: center;
  }

  .room-rent-grid {
    grid-template-columns: 1fr;
  }

  .meter-toolbar {
    grid-template-columns: 1fr;
  }

  .meter-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .meter-summary .stat {
    min-height: 72px;
    padding: 8px 4px;
    text-align: center;
    border-left-width: 0;
    border-top: 4px solid var(--brand);
  }

  .meter-summary .stat strong {
    font-size: 16px;
  }

  .meter-summary .stat span,
  .meter-summary .stat small {
    font-size: 10.5px;
  }

  .quick-search {
    grid-template-columns: 1fr;
  }

  .bill-toolbar {
    grid-template-columns: 1fr;
  }

  .bill-room-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .bill-room-tile {
    min-height: 74px;
    padding: 7px;
  }

  .bill-room-tile strong {
    font-size: 16px;
  }

  .bill-room-tile span {
    font-size: 12px;
  }

  .bill-room-tile small {
    font-size: 10px;
  }

  .bill-payment-actions {
    grid-template-columns: 1fr;
  }

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

  .bill-detail-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .bill-detail-summary .stat {
    min-height: 72px;
    padding: 8px 4px;
    text-align: center;
  }

  .bill-detail-summary .stat strong {
    font-size: 16px;
  }

  .meter-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .meter-card {
    padding: 10px;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .meter-list {
    gap: 0;
    min-width: 0;
  }

  .meter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 8px;
    margin: 0 0 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
  }

  .meter-row > strong {
    order: 1;
    grid-column: 1;
    font-size: 18px;
    align-self: center;
  }

  .meter-row label {
    order: 3;
  }

  .meter-row .pill {
    order: 2;
    justify-self: end;
    justify-content: center;
    align-self: center;
  }

  .meter-actions {
    order: 4;
    grid-column: 1 / -1;
    width: 100%;
  }

  .meter-actions {
    justify-self: stretch;
  }

  .meter-icon-button {
    min-height: 36px;
  }

  .modal-backdrop {
    align-items: start;
    padding: 10px;
  }

  .modal-panel {
    max-height: calc(100svh - 20px);
    padding: 14px;
  }

  .modal-panel:has(.close-x) {
    position: relative;
    padding-top: 48px;
  }

  .modal-head {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-head .close-x {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
  }

  .receipt-head-actions {
    justify-content: flex-start;
    padding-right: 0;
  }

  .receipt-print-desktop {
    display: none;
  }

  .receipt-print-mobile {
    display: grid;
    margin-top: 10px;
  }

  .receipt-print-mobile button {
    align-items: center;
    display: inline-flex;
    gap: 8px;
    justify-content: center;
    justify-self: stretch;
  }

  .receipt-print-mobile svg {
    fill: currentColor;
    height: 18px;
    width: 18px;
  }

  .capture-backdrop .monthly-bill-panel {
    width: 100%;
    min-height: 100svh;
    max-height: none;
    padding-top: 48px;
  }

  .capture-backdrop {
    padding: 0;
  }

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

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .bill-options,
  .receipt-meta,
  .receipt-sign {
    grid-template-columns: 1fr;
  }

  .bill-panel {
    width: 100%;
  }

  .receipt-copy {
    padding: 12px;
  }

  .receipt-head strong,
  .receipt-head b {
    font-size: 16px;
  }

  .receipt-meta,
  .receipt-note,
  .receipt-sign {
    font-size: 12px;
  }

  .room-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .room-summary .stat {
    min-height: 74px;
  }

  .room-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .room-card {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 9px;
  }

  .room-card-top {
    align-items: flex-start;
    justify-content: space-between;
    gap: 5px;
  }

  .room-card strong {
    font-size: 15px;
  }

  .room-card p {
    margin: 6px 0 3px;
    font-size: 13px;
    line-height: 1.25;
  }

  .room-card span {
    font-size: 11px;
    line-height: 1.25;
  }

  .room-card .pill {
    padding: 3px 6px;
    font-size: 10px;
  }

  .room-card .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    width: 100%;
  }

  .room-card .row-actions button {
    padding: 7px 4px;
    font-size: 11px;
  }

  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  .room-toolbar {
    grid-template-columns: 1fr;
  }

  .filter-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .filter-tabs button {
    padding: 8px 6px;
    font-size: 12px;
  }

  .follow-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid .wide {
    grid-column: span 1;
  }
}

@media (max-width: 900px), (pointer: coarse) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden !important;
  }

  .topbar {
    align-items: center !important;
    flex-direction: row !important;
    padding: 10px 14px !important;
  }

  .top-actions {
    display: none !important;
  }

  .layout {
    display: block !important;
    padding: 14px 14px calc(96px + env(safe-area-inset-bottom)) !important;
  }

  .nav {
    align-items: stretch !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid var(--line) !important;
    border-bottom: 0 !important;
    border-radius: 18px 18px 0 0 !important;
    bottom: 0 !important;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.12) !important;
    box-sizing: border-box !important;
    display: grid !important;
    gap: 4px !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    left: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom)) !important;
    position: fixed !important;
    right: 0 !important;
    top: auto !important;
    transform: none !important;
    width: 100vw !important;
    z-index: 1000 !important;
  }

  .nav button {
    align-items: center !important;
    background: transparent !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    color: var(--muted) !important;
    display: grid !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    gap: 3px !important;
    justify-content: center !important;
    line-height: 1.15 !important;
    min-width: 0 !important;
    padding: 7px 2px !important;
    place-items: center !important;
    text-align: center !important;
    white-space: normal !important;
  }

  .nav button.active {
    background: var(--nav-soft, #eff6ff) !important;
    color: var(--nav-icon, var(--brand)) !important;
  }

  .nav svg {
    background: var(--nav-soft, #eff6ff) !important;
    border-radius: 12px !important;
    box-sizing: content-box !important;
    color: var(--nav-icon, var(--brand)) !important;
    height: 21px !important;
    padding: 5px !important;
    width: 21px !important;
  }

  .nav button.active svg {
    background: white !important;
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.10) !important;
  }
}

/* Racha app polish: visual layer only, no layout or data-flow changes. */
.topbar {
  border-bottom-color: rgba(219, 228, 240, 0.9);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.brand-mark {
  border-radius: 14px;
  background: linear-gradient(145deg, #0f4ca8, #2f80ed);
  box-shadow: 0 12px 22px rgba(31, 111, 235, 0.24);
}

.card,
.stat,
.login-box {
  border-color: rgba(219, 228, 240, 0.92);
  border-radius: 18px;
  box-shadow: 0 16px 36px rgba(16, 24, 40, 0.08);
}

.stat {
  border-left-width: 0;
  border-top: 5px solid var(--brand);
  background:
    linear-gradient(180deg, rgba(234, 243, 255, 0.65), rgba(255, 255, 255, 0) 58%),
    #ffffff;
}

.stat.success {
  border-top-color: #22c55e;
}

.stat.soft {
  border-top-color: #94a3b8;
}

.stat.danger {
  border-top-color: #f43f5e;
}

.stat strong {
  letter-spacing: -0.02em;
}

.page-head h1,
.section-head h2,
.card h2 {
  letter-spacing: -0.02em;
}

.notice {
  border: 1px solid #e8dfd0;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff8e8, #ffffff);
  color: #5f451b;
}

.filter-tabs button,
.quick-search button,
.row-actions button,
.backup-actions button,
.sync-actions button,
.settings-save,
.import-file-button {
  border-radius: 14px;
}

.room-tile {
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.05);
}

.room-tile.occupied {
  border-color: #86efac;
  background: linear-gradient(180deg, #dcfce7, #f0fdf4);
  color: #166534;
}

.room-tile.vacant {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #dbeafe, #eff6ff);
  color: #1d4ed8;
}

.room-tile.repair {
  border-color: #fda4af;
  background: linear-gradient(180deg, #ffe4e6, #fff1f2);
  color: #be123c;
}

.room-card {
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.05);
}

.room-card.occupied {
  border-color: #86efac;
}

.room-card.vacant {
  border-color: #93c5fd;
}

.meter-row,
.bill-detail-panel,
.receipt-card {
  border-radius: 16px;
}

@media (max-width: 900px), (pointer: coarse) {
  body {
    background:
      radial-gradient(circle at top left, rgba(31, 111, 235, 0.08), transparent 58vw),
      linear-gradient(180deg, #ffffff 0%, #f5f7fb 38%, #ffffff 100%) !important;
  }

  .topbar {
    background: linear-gradient(135deg, #0f4ca8, #1f6feb 62%, #38bdf8) !important;
    border: 0 !important;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 14px 30px rgba(31, 111, 235, 0.25);
    color: white;
    margin: 0 0 2px;
    min-height: 68px;
  }

  .brand {
    color: white;
  }

  .brand-mark {
    background: rgba(255, 255, 255, 0.18) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.26), 0 10px 22px rgba(15, 23, 42, 0.16);
  }

  .page-head {
    background: #ffffff;
    border: 1px solid rgba(219, 228, 240, 0.95);
    border-radius: 22px;
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.07);
    padding: 16px;
  }

  .page-head h1 {
    font-size: 26px;
  }

  .page-head p {
    font-size: 13px;
    line-height: 1.45;
  }

  .card,
  .stat,
  .login-box {
    border-radius: 18px;
  }

  .nav {
    background: rgba(255, 255, 255, 0.96) !important;
    border-radius: 24px 24px 0 0 !important;
    box-shadow: 0 -12px 30px rgba(16, 24, 40, 0.15) !important;
    padding-top: 9px !important;
  }

  .nav svg {
    border-radius: 14px !important;
  }

  .dashboard-stats {
    gap: 9px;
  }

  .stat {
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    border-top-width: 0;
    box-shadow: 0 12px 24px rgba(16, 24, 40, 0.07);
  }

  .stat strong {
    color: #0f4ca8;
  }

  .stat.success strong {
    color: #15803d;
  }

  .stat.danger strong {
    color: #be123c;
  }

  .room-map {
    gap: 9px;
  }

  .room-tile {
    align-content: start;
    aspect-ratio: auto;
    border-radius: 16px;
    box-shadow: 0 8px 18px rgba(16, 24, 40, 0.06);
    min-height: 86px;
    text-align: left;
  }

  .room-tile-head {
    justify-content: space-between;
  }

  .room-tile svg {
    display: block;
  }

  .room-tile strong {
    font-size: 20px;
  }

  .room-tile span {
    font-size: 12px;
    font-weight: 800;
  }

  .room-tile.occupied {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    color: white;
  }

  .room-tile.vacant {
    background: linear-gradient(145deg, #38bdf8, #1f6feb);
    color: white;
  }

  .room-tile.repair {
    background: linear-gradient(145deg, #fb7185, #e11d48);
    color: white;
  }

  .room-tile span {
    opacity: 0.9;
  }

  .bill-room-tile {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 12px 22px rgba(16, 24, 40, 0.08);
  }

  .bill-room-tile.paid {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    color: white;
  }

  .bill-room-tile.partial {
    background: linear-gradient(145deg, #facc15, #f97316);
    color: #422006;
  }

  .bill-room-tile.unpaid {
    background: linear-gradient(145deg, #fb7185, #e11d48);
    color: white;
  }

  .bill-room-tile.none {
    background: linear-gradient(145deg, #f1f5f9, #e2e8f0);
  }

  .bill-room-tile small {
    color: currentColor;
    opacity: 0.76;
  }

  .filter-tabs,
  .quick-search,
  .meter-toolbar,
  .room-toolbar {
    background: rgba(255, 255, 255, 0.72);
    border-radius: 18px;
  }
}

/* Racha warm app theme: calm cream base with charcoal controls. */
:root {
  --bg: #faf7f0;
  --ink: #242424;
  --muted: #716b61;
  --line: #e8dfd0;
  --brand: #2f2f2f;
  --brand-dark: #171717;
  --accent: #c8a96a;
  --soft-blue: #f3ead8;
}

body {
  background: #faf7f0;
}

button {
  background: var(--brand);
  box-shadow: none;
}

button:hover {
  background: var(--brand-dark);
}

button.secondary {
  background: #f3ead8;
  color: #5f451b;
}

.brand-mark {
  background: #2f2f2f;
  box-shadow: none;
}

.nav button[data-view="dashboard"],
.nav button[data-view="rooms"],
.nav button[data-view="meters"],
.nav button[data-view="bills"],
.nav button[data-view="settings"] {
  --nav-icon: #2f2f2f;
  --nav-soft: #f3ead8;
}

.stat strong {
  color: #2f2f2f;
}

.stat {
  border-top-color: #c8a96a;
}

.filter-tabs button.active {
  background: #2f2f2f;
}

@media (max-width: 900px), (pointer: coarse) {
  body {
    background: #faf7f0 !important;
  }

  .topbar {
    background: #2f2f2f !important;
    box-shadow: 0 12px 26px rgba(36, 36, 36, 0.18);
  }

  .brand-mark {
    background: rgba(255, 255, 255, 0.22) !important;
  }

  .page-head {
    background: #ffffff;
    box-shadow: 0 10px 22px rgba(16, 24, 40, 0.06);
  }

  .nav button.active {
    background: #f3ead8 !important;
    color: #2f2f2f !important;
  }

  .nav svg {
    background: #f3ead8 !important;
    color: #2f2f2f !important;
  }

  .room-tile.occupied {
    background: linear-gradient(180deg, #dcfce7, #f0fdf4);
    border: 1px solid #86efac;
    color: #166534;
  }

  .room-tile.vacant {
    background: linear-gradient(180deg, #fffdf8, #ffffff);
    border: 1px solid #e8dfd0;
    color: #5f451b;
  }

  .room-tile.repair {
    background: linear-gradient(180deg, #ffe4e6, #fff1f2);
    border: 1px solid #fda4af;
    color: #be123c;
  }

  .bill-room-tile.paid {
    background: #22c55e;
    color: white;
  }

  .bill-room-tile.partial {
    background: #facc15;
    color: #422006;
  }

  .bill-room-tile.unpaid {
    background: #f43f5e;
    color: white;
  }
}

/* Racha lively app theme: desktop and mobile color polish. */
:root {
  --bg: #fff8f1;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #6b7280;
  --line: #f0ded1;
  --brand: #ff7657;
  --brand-dark: #e95f42;
  --accent: #16b8a6;
  --soft-blue: #fff1e8;
  --ok: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 14px 34px rgba(93, 64, 46, 0.09);
}

body {
  background:
    radial-gradient(circle at top left, rgba(255, 214, 186, 0.5), transparent 360px),
    #fff8f1;
}

.topbar {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(240, 222, 209, 0.9);
  box-shadow: 0 12px 28px rgba(93, 64, 46, 0.08);
}

.brand-mark {
  background: linear-gradient(135deg, #ff7657, #ffaf65);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(255, 118, 87, 0.28);
}

.brand > div > div {
  color: var(--ink);
}

button {
  background: linear-gradient(135deg, #ff7657, #ff9f5f);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(255, 118, 87, 0.22);
}

button:hover {
  background: linear-gradient(135deg, #ef6749, #f58f4f);
}

button.secondary,
button.light {
  background: #fff1e8;
  color: #9a4b30;
  box-shadow: none;
}

button.danger {
  background: #fff0f0;
  color: #dc2626;
  box-shadow: none;
}

.card,
.stat,
.login-box,
.meter-card,
.follow-item,
.room-card {
  border-color: rgba(240, 222, 209, 0.95);
  border-radius: 14px;
  box-shadow: 0 14px 32px rgba(93, 64, 46, 0.08);
}

.card {
  background: rgba(255, 255, 255, 0.96);
}

.card h2,
.section-head h2,
.page-head h1,
.floor-group h3 {
  color: #172033;
}

.stat {
  position: relative;
  overflow: hidden;
  border-left: 0;
  border-top: 4px solid #ff7657;
  background: #ffffff;
}

.stat::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -28px;
  width: 86px;
  height: 86px;
  border-radius: 999px;
  background: rgba(255, 118, 87, 0.1);
}

.dashboard-stats .stat:nth-child(2),
.room-summary .stat:nth-child(2),
.meter-summary .stat:nth-child(2),
.bill-detail-summary .stat:nth-child(2) {
  border-top-color: #14b8a6;
}

.dashboard-stats .stat:nth-child(2)::after,
.room-summary .stat:nth-child(2)::after,
.meter-summary .stat:nth-child(2)::after,
.bill-detail-summary .stat:nth-child(2)::after {
  background: rgba(20, 184, 166, 0.1);
}

.dashboard-stats .stat:nth-child(3),
.room-summary .stat:nth-child(3),
.meter-summary .stat:nth-child(3),
.bill-detail-summary .stat:nth-child(3) {
  border-top-color: #8b5cf6;
}

.dashboard-stats .stat:nth-child(3)::after,
.room-summary .stat:nth-child(3)::after,
.meter-summary .stat:nth-child(3)::after,
.bill-detail-summary .stat:nth-child(3)::after {
  background: rgba(139, 92, 246, 0.1);
}

.dashboard-stats .stat:nth-child(4) {
  border-top-color: #f59e0b;
}

.dashboard-stats .stat:nth-child(4)::after {
  background: rgba(245, 158, 11, 0.12);
}

.stat strong {
  color: #172033;
}

.room-tile {
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(93, 64, 46, 0.07);
}

.room-tile.occupied {
  background: #ecfdf5;
  border-color: #86efac;
  color: #166534;
}

.room-tile.vacant {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.room-tile.repair {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.room-card.occupied {
  border-left: 5px solid #22c55e;
}

.room-card.vacant {
  border-left: 5px solid #fb923c;
}

.room-card.repair {
  border-left: 5px solid #f43f5e;
}

.filter-tabs button,
.quick-search button,
.row-actions button,
.backup-actions button,
.sync-actions button,
.import-file-button {
  border-radius: 12px;
}

.filter-tabs button {
  background: #ffffff;
  border: 1px solid #f0ded1;
  color: #5b6170;
  box-shadow: none;
}

.filter-tabs button.active {
  background: #ff7657;
  color: #ffffff;
}

.bill-room-tile {
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(93, 64, 46, 0.07);
}

.bill-room-tile.paid {
  background: #22c55e;
  color: #ffffff;
}

.bill-room-tile.partial {
  background: #fbbf24;
  color: #422006;
}

.bill-room-tile.unpaid {
  background: #fb7185;
  color: #ffffff;
}

.bill-room-tile.none {
  background: #f3f4f6;
  color: #64748b;
}

.nav button[data-view="dashboard"] {
  --nav-icon: #ff7657;
  --nav-soft: #fff1e8;
}

.nav button[data-view="rooms"] {
  --nav-icon: #14b8a6;
  --nav-soft: #ecfdf5;
}

.nav button[data-view="meters"] {
  --nav-icon: #8b5cf6;
  --nav-soft: #f5f3ff;
}

.nav button[data-view="bills"] {
  --nav-icon: #f59e0b;
  --nav-soft: #fffbeb;
}

.nav button[data-view="settings"] {
  --nav-icon: #3b82f6;
  --nav-soft: #eff6ff;
}

.nav button.active {
  background: var(--nav-soft);
  color: var(--nav-icon);
}

.nav svg {
  color: var(--nav-icon);
}

@media (max-width: 900px), (pointer: coarse) {
  body {
    background: #fff8f1 !important;
  }

  .topbar {
    background: #ffffff !important;
    border-color: rgba(240, 222, 209, 0.9) !important;
    box-shadow: 0 12px 28px rgba(93, 64, 46, 0.08) !important;
  }

  .brand-mark {
    background: linear-gradient(135deg, #ff7657, #ffaf65) !important;
  }

  .page-head {
    background: #ffffff;
    border: 1px solid rgba(240, 222, 209, 0.9);
    box-shadow: 0 10px 24px rgba(93, 64, 46, 0.07);
  }

  .nav {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: rgba(240, 222, 209, 0.9) !important;
  }

  .nav button.active {
    background: var(--nav-soft, #fff1e8) !important;
    color: var(--nav-icon, #ff7657) !important;
  }

  .nav svg {
    background: var(--nav-soft, #fff1e8) !important;
    color: var(--nav-icon, #ff7657) !important;
  }
}

/* Cleaner cards: keep the app colorful, but make content boxes calm and clear. */
.card,
.stat,
.login-box,
.meter-card,
.follow-item,
.room-card {
  background: rgba(255, 255, 255, 0.98);
  border-color: #efe5dc;
  box-shadow: 0 10px 26px rgba(58, 43, 33, 0.06);
}

.stat {
  border-top: 1px solid #efe5dc;
  overflow: visible;
}

.stat::after,
.dashboard-stats .stat:nth-child(2)::after,
.room-summary .stat:nth-child(2)::after,
.meter-summary .stat:nth-child(2)::after,
.bill-detail-summary .stat:nth-child(2)::after,
.dashboard-stats .stat:nth-child(3)::after,
.room-summary .stat:nth-child(3)::after,
.meter-summary .stat:nth-child(3)::after,
.bill-detail-summary .stat:nth-child(3)::after,
.dashboard-stats .stat:nth-child(4)::after {
  content: none;
  display: none;
}

.dashboard-stats .stat,
.room-summary .stat,
.meter-summary .stat,
.bill-detail-summary .stat {
  border-top-color: #efe5dc;
}

.card h2,
.section-head h2,
.page-head h1 {
  letter-spacing: 0;
}

/* Remove all decorative color strips from content boxes. */
.stat,
.stat.success,
.stat.soft,
.stat.danger,
.dashboard-stats .stat,
.room-summary .stat,
.meter-summary .stat,
.bill-detail-summary .stat,
.dashboard-stats .stat:nth-child(2),
.dashboard-stats .stat:nth-child(3),
.dashboard-stats .stat:nth-child(4),
.room-summary .stat:nth-child(2),
.room-summary .stat:nth-child(3),
.meter-summary .stat:nth-child(2),
.meter-summary .stat:nth-child(3),
.bill-detail-summary .stat:nth-child(2),
.bill-detail-summary .stat:nth-child(3) {
  border-top: 1px solid #efe5dc !important;
  border-left: 1px solid #efe5dc !important;
}

.room-card.occupied,
.room-card.vacant,
.room-card.repair {
  border-left: 1px solid #efe5dc !important;
}

/* Apricot + Teal trial: softer than orange, still bright and app-like. */
:root {
  --bg: #fff9f3;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #eee2d7;
  --brand: #f4a261;
  --brand-dark: #e78b45;
  --accent: #2a9d8f;
  --soft-blue: #fef0e3;
  --ok: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 10px 26px rgba(68, 52, 39, 0.06);
}

body {
  background:
    radial-gradient(circle at top left, rgba(42, 157, 143, 0.1), transparent 330px),
    #fff9f3;
}

.brand-mark {
  background: linear-gradient(135deg, #2a9d8f, #5ec7b7);
  box-shadow: 0 10px 22px rgba(42, 157, 143, 0.22);
}

button {
  background: linear-gradient(135deg, #f4a261, #f7b979);
  box-shadow: 0 10px 18px rgba(244, 162, 97, 0.2);
}

button:hover {
  background: linear-gradient(135deg, #e78b45, #f0a968);
}

button.secondary,
button.light {
  background: #eaf8f6;
  color: #14756a;
}

.filter-tabs button.active {
  background: #2a9d8f;
  color: #ffffff;
}

.room-tile.vacant {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.nav button[data-view="dashboard"] {
  --nav-icon: #f4a261;
  --nav-soft: #fff1e4;
}

.nav button[data-view="rooms"] {
  --nav-icon: #2a9d8f;
  --nav-soft: #eaf8f6;
}

.nav button[data-view="meters"] {
  --nav-icon: #7c6df0;
  --nav-soft: #f3f2ff;
}

.nav button[data-view="bills"] {
  --nav-icon: #e9a318;
  --nav-soft: #fff8df;
}

.nav button[data-view="settings"] {
  --nav-icon: #4078c8;
  --nav-soft: #eef5ff;
}

@media (max-width: 900px), (pointer: coarse) {
  body {
    background: #fff9f3 !important;
  }

  .brand-mark {
    background: linear-gradient(135deg, #2a9d8f, #5ec7b7) !important;
  }
}

/* Room list status color: make occupied rooms easier to scan. */
.room-card.occupied {
  background: #ecfdf5 !important;
  border-color: #bbf7d0 !important;
}

.room-card.occupied .pill {
  background: #dcfce7;
  color: #166534;
}

.room-card.vacant {
  background: #ffffff !important;
}

@media print {
  html,
  body {
    width: 210mm;
    height: 297mm;
    margin: 0;
    overflow: hidden;
  }

  body {
    background: white;
    position: relative;
  }

  body * {
    visibility: hidden !important;
  }

  .bill-backdrop,
  .bill-backdrop * {
    visibility: visible !important;
  }

  .bill-backdrop {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 210mm;
    height: 297mm;
    overflow: hidden;
    background: white;
    padding: 0;
  }

  .bill-panel {
    width: 100%;
    height: 100%;
    max-height: none;
    overflow: hidden;
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  .no-print,
  .mobile-receipt {
    display: none !important;
  }

  .print-sheet {
    display: grid;
    grid-template-rows: 135mm 6mm 135mm;
    width: 196mm;
    height: 276mm;
    overflow: hidden;
    margin: 0 auto;
  }

  .receipt-copy {
    visibility: visible !important;
    min-height: 0;
    height: 135mm;
    overflow: hidden;
    border: 1px solid #111827;
    box-shadow: none;
    break-inside: avoid;
    padding: 5mm;
    font-size: 10.5px;
  }

  .receipt-head {
    padding-bottom: 3mm;
  }

  .receipt-head strong,
  .receipt-head b {
    font-size: 14px;
  }

  .receipt-meta {
    gap: 2mm 5mm;
    margin-top: 3mm;
  }

  .receipt-items {
    gap: 2mm;
    margin-top: 3mm;
  }

  .receipt-items div {
    padding-bottom: 1.5mm;
  }

  .receipt-total {
    margin-top: 3mm;
    padding: 2mm;
  }

  .receipt-total strong {
    font-size: 14px;
  }

  .receipt-note {
    margin-top: 3mm;
    font-size: 9.5px;
  }

  .receipt-sign {
    margin-top: 5mm;
    font-size: 10px;
  }

  .cut-line {
    visibility: visible !important;
    margin: 0;
    height: 6mm;
    line-height: 5mm;
    padding-top: 0;
  }

  @page {
    size: A4 portrait;
    margin: 10mm 7mm;
  }
}
