.zyss-household-book {
  --zhb-bg: #0d0f12;
  --zhb-card: #15181d;
  --zhb-card-2: #1c2027;
  --zhb-border: rgba(255, 255, 255, 0.12);
  --zhb-text: #f7f8fa;
  --zhb-muted: #aab2bf;
  --zhb-accent: #9acd32;
  --zhb-danger: #f87171;
  color: var(--zhb-text);
  display: grid;
  gap: 24px;
  font-family: inherit;
  margin-top: 22px;
}

.zyss-household-book * { box-sizing: border-box; }

.zhb-card,
.zhb-dialog {
  border: 1px solid var(--zhb-border);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--zhb-card), var(--zhb-bg));
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.zhb-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 64px;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--zhb-border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: none;
}

.zhb-topbar__brand-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.zhb-topbar__home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--zhb-border);
  border-radius: 10px;
  background: var(--zhb-card-2);
  color: var(--zhb-text);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 800;
}

.zhb-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  color: var(--zhb-text);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.zhb-brand__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(154, 205, 50, 0.16);
}

.zhb-brand__text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.zhb-topbar h2,
.zhb-card h3 {
  margin: 0;
}

.zhb-topbar__guide {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--zhb-muted);
  font-size: 0.85rem;
  line-height: 1.4;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zhb-topbar__actions,
.zhb-actions,
.zhb-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.zhb-btn {
  min-height: 38px;
  border: 1px solid var(--zhb-border);
  border-radius: 10px;
  padding: 0 14px;
  background: var(--zhb-card-2);
  color: var(--zhb-text);
  cursor: pointer;
  font-weight: 700;
}

.zhb-btn--primary {
  border-color: rgba(154, 205, 50, 0.55);
  background: var(--zhb-accent);
  color: #111827;
}

.zhb-btn--danger {
  border-color: rgba(248, 113, 113, 0.7);
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
}

.zhb-btn--ghost {
  background: transparent;
}

.zhb-tabs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
  padding: 8px 0 10px;
  overflow-x: auto;
}

.zhb-tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--zhb-border);
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--zhb-card);
  color: var(--zhb-muted);
  cursor: pointer;
}

.zhb-tabs button.is-active {
  background: #f7f8fa;
  color: #111827;
}

.zhb-panel {
  display: none;
}

.zhb-panel.is-active {
  display: grid;
  gap: 22px;
}

.zhb-card {
  padding: 18px;
}

.zhb-summary-grid,
.zhb-stat-grid,
.zhb-settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.zhb-summary-card,
.zhb-stat-card {
  border: 1px solid var(--zhb-border);
  border-radius: 16px;
  padding: 16px;
  background: var(--zhb-card-2);
}

.zhb-summary-card span,
.zhb-stat-card span {
  display: block;
  color: var(--zhb-muted);
  font-size: 0.82rem;
}

.zhb-summary-card strong,
.zhb-stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.25rem;
}

.zhb-filter-grid,
.zhb-form-grid,
.zhb-inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.zhb-inline-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.zhb-field-wide {
  grid-column: 1 / -1;
}

.zyss-household-book input,
.zyss-household-book select,
.zyss-household-book textarea {
  width: 100%;
  border: 1px solid var(--zhb-border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #0b0d10;
  color: var(--zhb-text);
  font: inherit;
}

.zyss-household-book label {
  display: grid;
  gap: 6px;
  color: var(--zhb-muted);
  font-size: 0.86rem;
}

.zhb-list {
  display: grid;
  gap: 10px;
}

.zhb-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.8fr) minmax(0, 1.6fr) minmax(90px, 0.8fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--zhb-border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

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

.zhb-amount--income { color: #60a5fa; }
.zhb-amount--expense { color: #f87171; }

.zhb-dialog {
  width: min(760px, calc(100% - 28px));
  color: var(--zhb-text);
  padding: 0;
}

.zhb-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.zhb-form {
  padding: 20px;
}

.zhb-upload-preview {
  margin-top: 8px;
  color: var(--zhb-accent);
}

:root[data-zyss-color-mode="light"] .zyss-household-book,
:root:not([data-zyss-color-mode="dark"]) .zyss-household-book {
  --zhb-bg: #f8fafc;
  --zhb-card: #ffffff;
  --zhb-card-2: #f1f5f9;
  --zhb-border: #d8dee9;
  --zhb-text: #111827;
  --zhb-muted: #526071;
}

:root[data-zyss-color-mode="light"] .zhb-topbar,
:root:not([data-zyss-color-mode="dark"]) .zhb-topbar {
  background: rgba(255, 255, 255, 0.96);
}

@media (max-width: 900px) {
  .zhb-card__head {
    flex-direction: column;
    align-items: stretch;
  }

  .zhb-topbar {
    position: relative;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.75rem;
  }

  .zhb-topbar__brand-tools {
    flex: 1 1 auto;
  }

  .zhb-topbar__guide {
    flex-basis: 100%;
    order: 3;
    text-align: left;
    white-space: normal;
  }

  .zhb-topbar__actions {
    justify-content: flex-end;
  }

  .zhb-summary-grid,
  .zhb-stat-grid,
  .zhb-settings-grid,
  .zhb-filter-grid,
  .zhb-form-grid,
  .zhb-inline-form,
  .zhb-row {
    grid-template-columns: 1fr;
  }
}
