* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f7fb;
    color: #222;
}

.hidden {
    display: none !important;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.topbar {
    background: #fff;
    border: 1px solid #dde3ee;
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.topbar-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.user-box {
    text-align: right;
}

.stats {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.stats-three {
    grid-template-columns: repeat(3, 1fr);
}

.stat, .card {
    background: #fff;
    border: 1px solid #dde3ee;
    border-radius: 12px;
    padding: 16px;
}

.stat span {
    display: block;
    color: #666;
    margin-bottom: 8px;
}

.stat strong {
    font-size: 28px;
}

.toolbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.toolbar-left, .toolbar-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-center input {
    width: 100%;
}

input, select, textarea, button {
    font: inherit;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cfd7e6;
    border-radius: 8px;
    background: #fff;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid #2d6cdf;
    outline-offset: 1px;
}

textarea {
    resize: vertical;
}

.btn {
    border: 1px solid #cfd7e6;
    background: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
}

.btn:hover {
    background: #f2f5fb;
}

.btn.primary {
    background: #2d6cdf;
    color: #fff;
    border-color: #2d6cdf;
}

.btn.primary:hover {
    background: #2159bc;
}

.btn.danger {
    background: #fff0f0;
    color: #a62222;
    border-color: #f0c1c1;
}

.btn.small {
    padding: 8px 12px;
    font-size: 14px;
}

.events {
    display: grid;
    gap: 12px;
}

.event-card h3 {
    margin: 6px 0 4px;
}

.event-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.event-deadline {
    white-space: nowrap;
    font-weight: bold;
}

.event-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef3ff;
    font-size: 12px;
}

.status-new {
    background: #eef3ff;
}

.status-soon {
    background: #fff2cc;
}

.status-overdue {
    background: #ffe0e0;
}

.status-done {
    background: #dff5df;
}

.neutral {
    background: #ececec;
}

.important {
    background: #eadcff;
}

.event-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 14px;
}

.event-info > div {
    border: 1px solid #edf1f7;
    border-radius: 8px;
    padding: 10px;
    background: #fafcff;
}

.event-info span {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.sub-block {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    background: #fafcff;
}

.sub-title {
    font-weight: bold;
    margin-bottom: 8px;
}

.actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.result-block {
    background: #f2fff2;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.login-overlay {
    background: rgba(0,0,0,0.45);
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.modal-card {
    width: 100%;
    max-width: 960px;
    max-height: calc(100vh - 40px);
    overflow: auto;
}

.small-modal {
    max-width: 560px;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.icon-btn {
    border: none;
    background: none;
    font-size: 22px;
    cursor: pointer;
}

.stack {
    display: grid;
    gap: 12px;
}

.grid.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.grid.three {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

.checkbox-row {
    margin-top: 4px;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    line-height: 1.2;
}

.inline-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
}

.inline-check span {
    display: inline-block;
}

.option-box {
    gap: 8px;
}

.checkbox-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.check-item {
    display: flex;
    gap: 8px;
    align-items: center;
    border: 1px solid #e1e7f0;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fafcff;
}

.check-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
}

.demo-box {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.mini-btn {
    border: 1px solid #cfd7e6;
    background: #f6f8fc;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.report-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.report-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.mini-stat {
    border: 1px solid #edf1f7;
    border-radius: 8px;
    padding: 12px;
    background: #fafcff;
}

.mini-stat span {
    display: block;
    color: #666;
    margin-bottom: 6px;
}

.mini-stat strong {
    font-size: 22px;
}

.report-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.inner-card {
    padding: 12px;
}

.report-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #edf1f7;
}

.report-row:last-child {
    border-bottom: none;
}

.final-participants-list {
    display: grid;
    gap: 8px;
}

.participant-row {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1.5fr auto;
    gap: 8px;
    align-items: center;
}

.users-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.user-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    padding: 12px;
    background: #fafcff;
}

.muted {
    color: #666;
}

.small {
    font-size: 13px;
}

.empty-card {
    text-align: center;
    color: #666;
}

.toast-container {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}

.toast {
    background: #222;
    color: #fff;
    padding: 12px 14px;
    border-radius: 8px;
    min-width: 240px;
    opacity: 0;
    transform: translateY(8px);
    transition: 0.2s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    background: #a62222;
}

@media (max-width: 900px) {
    .stats-three,
    .event-info,
    .grid.two,
    .grid.three,
    .checkbox-list,
    .report-grid,
    .report-columns,
    .toolbar,
    .participant-row {
        grid-template-columns: 1fr;
    }

    .toolbar {
        display: grid;
    }

    .topbar,
    .event-top,
    .report-head,
    .user-row {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-right {
        justify-content: space-between;
    }

    .user-box {
        text-align: left;
    }
}