/* ─── Page-level components ─────────────────────────────────── */

/* ── Amount status cells ──── */
.amount-positive {
    background-color: #dcfce7;
    color: #2dc065;
    font-weight: 600;
}
.amount-negative {
    background-color: #fee2e2;
    color: #f34141;
    font-weight: 600;
}
.amount-zero {
    background-color: #f3f4f6;
    color: #6b7280;
}

/* ── Validation status ──── */
.validated-yes {
    background-color: #dcfce7;
    color: #2dc065;
    font-weight: 600;
}
.validated-no {
    background-color: #fee2e2;
    color: #f34141;
}

/* ── Remaining amount warning ──── */
.remaining-warning {
    background-color: #fff7ed;
    color: #92400e;
}

/* ── Action bar (toolbar above tables) ──── */
.action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0 16px;
    flex-wrap: wrap;
}

/* ── CSS action buttons (replacing image buttons) ──── */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font: 600 13px var(--font-family);
    cursor: pointer;
    text-decoration: none;
    transition: filter 0.15s, box-shadow 0.15s, transform 0.1s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    white-space: nowrap;
}
.btn-action:hover {
    filter: brightness(0.92);
    box-shadow: 0 3px 8px rgba(0,0,0,0.18);
    transform: translateY(-1px);
}
.btn-action:active { transform: translateY(0); }

