/* ============================================================
   Ceremony calendar (Appointment ▸ Calendar)

   The row colours are the legacy rptmgt-calbycer4 palette — the office reads
   this board by colour, so 禮堂 stays cyan, 法式 stays blue, 外出 teal, 文件
   sky, 會議 green, 可排期 pale, unavailable charcoal. Each chip uses the legacy
   hue as a left accent + tint, with readable ink instead of the legacy
   red-on-blue.
   ============================================================ */

.cal-page {
    padding: 22px 26px 32px;
}

/* ---------- head ---------- */

.cal-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.cal-head h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 0;
}

.cal-head .sub {
    color: var(--ink-3);
    font-size: 13.5px;
    margin-top: 3px;
}

.cal-earliest {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.cal-earliest .lbl {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-3);
    font-weight: 700;
}

.cal-earliest .val {
    font-size: 15px;
    font-weight: 700;
    color: var(--brand);
}

/* ---------- toolbar ---------- */

.cal-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 12px 14px;
    margin-bottom: 10px;
}

.cal-spacer {
    flex: 1;
}

.cal-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cal-month {
    font-size: 19px;
    font-weight: 700;
    min-width: 150px;
    text-align: center;
}

.cal-iconbtn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    cursor: pointer;
    transition: border-color .15s, color .15s, transform .1s;
}

.cal-iconbtn:hover {
    border-color: var(--brand-2);
    color: var(--brand);
}

.cal-iconbtn:active {
    transform: scale(.93);
}

.cal-btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}

.cal-btn:hover {
    border-color: var(--brand-2);
    color: var(--brand);
}

.cal-btn.ghost {
    border-style: dashed;
}

.cal-picker {
    max-width: 150px;
}

/* ---------- NIM colour filter ---------- */

.cal-colorbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 10px 14px;
    margin-bottom: 14px;
}

.cal-colorbar-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-3);
    font-weight: 700;
    margin-right: 4px;
}

.cal-colorbar-label small {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    opacity: .75;
}

.cal-swatch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 5px 11px 5px 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
    transition: opacity .15s, border-color .15s;
}

.cal-swatch .sw {
    width: 14px;
    height: 14px;
    border-radius: 5px;
    border: 1px solid rgba(0, 0, 0, .18);
}

.cal-swatch.off {
    opacity: .38;
    border-style: dashed;
}

.cal-swatch:hover {
    border-color: var(--brand-2);
}

/* ---------- grid ---------- */

