*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Kanit', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background-color: #f0f4f8;
    color: #1f2933;
    padding-top: 100px;
}
button,
input,
select,
textarea {
    font-family: 'Kanit', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

.main-header {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);

    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
}



.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
}

.main-nav-links a {
    color: #e0f2f1;
    margin-left: 12px;
    text-decoration: none;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 999px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}
.main-nav-links a:hover {
    background-color: rgba(255,255,255,0.15);
    color: #ffffff;
}
.main-content {
    margin-top: 0px;
}

/* Card */
.card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

/* Section title */
.section-title {
    font-size: 20px;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 20px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    border-radius: 999px;
    background: linear-gradient(135deg, #10b981, #059669);
}

/* Summary cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.summary-card {
    border-radius: 16px;
    padding: 20px;
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.summary-card::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -40%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.16) 0%, transparent 60%);
}

.summary-card.income {
    background: linear-gradient(135deg, #11998e, #38ef7d);
}

.summary-card.expense {
    background: linear-gradient(135deg, #ee0979, #ff6a00);
}

.summary-card.balance {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.summary-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.summary-label {
    font-size: 14px;
    opacity: 0.9;
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
}

/* Period filter */
.filter-period {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.filter-period a {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid #d0e2ff;
    text-decoration: none;
    font-size: 14px;
    color: #1f2933;
    background-color: #ffffff;
    transition: all 0.2s;
}

.filter-period a:hover {
    background-color: #ebf5ff;
}

.filter-period a.active {
    background-color: #10b981;
    border-color: #10b981;
    color: #ffffff;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    font-size: 15px;
    outline: none;
    background-color: #f8fafc;
    transition: border 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #10b981;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

.btn-secondary {
    background-color: #e5e7eb;
    color: #111827;
}

.btn-secondary:hover {
    background-color: #d1d5db;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(239,68,68,0.4);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(239,68,68,0.55);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-big {
    width: 100%;
    padding: 14px 18px;
    margin-top: 8px;
    font-size: 16px;
}

/* Filter form */
.filter-form {
    margin-bottom: 16px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: flex-end;
}

.filter-grid label {
    font-size: 13px;
    margin-bottom: 4px;
    display: block;
}

.filter-grid input,
.filter-grid select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 14px;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

/* Table */
.transactions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
}

.transactions-table th,
.transactions-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
}

.transactions-table th {
    text-align: left;
    background-color: #f9fafb;
    font-weight: 600;
    color: #4b5563;
}

.transactions-table tr:nth-child(even) {
    background-color: #f9fafb;
}

.transactions-table tr:hover {
    background-color: #eef2ff;
}

.transactions-table .right {
    text-align: right;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-income {
    background-color: #dcfce7;
    color: #15803d;
}

.badge-expense {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 14px;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
}

.alert-error {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 16px;
    color: #9ca3af;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

/* Note text */
.note {
    margin-top: 12px;
    font-size: 13px;
    color: #6b7280;
}

/* ปุ่มใหญ่เพิ่มรายรับ/รายจ่ายแบบการ์ด gradient */
.add-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 12px;
}

.btn-add.big {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-radius: 24px;
    border: none;
    cursor: pointer;
    color: #ffffff;
    box-shadow: 0 14px 30px rgba(15,23,42,0.35);
    transition: transform 0.1s ease-out, box-shadow 0.2s ease-out;
    text-align: left;
}

.btn-add.big .btn-add-icon {
    font-size: 32px;
}

.btn-add.big .btn-add-text .label {
    font-size: 14px;
    opacity: 0.9;
}

.btn-add.big .btn-add-text .title {
    font-size: 22px;
    font-weight: 800;
}

.btn-add.big.income {
    background: linear-gradient(135deg, #00c853, #00e676);
}

.btn-add.big.expense {
    background: linear-gradient(135deg, #ff4081, #ff9100);
}

.btn-add.big:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(15,23,42,0.45);
}

/* Popup Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    display: none;
    justify-content: center;
    align-items: center;
    padding: 16px;
    z-index: 999;
}

.modal {
    background: #ffffff;
    border-radius: 18px;
    max-width: 640px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(15,23,42,0.4);
    animation: modal-fade-in 0.2s ease-out;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 16px 20px 20px;
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
/* เมนูหลัก */
.main-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ปุ่มเมนู (hamburger) */
.nav-toggle {
    display: none; /* ซ่อนในจอใหญ่ */
    background: transparent;
    border: 1px solid #e0f2f1;
    color: #e0f2f1;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 18px;
    cursor: pointer;
}

/* กล่องลิงก์เมนู (แนวนอนในจอใหญ่) */
.main-nav-links {
    display: flex;
    align-items: center;
}

/* จอเล็ก: เมนูเป็น dropdown */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
    }

    .nav-toggle {
        display: inline-flex; /* แสดงปุ่มในจอเล็ก */
        align-items: center;
        justify-content: center;
    }

    .main-nav {
        margin-left: auto;
    }

    .main-nav-links {
        position: absolute;
        top: 100%;
        right: 16px;
        left: 16px;
        margin-top: 8px;
        background: #059669;
        border-radius: 16px;
        padding: 8px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.25);

        display: none;             /* ซ่อนปกติ */
        flex-direction: column;
        align-items: flex-start;
        z-index: 998;
    }

    .main-nav-links a {
        width: 100%;
        margin: 0;
        padding: 8px 12px;
    }

    .main-nav-links.show {
        display: flex;             /* แสดงตอนกดปุ่ม */
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav a {
        margin-left: 0;
        margin-right: 8px;
    }
}
.transactions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
}

.transactions-table th,
.transactions-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
}

.transactions-table th {
    text-align: left;
    background-color: #f9fafb;
    font-weight: 600;
    color: #4b5563;
}

/* เพิ่มตรงนี้ให้ตัวหนังสือในเซลล์เป็นสีดำเข้ม */
.transactions-table td {
    color: #111827;
}
