:root {
    --bg-1: #f3f7ff;
    --bg-2: #eefbf5;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #0f172a;
    --text-muted: #64748b;
    --brand: #0f766e;
    --brand-strong: #0b5f59;
    --border: #dce3ee;
    --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.09);
}

body {
    margin: 40px 10px;
    padding: 0;
    font-family: 'Sora', 'Segoe UI', Tahoma, sans-serif;
    font-size: 14px;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at -5% -10%, #dbeafe 0%, transparent 60%),
        radial-gradient(800px 400px at 110% 20%, #dcfce7 0%, transparent 55%),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
}

.auth-shell {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: min(420px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    padding: 22px;
}

.auth-card h1 {
    margin: 0 0 8px;
}

.auth-card p {
    margin: 0 0 14px;
    color: var(--text-muted);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-form input {
    border: 1px solid #cfd2da;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
}

.auth-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.auth-toggle-text {
    margin-top: 16px !important;
    text-align: center;
    font-size: 14px;
}

.link-btn {
    background: none;
    border: none;
    color: #1d4ed8;
    cursor: pointer;
    font-weight: 600;
    padding: 0;
    font-size: inherit;
    text-decoration: underline;
}

.link-btn:hover {
    color: #1b45bf;
}

.page-shell {
    max-width: 980px;
    margin: 0 auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 16px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 14px;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-soft);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.current-user {
    color: #0f172a;
    font-weight: 600;
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
}

#calendar {
    background-color: var(--surface);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

.calendar-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.day-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.day-panel-header {
    padding: 14px 14px 10px;
    border-bottom: 1px solid #ebedf2;
}

.day-panel-header h2 {
    margin: 0;
    font-size: 18px;
}

.day-panel-header p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 12px;
}

.day-panel-body {
    padding: 12px;
    max-height: 560px;
    overflow: auto;
}

.day-event-card {
    border: 1px solid #e2e8f0;
    border-left-width: 6px;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

.day-event-title {
    margin: 0;
    font-weight: 600;
}

.day-event-tag {
    margin: 4px 0 0;
    color: #475569;
    font-size: 12px;
}

.day-event-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.edit-event-row {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    display: grid;
    gap: 8px;
}

.edit-event-actions {
    display: flex;
    justify-content: flex-end;
}

.day-panel-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    position: sticky;
    bottom: 0;
    background: white;
    padding-top: 8px;
}

.fc .selected-day-cell {
    background: rgba(59, 130, 246, 0.12);
}

.btn {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
    background: #f4f7fb;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.12);
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
}

.btn-primary:hover {
    background: var(--brand-strong);
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.hidden {
    display: none;
}

.modal-card {
    width: min(540px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #ebedf2;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.icon-btn {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}

.modal-body input,
.modal-body select {
    border: 1px solid #cfd2da;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
}

.inline-field {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 36px;
    align-items: center;
}

.tag-chip {
    border: 1px solid #bfdbfe;
    color: #1e40af;
    background: #eff6ff;
    border-radius: 999px;
    padding: 6px 10px;
    cursor: pointer;
}

.modal-footer {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-footer.between {
    justify-content: space-between;
    align-items: center;
}

.right-actions {
    display: flex;
    gap: 8px;
}

.btn-danger {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
}

.btn-danger:hover {
    background: #fecaca;
}

.manage-card {
    width: min(900px, 100%);
}

.manage-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 360px;
}

.manage-layout aside {
    border-right: 1px solid #ebedf2;
    padding: 12px;
}

.manage-layout section {
    padding: 6px;
}

.manage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.manage-item {
    border: 1px solid #d7dce8;
    border-radius: 8px;
    background: white;
    padding: 10px;
    text-align: left;
    cursor: pointer;
}

.manage-item.active {
    border-color: #1d4ed8;
    background: #eff6ff;
}

.empty-message {
    color: #6b7280;
}

.toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1100;
    background: #0f766e;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.toast.is-error {
    background: #dc2626;
}

@media (max-width: 700px) {
    body {
        margin: 16px 8px;
    }

    #calendar {
        padding: 10px;
    }

    .calendar-layout {
        grid-template-columns: 1fr;
    }

    .topbar h1 {
        font-size: 20px;
    }

    .manage-layout {
        grid-template-columns: 1fr;
    }

    .manage-layout aside {
        border-right: 0;
        border-bottom: 1px solid #ebedf2;
    }
}

.color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 2px 0 6px;
}

.color-bubble {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 2px solid #d1d5db;
    cursor: pointer;
    padding: 0;
    box-sizing: border-box;
    position: relative;
}

.color-bubble.active {
    border-color: #0f172a;
    box-shadow: 0 0 0 2px #e2e8f0;
}

.color-bubble-custom {
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.color-bubble-plus {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

.color-bubble-picker {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    border: 0;
    cursor: pointer;
}

.manage-item-content {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.manage-item-color {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.25);
    flex-shrink: 0;
}

.manage-item-title {
    line-height: 1.2;
}

.admin-modal-card {
    width: min(760px, 100%);
}

.admin-users-section {
    max-height: 40vh;
    overflow-y: auto;
}

.admin-user-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    background: #f8fafc;
}

.admin-user-info {
    display: flex;
    flex-direction: column;
    color: #0f172a;
}

.admin-user-info small {
    color: #64748b;
}

.admin-user-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-edit-form {
    border-top: 1px solid #dbe2ea;
    margin-top: 6px;
    padding-top: 14px;
}

.admin-edit-form .modal-footer {
    margin-top: 10px;
}

.visual-select-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.visual-select-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    background-color: #f8fafc;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.visual-select-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.visual-select-item.selected {
    border-color: #1e293b;
    background-color: #f1f5f9;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.visual-select-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.fc .fc-toolbar-title {
    font-size: 1.15rem;
    text-transform: capitalize;
}

.fc .fc-button {
    border-radius: 9px !important;
    border: 1px solid var(--border) !important;
    background: #ffffff !important;
    color: var(--text) !important;
    box-shadow: none !important;
}

.fc .fc-button:hover {
    background: #f4f7fb !important;
}

.fc .fc-button.fc-button-active {
    background: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #ffffff !important;
}

.fc .fc-daygrid-day-number {
    color: #0f172a;
    font-weight: 600;
}

.view-events-card {
    width: min(720px, 100%);
}

.events-preview-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 46vh;
    overflow-y: auto;
    padding-right: 2px;
}

.event-preview-item {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 12px;
    border: 1px solid #e2e8f0;
    border-left: 6px solid #3b82f6;
    border-radius: 10px;
    background: #ffffff;
    padding: 10px;
}

.event-preview-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 8px;
}

