:root {
  --bg: #f3f6f8;
  --panel: #ffffff;
  --panel-2: #f8fafb;
  --ink: #1d2730;
  --muted: #637381;
  --line: #d9e2e7;
  --brand: #1677ff;
  --brand-dark: #0f5ec7;
  --green: #16834b;
  --red: #c2413d;
  --amber: #b7791f;
  --blue-soft: #eaf3ff;
  --radius: 6px;
  --shadow: 0 14px 36px rgba(28, 39, 48, 0.08);
  font-family:
    "Microsoft JhengHei", "Microsoft YaHei", "PingFang TC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 12px;
  background: #172231;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--brand);
  font-size: 20px;
  font-weight: 800;
}

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

.brand span,
.side-card span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-section {
  margin: 12px 8px 4px;
  color: rgba(255, 255, 255, 0.46);
  font-size: 12px;
}

.nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

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

.nav small {
  color: inherit;
  opacity: 0.72;
}

.side-card {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
}

.side-card strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.crumb {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.top-actions,
.toolbar,
.filters,
.tabs,
menu {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-panel {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.cloud-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9ca3af;
}

.cloud-dot.online {
  background: var(--green);
}

.cloud-dot.offline {
  background: var(--red);
}

.cloud-dot.local {
  background: var(--amber);
}

.link-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
}

.link-btn:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.btn,
.icon-btn,
.tab {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}

.btn {
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.btn.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.btn.primary:hover {
  background: var(--brand-dark);
}

.btn.ghost:hover,
.tab:hover {
  background: var(--panel-2);
}

.dialog-note {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-dialog {
  width: min(420px, calc(100vw - 28px));
}

.form-error {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--red);
  font-size: 13px;
}

.btn.danger {
  border-color: #ffd4d1;
  color: var(--red);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 24px;
}

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

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

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

.card {
  padding: 16px;
}

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

.card strong {
  display: block;
  margin: 8px 0;
  font-size: 28px;
  line-height: 1;
}

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

.panel {
  min-width: 0;
  padding: 14px;
}

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

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

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

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf3f8;
  color: #314150;
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #f7fbff;
}

.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f5;
  color: #485766;
  font-size: 12px;
  font-weight: 700;
}

.badge.green {
  background: #e8f6ee;
  color: var(--green);
}

.badge.red {
  background: #fdecea;
  color: var(--red);
}

.badge.amber {
  background: #fff4df;
  color: var(--amber);
}

.badge.blue {
  background: var(--blue-soft);
  color: var(--brand-dark);
}

.tabs {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.tab {
  min-height: 30px;
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
}

.tab.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.filters {
  margin-bottom: 12px;
}

input,
select,
textarea {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #bdc9d2;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 82px;
  padding-top: 8px;
  resize: vertical;
}

.filters input,
.filters select {
  width: 170px;
}

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

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

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

.room-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.room-card header,
.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.room-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 12px;
  margin: 12px 0 0;
}

.room-card dt {
  color: var(--muted);
}

.room-card dd {
  margin: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.chip {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f5;
  font-size: 12px;
}

.upload-box {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 16px;
  border: 1px dashed #8eb5d8;
  border-radius: var(--radius);
  background: #edf6ff;
  color: var(--brand-dark);
  text-align: center;
}

.upload-box input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-box strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.receipt {
  max-width: 540px;
  margin: 0 auto;
  padding: 24px;
  border: 1px solid #111;
  background: #fff;
  color: #111;
}

.receipt h2 {
  text-align: center;
  text-decoration: underline;
  font-size: 24px;
}

.receipt .line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0;
}

.receipt table {
  min-width: 0;
  border: 1px solid #111;
}

.receipt td {
  border: 1px solid #111;
}

