/* ================================================================
   DIARY · UNIFIED CALENDAR  (redesign, Batch 1 — 2026-07-31)
   One slim toolbar + colour-coded entry timeline (Day/Week/Month/
   Agenda). Neutrals reuse the app design-system tokens; only the
   four semantic entry-type accents are local. Everything is scoped
   under #module-calendar so it can't leak into other modules.
   Class prefix: .dcal-*   (the .diary-rail drawer is untouched)
================================================================ */

#module-calendar {
  /* The unified calendar is a full-bleed workspace — lift the app's
     80rem .module content cap (and its auto side-margins) so the week
     grid uses the whole window, matching the design reference. Other
     modules keep the cap. */
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  /* Entry-type accents — the soul of the redesign. */
  --c-court:    #b23b4e;
  --c-meet:     #2f5aa8;
  --c-task:     #15803d;
  --c-deadline: #b45309;
  --c-other:    var(--ink-4);
  /* Local aliases onto the app palette so the ported design CSS
     reads cleanly. */
  --dcal-line:  var(--paper-edge);
  --dcal-card-line: var(--line-soft);
  --dcal-gold:  var(--gold-line);
}

/* The stream container hosts the calendar views; it must fill the
   pane and let each view manage its own internal scroll. */
#module-calendar .diary-stream {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  gap: 0;
}

/* ── Slim toolbar ─────────────────────────────────────────────── */
.dcal-toolbar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  flex-wrap: wrap;                 /* wrap on narrow rather than clip */
  overflow: visible;               /* let Add/options popovers escape */
  padding: 0.15rem 0.1rem 0.55rem;
}
.dcal-vr { width: 1px; height: 24px; background: var(--dcal-card-line); flex-shrink: 0; }
.dcal-tb-spacer { flex: 1; min-width: 0.5rem; }

