* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f2f4f7;
    color: #1f2430;
    margin: 0;
    padding: 0;
}

.wrapper {
    max-width: 480px;
    margin: 60px auto;
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.wrapper.wide {
    max-width: 800px;
}

h1 {
    font-size: 22px;
    margin-top: 0;
    margin-bottom: 24px;
    color: #1a1f36;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #444;
}

input[type=text], input[type=password] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    border: 1px solid #d7dbe2;
    border-radius: 8px;
    font-size: 15px;
}

input[type=text]:focus, input[type=password]:focus {
    outline: none;
    border-color: #5b6cff;
}

button, .btn {
    background: #5b6cff;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

button:hover, .btn:hover {
    background: #4655d6;
}

.btn.danger {
    background: #e04b4b;
}

.btn.danger:hover {
    background: #c23b3b;
}

.btn.secondary {
    background: #8892a6;
}

.btn.secondary:hover {
    background: #707a8f;
}

.error {
    background: #fdeaea;
    color: #b02a2a;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.success {
    background: #e8f7ee;
    color: #1e7d43;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.topbar .role {
    font-size: 13px;
    color: #777;
    background: #eef0f5;
    padding: 4px 10px;
    border-radius: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

th, td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

th {
    color: #666;
    font-weight: 600;
}

.badge {
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge.admin {
    background: #fff1d6;
    color: #a86b00;
}

.badge.user {
    background: #e6ecff;
    color: #2f4fd0;
}

.badge.power {
    background: #e6f7f0;
    color: #12805c;
}

/* ===== Terminarz spotkań: lista bez ramek i nagłówków, tylko kolorowy pasek + biały tekst ===== */

.meeting-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.meeting-item {
    scroll-margin-top: 90px; /* żeby po scrollIntoView pasek nie chował się pod topbarem */
}

.meeting-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    border: none;
}

.meeting-bar .date-label {
    text-align: left;
}

.meeting-bar .bar-date {
    font-size: 1.12em;
}

.meeting-bar .bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.meeting-bar .icon-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.meeting-bar .icon-btn:hover {
    background: rgba(255,255,255,0.35);
}

.meeting-bar .arrow {
    font-size: 22px;
    line-height: 1;
    transition: transform 0.2s ease;
    display: inline-block;
}

.meeting-bar .arrow.open {
    transform: rotate(180deg);
}

.meeting-body {
    background: #ffffff;
    color: #000000;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.meeting-body.open {
    max-height: 2000px;
}

.meeting-body-inner {
    padding: 14px 16px 18px 16px;
}

.meeting-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.meeting-meta-static {
    background: #ffffff;
    color: #333;
    font-size: 13px;
    padding: 8px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.meeting-meta span {
    margin-right: 16px;
}

.meeting-text {
    font-size: 14px;
    color: #000;
    line-height: 1.55;
    margin-bottom: 14px;
    word-wrap: break-word;
}

/* RSVP */
.rsvp-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 6px;
}

.rsvp-row button {
    font-size: 13px;
    padding: 6px 12px;
}

.rsvp-row button.active {
    outline: 3px solid rgba(0,0,0,0.15);
}

.rsvp-yes { background: #1e8449; }
.rsvp-yes:hover { background: #166a39; }
.rsvp-no { background: #c0392b; }
.rsvp-no:hover { background: #a5301f; }
.rsvp-maybe { background: #c9a227; }
.rsvp-maybe:hover { background: #ab8a1f; }

.rsvp-summary,
.attendance-summary {
    font-size: 12px;
    color: #888;
}

/* Legenda kolorów */
.color-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #666;
    padding: 0 4px 12px 4px;
}

.color-legend .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

/* ===== Natywny <dialog> - okno modalne dodawania/edycji terminu ===== */

dialog {
    border: none;
    border-radius: 12px;
    padding: 0;
    width: 92%;
    max-width: 560px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}

dialog::backdrop {
    background: rgba(20, 24, 35, 0.55);
}

dialog .dialog-inner {
    padding: 24px;
}

dialog h2 {
    margin-top: 0;
    font-size: 18px;
    color: #1a1f36;
}

dialog h3 {
    font-size: 14px;
    color: #444;
    margin: 20px 0 10px 0;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.field-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.field-row > div {
    flex: 1;
    min-width: 140px;
}

select {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    border: 1px solid #d7dbe2;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
}

input[type=datetime-local], input[type=number], input[type=email] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    border: 1px solid #d7dbe2;
    border-radius: 8px;
    font-size: 15px;
}

textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d7dbe2;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 90px;
}

.format-toolbar {
    margin-bottom: 6px;
}

.format-toolbar button {
    font-size: 13px;
    padding: 5px 10px;
    margin-right: 6px;
    background: #eef0f5;
    color: #333;
}

.format-toolbar button:hover {
    background: #dfe2ea;
}

.dialog-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    flex-wrap: wrap;
    gap: 10px;
}

.dialog-close {
    background: none;
    border: none;
    color: #888;
    font-size: 22px;
    cursor: pointer;
    float: right;
    line-height: 1;
    padding: 0;
}

/* Lista obecności w oknie zarządzania */
.attendance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
    margin: 10px 0 6px 0;
}

.attendance-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f7f8fb;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 0;
    cursor: pointer;
}

.attendance-grid input {
    width: auto;
    margin: 0;
}

/* Formularz "+ Gość" wewnątrz wiersza RSVP */
.guest-inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.guest-inline-form input[type=text] {
    margin-bottom: 0;
    padding: 7px 10px;
    font-size: 13px;
    width: 170px;
}

/* Lista "Pokaż listę" / "Lista obecności" w oknie modalnym */
.list-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 50vh;
    overflow-y: auto;
    margin: 10px 0;
}

.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    border: 1px solid #e6e6e6;
}

label.list-row {
    cursor: pointer;
}

.list-row.present-1,
.list-row.rsvp-row-yes {
    background: #eaf6ee;
    border-color: #bfe3c9;
}

.list-row.present-0,
.list-row.rsvp-row-none {
    background: #ffffff;
    border-color: #e6e6e6;
}

.list-row.rsvp-row-no {
    background: #fbeae8;
    border-color: #eec3bd;
}

.list-row-guest {
    background: #fdf6e3;
    border-color: #ecd98d;
}

.icon-btn-plain {
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
}

.icon-btn-plain:hover {
    color: #c0392b;
}

/* Pływający przycisk powrotu do najbliższego spotkania */
.float-btn {
    position: fixed;
    right: 20px;
    bottom: 24px;
    background: #1a1f36;
    color: #fff;
    border: none;
    padding: 12px 18px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    z-index: 50;
}

.float-btn:hover {
    background: #2a3150;
}

.meetings-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: #fff;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.meetings-topbar .title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1f36;
}

