j/* ================== GLOBAL ================== */

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: #101319 !important;  /* темний фон */
}

body {
  min-height: 100vh;
  color: #e5e5e5;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

/* ================== HEADER ================== */

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

header h1 {
  margin-bottom: 0.2rem;
  color: #f4f4f7;
}

header p {
  margin-top: 0;
  color: #9ca3af;
}

/* ================== SECTION BOX (CARD) ================== */

.section-box {
  background: #171b23;
  border-radius: 14px;
  padding: 1.8rem;
  margin-bottom: 2.5rem;
  border: 1px solid #252a34;
}

.section-box h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #e5e7eb;
}

.section-box p {
  margin-top: 0;
  color: #9ca3af;
}

/* ================== TABLES (dashboard + child history + admin) ================== */

.section-box table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: #111827;   /* dark slate */
    color: #e5e7eb;
    font-size: 0.95rem;
    border-radius: 12px;
    overflow: hidden;
}

/* header */
.section-box thead {
    background-color: #1f2933;
}

.section-box thead th {
    padding: 12px 16px;
    border-bottom: 1px solid #27303b;
    font-weight: 600;
    text-align: left;
}

/* numeric columns right-aligned */
.section-box th:nth-child(2),
.section-box th:nth-child(3),
.section-box th:nth-child(4),
.section-box td:nth-child(2),
.section-box td:nth-child(3),
.section-box td:nth-child(4) {
    text-align: right;
}

/* zebra rows */
.section-box tbody tr:nth-child(odd) {
    background-color: #111827;
}

.section-box tbody tr:nth-child(even) {
    background-color: #151922;
}

.section-box tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid #1f2933;
}

.section-box tbody tr:last-child td {
    border-bottom: none;
}

/* Позитивне / негативне сальдо */
.section-box td.positive {
  color: #16a34a;
  font-weight: 600;
}

.section-box td.negative {
  color: #dc2626;
  font-weight: 600;
}

/* Лінк з ім’ям дитини – як звичайний чорний текст, але клікабельний */
.section-box a.child-link {
  color: #111827;
  font-weight: 600;
  text-decoration: none;
}

.section-box a.child-link:hover {
  text-decoration: underline;
}

/* ================== SUMMARY (Podsumowanie) ================== */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.2rem;
}

@media (max-width: 700px) {
    .summary-grid {
        grid-template-columns: 1fr; /* na telefonie karty jedna pod drugą */
    }
}

.summary-card {
  background-color: #111827;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  border: 1px solid #1f2933;
}

.summary-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  margin-bottom: 0.25rem;
}

.summary-value {
  font-size: 1.1rem;
  font-weight: 600;
}

.summary-value.balance {
  color: #e5e7eb;
}

.summary-value.income {
  color: #16a34a;
}

.summary-value.expense {
  color: #dc2626;
}

/* ================== FOOTER ================== */

.footer {
  text-align: center;
  margin-top: 2rem;
  color: #6b7280;
  font-size: 0.9rem;
}

/* ===== Tables inside section-box – dark theme, but readable ===== */

.section-box table,
.section-box table thead,
.section-box table tbody,
.section-box table tr,
.section-box table th,
.section-box table td {
  background-color: transparent !important; /* фон беремо з рядків нижче */
  border-color: #252a34 !important;
  color: #e5e7eb;
}

/* Шапка трохи світліша за фон карточки */
.section-box table thead th {
  background-color: #1f2933 !important;
  font-weight: 600;
}

/* Зебра для рядків – два близьких відтінки */
.section-box table tbody tr:nth-child(odd) td {
  background-color: #171b23 !important;
}

.section-box table tbody tr:nth-child(even) td {
  background-color: #131720 !important;
}

/* Щоб при hover у Pico не проскакував свій білий фон */
.section-box table tbody tr:hover td {
  background-color: #1d222c !important;
}

/* ===== Child links in dark table ===== */

.section-box a.child-link {
    color: #f3f4f6 !important;     /* майже білий, але не різкий */
    font-weight: 600;
    text-decoration: none;
}

.section-box a.child-link:hover {
    color: #93c5fd !important;     /* ніжний синій акцент */
    text-decoration: underline;
}

/* Total balance card – responsive fix */
#totalBalanceCard {
  max-width: 340px;      /* на великих екранах акуратно */
}

@media (max-width: 600px) {
  #totalBalanceCard {
    max-width: 100%;     /* на iPhone картка на всю ширину */
  }
}

/* ================== MOBILE FIXES (iPhone) ================== */
@media (max-width: 480px) {

    /* Менші відступи у секціях */
    .section-box {
        padding: 1.2rem;
    }

    /* Менше місця всередині таблиці */
    .section-box table th,
    .section-box table td {
        padding: 6px 8px;
        font-size: 0.85rem;
    }

    /* Шапка таблиці компактніша */
    .section-box thead th {
        padding: 8px 8px;
    }

    /* Зменшення міжрядкових відступів */
    .section-box tbody td {
        padding: 6px 8px;
    }

    /* Контейнер сторінки */
    .container {
        padding: 1rem 0.6rem;
    }

    /* Заголовки трохи компактніші */
    h2 {
        font-size: 1.3rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    /* Виправлення для карток у child.html */
    .summary-grid {
        gap: 0.6rem;
    }
}