.event-preview-month {
    font-size: 12px;
    text-transform: capitalize;
    color: #64748b;
}

.event-preview-day {
    font-size: 24px;
    line-height: 1;
    color: #0f172a;
}

.event-preview-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.event-preview-title {
    margin: 0;
    font-weight: 700;
    color: #0f172a;
}

.event-preview-tag {
    margin: 6px 0 0;
    color: #475569;
    font-size: 13px;
}

@media (max-width: 700px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .topbar-actions .btn {
        flex: 1 1 calc(50% - 6px);
        min-width: 140px;
    }

    .current-user {
        width: 100%;
        margin-bottom: 4px;
    }

    .modal {
        align-items: flex-end;
        padding: 10px;
    }

    .modal-card,
    .manage-card,
    .admin-modal-card {
        width: 100%;
        max-height: 88vh;
        overflow-y: auto;
        border-radius: 12px 12px 0 0;
    }

    #dayEventModal {
        align-items: flex-start;
        padding-top: 8px;
    }

    #dayEventModal .modal-card {
        max-height: 92vh;
        border-radius: 12px;
    }

    .admin-user-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-user-actions {
        width: 100%;
    }

    .admin-user-actions .btn {
        flex: 1 1 0;
    }

    .visual-select-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .visual-select-item {
        width: 100%;
        justify-content: flex-start;
    }

    .event-preview-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .event-preview-date {
        flex-direction: row;
        justify-content: flex-start;
        gap: 8px;
    }

    .event-preview-day {
        font-size: 20px;
    }

    .modal-footer,
    .modal-footer.between {
        flex-wrap: wrap;
    }

    .right-actions,
    .left-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .right-actions .btn,
    .left-actions .btn,
    .modal-footer > .btn {
        flex: 1 1 0;
    }
}

