
/* =========================
   1. CÀI ĐẶT CHUNG
========================= */

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f6fa;
    color: #333;
    margin: 0;
    line-height: 1.6;
}

main {
    max-width: 1200px;
    margin: auto;
    padding: 30px 25px;
}

/* =========================
   2. THANH ĐIỀU HƯỚNG
========================= */

nav {
    background-color: #1e293b;
    color: white;
    padding: 15px 40px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav h2 {
    margin: 0;
    color: white;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 25px;
    margin: 0;
    padding: 0;
}

nav a {
    color: white;
    text-decoration: none;
    font-size: 14px;
}

nav a:hover {
    color: #38bdf8;
}

/* =========================
   3. KHU VỰC CHÀO MỪNG
========================= */

.welcome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.welcome h1 {
    color: #1e293b;
    margin-bottom: 5px;
}

.welcome p {
    color: #64748b;
    margin-top: 0;
}

.date {
    background-color: white;
    padding: 10px 18px;
    border-radius: 8px;
    color: #64748b;
    font-size: 13px;
}

/* =========================
   4. THẺ THỐNG KÊ
========================= */

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 35px;
}


.card {
    background-color: white;
    padding: 22px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.card-title {
    color: #64748b;
    font-size: 14px;
    margin-top: 0;
}

.card h2 {
    color: #1e293b;
    font-size: 23px;
    margin: 12px 0;
}

.card-note {
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 0;
}

/* =========================
   5. CÁC KHU VỰC NỘI DUNG
========================= */

.content-section {
    background-color: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.section-heading {
    margin-bottom: 20px;
}

.section-heading h2 {
    color: #1e293b;
    margin: 0;
}

.section-heading p {
    color: #94a3b8;
    font-size: 13px;
    margin-top: 5px;
}

/* =========================
   6. BẢNG GIAO DỊCH
========================= */

.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background-color: #f8fafc;
    color: #64748b;
    font-size: 13px;
    padding: 14px;
}

td {
    padding: 15px 14px;
    border-bottom: 1px solid #eeeeee;
    font-size: 14px;
}

.income {
    color: #16a34a;
    background-color: #dcfce7;
    padding: 5px 10px;
    border-radius: 20px;
}

.expense {
    color: #dc2626;
    background-color: #fee2e2;
    padding: 5px 10px;
    border-radius: 20px;
}

/* =========================
   7. CÁC THẺ CHỨC NĂNG
========================= */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.feature-card {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 22px;
    border-radius: 10px;
}

.feature-card h3 {
    color: #1e293b;
    margin-top: 0;
}

.feature-card p {
    color: #64748b;
    font-size: 14px;
}

/* =========================
   8. CHÂN TRANG
========================= */

footer {
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    padding: 20px;
}

/* =========================
   9. HIỂN THỊ TRÊN TABLET
========================= */

@media (max-width: 900px) {

    .dashboard-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    nav {
        padding: 15px 20px;
    }

    nav ul {
        gap: 12px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================
   10. HIỂN THỊ TRÊN ĐIỆN THOẠI
========================= */

@media (max-width: 600px) {

    nav {
        flex-direction: column;
        gap: 15px;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    main {
        padding: 20px 15px;
    }

    .welcome {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .content-section {
        padding: 15px;
    }
}

/* =========================
   11. TỐI ƯU GIAO DIỆN ĐIỆN THOẠI
========================= */

@media (max-width: 600px) {

    /* Thanh điều hướng */
    nav {
        padding: 18px 15px;
        gap: 14px;
    }

    nav h2 {
        font-size: 21px;
    }

    nav ul {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px 8px;
        width: 100%;
        text-align: center;
    }

    nav a {
        font-size: 13px;
        display: block;
        padding: 5px 2px;
    }

    /* Tiêu đề trang */
    .welcome h1 {
        font-size: 23px;
    }

    .welcome p {
        font-size: 13px;
    }

    .date {
        font-size: 12px;
    }

    /* Thẻ thống kê: 2 cột */
    .dashboard-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .card {
        padding: 14px 12px;
        min-width: 0;
    }

    .card-title {
        font-size: 12px;
    }

    .card h2 {
        font-size: 17px;
        overflow-wrap: anywhere;
    }

    .card-note {
        font-size: 11px;
    }

    /* Tiêu đề khu vực */
    .section-heading h2 {
        font-size: 19px;
    }

    .section-heading p {
        font-size: 12px;
    }

    /* Bảng giao dịch */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 520px;
    }

    /* Thẻ chức năng */
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .feature-card {
        padding: 17px;
    }

    footer {
        padding: 20px 15px;
        font-size: 11px;
    }
}

/* =========================
   12. FORM GIAO DỊCH
========================= */

.transaction-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group label {
    font-size: 14px;
    font-weight: bold;
    color: #334155;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    background-color: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
}

.submit-button {
    grid-column: 1 / -1;
    padding: 13px;
    background-color: #1e293b;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
}

.submit-button:hover {
    background-color: #334155;
}

/* Nút xóa giao dịch */

.delete-button {
    background-color: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 6px;
    padding: 7px 10px;
    cursor: pointer;
}

.delete-button:hover {
    background-color: #fecaca;
}

/* Responsive form */

@media (max-width: 600px) {
    .transaction-form {
        grid-template-columns: 1fr;
    }

    .submit-button {
        grid-column: auto;
    }
}

/* =========================
   13. QUẢN LÝ NGUYÊN LIỆU
========================= */

.inventory-heading {
    margin-top: 35px;
}

.inventory-heading h3 {
    color: #1e293b;
    font-size: 17px;
    margin-bottom: 0;
}

/* Bảng tồn kho */

#ingredient-list td {
    vertical-align: middle;
}

#ingredient-list td:nth-child(5) {
    font-weight: bold;
    color: #1e293b;
}

.inventory-empty {
    text-align: center;
    color: #94a3b8;
    padding: 25px !important;
}

/* Giá trị tồn kho */

#inventory-value {
    overflow-wrap: anywhere;
}

/* Điện thoại */

@media (max-width: 600px) {
    #ingredients .transaction-form {
        grid-template-columns: 1fr;
    }

    #ingredients table {
        min-width: 650px;
    }

    .inventory-heading {
        margin-top: 25px;
    }
}

