:root {
  --bg: #0e1116;
  --surface: #161b24;
  --surface2: #1d2430;
  --border: #2a3342;
  --text: #e8ecf3;
  --muted: #8b96a8;
  --accent: #4fc3a1;
  --accent-dim: rgba(79, 195, 161, .12);
  --red: #ef6a6a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: #ef6a6a; margin-top: 10px; font-size: 14px; }

/* ---------- login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 36px 32px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px;
  text-align: center;
}
.login-card h1 { font-size: 26px; }

input, select, textarea {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); padding: 10px 12px; font-size: 15px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 60px; }

.btn {
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 16px; font-size: 14px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b1210; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger:hover { border-color: #ef6a6a; color: #ef6a6a; }

/* ---------- header ---------- */
header { border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.header-inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.logo { font-size: 18px; font-weight: 700; color: var(--text); text-decoration: none; }
.rates { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.rate-chip {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 20px;
  padding: 3px 12px; font-size: 13px; color: var(--muted);
}
.rate-chip b { color: var(--text); font-weight: 600; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

/* ---------- dashboard ---------- */
.summary-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px;
}
.stat .label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.stat .value { font-size: 20px; font-weight: 700; }
.stat .value.green { color: var(--accent); }

.section-head { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 14px; }
.section-head h2 { font-size: 19px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; cursor: pointer; transition: border-color .15s, transform .15s;
  display: flex; flex-direction: column; gap: 10px;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { font-size: 16px; line-height: 1.35; }
.badge {
  display: inline-block; border-radius: 20px; padding: 2px 10px; font-size: 12px;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface2);
}
.badge.green { color: #6fdcb8; border-color: rgba(111,220,184,.35); background: rgba(111,220,184,.08); }
.badge.amber { color: #eec776; border-color: rgba(238,199,118,.35); background: rgba(238,199,118,.08); }
.badge.blue  { color: #7fb5f0; border-color: rgba(127,181,240,.35); background: rgba(127,181,240,.08); }
.badge.violet{ color: #c3a6f2; border-color: rgba(195,166,242,.35); background: rgba(195,166,242,.08); }
.badge.gray  { color: var(--muted); }
.card .row { display: flex; justify-content: space-between; font-size: 14px; }
.card .row .muted { font-size: 13px; }

/* ---------- property page ---------- */
.back-link { color: var(--muted); text-decoration: none; font-size: 14px; }
.back-link:hover { color: var(--accent); }
.prop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin: 14px 0 6px; }
.prop-head h2 { font-size: 22px; line-height: 1.3; }
.prop-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 18px; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 20px; }
.note-box {
  background: var(--accent-dim); border: 1px solid rgba(79,195,161,.3);
  border-radius: 12px; padding: 12px 16px; font-size: 14px; margin-bottom: 20px;
}

.block { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.block-head h3 { font-size: 16px; }

.tx-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount-pos { color: var(--accent); }
.amount-neg { color: #ef8f8f; }
.tx-flags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.tx-comment { color: var(--muted); font-size: 13px; margin-top: 2px; }
.row-actions { white-space: nowrap; }
.row-actions button { margin-left: 4px; }

.plan-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.plan-item:last-child { border-bottom: none; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5,8,12,.7); z-index: 20;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  width: 100%; max-width: 520px; padding: 22px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal form { display: flex; flex-direction: column; gap: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; }
.check-row label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.check-row input { width: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

@media (max-width: 640px) {
  .header-inner { padding: 10px 14px; }
  main { padding: 18px 14px 50px; }
  .field-row { grid-template-columns: 1fr; }
  .prop-head h2 { font-size: 19px; }
}
