/* ═══════════════════════════════════════════════════════════
   Company Calendar (SWHW-240)
   Page-scoped .cc-* styles. Colours come from the app.css
   tokens — no new hex values, no page-local palette.
   ═══════════════════════════════════════════════════════════ */

.cc-page { padding: 4px 0 24px; }

/* ── Header + controls ───────────────────────────────────── */
.cc-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
.cc-filter {
  font-family: var(--f); font-size: 13px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; min-width: 160px;
}
.cc-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.cc-segs {
  display: inline-flex; background: var(--bg-alt);
  border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px;
}
.cc-seg {
  font-family: var(--f); font-size: 13px; font-weight: 500; color: var(--muted);
  background: transparent; border: 0; border-radius: 6px;
  padding: 6px 14px; cursor: pointer;
}
.cc-seg:hover { color: var(--text); }
.cc-seg.active { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: var(--shadow); }

.cc-nav { display: flex; align-items: center; gap: 8px; }
.cc-navbtn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f); font-size: 13px; font-weight: 500; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; min-width: 34px; height: 32px;
}
.cc-navbtn:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-light); }
.cc-navbtn svg { width: 16px; height: 16px; }
.cc-today { padding: 6px 14px; }
.cc-range { font-size: 14px; font-weight: 600; color: var(--text-strong); margin-left: 6px; }

/* ── Grids ───────────────────────────────────────────────── */
.cc-weekgrid, .cc-monthgrid, .cc-monthhead {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px;
}
.cc-monthhead { margin-bottom: 8px; gap: 8px; }
.cc-mh {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: var(--muted); text-align: center; padding: 4px 0;
}
.cc-monthgrid { grid-auto-rows: minmax(96px, auto); }

.cc-day {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--r); padding: 10px; min-height: 150px;
  display: flex; flex-direction: column; gap: 8px;
}
.cc-monthgrid .cc-day { min-height: 0; padding: 8px; gap: 6px; }
.cc-day-today { border-color: var(--accent-border); box-shadow: 0 0 0 1px var(--accent-border) inset; }
.cc-day-dim { background: var(--canvas); }
.cc-day-dim .cc-daynum { color: var(--gray-text); }

.cc-dayhead { display: flex; align-items: baseline; gap: 6px; }
.cc-dayname { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.cc-daynum { font-size: 16px; font-weight: 700; color: var(--text-strong); }
.cc-day-today .cc-daynum { color: var(--accent); }
/* Month cells sit under the shared SUN..SAT header row, so their own day name is
   redundant — until the header is dropped on narrow screens (see the media query). */
.cc-monthgrid .cc-dayname { display: none; }
.cc-daybody { display: flex; flex-direction: column; gap: 6px; }
.cc-noevents { font-size: 12px; color: var(--gray-text); }
.cc-monthgrid .cc-noevents { display: none; }

/* ── Event chips ─────────────────────────────────────────── */
.cc-chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; line-height: 1.35;
  border: 1px solid var(--border); border-left-width: 3px;
  border-radius: 8px; padding: 6px 8px; background: var(--surface);
  color: var(--text); overflow: hidden;
}
.cc-chip span { overflow: hidden; text-overflow: ellipsis; }
.cc-chip svg { width: 13px; height: 13px; flex: 0 0 13px; }
.cc-chip-sm { font-size: 11px; padding: 4px 6px; white-space: nowrap; }

.cc-t-holiday     { background: var(--red-bg);    border-color: var(--red-border);    border-left-color: var(--red); }
.cc-t-pto         { background: var(--orange-bg); border-color: var(--orange-border); border-left-color: var(--orange); }
.cc-t-birthday    { background: var(--pink-bg);   border-color: var(--pink-border);   border-left-color: var(--pink); }
.cc-t-anniversary { background: var(--blue-bg);   border-color: var(--blue-border);   border-left-color: var(--blue); }

/* ── Today view ──────────────────────────────────────────── */
.cc-todaycard {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--r); padding: 16px;
  display: flex; flex-direction: column; gap: 18px;
}
.cc-tgroup { display: flex; flex-direction: column; gap: 6px; }
.cc-tgrouphead {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: transparent; border: 0;
  border-left: 3px solid var(--border); padding: 0 0 4px 8px;
}
.cc-tgrouphead svg { width: 14px; height: 14px; }

/* ── Legend ──────────────────────────────────────────────── */
.cc-legend {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--r);
}
.cc-leg { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.cc-dot { width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--border); }
.cc-dot.cc-t-holiday     { background: var(--red); border-color: var(--red); }
.cc-dot.cc-t-pto         { background: var(--orange); border-color: var(--orange); }
.cc-dot.cc-t-birthday    { background: var(--pink); border-color: var(--pink); }
.cc-dot.cc-t-anniversary { background: var(--blue); border-color: var(--blue); }

