/* Medha Calendar - shared by the Hub popup, Mailbox, /holidays and Space.
   Colours come from each host's theme tokens (neutral fallbacks), so it
   matches the host in light and dark mode; layout is identical everywhere. */
.mc {
  --mc-surface: var(--surface, #fff);
  --mc-soft: color-mix(in srgb, var(--text, #0f172a) 3.5%, var(--mc-surface));
  --mc-text: var(--text, #0f172a);
  --mc-muted: var(--text-secondary, var(--text-muted, #64748b));
  --mc-line: color-mix(in srgb, var(--text, #0f172a) 9%, var(--mc-surface));
  --mc-brand: var(--brand-solid, var(--brand-solid-bright, var(--brand, #ce0505)));
  --mc-on-brand: var(--text-on-brand, #fff);
  --k-holiday: #d97706; --k-event: #2563eb; --k-other: #0d9488; --k-birthday: #db2777; --k-zimbra: var(--mc-brand); --k-space: #7c3aed;
  position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden;
  color: var(--mc-text); background: var(--mc-surface);
  font: 14px/1.4 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.mc *, .mc *::before, .mc *::after { box-sizing: border-box; }
.mc button { font: inherit; color: inherit; }
.mc svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* header */
.mc-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: clamp(16px, 2.4vw, 28px) clamp(16px, 2.6vw, 32px) 14px; flex: none; }
.mc-month { margin: 0; font-size: clamp(20px, 2.2vw, 26px); font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.mc-actions { display: flex; align-items: center; gap: 10px; }
.mc-arrows { display: inline-flex; gap: 4px; }
.mc-icon-btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--mc-muted); cursor: pointer; transition: background .15s, color .15s; }
.mc-icon-btn:hover { background: var(--mc-soft); color: var(--mc-text); }
.mc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 18px; border: 1px solid var(--mc-line); border-radius: 999px; background: var(--mc-surface); color: var(--mc-text); font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s; }
.mc-btn:hover { background: var(--mc-soft); }
.mc-btn--primary { border-color: var(--mc-brand); background: var(--mc-brand); color: var(--mc-on-brand); }
.mc-btn--primary:hover { background: var(--mc-brand); filter: brightness(1.07); }
.mc-btn--primary svg { width: 16px; height: 16px; }
.mc-btn--danger { color: #dc2626; }
.mc-add { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: var(--mc-brand); color: var(--mc-on-brand); cursor: pointer; box-shadow: 0 6px 16px color-mix(in srgb, var(--mc-brand) 28%, transparent); transition: transform .15s; }
.mc-add:hover { transform: scale(1.05); }

/* filters */
.mc-filters { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 0 clamp(16px, 2.6vw, 32px) 16px; flex: none; }
.mc-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--mc-soft); }
.mc-seg button { height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--mc-muted); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.mc-seg button.is-on { background: var(--mc-surface); color: var(--mc-text); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.mc-tags { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.mc-tag { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 2px; border: 0; background: none; color: var(--mc-muted); font-size: 12.5px; font-weight: 600; cursor: pointer; opacity: .45; transition: opacity .15s; }
.mc-tag.is-on { opacity: 1; color: var(--mc-text); }
.mc-tag i { width: 9px; height: 9px; border-radius: 3px; background: var(--k); }
.mc-tag--holiday { --k: var(--k-holiday); } .mc-tag--event { --k: var(--k-event); } .mc-tag--birthday { --k: var(--k-birthday); } .mc-tag--other { --k: var(--k-other); } .mc-tag--meeting { --k: var(--k-space); }
.mc-notice { margin: 0 clamp(16px, 2.6vw, 32px) 12px; padding: 9px 14px; border-radius: 10px; background: var(--mc-soft); color: var(--mc-muted); font-size: 12.5px; }

/* grid: hairline cells that always fill the space they're given */
.mc-body { flex: 1; min-height: 0; display: flex; }
.mc-grid { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 0 clamp(8px, 1.6vw, 20px) clamp(8px, 1.6vw, 20px); }
.mc-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); flex: none; border-bottom: 1px solid var(--mc-line); }
.mc-weekdays span { padding: 0 12px 10px; color: var(--mc-muted); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.mc-weeks { flex: 1; min-height: 0; display: grid; grid-template-rows: repeat(var(--mc-weeks, 6), minmax(0, 1fr)); }
.mc-week { position: relative; min-height: 0; border-bottom: 1px solid var(--mc-line); }
.mc-week:last-child { border-bottom: 0; }
.mc-days { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mc-day { display: flex; align-items: flex-start; justify-content: flex-start; min-width: 0; padding: 6px 8px; border: 0; border-right: 1px solid var(--mc-line); background: transparent; cursor: pointer; text-align: left; transition: background .15s; }
.mc-day:last-child { border-right: 0; }
.mc-day:hover { background: var(--mc-soft); }
.mc-day.is-weekend { background: color-mix(in srgb, var(--mc-soft) 55%, transparent); }
.mc-day.is-out .mc-num { color: color-mix(in srgb, var(--mc-muted) 55%, transparent); }
.mc-day.is-today { background: color-mix(in srgb, var(--mc-brand) 7%, var(--mc-surface)); }
.mc-day.is-selected { background: color-mix(in srgb, var(--mc-brand) 5%, var(--mc-surface)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--mc-brand) 45%, transparent); }
.mc-num { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.mc-day.is-today .mc-num { background: var(--mc-brand); color: var(--mc-on-brand); font-weight: 700; }

/* event bars: one continuous bar per event per week */
.mc-bars { position: absolute; left: 0; right: 0; top: 32px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 21px; row-gap: 3px; pointer-events: none; }
.mc-bar { --k: var(--k-event); pointer-events: auto; display: flex; align-items: center; gap: 5px; min-width: 0; height: 21px; margin: 0 6px; padding: 0 8px; border: 0; border-radius: 6px; background: color-mix(in srgb, var(--k) 15%, var(--mc-surface)); color: color-mix(in srgb, var(--k) 55%, var(--mc-text)); font-size: 12px; font-weight: 600; text-align: left; cursor: pointer; overflow: hidden; transition: filter .15s; }
.mc-bar::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--k); }
.mc-bar.cont-l::before { display: none; }
.mc-bar.is-multi { background: color-mix(in srgb, var(--k) 22%, var(--mc-surface)); }
.mc-bar.cont-l { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.mc-bar.cont-r { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.mc-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-bar b { flex: none; font-weight: 600; opacity: .75; }
.mc-bar:hover { filter: brightness(.95); }
.mc-more { pointer-events: auto; margin: 0 6px; padding: 0 8px; border: 0; background: none; color: var(--mc-muted); font-size: 11.5px; font-weight: 700; text-align: left; cursor: pointer; }
.mc-more:hover { color: var(--mc-text); }
.mc-k-holiday { --k: var(--k-holiday); } .mc-k-event { --k: var(--k-event); } .mc-k-other { --k: var(--k-other); } .mc-k-birthday { --k: var(--k-birthday); } .mc-k-zimbra { --k: var(--k-zimbra); } .mc-k-space { --k: var(--k-space); }

/* side list - /holidays only */
.mc-agenda { flex: none; width: clamp(260px, 25vw, 330px); display: flex; flex-direction: column; min-height: 0; padding: 4px 22px 18px; border-left: 1px solid var(--mc-line); }
.mc-agenda-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.mc-agenda-head h4 { margin: 3px 0 0; font-size: 17px; font-weight: 700; }
.mc-eyebrow { margin: 0; color: var(--mc-brand); font-size: 10.5px; font-weight: 700; letter-spacing: .12em; }
.mc-link { border: 0; background: none; color: var(--mc-brand); font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.mc-agenda-list, .mc-day-list { display: flex; flex-direction: column; gap: 6px; }
.mc-agenda-list { flex: 1; min-height: 0; overflow-y: auto; }
.mc-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 12px; background: var(--mc-soft); text-align: left; cursor: pointer; transition: background .15s; }
.mc-item:hover { background: color-mix(in srgb, var(--k) 10%, var(--mc-surface)); }
.mc-item-date { flex: none; display: grid; justify-items: center; width: 40px; padding: 5px 0; border-radius: 9px; background: var(--mc-surface); line-height: 1.1; }
.mc-item-date b { font-size: 15px; } .mc-item-date small { font-size: 9.5px; font-weight: 700; text-transform: uppercase; color: var(--mc-muted); }
.mc-item-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.mc-item-copy strong { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-item-copy small { color: var(--mc-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-pill { flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: color-mix(in srgb, var(--k) 15%, var(--mc-surface)); color: color-mix(in srgb, var(--k) 70%, var(--mc-text)); font-size: 11px; font-weight: 700; white-space: nowrap; }
.mc-empty { margin: 0; padding: 26px 12px; border-radius: 12px; background: var(--mc-soft); color: var(--mc-muted); font-size: 13px; text-align: center; }

/* sheets: day, event detail, add */
.mc-layer { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .32); backdrop-filter: blur(5px); animation: mc-fade .15s ease; }
.mc-layer[hidden] { display: none; }
.mc-sheet { width: min(480px, 100%); max-height: 100%; overflow-y: auto; padding: 26px; border-radius: 22px; background: var(--mc-surface); box-shadow: 0 30px 80px rgba(15, 23, 42, .25); animation: mc-rise .18s ease; }
@keyframes mc-fade { from { opacity: 0; } } @keyframes mc-rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.mc-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.mc-sheet-head h3 { margin: 6px 0 0; font-size: 20px; font-weight: 700; letter-spacing: -.015em; }
.mc-sheet-head p { margin: 4px 0 0; color: var(--mc-muted); font-size: 13px; }
.mc-detail { display: grid; gap: 14px; }
.mc-drow { display: flex; gap: 12px; font-size: 14px; } .mc-drow > span:first-child { flex: none; width: 20px; text-align: center; }
.mc-drow a, .mc-desc a { color: var(--mc-brand); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.mc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-chip { padding: 4px 10px; border-radius: 999px; background: var(--mc-soft); font-size: 12px; font-weight: 600; }
.mc-desc { padding: 14px 16px; border-radius: 14px; background: var(--mc-soft); font-size: 13.5px; line-height: 1.6; overflow-wrap: anywhere; }
.mc-files h5 { margin: 0 0 8px; color: var(--mc-muted); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.mc-file { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--mc-soft); font-size: 13px; }
.mc-file + .mc-file { margin-top: 6px; } .mc-file > span:last-child { display: flex; gap: 6px; } .mc-file .mc-btn { height: 30px; padding: 0 12px; font-size: 12px; }
.mc-form { display: grid; gap: 16px; }
.mc-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
.mc-form label[hidden], .mc-row[hidden] { display: none; }
.mc-form input:not([type="checkbox"]), .mc-form select { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--mc-line); border-radius: 12px; background: var(--mc-surface); color: var(--mc-text); font: inherit; font-size: 14.5px; outline: 0; transition: border-color .15s, box-shadow .15s; }
.mc-form input:focus, .mc-form select:focus { border-color: var(--mc-brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mc-brand) 14%, transparent); }
.mc-row { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.mc-check { display: flex !important; align-items: center; gap: 9px; cursor: pointer; } .mc-check input { width: 16px; height: 16px; accent-color: var(--mc-brand); }
.mc-optional { color: var(--mc-muted); font-weight: 400; }
.mc-form-msg { margin: 0; min-height: 1em; color: #dc2626; font-size: 12.5px; }
.mc-form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.mc-form .mc-form-actions { margin-top: 0; }

/* modal host (Hub popup, Mailbox) */
.mc-modal { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: clamp(0px, 2vw, 28px); background: rgba(15, 23, 42, .45); backdrop-filter: blur(5px); }
.mc-modal[hidden] { display: none; }
.mc-modal-card { width: min(1320px, 100%); height: min(920px, 100%); overflow: hidden; border-radius: 22px; background: var(--surface, #fff); box-shadow: 0 30px 90px rgba(15, 23, 42, .35); }
html.mc-modal-open { overflow: hidden; }

@media (max-width: 900px) {
  .mc-body.has-agenda { flex-direction: column; overflow-y: auto; }
  .mc-body.has-agenda .mc-grid { flex: none; height: min(78dvh, 640px); }
  .mc-agenda { width: 100%; border-left: 0; border-top: 1px solid var(--mc-line); padding-top: 16px; }
  .mc-agenda-list { overflow: visible; }
}
@media (max-width: 600px) {
  .mc-toolbar { padding: 14px 12px 10px; gap: 8px; }
  .mc-filters { padding: 0 12px 12px; } .mc-tags { gap: 2px 10px; } .mc-seg button { padding: 0 10px; }
  .mc-actions { gap: 4px; } .mc-btn { padding: 0 12px; height: 34px; } .mc-icon-btn, .mc-add { width: 34px; height: 34px; }
  .mc-grid { padding: 0 4px 6px; }
  .mc-weekdays span { padding: 0 0 8px; text-align: center; font-size: 10.5px; }
  .mc-day { justify-content: center; padding: 3px 2px; } .mc-num { min-width: 22px; height: 22px; font-size: 12px; }
  .mc-bars { top: 24px; grid-auto-rows: 16px; row-gap: 2px; }
  .mc-bar { height: 16px; margin: 0 2px; padding: 0 4px; border-radius: 4px; font-size: 9.5px; } .mc-bar::before, .mc-bar b { display: none; }
  .mc-more { margin: 0 2px; padding: 0 2px; font-size: 9.5px; }
  .mc-modal-card { border-radius: 0; }
  .mc-sheet { padding: 20px; border-radius: 18px; }
}
.mc-sheet-tools { display: flex; align-items: center; gap: 6px; }
/* Multi-day bars: label always centred across the days the bar covers. */
.mc-bar.is-multi { justify-content: center; text-align: center; }
.mc-bar.is-multi span { flex: 0 1 auto; }
