:root {
    --accent: #c96f3c;
    --accent-dark: #a85a2e;
    --bg: #faf6f1;
    --card-bg: #ffffff;
    --text: #2e2620;
    --text-muted: #7a6f63;
    --border: #ece3d8;
    --danger: #c1443a;
    --radius: 14px;
    font-size: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 24px 16px 64px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(60, 40, 20, 0.08);
    padding: 32px;
    width: 100%;
    max-width: 700px;
    height: fit-content;
}

h1 {
    margin: 0 0 4px;
    font-size: 1.6rem;
}

h1 .emoji {
    margin-right: 8px;
}

.subtitle {
    color: var(--text-muted);
    margin: 0 0 28px;
    font-size: 0.95rem;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

input[type="text"],
input[type="date"],
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #fffdfb;
    color: var(--text);
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.field {
    margin-bottom: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn:hover {
    background: var(--accent-dark);
}

.btn.secondary {
    background: transparent;
    color: var(--accent-dark);
    border: 1px solid var(--border);
}

.btn.secondary:hover {
    background: #fbeee4;
}

.btn.icon {
    padding: 6px 10px;
    font-size: 0.95rem;
}

.recent-events {
    margin-top: 32px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.recent-events h2 {
    font-size: 1rem;
    margin: 0 0 10px;
    color: var(--text-muted);
}

.recent-events ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-events li {
    margin-bottom: 6px;
}

.recent-events a {
    color: var(--accent-dark);
    text-decoration: none;
    font-weight: 600;
}

.recent-events a:hover {
    text-decoration: underline;
}

/* Event header */
.event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
}

.event-header .date {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 2px 0 0;
}

/* Table as CSS grid, collapses to stacked cards on narrow screens */
.entries-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.3fr 0.9fr 1.3fr auto;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 24px;
}

.entries-grid .row {
    display: contents;
}

.entries-grid .cell {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
    display: flex;
    align-items: center;
}

.entries-grid .head .cell {
    background: #fbf3ec;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.entries-grid .row:last-child .cell {
    border-bottom: none;
}

.entries-grid .cell.actions {
    gap: 6px;
    justify-content: flex-end;
}

.entries-grid .cell input {
    padding: 6px 8px;
    font-size: 0.9rem;
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 24px 0;
    font-size: 0.95rem;
}

.add-form {
    display: grid;
    grid-template-columns: 1.1fr 1.3fr 0.9fr 1.3fr auto;
    gap: 8px;
    align-items: end;
    margin-bottom: 28px;
    padding: 16px;
    background: #fbf8f4;
    border-radius: 10px;
}

.add-form .field {
    margin-bottom: 0;
}

.add-form label {
    font-size: 0.75rem;
    margin-bottom: 4px;
    color: var(--text-muted);
}

.hint {
    color: var(--accent-dark);
    font-size: 0.78rem;
    margin-top: 4px;
}

.toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.toast.show {
    opacity: 1;
}

@media (max-width: 640px) {
    .card {
        padding: 20px;
    }

    .add-form {
        grid-template-columns: 1fr;
    }

    .entries-grid {
        display: block;
        grid-template-columns: none;
        border: none;
    }

    .entries-grid .row {
        display: block;
        border: 1px solid var(--border);
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 8px 4px;
        background: #fffdfb;
    }

    .entries-grid .row.head {
        display: none;
    }

    .entries-grid .cell {
        border-bottom: none;
        display: flex;
        justify-content: space-between;
        gap: 8px;
    }

    .entries-grid .cell::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.72rem;
        text-transform: uppercase;
        color: var(--text-muted);
        flex-shrink: 0;
    }

    .entries-grid .cell.actions {
        justify-content: flex-end;
    }

    .entries-grid .cell.actions::before {
        content: "";
    }
}