.cal-grid-wrap {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.cal-dows {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: #056799;
}

.cal-dows .dow {
    text-align: center;
    padding: 9px 4px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.cal-dows .dow.sun {
    color: #ffc9c9;
}

.cal-dows .dow.sat {
    color: #b8f4ff;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cal-cell {
    border-right: 1px solid var(--line-2);
    border-bottom: 1px solid var(--line-2);
    min-height: 108px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cal-cell:nth-child(7n) {
    border-right: 0;
}

.cal-cell.blank {
    background: #f6f3f6;
}

/* Legacy shades the days closest to now so the office sees what is about to run. */
.cal-cell.hl-urgent {
    background: #ffd6d6;
}

.cal-cell.hl-soon {
    background: #ffeeee;
}

.cal-daynum {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: #056799;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.cal-daynum.holiday {
    background: #d95c5c;
}

.cal-daynum.special {
    background: #800080;
}

.cal-daynum.sat {
    background: #0a5f80;
}

.cal-daynum .n {
    min-width: 20px;
    text-align: center;
    border-radius: 6px;
}

.cal-daynum .today {
    font-size: 9px;
    letter-spacing: .06em;
    background: rgba(255, 255, 255, .22);
    border-radius: 999px;
    padding: 1px 7px;
}

.cal-daynum .badge {
    margin-left: auto;
    font-size: 9.5px;
    font-weight: 700;
    background: rgba(255, 255, 255, .22);
    border-radius: 999px;
    padding: 1px 7px;
}

.cal-cellbody {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
    min-width: 0;
}

/* ---------- chips ---------- */

.cal-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    padding: 3px 6px;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 5px;
    background: #f1eef1;
    color: var(--ink-2);
    cursor: pointer;
    min-width: 0;
    transition: filter .12s, transform .1s;
}

.cal-chip.flat {
    cursor: default;
}

.cal-chip:not(.flat):hover {
    filter: brightness(.96);
    transform: translateX(1px);
}

.cal-chip .t {
    font-variant-numeric: tabular-nums;
    flex: none;
    opacity: .85;
}

.cal-chip .l {
    flex: none;
}

.cal-chip .r {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: .9;
}

.cal-chip .sur {
    flex: none;
    font-size: 10px;
    background: rgba(0, 0, 0, .08);
    border-radius: 999px;
    padding: 0 5px;
}

/* NIM status square carried over from the legacy two-cell swatch. */
.cal-chip .nim {
    flex: none;
    width: 9px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, .2);
}

/* Time-of-day tint on the clock, as in the legacy font colours. */
.cal-chip.b-am .t { color: #00706f; }
.cal-chip.b-pm .t { color: #c25100; }
.cal-chip.b-night .t { color: #2323c4; }

.cal-chip.k-hall       { background: #ddf8f8; border-left-color: #00b6bb; color: #075356; }
.cal-chip.k-french     { background: #e3e3fa; border-left-color: #2323c4; color: #1c1c85; }
.cal-chip.k-outside    { background: #dcefef; border-left-color: #008888; color: #045a5a; }
.cal-chip.k-document   { background: #e3f2fd; border-left-color: #4bb4f0; color: #0e5c8a; }
.cal-chip.k-meeting    { background: #e9f7d9; border-left-color: #74c22e; color: #3a6416; }
.cal-chip.k-ce         { background: #f6eef4; border-left-color: #8a0b71; color: #5e0a4e; }
.cal-chip.k-slot       { background: #f4fafd; border-left-color: #99ddee; color: #7d8f98; font-weight: 500; }
.cal-chip.k-slot .t    { color: #7d8f98; }

.cal-chip.k-workshop {
    background: #004488;
    border-left-color: #002a55;
    color: #fff;
}

.cal-chip.k-unavailable {
    background: #444444;
    border-left-color: #222;
    color: #fff;
}

/* ---------- legend ---------- */

.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding: 14px 4px 0;
    font-size: 12px;
    color: var(--ink-2);
}

.cal-legend .lg {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
}

.cal-legend .lg b {
    background: var(--brand-tint);
    color: var(--brand);
    border-radius: 999px;
    padding: 0 7px;
    font-size: 11px;
}

.cal-legend .sw {
    width: 13px;
    height: 13px;
    border-radius: 4px;
    border-left: 3px solid transparent;
}

.cal-legend .sw.k-hall       { background: #ddf8f8; border-left-color: #00b6bb; }
.cal-legend .sw.k-french     { background: #e3e3fa; border-left-color: #2323c4; }
.cal-legend .sw.k-outside    { background: #dcefef; border-left-color: #008888; }
.cal-legend .sw.k-document   { background: #e3f2fd; border-left-color: #4bb4f0; }
.cal-legend .sw.k-meeting    { background: #e9f7d9; border-left-color: #74c22e; }
.cal-legend .sw.k-ce         { background: #f6eef4; border-left-color: #8a0b71; }
.cal-legend .sw.k-slot       { background: #f4fafd; border-left-color: #99ddee; }
.cal-legend .sw.k-workshop   { background: #004488; border-left-color: #002a55; }
.cal-legend .sw.k-unavailable { background: #444; border-left-color: #222; }

@media (max-width: 1100px) {
    .cal-page { padding: 18px 14px 26px; }
    .cal-cell { min-height: 92px; }
    .cal-chip { font-size: 10px; }
}