.btn-add      { background: #86efac; color: #14532d; }
.btn-save     { background: #93c5fd; color: #1e3a5f; }
.btn-delete   { background: #fca5a5; color: #7f1d1d; }
.btn-back     { background: #e5e7eb; color: #374151; }
.btn-transfer { background: #c4b5fd; color: #3b0764; }
.btn-reset    { background: #e5e7eb; color: #374151; }
.btn-validate { background: #86efac; color: #14532d; }
.btn-invalidate { background: #f9a8d4; color: #831843; }
.btn-activate { background: #c4b5fd; color: #3b0764; }
.btn-prev     { background: #e0f2fe; color: #0c4a6e; }
.btn-next     { background: #e0f2fe; color: #0c4a6e; }
.btn-logical  { background: #fde68a; color: #78350f; }
.btn-filter   { background: #f0f4ff; color: #312e81; }

/* ── Form card ──── */
.form-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    max-width: 700px;
}

.form-card table {
    width: 100%;
    border-collapse: collapse;
}

.form-card td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.form-card tr:last-child td { border-bottom: none; }

.form-card .form-label {
    background-color: #f8f9fb;
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    width: 28%;
    white-space: nowrap;
}

.form-card .form-title-row td {
    background-color: var(--td-accent-dark-bg-color);
    color: var(--td-accent-dark-text-color);
    font-weight: 700;
    font-size: 14px;
    padding: 12px 16px;
    letter-spacing: 0.03em;
}

.form-card .form-actions-row td {
    background-color: #f8f9fb;
    border-top: 1px solid #e5e7eb;
    padding: 12px 16px;
    text-align: center;
}

/* ── Page section (card around tables) ──── */
.page-section {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    border: 1px solid #e5e7eb;
    padding: 20px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.page-section h3 {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 700;
    color: #1e2235;
    border-left: 4px solid var(--navbar-accent);
    padding-left: 10px;
}

/* ── Data table ──── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.data-table thead tr {
    background-color: var(--tablesorter-header-bg-color);
}

.data-table thead th,
.data-table thead td {
    padding: 10px 12px;
    color: var(--tablesorter-header-text-color);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    border: none;
}

.data-table thead th:first-child,
.data-table thead td:first-child { border-radius: 8px 0 0 0; }
.data-table thead th:last-child,
.data-table thead td:last-child  { border-radius: 0 8px 0 0; }

.data-table tbody tr {
    transition: background-color 0.12s;
}

.data-table tbody tr:hover td {
    background-color: var(--tablesorter-hover-bg-color) !important;
}

.data-table tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid #f0f2f6;
    vertical-align: middle;
}

.data-table tbody tr:nth-child(even) td { background-color: #fafbfd; }
.data-table tbody tr:nth-child(odd) td  { background-color: #ffffff; }

.data-table a {
    color: var(--navbar-accent);
    text-decoration: none;
    font-weight: 500;
}
.data-table a:hover { text-decoration: underline; }

/* ── Sub-parts table inside transaction rows ──── */
.sub-parts-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 2px;
    font-size: 12px;
}

.sub-parts-table td {
    padding: 3px 6px;
    border-radius: 4px;
}

/* ── Filter sidebar form elements ──── */
.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 0 2px;
    display: block;
}

.filter-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e2235;
    padding: 10px 0 4px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 8px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    padding: 8px 0 16px;
}

.filter-input {
    width: 100% !important;
    height: 36px;
    padding: 0 10px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 13px;
    color: #1e2235;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-sizing: border-box;
}

.filter-input:focus {
    border-color: var(--navbar-accent);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12);
}

/* ── Login page ──── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e2235 0%, #2d3561 50%, #1e2235 100%);
    padding: 20px;
}

.login-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
    padding: 48px 40px 40px;
    width: 100%;
    max-width: 400px;
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .login-logo h1 {
    font-size: 26px;
    font-weight: 800;
    color: #1e2235;
    margin: 8px 0 4px;
    letter-spacing: -0.5px;
}

.login-card .login-logo p {
    font-size: 13px;
    color: #9ca3af;
    margin: 0;
}

.login-field {
    margin-bottom: 18px;
}

.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-family: var(--font-family);
    font-size: 14px;
    color: #1e2235;
    background: #f9fafb;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    outline: none;
    box-sizing: border-box;
}

.login-field input:focus {
    border-color: var(--navbar-accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.login-submit {
    width: 100%;
    height: 46px;
    background: var(--navbar-accent);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font: 700 15px var(--font-family);
    cursor: pointer;
    transition: filter 0.15s, box-shadow 0.15s, transform 0.1s;
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.35);
    margin-top: 8px;
    letter-spacing: 0.02em;
}

.login-submit:hover {
    filter: brightness(1.08);
    box-shadow: 0 6px 16px rgba(108, 99, 255, 0.45);
    transform: translateY(-1px);
}

.login-submit:active { transform: translateY(0); }

.login-error {
    background: #fee2e2;
    color: #991b1b;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 16px;
    text-align: center;
}

.logout-btn {
    width: 100%;
    height: 44px;
    background: #f3f4f6;
    color: #374151;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font: 600 14px var(--font-family);
    cursor: pointer;
    transition: background-color 0.15s;
    margin-top: 12px;
}
.logout-btn:hover { background: #e5e7eb; }

/* ── Budget summary rows ──── */
.budget-row-debit  { background-color: #fff1f2 !important; }
.budget-row-credit { background-color: #f0fdf4 !important; }

/* ── Remaining amount badge ──── */
.remaining-badge {
    background: #fff7ed;
    color: #92400e;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    display: inline-block;
    border: 1px solid #fed7aa;
}

/* ── In-table form inputs (accounts, transaction parts) ──── */
.table-input {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 13px;
    color: #1e2235;
    background: #ffffff;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}
.table-input:focus {
    border-color: var(--navbar-accent);
    box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.12);
}

.table-select {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 13px;
    color: #1e2235;
    background: #ffffff;
    box-sizing: border-box;
    cursor: pointer;
    outline: none;
}
.table-select:focus {
    border-color: var(--navbar-accent);
}

.btn-table {
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    font: 600 12px var(--font-family);
    cursor: pointer;
    transition: filter 0.15s;
    white-space: nowrap;
}
.btn-table:hover { filter: brightness(0.92); }

.btn-table-save   { background: #93c5fd; color: #1e3a5f; }
.btn-table-delete { background: #fca5a5; color: #7f1d1d; }
.btn-table-add    { background: #86efac; color: #14532d; }
