* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f4f0;
    color: #1a2e1a;
    min-height: 100vh;
}

header {
    background: #2d5a2d;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header .logo {
    color: #fff;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
}

header .nav-link {
    color: #c8e6c8;
    text-decoration: none;
    font-size: 0.9rem;
}

header .nav-link:hover {
    color: #fff;
}

main {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.card.center {
    text-align: center;
    margin-top: 4rem;
}

h1, h2 {
    margin-bottom: 1.5rem;
    color: #2d5a2d;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #444;
}

input {
    padding: 0.6rem 0.8rem;
    border: 1.5px solid #c8d8c8;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: #2d5a2d;
}

.btn {
    display: inline-block;
    background: #2d5a2d;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.btn:hover {
    background: #3d7a3d;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f0f7f0;
    border-radius: 8px;
    padding: 0.9rem 1rem;
    margin-top: 1.5rem;
}

.result span {
    color: #555;
    font-size: 0.9rem;
}

.result strong {
    font-size: 1.3rem;
    color: #2d5a2d;
}

.error {
    margin-top: 1rem;
    color: #c0392b;
    font-size: 0.9rem;
}

.back {
    display: inline-block;
    margin-top: 1.5rem;
    color: #2d5a2d;
    text-decoration: none;
    font-size: 0.9rem;
}

.back:hover {
    text-decoration: underline;
}

/* History */

.card.wide {
    max-width: 900px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

thead tr {
    background: #2d5a2d;
    color: #fff;
}

th, td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid #e0eae0;
}

tbody tr:hover {
    background: #f5faf5;
}

td.date {
    white-space: nowrap;
    color: #666;
    font-size: 0.82rem;
}

td.total {
    font-weight: 700;
    color: #2d5a2d;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-square {
    background: #d4edda;
    color: #1a5c2a;
}

.badge-rect {
    background: #cce5ff;
    color: #1a3a5c;
}

.empty {
    color: #888;
    text-align: center;
    padding: 2rem 0;
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
}

.table-wrapper table {
    margin-bottom: 0;
    min-width: 600px;
}

/* Responsive */

@media (max-width: 480px) {
    main {
        padding: 1rem 0.75rem;
    }

    .card {
        padding: 1.25rem;
        border-radius: 10px;
    }

    .card.center {
        margin-top: 2rem;
    }

    h1 {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    input {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .result strong {
        font-size: 1.1rem;
    }

    header {
        padding: 0.75rem 1rem;
    }

    header .logo {
        font-size: 1rem;
    }
}