/* ── Notices, errors, empties ────────────────────────────── */
.cc-notice {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; color: var(--text-strong);
  background: var(--orange-bg); border: 1px solid var(--orange-border);
  border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px;
}
.cc-notice svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; color: var(--orange); }
.cc-notice code { font-size: 12px; }
.cc-error {
  font-size: 13px; color: var(--red);
  background: var(--red-bg); border: 1px solid var(--red-border);
  border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px;
}
.cc-empty { font-size: 14px; color: var(--muted); padding: 28px 4px; }

/* ── Contacts ────────────────────────────────────────────── */
.cc-search { position: relative; max-width: 380px; margin-bottom: 14px; }
.cc-search svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--gray-text);
}
.cc-search input {
  width: 100%; font-family: var(--f); font-size: 13px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px 8px 32px;
}
.cc-search input:focus { outline: none; border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-light); }

.cc-contacts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px;
}
.cc-contact {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--r); padding: 12px 14px;
}
.cc-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 38px;
  object-fit: cover; background: var(--bg-alt);
}
.cc-avatar-ph { display: inline-flex; align-items: center; justify-content: center; color: var(--gray-text); }
.cc-avatar-ph svg { width: 18px; height: 18px; }
.cc-cmain { flex: 1 1 auto; min-width: 0; }
.cc-cname { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.cc-csub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cc-cmeta {
  flex: 1 1 100%; display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--muted); margin-top: 8px;
}
.cc-cmeta span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.cc-cmeta svg { width: 13px; height: 13px; flex: 0 0 13px; color: var(--gray-text); }
.cc-cmeta a { color: var(--accent); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.cc-cmeta a:hover { text-decoration: underline; }

/* ── Narrow screens: the 7-column grids stop working ─────── */
@media (max-width: 900px) {
  .cc-weekgrid { grid-template-columns: 1fr; }
  .cc-weekgrid .cc-day { min-height: 0; }
  .cc-monthhead { display: none; }
  .cc-monthgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cc-monthgrid .cc-day-dim { display: none; }
  /* The column headers are gone, so each month cell has to name its own day. */
  .cc-monthgrid .cc-dayname { display: inline; }
}


/* ═══════════════════════════════════════════════════════════
   Manual company events (SWHW-247)
   Green completes the type palette (holiday red / PTO orange / birthday pink /
   anniversary blue) and reads as "scheduled, not personal".
   ═══════════════════════════════════════════════════════════ */
.cc-t-event { background: var(--green-bg); border-color: var(--green-border); border-left-color: var(--green); }
.cc-dot.cc-t-event { background: var(--green); border-color: var(--green); }

/* Only manual events are clickable — the cursor is the affordance, so it must not
   appear on the synced types that have nothing to open. */
.cc-chip-editable { cursor: pointer; }
.cc-chip-editable:hover { filter: brightness(0.97); border-left-width: 4px; }
.cc-chip-time { margin-left: auto; padding-left: 6px; font-size: 11px; opacity: .75; white-space: nowrap; }

.cc-addbtn { margin-left: auto; }

/* ── Add / edit dialog ───────────────────────────────────── */
.cc-form { display: flex; flex-direction: column; gap: 12px; min-width: 320px; }
.cc-f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text-strong); }
.cc-f em { font-weight: 400; font-style: normal; color: var(--muted); }
.cc-f input, .cc-f select, .cc-f textarea { font-weight: 400; }
.cc-f textarea { resize: vertical; font-family: inherit; }
/* Two-up on desktop, stacked on narrow screens — date pairs belong side by side. */
.cc-f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .cc-f-row { grid-template-columns: 1fr; } }
.cc-f-note { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }

/* Delete sits in the same action row as Save, so it needs to read as destructive
   without being the primary target. */
.cc-danger { color: var(--red); border-color: var(--red-border); }
.cc-danger:hover { background: var(--red-bg); }

/* ── On-call schedule (SWHW-248) ──────────────────────────── */
/* Purple sits apart from the four BambooHR types and the green company events —
   the rota is about reachability, not about time off. */
.cc-t-oncall { background: var(--accent-light); border-color: var(--accent-border); border-left-color: var(--accent); }
.cc-dot.cc-t-oncall { background: var(--accent); border-color: var(--accent); }

.cc-oncallbtn { margin-left: auto; }
/* When both buttons show, Add Event owns the right edge and On-call sits beside it. */
.cc-oncallbtn + .cc-addbtn { margin-left: 8px; }

.cc-oc-form { display: grid; grid-template-columns: 1.4fr 1fr 1.4fr auto; gap: 10px; align-items: end; margin-bottom: 14px; }
@media (max-width: 620px) { .cc-oc-form { grid-template-columns: 1fr; } }
.cc-oc-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.cc-oc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cc-oc-table th { text-align: left; padding: 8px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--bg); position: sticky; top: 0; }
.cc-oc-table td { padding: 8px 10px; border-top: 1px solid var(--border); }
.cc-oc-del { width: 40px; text-align: right; }
.cc-oc-none { text-align: center; color: var(--muted); padding: 18px 10px; }
.cc-oc-empty { padding: 10px 4px; }
.cc-oc-empty p { margin: 0 0 8px; }
.cc-oc-note { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); font-size: 12px; line-height: 1.5; color: var(--text); }
.cc-oc-note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--muted); }
