/* Section: البيوت (P2: the houses; P4: their expenses and bills; P6: the house page's open tasks). The approved
   demo's household.css, plus the P2 notes panel. Colours come from the :root tokens. */

/* A due bill: the row opens the bill, the small «تم الدفع» button pays it. */
.hh-due {
  gap: 10px;
  padding-block: 8px;
  padding-inline-end: 10px;
}

.hh-due-link {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  align-self: stretch;
  color: inherit;
}

.hh-due .btn {
  flex-shrink: 0;
}

.hh-due-late {
  color: var(--late);
  font-weight: 800;
}

.hh-due-soon {
  color: var(--soon);
  font-weight: 800;
}

.hh-varies {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

/* Main screen: the houses and their buttons. */
.hh-house-sub .money {
  color: var(--text);
  font-weight: 700;
}

/* Keep «هذي السنة: Y» together when the line wraps on a phone. */
.hh-house-sub > span {
  white-space: nowrap;
}

.hh-house-btns {
  margin-top: 12px;
}

/* House page. */
.hh-actions {
  margin: 0 0 14px;
}

.hh-notes-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.hh-notes {
  margin: 2px 0 0;
  font-weight: 600;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.hh-period {
  max-width: 440px;
  margin: 0 0 12px;
}

.hh-period .chip {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  padding-inline: 8px;
}

/* Phone: two boxes, then «الإجمالي» on its own row. Wider: three in one row. */
.hh-totals .totals {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hh-totals .total-value {
  font-size: 18px;
}

/* A big amount wraps before «ر.س» instead of spilling out of its box. */
.hh-totals .total-value .money {
  white-space: normal;
}

.hh-totals .total:last-child {
  grid-column: 1 / -1;
  background: var(--brand-soft);
}

.hh-totals .total:last-child .total-value {
  color: var(--brand-ink);
  font-size: 24px;
}

@media (min-width: 560px) {
  .hh-totals .totals {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hh-totals .total:last-child {
    grid-column: auto;
  }

  .hh-totals .total:last-child .total-value {
    font-size: 20px;
  }
}

.hh-section {
  margin-top: 26px;
}

.hh-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
}

/* «حسب التصنيف» / «حسب الشهر»: a label, its amount and a bar. */
.hh-bars {
  display: grid;
  gap: 14px;
}

.hh-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 15px;
}

.hh-bar-label {
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.hh-bar-track {
  height: 10px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.hh-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.hh-bar-zero .hh-bar-head {
  color: var(--muted);
}

.hh-bar-zero .money {
  font-weight: 600;
}

.hh-sec-btn {
  margin-top: 10px;
}

.hh-list {
  margin-top: 4px;
}

/* House page: the open tasks (P6). The relative due date on the side is grey, red when late and amber when due
   today. The two-class rules beat .hh-task-due (the approved demo put it after .hh-due-late / .hh-due-soon, so its
   late and today dates stayed grey). */
.hh-task-due {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.hh-task-due.hh-due-late {
  color: var(--late);
  font-weight: 800;
}

.hh-task-due.hh-due-soon {
  color: var(--soon);
  font-weight: 800;
}

.hh-more-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 6px;
  color: var(--brand-ink);
  font-weight: 800;
}

/* Detail screens. */
.hh-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-bottom: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.hh-hero .money {
  font-size: 28px;
  font-weight: 900;
  line-height: 1.4;
}

.hh-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.hh-link-icon .icon svg {
  width: 22px;
  height: 22px;
}

.hh-bill-link {
  margin-bottom: 12px;
}

.hh-pay {
  margin: 0 0 14px;
}

.hh-form-intro {
  margin: 0 0 10px;
  font-weight: 700;
}

/* Notes on a detail screen keep their line breaks. */
.hh-fact-notes {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