/* =========================
   14. NHẬP KHO VÀ XUẤT KHO
========================= */

.inventory-heading {
    margin-top: 30px;
    margin-bottom: 15px;
}

.inventory-heading h3 {
    color: #1e293b;
    font-size: 17px;
    margin-bottom: 4px;
}

.inventory-heading p {
    color: #64748b;
    font-size: 13px;
    margin-top: 4px;
}

#ingredients table {
    min-width: 760px;
}

#ingredient-list td {
    vertical-align: middle;
}

#ingredient-list td:nth-child(5) {
    font-weight: bold;
    color: #1e293b;
}

.stock-status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 12px;
    white-space: nowrap;
}

.stock-normal {
    color: #15803d;
    background: #dcfce7;
}

.stock-low {
    color: #b45309;
    background: #fef3c7;
}

.stock-empty {
    color: #b91c1c;
    background: #fee2e2;
}

@media (max-width: 600px) {
    #ingredients .transaction-form {
        grid-template-columns: 1fr;
    }

    #ingredients table {
        min-width: 760px;
    }
}
/* Giữ bảng thống kê chi phí vừa màn hình điện thoại. */
@media (max-width: 600px) {
    #expenses {
        min-width: 0;
    }

    #expenses table {
        min-width: 0;
        table-layout: fixed;
        overflow-wrap: anywhere;
    }

    #expenses th,
    #expenses td {
        padding: 8px;
    }
}
/* Giao diện báo cáo thu chi */
#reports {
    padding: clamp(16px, 4vw, 36px);
    border: 1px solid #e6dece;
    border-radius: 20px;
    background: #fffdfa;
    color: #17283c;
    box-shadow: 0 12px 32px rgba(23, 40, 60, 0.08);
}

#reports h2 {
    color: inherit;
    font-size: clamp(24px, 4vw, 34px);
    line-height: 1.2;
    letter-spacing: -0.03em;
}

#reports .form-group {
    max-width: 280px;
}

#report-month:focus-visible {
    outline: 2px solid #896125;
    outline-offset: 2px;
}

#report-count {
    color: #526173;
    font-size: 14px;
}

.report-totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0 28px;
}

.report-totals p {
    margin: 0;
    padding: 14px 16px;
    border: 1px solid #32485f;
    border-radius: 14px;
    background: #17283c;
    color: #e3eaf2;
    font-size: 14px;
}

.report-totals strong {
    display: block;
    margin-top: 5px;
    color: #fff;
    font-size: clamp(22px, 3vw, 30px);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.report-totals .report-balance-card {
    border-color: #dacaab;
    background: #f2e7d0;
    color: #584629;
}

.report-balance-card strong {
    color: #17283c;
}

#expenses th {
    background: #f3eee4;
    color: #344458;
}

#expenses th:not(:first-child),
#expenses td:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
    .report-totals {
        grid-template-columns: 1fr;
    }
}