:root {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: #253144;
    background: #f8fafc
}

* {
    box-sizing: border-box
}

body {
    margin: 0
}

main {
    max-width: 980px;
    margin: 24px auto;
    padding: 0 16px
}

.calendar {
    background: #fff;
    border: 1px solid #e5e9f0;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 5px 25px #172a4309
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px
}

.toolbar h1 {
    font-size: 22px;
    margin: 0;
    text-align: center
}

button,
.btn {
    font: inherit;
    cursor: pointer;
    border: 1px solid #d6deea;
    border-radius: 9px;
    padding: 9px 13px;
    background: #fff;
    color: #263750
}

button:hover:not(:disabled) {
    background: #f2f5fa
}

button:disabled {
    opacity: .4;
    cursor: not-allowed
}

.primary {
    background: #263f85;
    color: white;
    border-color: #263f85
}

.primary:hover:not(:disabled) {
    background: #1b326e
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px
}

.weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    padding: 12px 0;
    color: #718096
}

.day {
    border: 1px solid #e8edf4;
    background: white;
    border-radius: 8px;
    min-height: 91px;
    padding: 7px;
    text-align: left;
    overflow: hidden
}

.day.outside {
    background: #f8fafc;
    color: #adb5c0
}

.day.today {
    border-color: #4064b7
}

.day.selected {
    outline: 2px solid #4368b7;
    outline-offset: -2px
}

.day .number {
    font-size: 13px;
    font-weight: 650
}

.dots {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 8px
}

.cat-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    vertical-align: -1px;
    margin-right: 4px;
    flex-shrink: 0;
}

.event-pill {
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 5px;
    background: #e9f0ff;
    color: #25498e;
    line-height: 1.3;
}

.event-pill .pill-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-pill.private {
    background: #fff1e3;
    color: #8b4f15;
}

/* Kategori: live_sale / event (keranjang, default biru) */
.event-pill.cat-live_sale,
.event-pill.cat-event {
    background: #e9f0ff;
    color: #25498e;
}

/* Kategori: pengiriman (motor, hijau) */
.event-pill.cat-pengiriman {
    background: #d1fae5;
    color: #065f46;
}

/* Kategori: market_day (buku, ungu) */
.event-pill.cat-market_day {
    background: #ede9fe;
    color: #4c1d95;
}

/* Kategori: other (abu) */
.event-pill.cat-other {
    background: #f1f5f9;
    color: #475569;
}

/* Private override */
.event-pill.private.cat-live_sale,
.event-pill.private.cat-event       { background: #fff1e3; color: #8b4f15; }
.event-pill.private.cat-pengiriman  { background: #dcfce7; color: #14532d; }
.event-pill.private.cat-market_day  { background: #f3e8ff; color: #581c87; }
.event-pill.private.cat-other       { background: #e2e8f0; color: #334155; }

/* Detail panel: heading & badge kategori */
.event-item h3 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    margin: 0 0 6px;
}

.event-item h3 .cat-icon {
    width: 17px;
    height: 17px;
    margin-right: 0;
}

.cat-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 6px;
    vertical-align: middle;
}

.cat-badge .cat-icon {
    width: 11px;
    height: 11px;
    margin-right: 3px;
}

.cat-badge.cat-live_sale,
.cat-badge.cat-event       { background: #e9f0ff; color: #25498e; }
.cat-badge.cat-pengiriman  { background: #d1fae5; color: #065f46; }
.cat-badge.cat-market_day  { background: #ede9fe; color: #4c1d95; }
.cat-badge.cat-other       { background: #f1f5f9; color: #475569; }

.details {
    margin-top: 18px;
    border-top: 1px solid #ecedf1;
    padding-top: 16px
}

.details h2 {
    font-size: 17px;
    margin: 0 0 12px
}

.event-item {
    border: 1px solid #e6eaf1;
    border-radius: 9px;
    padding: 12px;
    margin-bottom: 8px
}

.event-item h3 {
    font-size: 15px;
    margin: 0 0 6px
}

.event-item p {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin: 8px 0 0;
    color: #526173;
    font-size: 13px
}

.meta {
    color: #617084;
    font-size: 12px
}

.event-actions {
    display: flex;
    gap: 8px;
    margin-top: 9px
}

.muted {
    color: #6b7483
}

.status {
    min-height: 24px;
    color: #9c2f2f;
    font-size: 13px;
    margin: 12px 0
}

form {
    border: 1px solid #dfe6ef;
    background: white;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 20px
}

form h2 {
    margin-top: 0;
    font-size: 18px
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 13px
}

label {
    font-size: 13px;
    font-weight: 600
}

input,
textarea,
select {
    font: inherit;
    width: 100%;
    border: 1px solid #cfd8e4;
    border-radius: 8px;
    padding: 10px;
    background: white;
    color: #253144
}

textarea {
    min-height: 85px;
    resize: vertical
}

.form-actions {
    display: flex;
    gap: 9px;
    align-items: center
}

.hidden {
    display: none !important
}

@media(max-width:600px) {
    main {
        padding: 0 10px
    }

    .calendar {
        padding: 11px
    }

    .calendar-grid {
        gap: 2px
    }

    .day {
        min-height: 64px;
        padding: 4px;
        border-radius: 5px
    }

    .event-pill {
        font-size: 9px;
        padding: 2px 4px;
    }

    .cat-icon {
        width: 10px;
        height: 10px;
        margin-right: 2px;
    }

    .toolbar h1 {
        font-size: 18px
    }

    .weekday {
        font-size: 10px
    }

    .form-grid {
        grid-template-columns: 1fr
    }
}