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

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

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 16px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 24px;
    color: #16213e;
    margin-bottom: 8px;
}

.nav-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.nav-links a {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #0f3460;
    background: rgba(15, 52, 96, 0.08);
}

.week-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 10px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.week-nav a {
    color: #0f3460;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.week-label {
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

.back-link {
    display: inline-block;
    margin-top: 8px;
    color: #0f3460;
    text-decoration: none;
    font-weight: 600;
}

/* Kitchen Sections */
.kitchen-section {
    margin-bottom: 24px;
}

.kitchen-section h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #16213e;
}

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

.rota-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.rota-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

.rota-table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
}

.rota-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.rota-table tbody tr:last-child td {
    border-bottom: none;
}

.task-row {
    cursor: pointer;
    transition: background 0.15s;
}

.task-row:hover {
    background: #f5f7fa;
}

.task-row.done {
    opacity: 0.75;
}

.task-row.done .task-name {
    text-decoration: line-through;
    text-decoration-color: #4caf50;
    text-decoration-thickness: 2px;
}

.task-name {
    font-weight: 500;
    color: #333;
}

.person-badge {
    display: inline-block;
    background: #e8f0fe;
    color: #0f3460;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
}

.task-status {
    white-space: nowrap;
}

.status-done {
    font-size: 16px;
}

.status-pending {
    font-size: 16px;
    opacity: 0.4;
}

.done-by-sm {
    font-size: 11px;
    color: #888;
    margin-left: 4px;
}

.photo-indicator {
    margin-left: 6px;
    font-size: 14px;
}

/* Progress Bar */
.progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #4caf50;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: #888;
    font-weight: 600;
    white-space: nowrap;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 16px 40px;
    overflow-y: auto;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 480px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.modal-close:hover { color: #333; }

.modal-title {
    font-size: 18px;
    margin-bottom: 4px;
    color: #16213e;
}

.modal-kitchen {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
}

.modal-assigned {
    font-size: 14px;
    margin-bottom: 16px;
    color: #555;
}

.modal-status-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
}

.done-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.done-label { font-weight: 600; font-size: 14px; }

.done-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.done-yes { background: #d4edda; color: #155724; }
.done-no { background: #fff3cd; color: #856404; }

.done-info {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.proof-note {
    font-size: 13px;
    color: #555;
    font-style: italic;
    margin-top: 8px;
    padding: 8px;
    background: #fff;
    border-radius: 6px;
    border-left: 3px solid #0f3460;
}

/* Modal Photos */
.modal-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.modal-photo-wrap {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
}

.modal-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.modal-photo.expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 2000;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

.btn-delete-photo {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Form */
.modal-form {
    margin-bottom: 12px;
}

.modal-form .field {
    margin-bottom: 10px;
}

.modal-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.form-select, .form-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-file {
    font-size: 13px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

.btn-done {
    background: #4caf50;
    color: white;
}

.btn-done:hover { background: #43a047; }

.btn-undo {
    background: #f44336;
    color: white;
}

.btn-undo:hover { background: #e53935; }

.btn-primary {
    background: #0f3460;
    color: white;
    width: auto;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    background: #0f3460;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* Leaderboard */
.leaderboard-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.tab {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: #666;
    background: white;
    border: 1px solid #ddd;
}

.tab.active {
    background: #0f3460;
    color: white;
    border-color: #0f3460;
}

.leaderboard-table .rank { font-size: 18px; text-align: center; width: 40px; }

.gold { background: #fffde7; }
.silver { background: #f5f5f5; }
.bronze { background: #fff8e1; }

/* Admin (unchanged from before) */
.admin-section {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.admin-section h2 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #16213e;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form label {
    font-weight: 600;
    font-size: 14px;
}

.inline-form input[type="date"] {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.swap-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.swap-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
}

.swap-info { flex: 1; min-width: 150px; }
.swap-info strong { display: block; font-size: 14px; }
.swap-task { display: block; font-size: 12px; color: #666; }
.swap-kitchen { font-size: 11px; color: #999; text-transform: uppercase; }

.swap-select {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

.email-grid { display: flex; flex-direction: column; gap: 8px; }

.email-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.email-name { font-weight: 600; font-size: 14px; min-width: 120px; }
.email-name small { font-weight: 400; color: #999; }

.email-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    min-width: 180px;
}

.flash-messages { margin-bottom: 16px; }

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 8px;
}

.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.empty-state { text-align: center; padding: 40px 16px; color: #888; }
.empty-state a { color: #0f3460; }

.modal-loading { text-align: center; padding: 20px; color: #888; }

/* Config Page */
.section-desc {
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
    line-height: 1.4;
}

.config-kitchen-group {
    margin-bottom: 16px;
}

.config-kitchen-group h3 {
    font-size: 14px;
    color: #555;
    margin-bottom: 6px;
    padding-left: 4px;
}

.config-task-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.config-task-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.config-task-row.one-off {
    background: #fff8e1;
    border-left: 3px solid #ffa000;
}

.config-task-name {
    font-weight: 600;
    font-size: 14px;
    flex: 1;
    min-width: 150px;
}

.config-task-type {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-recurring { background: #d4edda; color: #155724; }
.badge-oneoff { background: #fff3cd; color: #856404; }
.badge-kitchen { background: #e8f0fe; color: #0f3460; }
.badge-email { background: #f3e5f5; color: #7b1fa2; }

.config-task-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.btn-edit {
    background: #0f3460;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}

.btn-del {
    background: #c62828;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}

.inline-del { display: inline; }

.add-form {
    background: #f0f4f8;
    border-radius: 10px;
    padding: 16px;
    margin-top: 12px;
}

.add-form h3 {
    font-size: 15px;
    margin-bottom: 10px;
    color: #333;
}

.config-form .form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.config-form .field { flex: 1; min-width: 120px; }
.config-form .field.flex-2 { flex: 2; min-width: 180px; }

.config-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 3px;
}

.btn-secondary {
    background: #999;
    color: white;
    width: auto;
    margin-left: 8px;
}

/* Mobile */
@media (max-width: 480px) {
    .container { padding: 10px; }
    .rota-table th, .rota-table td { padding: 8px 8px; font-size: 13px; }
    .person-badge { font-size: 12px; padding: 2px 8px; }
    .modal-content { padding: 16px; margin: 20px 0; }
}