.timeline {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

dialog {
  width: min(780px, calc(100vw - 28px));
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

dialog::backdrop {
  background: rgba(20, 31, 42, 0.48);
}

.dialog {
  padding: 16px;
}

.dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

menu {
  justify-content: flex-end;
  margin: 16px 0 0;
  padding: 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #172231;
  color: #fff;
  opacity: 0;
  transform: translateY(12px);
  transition: 0.18s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .brand div:last-child,
  .nav button span,
  .nav-section,
  .side-card {
    display: none;
  }

  .brand,
  .nav button {
    justify-content: center;
  }

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

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

@media (max-width: 720px) {
  .app {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 4;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }

  .nav {
    display: flex;
  }

  .nav button {
    width: 42px;
  }

  .main {
    padding: 14px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .top-actions,
  .toolbar {
    width: 100%;
  }

  .btn {
    flex: 1;
  }
}

/* Fangdongliqi-inspired dashboard skin */
:root {
  --bg: #f0f0f0;
  --panel: #fff;
  --panel-2: #f5f5f5;
  --ink: #282c33;
  --muted: #7f8792;
  --line: #e8e8e8;
  --brand: #5b8eea;
  --brand-dark: #4077d6;
  --green: #57d85a;
  --red: #ff4d5e;
  --amber: #f5b940;
  --radius: 5px;
  --shadow: none;
}

.app {
  grid-template-columns: 164px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  gap: 0;
  padding: 0;
  background: #30313a;
}

.brand {
  height: 60px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: transparent;
  font-size: 21px;
}

.brand strong {
  font-size: 18px;
}

.brand span,
.nav-section,
.side-card {
  display: none;
}

.nav {
  display: block;
}

.nav button {
  justify-content: flex-start;
  gap: 16px;
  height: 60px;
  padding: 0 14px;
  border-radius: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  color: #fff;
  font-weight: 700;
}

.nav button:hover {
  background: #3a3b45;
}

.nav button.active {
  background: #5b8eea;
}

.nav .nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  min-width: 22px;
  color: #fff;
  font-size: 18px;
  opacity: 1;
}

.nav button span {
  font-size: 14px;
}

.main {
  padding: 18px 20px;
}

.topbar {
  display: none;
}

.topbar h1,
.crumb {
  display: none;
}

.top-actions .btn {
  border-color: transparent;
}

.panel,
.card,
.room-card {
  border: 0;
  border-radius: var(--radius);
  background: #fff;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 2.15fr 2.15fr 0.84fr 1.02fr;
  grid-template-areas:
    "alerts quick recruit reminder"
    "finance finance asset reminder"
    "occupancy arrears income reminder";
  gap: 10px;
}

.summary-panel {
  min-height: 138px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: #fff;
}

.alert-panel {
  grid-area: alerts;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 42px;
}

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

.stat-line {
  display: flex;
  align-items: center;
  gap: 22px;
}

.stat-line strong {
  display: block;
  color: var(--red);
  font-size: 20px;
  line-height: 1;
  text-align: center;
}

.stat-line small {
  display: block;
  margin-top: 8px;
  color: #111827;
  font-weight: 700;
}

.round-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  color: #fff;
  font-size: 26px;
  font-weight: 700;
}

.round-icon.red {
  background: #ff4d63;
}

.round-icon.orange {
  background: #ff9200;
}

.round-icon.amber {
  background: #f4c64f;
}

.round-icon.blue {
  background: #88aaf0;
}

.quick-icon {
  display: grid;
  justify-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: #222;
  font-weight: 700;
}

.quick-icon span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #4d8ee6;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}

.recruit-card {
  grid-area: recruit;
  display: grid;
  place-items: center;
  align-content: center;
  border: 0;
  border-radius: var(--radius);
  background: #ff7a37;
  color: #fff;
}

.recruit-card span {
  font-size: 62px;
  line-height: 0.8;
}

.recruit-card strong {
  font-size: 34px;
}

.finance-panel {
  grid-area: finance;
  min-height: 405px;
  padding: 16px 24px;
}

.asset-panel {
  grid-area: asset;
  min-height: 405px;
  padding: 16px 28px;
}

.reminder-panel {
  grid-area: reminder;
  min-height: 405px;
  padding: 20px;
  text-align: center;
}

.reminder-panel .panel-head {
  flex-direction: row;
}

.mute-icon {
  margin: 70px auto 24px;
  color: #222;
  font-size: 34px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #333;
  font-size: 13px;
}

.dot {
  width: 10px;
  height: 10px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.dot.red,
.line.red {
  color: #ff4d5e;
  stroke: #ff4d5e;
}

.dot.green,
.line.green {
  color: #72d475;
  stroke: #72d475;
}

.dot.blue,
.line.blue {
  color: #75a4f6;
  stroke: #75a4f6;
}

.chart-wrap {
  width: 100%;
  overflow: hidden;
}

.chart-wrap svg {
  display: block;
  width: 100%;
  min-height: 310px;
}

.grid-line {
  stroke: #cfcfcf;
  stroke-width: 1;
}

.axis {
  fill: #555;
  font-size: 12px;
}

.line {
  fill: none;
  stroke-width: 2;
}

.asset-panel h2 {
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 500;
}

.eye {
  color: #5b8eea;
  font-size: 16px;
}

.asset-row {
  margin: 16px 0 22px;
}

.asset-row div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #6b7280;
}

.asset-row em {
  color: #1f2937;
  font-style: normal;
}

.asset-row .red {
  color: #ff3348;
}

.asset-row .green {
  color: #54d856;
}

.asset-row .blue {
  color: #667085;
}

.bar {
  height: 28px;
  margin-top: 6px;
  border-radius: 4px;
  background: #f1f1f1;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.bar i.red {
  background: #ff3348;
}

.bar i.green {
  background: #54d856;
}

.bar i.dark {
  background: #1f2937;
}

.bar i.blue,
.bar i.gray {
  background: #e6e6e6;
}

.donut-panel {
  min-height: 280px;
  padding: 18px 24px;
}

.donut-panel:nth-last-child(3) {
  grid-area: occupancy;
}

.donut-panel:nth-last-child(2) {
  grid-area: arrears;
}

.donut-panel:nth-last-child(1) {
  grid-area: income;
}

.donut-head {
  display: grid;
  gap: 8px;
  width: 108px;
  color: #333;
  font-size: 13px;
}

.legend-box {
  display: inline-block;
  width: 24px;
  height: 14px;
  margin-right: 7px;
  border-radius: 3px;
  vertical-align: -2px;
}

.legend-box.gray {
  background: #ddd;
}

.donut-panel h2 {
  margin-top: -28px;
  text-align: center;
  font-size: 22px;
}

.donut-layout {
  display: grid;
  grid-template-columns: 1fr 150px 1fr;
  align-items: center;
  justify-items: center;
  margin-top: 32px;
}

.donut {
  display: grid;
  place-items: center;
  width: 138px;
  height: 138px;
  border-radius: 50%;
  background: conic-gradient(var(--color) calc(var(--value) * 1%), #dedede 0);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  width: 102px;
  height: 102px;
  border-radius: 50%;
  background: #fff;
}

.donut strong {
  z-index: 1;
  color: #333;
}

.donut-label {
  color: #c8cdd3;
  font-size: 13px;
}

.donut-label.right {
  color: #75a4f6;
}

.arrears .donut-label.right {
  color: #ff7a45;
}

@media (max-width: 1280px) {
  .dashboard-shell {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "alerts quick"
      "recruit reminder"
      "finance finance"
      "asset reminder"
      "occupancy arrears"
      "income income";
  }
}

@media (max-width: 780px) {
  .app {
    display: block;
  }

  .dashboard-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "alerts"
      "quick"
      "recruit"
      "finance"
      "asset"
      "reminder"
      "occupancy"
      "arrears"
      "income";
  }

  .alert-panel,
  .quick-panel {
    grid-template-columns: 1fr 1fr;
  }
}
