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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
}

header {
    background: #2F5D50;
    color: white;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

header h1 { font-size: 1.2rem; font-weight: 600; flex: 1; }
header h1 a { color: white; text-decoration: none; }
header h1 a:hover { opacity: 0.85; }

header a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.15s;
}

header a:hover { color: white; }

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Add form */
.add-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    overflow: hidden;
}

.add-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
}

.add-toggle h2 { font-size: 0.95rem; font-weight: 600; }

.add-toggle .chevron {
    font-size: 0.75rem;
    color: #aaa;
    transition: transform 0.2s;
}

.add-toggle.open .chevron { transform: rotate(180deg); }

.add-form {
    display: none;
    padding: 0 18px 18px;
    border-top: 1px solid #eee;
}

.add-form.open { display: block; }

.form-grid {
    display: grid;
    grid-template-columns: 2fr repeat(8, 1fr);
    gap: 8px;
    margin-top: 14px;
    align-items: end;
}

.form-group label {
    display: block;
    font-size: 0.72rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.form-group input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.88rem;
    background: #fafafa;
    color: #1a1a2e;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus { border-color: #4a90d9; background: white; }

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: flex-end;
}

/* Table */
.table-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    overflow: hidden;
}

.table-header-bar {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #eee;
}

.table-header-bar h2 { font-size: 0.95rem; font-weight: 600; flex: 1; }

.search-wrap { position: relative; }
.search-wrap input {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 7px 10px 7px 30px;
    font-size: 0.85rem;
    background: #fafafa;
    outline: none;
    width: 200px;
    transition: border-color 0.15s;
}

.search-wrap input:focus { border-color: #4a90d9; background: white; }
.search-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: #aaa; font-size: 0.8rem; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

thead th {
    background: #f8f9fb;
    padding: 8px 12px;
    text-align: right;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #aaa;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

thead th:first-child { text-align: left; }
thead th:last-child { text-align: center; }

tbody tr { border-bottom: 1px solid #f3f3f3; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafbff; }

td {
    padding: 9px 12px;
    text-align: right;
    color: #555;
    vertical-align: middle;
}

td:first-child { text-align: left; font-weight: 500; color: #1a1a2e; }
td:last-child { text-align: center; white-space: nowrap; }

/* Inline edit inputs */
td input.edit-input {
    width: 100%;
    border: 1px solid #4a90d9;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 0.85rem;
    background: #f0f6ff;
    outline: none;
    text-align: right;
}

td:first-child input.edit-input { text-align: left; min-width: 160px; }

/* Buttons */
.btn {
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.82rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s, opacity 0.15s;
}

.btn-primary { background: #4a90d9; color: white; }
.btn-primary:hover { background: #357abd; }
.btn-success { background: #44b87a; color: white; }
.btn-success:hover { background: #359962; }
.btn-ghost { background: #f0f2f5; color: #555; }
.btn-ghost:hover { background: #e2e5ea; }
.btn-danger { background: none; color: #ccc; font-size: 1rem; padding: 4px 8px; }
.btn-danger:hover { color: #e05454; }
.btn-edit { background: none; color: #4a90d9; font-size: 0.78rem; padding: 4px 8px; border: 1px solid #c8d8f0; border-radius: 6px; }
.btn-edit:hover { background: #f0f6ff; }

.empty-state {
    padding: 40px;
    text-align: center;
    color: #bbb;
    font-style: italic;
}

.count-badge {
    background: #f0f2f5;
    color: #888;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 99px;
}

.type-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 99px;
    white-space: nowrap;
}

.type-badge.walking  { background: #e8f5e1; color: #3a7a20; }
.type-badge.cycling  { background: #fff0e0; color: #a05a10; }
.type-badge.rowing   { background: #e0eeff; color: #1a4fa0; }
.type-badge.swimming { background: #e0f4ff; color: #0a6a9a; }
.type-badge.tennis   { background: #fef0e0; color: #8a4a00; }