:root {
    --blue: #2563eb;
    --blue-dark: #1e40af;
    --green: #16a34a;
    --green-bg: #dcfce7;
    --red: #dc2626;
    --red-bg: #fee2e2;
    --amber-bg: #fef3c7;
    --amber: #b45309;
    --gray-bg: #f1f5f9;
    --gray-border: #e2e8f0;
    --text: #1e293b;
    --text-light: #64748b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background: #f8fafc;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--gray-border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--blue-dark); text-decoration: none; }
.nav { display: flex; gap: 16px; flex: 1; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--blue); }
.user-box { display: flex; align-items: center; gap: 12px; color: var(--text-light); font-size: 0.9rem; }
.btn-link { color: var(--blue); text-decoration: none; }
.btn-link:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

h1 { font-size: 1.5rem; margin-bottom: 8px; }
h2 { font-size: 1.15rem; margin-top: 0; }

.card {
    background: #fff;
    border: 1px solid var(--gray-border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
}

.alert { padding: 10px 14px; border-radius: 8px; font-size: 0.95rem; }
.alert-error { background: var(--red-bg); color: var(--red); }
.alert-success { background: var(--green-bg); color: var(--green); }

/* Formularze */
.form-grid { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; }
.form-grid label { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--text-light); gap: 4px; }
input, select, button { font-family: inherit; font-size: 0.95rem; }
input[type=text], input[type=password], select {
    padding: 8px 10px; border: 1px solid var(--gray-border); border-radius: 6px; min-width: 180px;
}
button {
    background: var(--blue); color: #fff; border: none; padding: 9px 16px;
    border-radius: 6px; cursor: pointer; font-weight: 600;
}
button:hover { background: var(--blue-dark); }
.btn-small { background: var(--gray-bg); color: var(--text); padding: 5px 10px; font-size: 0.8rem; border-radius: 5px; border: 1px solid var(--gray-border); cursor: pointer; text-decoration: none; display: inline-block; }
.btn-small:hover { background: #e2e8f0; }
.hidden { display: none; }
.reset-form { margin-top: 6px; display: flex; gap: 6px; }

/* Logowanie / instalacja */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f1f5f9; }
.login-box { background: #fff; padding: 32px; border-radius: 12px; width: 320px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.login-box h1 { text-align: center; color: var(--blue-dark); }
.login-box form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.login-box label { font-size: 0.85rem; color: var(--text-light); }

/* Tabela pracowników */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--gray-border); }
.actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.tag-ok { background: var(--green-bg); color: var(--green); }
.tag-off { background: var(--red-bg); color: var(--red); }
.tag-warn { background: var(--amber-bg); color: var(--amber); }

/* Nawigacja miesiąca */
.month-nav { display: flex; align-items: center; gap: 16px; margin: 16px 0; }
.month-title { font-weight: 700; font-size: 1.1rem; min-width: 160px; text-align: center; }
.legend { color: var(--text-light); font-size: 0.85rem; margin-bottom: 12px; }

/* Kalendarz miesięczny */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.cal-head { text-align: center; font-size: 0.8rem; color: var(--text-light); font-weight: 600; padding-bottom: 4px; }
.cal-cell {
    background: #fff; border: 1px solid var(--gray-border); border-radius: 8px;
    min-height: 64px; padding: 8px; text-decoration: none; color: var(--text);
    display: flex; flex-direction: column; gap: 6px;
}
.cal-cell:hover { border-color: var(--blue); }
.cal-empty { background: transparent; border: none; }
.cal-daynum { font-weight: 700; font-size: 0.95rem; }

/* Siatka slotów - pracownik (przyciski) */
.slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 6px;
}
.slot-btn {
    background: var(--green-bg); color: var(--green); border: 1px solid transparent;
    padding: 10px 4px; border-radius: 6px; font-weight: 600; font-size: 0.85rem; cursor: pointer;
}
.slot-btn.slot-excluded { background: var(--red-bg); color: var(--red); }

/* Siatka slotów - admin (tabela) */
.table-scroll { overflow-x: auto; }
.grid-table { border-collapse: collapse; width: 100%; min-width: 480px; }
.grid-table th, .grid-table td { border: 1px solid var(--gray-border); text-align: center; padding: 6px 8px; font-size: 0.85rem; }
.grid-table .time-col { background: var(--gray-bg); font-weight: 600; white-space: nowrap; }
.slot-cell { cursor: pointer; background: var(--green-bg); color: var(--green); font-weight: 700; min-width: 70px; }
.slot-cell.slot-excluded { background: var(--red-bg); color: var(--red); }
.slot-cell.slot-excluded.slot-assigned { background: var(--amber-bg); color: var(--amber); }
.slot-cell.slot-assigned { background: #bbf7d0; }
.coverage-col.cov-ok { background: var(--green-bg); color: var(--green); font-weight: 700; }
.coverage-col.cov-bad { background: var(--red-bg); color: var(--red); font-weight: 700; }

@media (max-width: 640px) {
    .calendar-grid { grid-template-columns: repeat(7, minmax(0,1fr)); font-size: 0.75rem; }
    .cal-cell { min-height: 50px; padding: 4px; }
}