.topbar-right {
    position: relative;
}

.hamburger-btn {
    background: #f2f4f7;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
}

.hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #1a1f36;
    border-radius: 2px;
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    min-width: 220px;
    padding: 8px;
    z-index: 100;
    flex-direction: column;
    gap: 2px;
}

.nav-dropdown.open {
    display: flex;
}

.nav-dropdown .nav-user {
    padding: 8px 10px;
    font-size: 13px;
    color: #666;
    border-bottom: 1px solid #eee;
    margin-bottom: 6px;
}

.nav-dropdown a,
.nav-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    color: #1a1f36;
    border: none;
    padding: 10px 10px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}

.nav-dropdown a:hover,
.nav-dropdown button:hover {
    background: #f2f4f7;
}

.meetings-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 0 80px 0;
}

.empty-state {
    text-align: center;
    color: #888;
    padding: 60px 20px;
}

/* ===== Responsywność / smartfony ===== */
@media (max-width: 640px) {
    .wrapper, .wrapper.wide {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        max-width: 100%;
        padding: 18px 16px;
    }

    .meetings-topbar {
        padding: 12px 14px;
    }

    .meeting-bar {
        padding: 12px 14px;
        font-size: 14px;
    }

    .meeting-body-inner {
        padding: 12px 14px 16px 14px;
    }

    dialog {
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }

    .float-btn {
        right: 14px;
        bottom: 14px;
        padding: 10px 16px;
        font-size: 13px;
    }
}

.actions form {
    display: inline;
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.inline-form > div {
    flex: 1;
    min-width: 140px;
}

.inline-form input {
    margin-bottom: 0;
}

.muted {
    color: #888;
    font-size: 13px;
}
