
:root { font-family: Arial, Helvetica, sans-serif; color: #20242a; background: #f4f6f9; }
* { box-sizing: border-box; }
body { margin: 0; }
.container { width: min(1140px, calc(100% - 32px)); margin: 0 auto; }
.topbar { background: #fff; border-bottom: 1px solid #e3e7ec; margin-bottom: 28px; }
.topbar-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { color: #20242a; text-decoration: none; font-size: 20px; font-weight: 800; }
.user-menu { display: flex; align-items: center; gap: 12px; }
.user-menu span { display: grid; font-weight: 700; }
.user-menu small { color: #68707c; font-weight: 400; }
.page-header, .card-row, .project-meta, .actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-header { margin-bottom: 22px; }
h1, h2, h3 { margin-top: 0; }
.muted { color: #68707c; }
.eyebrow { display: block; font-size: 12px; font-weight: 800; letter-spacing: .12em; color: #1769e0; margin-bottom: 8px; }
.card { background: #fff; border: 1px solid #e2e7ed; border-radius: 15px; padding: 20px; box-shadow: 0 5px 18px rgba(30,40,55,.05); }
.hero { margin-bottom: 24px; padding: 30px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.project-card { color: inherit; text-decoration: none; }
.project-meta { color: #68707c; font-size: 13px; }
.summary-grid, .balance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.stat span, .balance-card span { display: block; color: #68707c; margin-bottom: 8px; }
.stat strong { font-size: 27px; }
.balance-card div { margin-top: 12px; }
.balance-result { border-top: 1px solid #edf0f3; padding-top: 14px; font-weight: 800; }
.badge { border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; }
.badge.open { background: #fff2cc; color: #765b00; }
.badge.closed { background: #dcf6e8; color: #14663d; }
.badge.inactive { background: #eceff3; color: #596170; }
.btn { display: inline-block; border: 1px solid #cbd2da; background: #fff; color: #20242a; border-radius: 9px; padding: 10px 14px; text-decoration: none; cursor: pointer; font-weight: 700; }
.btn.primary { background: #1769e0; color: #fff; border-color: #1769e0; }
.btn.danger { background: #b42318; color: #fff; border-color: #b42318; }
.btn.small { padding: 7px 10px; font-size: 12px; }
.form-card { display: grid; gap: 14px; max-width: 720px; }
label { display: grid; gap: 6px; font-weight: 700; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #cfd5dd; border-radius: 8px; font: inherit; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 28px 0; }
.two-columns .form-card { max-width: none; }
.table-wrap { overflow-x: auto; padding: 0; margin-bottom: 28px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px; border-bottom: 1px solid #edf0f3; white-space: nowrap; }
th { background: #f8fafc; color: #596170; }
td small { display: block; color: #68707c; margin-top: 4px; }
.positive { color: #167342; }
.negative { color: #b42318; }
.inactive-row { opacity: .55; background: #fafafa; }
.alert { padding: 12px 14px; border-radius: 9px; margin-bottom: 16px; }
.alert.success { background: #dcf6e8; color: #14663d; }
.alert.error { background: #fde5e2; color: #8a1c13; }
.alert.info { background: #e7f0ff; color: #164f9c; }
.close-form { margin-bottom: 40px; }
.empty { text-align: center; padding: 50px 20px; }
.login-shell { min-height: 65vh; display: grid; place-items: center; }
.login-card { width: min(430px, 100%); display: grid; gap: 15px; }
.actions { justify-content: flex-start; }
.actions form { margin: 0; }
@media (max-width: 800px) {
  .summary-grid, .balance-grid, .two-columns { grid-template-columns: 1fr; }
  .page-header, .topbar-inner { align-items: flex-start; flex-direction: column; }
  .topbar-inner { padding: 16px 0; }
  .user-menu { flex-wrap: wrap; }
}


.debt-list {
  display: grid;
  gap: 0;
  margin-bottom: 28px;
  padding: 0;
}
.debt-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #edf0f3;
}
.debt-line:last-child { border-bottom: 0; }
.debt-line span { color: #68707c; margin: 0 6px; }
.debt-value { font-size: 18px; color: #b42318; }
.settled-card { margin-bottom: 28px; color: #167342; }
.person-debt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.person-debt-card h3 {
  padding-bottom: 12px;
  border-bottom: 1px solid #edf0f3;
}
.person-section { margin-top: 18px; }
.section-title {
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: #68707c;
  margin-bottom: 10px;
}
.person-line, .person-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}
.person-total {
  border-top: 1px solid #edf0f3;
  margin-top: 6px;
  padding-top: 12px;
  font-weight: 800;
}
@media (max-width: 800px) {
  .person-debt-grid { grid-template-columns: 1fr; }
  .debt-line { align-items: flex-start; flex-direction: column; }
}


.password-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}
.password-card {
  max-width: none;
}


.project-main-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.delete-project {
  border-top: 1px solid #edf0f3;
  margin-top: 16px;
  padding-top: 12px;
}
.delete-project summary {
  color: #b42318;
  cursor: pointer;
  font-weight: 700;
}
.delete-project form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.delete-project .btn {
  justify-self: start;
}