/* Segmented control (tabs + view switch) */
.dcal-seg {
  display: inline-flex; align-items: center;
  background: var(--paper-3);
  border: 1.3px solid var(--line);
  border-radius: 11px; padding: 3px; gap: 2px; flex-shrink: 0;
}
.dcal-seg-btn {
  border: 0; background: transparent; color: var(--ink-4);
  font: inherit; font-weight: 600; font-size: 0.82rem;
  padding: 0.36rem 0.62rem; border-radius: 8px;
  white-space: nowrap; cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.dcal-seg-btn:hover { color: var(--ink-2); }
.dcal-seg-btn[data-active="1"] {
  background: var(--paper-2); color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 700;
}
.dcal-seg.dark .dcal-seg-btn[data-active="1"] {
  background: var(--ink); color: #fff; box-shadow: none;
}

/* Icon button + today pill */
.dcal-icon {
  width: 32px; height: 32px; border-radius: 9px;
  border: 1.3px solid var(--line); background: var(--paper-2);
  color: var(--ink-3); display: inline-flex; align-items: center;
  justify-content: center; flex-shrink: 0; cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.dcal-icon:hover { background: var(--paper-3); color: var(--ink); border-color: var(--ink-3); }
.dcal-icon[data-active="1"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.dcal-period {
  font-weight: 600; color: var(--ink-2); font-size: 0.84rem;
  text-align: center; white-space: nowrap; padding: 0 0.3rem;
  min-width: 8.5rem; font-variant-numeric: tabular-nums;
}
.dcal-today {
  display: inline-flex; align-items: center; gap: 0.38rem;
  border: 1.3px solid var(--line); background: var(--paper-2);
  color: var(--ink-2); border-radius: 9px; padding: 0.38rem 0.62rem;
  font: inherit; font-weight: 600; font-size: 0.8rem; white-space: nowrap;
  cursor: pointer; flex-shrink: 0;
}
.dcal-today:hover { background: var(--paper-3); }
.dcal-today-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--c-task); }

/* Buttons */
.dcal-btn {
  display: inline-flex; align-items: center; gap: 0.42rem;
  border: 1.3px solid var(--line); background: var(--paper-2);
  color: var(--ink-2); border-radius: 10px; padding: 0.46rem 0.72rem;
  font: inherit; font-weight: 600; font-size: 0.82rem;
  white-space: nowrap; flex-shrink: 0; cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.dcal-btn:hover { background: var(--paper-3); border-color: var(--ink-3); }
.dcal-btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.dcal-btn.primary:hover { background: #2e2a23; border-color: #2e2a23; }
.dcal-btn svg { width: 15px; height: 15px; }

/* Filter chips + colour key dot */
.dcal-chips { display: inline-flex; align-items: center; gap: 0.3rem; flex-shrink: 0; }
.dcal-chip {
  display: inline-flex; align-items: center; gap: 0.34rem;
  padding: 0.18rem 0.55rem; border-radius: 999px;
  background: var(--paper-2); border: 1.2px solid var(--line);
  color: var(--ink-4); font: inherit; font-size: 0.76rem; font-weight: 600;
  white-space: nowrap; cursor: pointer; line-height: 1.5;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.dcal-chip:hover { border-color: var(--ink-3); }
.dcal-chip .dcal-dot { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }
.dcal-chip[data-active="1"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.dcal-chip[data-active="1"] .dcal-dot { outline: 1px solid rgba(255,255,255,.6); }
.dcal-linkbtn {
  border: 0; background: transparent; padding: 0; cursor: pointer;
  color: var(--ink-4); font: inherit; font-size: 0.76rem; font-weight: 600;
}
.dcal-linkbtn:hover { color: var(--ink); text-decoration: underline; }

/* Popover */
.dcal-popwrap { position: relative; display: inline-flex; flex-shrink: 0; }
.dcal-pop {
  position: absolute; z-index: 120; top: calc(100% + 6px); right: 0;
  min-width: 220px; background: var(--paper-2);
  border: 1px solid var(--dcal-card-line); border-radius: 12px;
  box-shadow: var(--shadow-pop); padding: 4px;
}
.dcal-pop.hidden { display: none; }
.dcal-pop-row {
  display: flex; align-items: center; gap: 0.55rem; width: 100%;
  border: 0; background: transparent; border-radius: 8px;
  padding: 0.5rem 0.6rem; font: inherit; font-size: 0.82rem; font-weight: 600;
  color: var(--ink-2); text-align: left; white-space: nowrap; cursor: pointer;
  transition: background var(--dur-fast);
}
.dcal-pop-row:hover { background: var(--paper-3); }
.dcal-pop-row svg { color: var(--ink-4); flex-shrink: 0; width: 16px; height: 16px; }
.dcal-pop-divider { border-top: 1px solid var(--dcal-card-line); margin: 0.3rem 0; }
.dcal-pop-label {
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.07em;
  color: var(--ink-5); padding: 0.4rem 0.6rem 0.3rem; text-transform: uppercase;
}
.dcal-pop-key { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem 0.5rem; padding: 0 0.6rem 0.4rem; }
.dcal-pop-key span { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.76rem; color: var(--ink-3); }
.dcal-pop-key i { width: 9px; height: 9px; border-radius: 3px; }

/* Switch (view-options) */
.dcal-switch {
  width: 36px; height: 21px; border-radius: 999px; border: 0;
  background: var(--line); position: relative; flex-shrink: 0; cursor: pointer;
  transition: background var(--dur-fast);
}
.dcal-switch[data-on="1"] { background: var(--ink); }
.dcal-switch::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px;
  width: 16px; height: 16px; border-radius: 999px; background: #fff;
  transition: left var(--dur-fast);
}
.dcal-switch[data-on="1"]::after { left: 18px; }

/* ── View body ────────────────────────────────────────────────── */
.dcal-body {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  gap: 0.6rem; overflow: hidden;
}
.dcal-nudge {
  display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0;
  background: var(--paper-2); border: 1px solid var(--dcal-card-line);
  border-radius: 11px; box-shadow: inset 2.5px 0 0 var(--dcal-gold);
  padding: 0.55rem 0.85rem;
}
.dcal-nudge-text { font-size: 0.82rem; color: var(--ink-3); line-height: 1.45; flex: 1; }
.dcal-nudge-text strong { color: var(--ink-2); }

/* Columns (week) */
.dcal-week {
  flex: 1; min-height: 0; display: grid; gap: 0.5rem;
}
.dcal-col {
  border: 1px solid var(--dcal-card-line); border-radius: 12px;
  background: var(--paper-2); display: flex; flex-direction: column;
  overflow: hidden; min-height: 0;
}
.dcal-col[data-today="1"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.dcal-colhead {
  display: flex; align-items: baseline; gap: 0.4rem; flex-shrink: 0;
  padding: 0.5rem 0.6rem 0.45rem; border-bottom: 1px solid var(--dcal-card-line);
}
.dcal-colhead .dow { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.07em; color: var(--ink-5); }
.dcal-colhead[data-today="1"] .dow { color: var(--ink); }
.dcal-colhead .date { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 600; color: var(--ink-3); line-height: 1; }
.dcal-colhead[data-today="1"] .date { color: var(--ink); }
.dcal-colhead .grow { flex: 1; }
.dcal-colhead .count { font-size: 0.72rem; color: var(--ink-5); font-weight: 600; }
.dcal-colhead .todaylbl { font-size: 0.6rem; font-weight: 800; letter-spacing: 0.06em; color: var(--ink); }
.dcal-colbody {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.4rem; padding: 0.45rem;
}
.dcal-colbody::-webkit-scrollbar { width: 6px; }
.dcal-colbody::-webkit-scrollbar-thumb { background: rgba(0,0,0,.13); border-radius: 99px; }

/* Add-in-column pill */
.dcal-add {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 0.3rem;
  border: 1.2px dashed var(--dcal-card-line); background: transparent;
  color: var(--ink-5); border-radius: 999px; padding: 0.26rem 0.65rem;
  font: inherit; font-size: 0.72rem; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.dcal-add:hover { color: var(--ink-3); border-color: var(--line); background: var(--paper-3); }
.dcal-add.ghost { opacity: 0; padding: 0.26rem 0.5rem; }
.dcal-col:hover .dcal-add.ghost, .dcal-colbody:focus-within .dcal-add.ghost { opacity: 1; }

/* ── Entry card ───────────────────────────────────────────────── */
.dcal-card {
  display: flex; flex-direction: column; gap: 0.28rem;
  width: 100%; min-width: 0; overflow: hidden; overflow-wrap: anywhere;
  text-align: left; background: var(--paper-2);
  border: 1px solid var(--dcal-card-line); border-left: 3px solid var(--line);
  border-radius: 9px; padding: 0.5rem 0.55rem; flex-shrink: 0; cursor: pointer;
  font: inherit;
  transition: box-shadow var(--dur-fast), transform var(--dur-fast), border-color var(--dur-fast);
}
.dcal-card:hover { box-shadow: 0 4px 14px rgba(20,30,28,.1); transform: translateY(-1px); }
.dcal-card[data-past="1"] { background: var(--paper); }
.dcal-card-top { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.dcal-card-time { font-size: 0.72rem; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.dcal-card-dot { display: inline-flex; flex-shrink: 0; }
.dcal-card-dot svg { width: 9px; height: 9px; }
.dcal-check {
  width: 15px; height: 15px; border-radius: 4px; border: 1.6px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff; background: transparent; cursor: pointer;
}
.dcal-check[data-done="1"] { color: #fff; }
.dcal-check svg { width: 11px; height: 11px; }
.dcal-card-title {
  font-size: 0.83rem; font-weight: 600; color: var(--ink-2); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.dcal-card[data-done="1"] .dcal-card-title { text-decoration: line-through; text-decoration-color: var(--ink-5); }
.dcal-card.dense .dcal-card-title { -webkit-line-clamp: 2; font-size: 0.78rem; }
.dcal-card-case {
  font-size: 0.72rem; color: var(--ink-4); font-family: var(--font-serif);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dcal-card-meta {
  display: flex; align-items: center; gap: 0.3rem; color: var(--ink-5); font-size: 0.72rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dcal-card-meta svg { width: 12px; height: 12px; flex-shrink: 0; }
.dcal-card-foot { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

/* Avatars */
.dcal-avstack { display: inline-flex; align-items: center; }
.dcal-av {
  border-radius: 999px; color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 0 0 2px var(--paper-2);
}
.dcal-av.ext { background: transparent !important; }
.dcal-avmore { font-size: 0.72rem; color: var(--ink-4); font-weight: 600; margin-left: 4px; }

/* Status pill inside card */
.dcal-stat {
  margin-left: auto; display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.14rem 0.48rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600;
  background: var(--paper-2); border: 1.2px solid var(--line); color: var(--ink-4);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.dcal-stat.ai   { color: var(--gold-deep); border-color: var(--gold-soft); }
.dcal-stat.ok   { color: var(--ok); border-color: #a8cdb4; }
.dcal-stat.warn { color: var(--warn); border-color: #e0c19a; }
.dcal-stat.live { color: var(--c-court); border-color: #e2b6bd; }
.dcal-stat .dcal-dot2 { width: 6px; height: 6px; border-radius: 999px; background: currentColor; flex-shrink: 0; }
.dcal-live-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--c-court); animation: dcalpulse 1.6s ease-in-out infinite; flex-shrink: 0; }
@keyframes dcalpulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ── Day view ─────────────────────────────────────────────────── */
.dcal-day {
  flex: 1; min-height: 0; border: 1px solid var(--dcal-card-line);
  border-radius: 12px; background: var(--paper-2); display: flex; flex-direction: column; overflow: hidden;
}
.dcal-day[data-today="1"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.dcal-day-head {
  display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0;
  padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--dcal-card-line);
}
.dcal-day-head .title { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; color: var(--ink); }
.dcal-day-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 56px 1fr; overflow-y: auto; }
.dcal-day-hours { position: relative; min-height: 620px; }
.dcal-day-hour { position: absolute; right: 8px; transform: translateY(-50%); font-size: 0.66rem; color: var(--ink-5); font-weight: 600; }
.dcal-day-track { position: relative; border-left: 1px solid var(--dcal-card-line); min-height: 620px; }
.dcal-day-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-soft); }
.dcal-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--c-court); z-index: 4; }
.dcal-now::before { content: ""; position: absolute; left: -5px; top: -5px; width: 9px; height: 9px; border-radius: 999px; background: var(--c-court); }
.dcal-day-ev { position: absolute; left: 0.5rem; right: 0.5rem; max-width: 620px; }

/* ── Month view ───────────────────────────────────────────────── */
.dcal-month { flex: 1; min-height: 0; border: 1px solid var(--dcal-card-line); border-radius: 12px; background: var(--paper-2); display: flex; flex-direction: column; overflow: hidden; }
.dcal-month-dow { display: grid; grid-template-columns: repeat(7,1fr); border-bottom: 1px solid var(--dcal-card-line); flex-shrink: 0; }
.dcal-month-dow span { padding: 0.45rem 0.6rem; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.07em; color: var(--ink-5); }
.dcal-month-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7,1fr); grid-auto-rows: 1fr; overflow-y: auto; }
.dcal-mcell { border-right: 1px solid var(--dcal-card-line); border-bottom: 1px solid var(--dcal-card-line); padding: 0.3rem 0.35rem; display: flex; flex-direction: column; gap: 0.2rem; min-height: 0; overflow: hidden; cursor: pointer; }
.dcal-mcell:nth-child(7n) { border-right: 0; }
.dcal-mcell[data-today="1"] { background: var(--paper-3); }
.dcal-mcell[data-blank="1"] { cursor: default; background: var(--paper); }
.dcal-mcell:hover:not([data-blank="1"]) { background: var(--paper-3); }
.dcal-mnum { font-size: 0.72rem; font-weight: 600; color: var(--ink-4); }
.dcal-mcell[data-today="1"] .dcal-mnum { font-weight: 800; color: var(--ink); }
.dcal-mini {
  display: block; width: 100%; text-align: left; border: 0; border-left: 2.5px solid var(--line);
  background: var(--paper); border-radius: 4px; padding: 0.14rem 0.3rem; font: inherit;
  font-size: 0.66rem; color: var(--ink-3); line-height: 1.35; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; cursor: pointer; flex-shrink: 0;
}
.dcal-mini:hover { background: var(--paper-3); }
.dcal-mini b { font-weight: 700; }
.dcal-mmore { font-size: 0.62rem; color: var(--ink-5); padding-left: 0.2rem; font-weight: 600; }

/* ── Agenda view ──────────────────────────────────────────────── */
.dcal-agenda { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; padding-right: 0.25rem; }
.dcal-agenda-sec {}
.dcal-agenda-head { display: flex; align-items: baseline; gap: 0.55rem; margin-bottom: 0.5rem; }
.dcal-agenda-head .day { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 600; color: var(--ink-3); }
.dcal-agenda-head[data-today="1"] .day { color: var(--ink); }
.dcal-agenda-head .rule { flex: 1; height: 1px; background: var(--dcal-card-line); }
.dcal-agenda-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 0.5rem; }

/* ── Meetings tab (Batch 1 — coming-up list) ──────────────────── */
.dcal-meet { flex: 1; min-height: 0; overflow-y: auto; padding: 0.25rem 0.1rem 1.5rem; }
.dcal-meet-inner { max-width: 74rem; display: flex; flex-direction: column; gap: 1.25rem; }
.dcal-seclabel { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.5rem; }
.dcal-seclabel span { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-5); }
.dcal-seclabel .rule { flex: 1; height: 1px; background: var(--dcal-card-line); }

.dcal-empty {
  border: 1px solid var(--dcal-card-line); border-radius: 12px; background: var(--paper-2);
  padding: 2rem; text-align: center; color: var(--ink-4); font-size: 0.85rem; line-height: 1.5;
}

/* Meetings-tab search row */
.dcal-meet-searchrow { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.dcal-search {
  display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 15rem; max-width: 30rem;
  background: var(--paper-2); border: 1.3px solid var(--line); border-radius: 10px;
  padding: 0.5rem 0.7rem; color: var(--ink-4);
}
.dcal-search svg { width: 16px; height: 16px; flex-shrink: 0; }
.dcal-search input { flex: 1; border: 0; background: transparent; outline: none; font: inherit; font-size: 0.85rem; color: var(--ink-2); min-width: 0; }
.dcal-search input::placeholder { color: var(--ink-5); }
.dcal-search-clear { border: 0; background: transparent; color: var(--ink-5); cursor: pointer; font-size: 0.8rem; padding: 0 0.2rem; }
.dcal-search-clear:hover { color: var(--ink-2); }

/* Archive panel + rows */
.dcal-panel { border: 1px solid var(--dcal-card-line); border-radius: 12px; background: var(--paper-2); padding: 0.3rem; }
.dcal-mrow {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  background: transparent; border: 0; border-radius: 9px; padding: 0.6rem 0.7rem;
  text-align: left; cursor: pointer; font: inherit; transition: background var(--dur-fast);
}
.dcal-mrow + .dcal-mrow { border-top: 1px solid var(--line-soft); }
.dcal-mrow:hover { background: var(--paper-3); }
.dcal-mrow-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; flex: 1; }
.dcal-mrow-title { font-size: 0.9rem; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcal-mrow-case { font-size: 0.76rem; color: var(--ink-4); font-family: var(--font-serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcal-mrow-when { font-size: 0.78rem; color: var(--ink-4); width: 8rem; flex-shrink: 0; }
.dcal-mrow-mode { font-size: 0.78rem; color: var(--ink-4); width: 6.5rem; flex-shrink: 0; }
.dcal-mrow-dur  { font-size: 0.78rem; color: var(--ink-4); width: 4rem; flex-shrink: 0; font-weight: 600; }
.dcal-mrow-people { width: 5.5rem; flex-shrink: 0; display: flex; }
.dcal-mrow-stat { width: 6rem; flex-shrink: 0; display: flex; justify-content: flex-end; }
.dcal-mrow-chev { color: var(--ink-5); display: inline-flex; flex-shrink: 0; }
.dcal-mrow-chev svg { width: 16px; height: 16px; }
@media (max-width: 900px) {
  .dcal-mrow-when, .dcal-mrow-mode, .dcal-mrow-dur, .dcal-mrow-people { display: none; }
}

/* Transcript search results */
.dcal-meet-count { font-size: 0.8rem; color: var(--ink-4); font-weight: 600; margin-bottom: 0.6rem; }
.dcal-hitcard { border: 1px solid var(--dcal-card-line); border-radius: 12px; background: var(--paper-2); padding: 0.85rem 1rem; margin-bottom: 0.6rem; }
.dcal-hitcard-title { font-size: 0.9rem; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 0.3rem; }
.dcal-hitcard-title svg { width: 13px; height: 13px; }
.dcal-hitcard-meta { font-size: 0.75rem; color: var(--ink-4); margin-bottom: 0.5rem; }
.dcal-hit-summary { margin-bottom: 0.5rem; padding-left: 0.7rem; border-left: 2px solid var(--gold-line); }
.dcal-hit-lbl { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em; color: var(--gold-deep); margin-bottom: 2px; text-transform: uppercase; }
.dcal-hit-summary > div:last-child { font-size: 0.82rem; color: var(--ink-3); line-height: 1.5; }
.dcal-hit { display: flex; align-items: flex-start; gap: 0.55rem; width: 100%; border: 0; background: transparent; border-radius: 8px; padding: 0.35rem 0.4rem; text-align: left; cursor: pointer; font: inherit; }
.dcal-hit:hover { background: var(--paper-3); }
.dcal-hit-t { font-size: 0.7rem; color: var(--ink-5); font-weight: 700; flex-shrink: 0; padding-top: 1px; font-variant-numeric: tabular-nums; }
.dcal-hit-txt { font-size: 0.82rem; color: var(--ink-3); line-height: 1.5; }
.dcal-mark { background: var(--gold-wash, #f5ecd6); color: var(--ink); border-radius: 3px; padding: 0 1px; }

/* Send-Lex modal */
.dcal-sendlex .label { margin-bottom: 0.3rem; }
.dcal-sl-ai {
  margin-top: 1rem; background: var(--paper-2); border: 1px solid var(--dcal-card-line);
  border-radius: 11px; box-shadow: inset 2.5px 0 0 var(--gold-line); padding: 0.75rem 0.9rem;
}
.dcal-sl-ai-lbl {
  display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.66rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 0.4rem;
}
.dcal-sl-ai-lbl svg { width: 14px; height: 14px; }
.dcal-sl-ai ul { margin: 0; padding-left: 1.1rem; font-size: 0.83rem; color: var(--ink-3); line-height: 1.7; }

/* ── Entry drawer cohesion ────────────────────────────────────── */
/* The rail detail drawer is a descendant of #module-calendar, so scope
   a light touch here to match its type chip to the new entry-card
   accents (pill + leading dot, sentence case). The rest of the drawer
   already matches the design language. */
#module-calendar .diary-rd-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border-radius: 999px; text-transform: none;
  font-size: 0.72rem; padding: 0.16rem 0.55rem; letter-spacing: 0;
}
#module-calendar .diary-rd-chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 999px;
  background: currentColor; flex-shrink: 0;
}
#module-calendar .diary-rd-chip.is-court   { background: var(--paper-2); color: var(--c-court); border-color: #e2b6bd; }
#module-calendar .diary-rd-chip.is-meeting { background: var(--paper-2); color: var(--c-meet);  border-color: #adc0dd; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .dcal-hide-narrow { display: none; }        /* icon-only buttons */
}

/* Tablet / small laptop — the week grid gets tight past ~5 columns. */
@media (max-width: 900px) {
  .dcal-toolbar { padding-bottom: 0.7rem; }
  .dcal-period { min-width: 6.5rem; }
}

/* Phone — the .module 1.5rem gutter is too fat; the 7-col week can't
   fit, so it becomes a horizontal-snap strip of day cards. Toolbar +
   meetings search go full-bleed and stack cleanly. */
@media (max-width: 768px) {
  #module-calendar { padding: 0.7rem !important; }
  .dcal-toolbar { gap: 0.4rem; row-gap: 0.5rem; }
  .dcal-week {
    grid-auto-flow: column;
    grid-auto-columns: 82%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .dcal-col { scroll-snap-align: start; }
  .dcal-day-grid { grid-template-columns: 44px 1fr; }
  .dcal-agenda-grid { grid-template-columns: 1fr; }
  /* Meetings tab: search takes the row, actions wrap below it. */
  .dcal-meet-searchrow { gap: 0.5rem; }
  .dcal-search { min-width: 100%; max-width: none; order: -1; }
  .dcal-meet { padding: 0.25rem 0 1.5rem; }
}

/* Narrow phone — give the swipeable day cards a touch more width and
   let the toolbar segments shrink their labels gracefully. */
@media (max-width: 560px) {
  .dcal-week { grid-auto-columns: 88%; }
  .dcal-seg-btn { padding: 0.34rem 0.5rem; font-size: 0.78rem; }
  .dcal-period { font-size: 0.8rem; min-width: 5.5rem; }
  .dcal-btn, .dcal-today { padding: 0.42rem 0.55rem; }
}
