/* 房東管理室 後台設計系統 — Claude Design：扁平、白底、細框、真圖示、字體放大 */
:root {
  --surface-0: #f6f6f4;   /* 頁面底 */
  --surface-1: #ffffff;   /* 卡片 */
  --surface-2: #f3f3f0;   /* 次要面 */
  --text: #1a1a19;
  --text-primary: #1a1a19;
  --text-secondary: #6b6b66;
  --text-muted: #9a9a92;
  --color-muted: #6b6b66;
  --border: rgba(20,20,15,.10);
  --border-strong: rgba(20,20,15,.18);

  --color-primary: #2c6ecb;  --color-primary-dark: #14498f;  --color-primary-light: #e8f0fb;
  --accent: #2c6ecb;         --accent-bg: #e8f0fb;           --accent-text: #14498f;
  --color-success: #3d8f5f;  --color-success-light: #e8f4ec; --success-text: #245c3b;
  --color-danger: #cc4b37;   --color-danger-light: #fbecea;  --danger-text: #9a3323;
  --color-warning: #b3771a;  --color-warning-light: #f9f0dd; --warning-text: #7a5010;

  --bg: #f6f6f4;
  --surface: #ffffff;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --radius: 10px;
  --radius-card: 16px;
  --shadow-card: none;
  --shadow-pop: 0 8px 30px rgba(20,20,15,.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
.ti { line-height: 1; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  background: var(--bg);
  margin: 0;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Login screen ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-0);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  padding: 40px 36px;
  border-radius: var(--radius-card);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-pop);
  width: 400px;
}
.login-brand {
  width: 54px; height: 54px; border-radius: 16px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; font-weight: 500; margin-bottom: 18px;
}
.login-card h1 { font-size: 23px; margin: 0 0 4px; font-weight: 500; letter-spacing: -.01em; }
.login-card p.sub { color: var(--text-secondary); font-size: 14px; margin: 0 0 26px; }
.field { margin-top: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 400; color: var(--text-secondary); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 13px 14px; border: 0.5px solid var(--border-strong); border-radius: var(--radius);
  font-size: 16px; background: var(--surface-1); color: var(--text-primary); font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0.5px solid var(--border-strong); background: var(--surface-1); color: var(--text-primary);
  border-radius: var(--radius); font-size: 15.5px; font-weight: 500;
  cursor: pointer; padding: 12px 20px; min-height: 46px; transition: transform .08s, background .12s, opacity .15s;
}
.btn .ti { font-size: 18px; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn-success { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.btn-danger { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-block { width: 100%; margin-top: 22px; }
.btn-ghost { background: var(--surface-1); color: var(--text-primary); border: 0.5px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }

.error-banner {
  margin-top: 14px; padding: 11px 13px; background: var(--color-danger-light); color: var(--danger-text);
  border-radius: var(--radius); font-size: 13.5px; display: none;
}
.hint-box { margin-top: 20px; padding: 14px; background: var(--surface-2); border-radius: var(--radius); font-size: 13px; color: var(--text-secondary); line-height: 1.8; }
.hint-box b { color: var(--text); }

/* ---------- App shell ---------- */
.topbar {
  background: var(--surface); padding: 14px 30px; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 0.5px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-left .brand-mark {
  width: 36px; height: 36px; border-radius: 11px; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 16px;
}
.topbar h1 { font-size: 18px; margin: 0; margin-right: 8px; font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.who-chip { font-size: 13px; color: var(--text-secondary); background: var(--surface-2); padding: 7px 13px; border-radius: 999px; }

.nav-tabs { display: flex; gap: 2px; margin-left: 12px; flex-wrap: wrap; }
.nav-tabs .nav-link {
  font-size: 14px; font-weight: 400; color: var(--text-secondary); text-decoration: none;
  padding: 8px 15px; border-radius: 999px; transition: background .15s, color .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav-tabs .nav-link .ti { font-size: 17px; }
.nav-tabs .nav-link:hover { background: var(--surface-2); }
.nav-tabs .nav-link.active { background: var(--accent-bg); color: var(--accent-text); }

.nav-badge {
  display: none; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--color-danger); color: #fff; font-size: 11px; font-weight: 600; line-height: 1;
}
.nav-badge.show { display: inline-flex; }

.page { max-width: 1200px; margin: 0 auto; padding: 26px 24px 70px; }

/* ---------- Forms / CRUD pages ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; margin: 0; font-weight: 500; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; }
.page-head h1 .ti { font-size: 26px; color: var(--text-secondary); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-actions .btn { margin-top: 0; width: auto; padding-left: 24px; padding-right: 24px; }
.select-input { width: 100%; padding: 13px 14px; border: 0.5px solid var(--border-strong); border-radius: var(--radius); font-size: 15.5px; background: var(--surface-1); color: var(--text-primary); font-family: inherit; }
.select-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

.overlay {
  position: fixed; inset: 0; background: rgba(20,20,15,.40); display: none; align-items: center; justify-content: center; z-index: 40; padding: 20px;
}
.overlay.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius-card); padding: 28px 30px; width: 100%; max-width: 560px; box-shadow: var(--shadow-pop); max-height: 88vh; overflow-y: auto; border: 0.5px solid var(--border); }
.modal h2 { font-size: 20px; margin: 0 0 20px; font-weight: 500; }

.mini-btn { border: 0.5px solid var(--border-strong); background: var(--surface-1); color: var(--text-primary); font-size: 13px; font-weight: 400; padding: 7px 13px; border-radius: var(--radius); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.mini-btn .ti { font-size: 15px; }
.mini-btn:hover { background: var(--surface-2); }
.mini-btn-primary { background: var(--accent-bg); color: var(--accent-text); border-color: transparent; }
.mini-btn-danger { background: var(--color-danger-light); color: var(--danger-text); border-color: transparent; }

.entity-card { border: 0.5px solid var(--border); border-radius: var(--radius-md); padding: 17px 19px; background: var(--surface-1); }
.entity-card + .entity-card { margin-top: 10px; }
.entity-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.entity-card .title { font-weight: 500; font-size: 16px; }
.entity-card .subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.entity-card .actions { display: flex; gap: 6px; flex-shrink: 0; }
.entity-card.is-archived { opacity: .6; }

/* ---------- Hero money banner ---------- */
.hero {
  background: var(--surface-1);
  color: var(--text-primary); border-radius: var(--radius-card); padding: 26px 28px; margin-bottom: 22px;
  border: 0.5px solid var(--border);
}
.hero-label { font-size: 14.5px; color: var(--text-secondary); font-weight: 400; margin-bottom: 6px; }
.hero-big { font-size: 42px; font-weight: 500; letter-spacing: -.02em; margin-bottom: 22px; line-height: 1.1; }
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.hero-stat { background: var(--surface-2); border-radius: var(--radius-md); padding: 15px 17px; }
.hero-stat .k { font-size: 12.5px; color: var(--text-secondary); font-weight: 400; margin-bottom: 5px; }
.hero-stat .v { font-size: 24px; font-weight: 500; }

/* ---------- Section cards ---------- */
.section { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-card); padding: 24px 26px; margin-bottom: 20px; box-shadow: var(--shadow-card); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.section-head h2 { font-size: 17.5px; margin: 0; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.section-head h2 .ti { font-size: 20px; color: var(--text-secondary); }
.section-head .count-pill { background: var(--color-warning-light); color: var(--warning-text); font-weight: 500; font-size: 12.5px; padding: 4px 11px; border-radius: 999px; }

/* ---------- Pending payment card grid ---------- */
.proof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 15px; }
.proof-card {
  border: 0.5px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--surface-1);
  display: flex; flex-direction: column;
}
.proof-thumb { height: 150px; background: var(--surface-2) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 12.5px; }
.proof-body { padding: 15px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.proof-name { font-weight: 500; font-size: 16px; }
.proof-amount { font-size: 22px; font-weight: 500; color: var(--accent-text); }
.proof-meta { font-size: 12.5px; color: var(--text-secondary); }
.proof-actions { display: flex; gap: 8px; padding: 0 15px 15px; }
.proof-actions .btn { flex: 1; padding: 10px; font-size: 14px; min-height: 42px; margin-top: 0; }

/* ---------- Status chips ---------- */
.chip { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.chip-UNPAID { background: var(--color-warning-light); color: var(--warning-text); }
.chip-OVERDUE { background: var(--color-danger-light); color: var(--danger-text); }
.chip-PENDING_REVIEW { background: var(--accent-bg); color: var(--accent-text); }
.chip-CONFIRMED { background: var(--color-success-light); color: var(--success-text); }
.chip-VOID { background: var(--surface-2); color: var(--text-muted); }
.chip-archived { background: var(--surface-2); color: var(--text-muted); }

/* ---------- Table ---------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data-table th { text-align: left; padding: 11px 13px; color: var(--text-secondary); font-size: 12.5px; font-weight: 400; border-bottom: 0.5px solid var(--border-strong); }
table.data-table td { padding: 14px 13px; border-bottom: 0.5px solid var(--border); }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--surface-2); }

.empty-state { text-align: center; padding: 40px 0; color: var(--text-muted); font-size: 14.5px; }
