* { box-sizing: border-box; }

:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --border: #e1e4eb;
    --text: #1a1d29;
    --muted: #6b7280;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --weekend: #fff7ed;
    --weekend-border: #fed7aa;
    --success: #10b981;
    --error: #ef4444;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.topbar h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.back-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
}
.back-link:hover { color: var(--primary); }

.container {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 24px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn {
    display: inline-block;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
}
.btn:hover { background: #f3f4f6; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}
.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 48px 24px;
}

/* === Strona glowna - kafelki === */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: var(--primary);
}

.tile-initials {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    text-transform: uppercase;
}

.tile-name {
    font-weight: 500;
    font-size: 15px;
}

/* === Dialog dodawania aktora === */
dialog {
    border: none;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    min-width: 320px;
}
dialog::backdrop {
    background: rgba(0,0,0,0.4);
}
dialog h2 {
    margin: 0 0 16px;
    font-size: 18px;
}
dialog label {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--muted);
}
dialog input {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
}
.dialog-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}
.dialog-actions button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
}
.dialog-actions .btn-primary {
    border-color: var(--primary);
}

/* === Harmonogram === */
.month-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}
.current-month {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.schedule {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.schedule-col h3 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.day {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    position: relative;
}
.day-weekend {
    background: var(--weekend);
    border-color: var(--weekend-border);
}
.day-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}
.day-num {
    font-weight: 700;
    font-size: 16px;
}
.day-weekday {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}
.day-notes {
    width: 100%;
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    resize: vertical;
    background: #fafbfc;
}
.day-notes:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.day-status {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 11px;
    color: var(--muted);
    opacity: 0;
    transition: opacity 0.2s;
}
.day-status.show { opacity: 1; }
.day-status.saved { color: var(--success); }
.day-status.error { color: var(--error); }

/* Mobile */
@media (max-width: 768px) {
    .schedule {
        grid-template-columns: 1fr;
    }
    .topbar { padding: 12px 16px; }
    .topbar h1 { font-size: 16px; }
    .container { padding: 0 12px; }
}
