/* Office Rotation Scheduler — ported from the prototype's styles.css into the CRM.
 * Everything is namespaced under .rot-* so nothing collides with the CRM. Uses the
 * global styles.css custom props (with hard fallbacks, same convention as the other
 * pages). The page owns its own vertical scroll; the month grid scrolls horizontally
 * inside its own container so wide months are never clipped. Blue = B3, green = B4. */

.rot-page {
  --rot-accent: #f5a623;
  --rot-accent-dark: #d4791a;
  --rot-blue: #3b82f6;
  --rot-border: var(--border-color, #e5e7eb);
  --rot-text: var(--text-primary, #1a1a1a);
  --rot-text-2: var(--text-secondary, #444);
  --rot-text-mut: var(--text-muted, #666);
  --rot-surface: var(--card-bg, #fff);
  --rot-shadow: 0 2px 12px rgba(0, 0, 0, .08);
  --rot-shadow-sm: 0 1px 3px rgba(0, 0, 0, .06);
  --rot-radius-md: 8px;
  --rot-radius-lg: 12px;

  /* pill colours */
  --rot-b3-bg: #dbeafe; --rot-b3-fg: #1e40af; --rot-b3-br: #bfdbfe;
  --rot-b4-bg: #dcfce7; --rot-b4-fg: #166534; --rot-b4-br: #bbf7d0;
  --rot-shoot-bg: #166534; --rot-shoot-fg: #fff;
  --rot-event-bg: #22c55e; --rot-event-fg: #fff;
  --rot-leave-bg: #fef3c7; --rot-leave-fg: #92400e; --rot-leave-br: #fde68a;
  --rot-bday-bg: #fce7f3; --rot-bday-fg: #be185d; --rot-bday-br: #fbcfe8;
  /* Public holiday is SOLID pink so it reads as a hard "office closed" state and
     is never mistaken for the pale-pink birthday chip next to it. */
  --rot-holiday-bg: #db2777; --rot-holiday-fg: #fff; --rot-holiday-br: #be185d;
  --rot-holiday-col-bg: #fdf2f8; --rot-holiday-col-fg: #be185d;
  --rot-weekend-bg: #eef4ea;

  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  color: var(--rot-text);
  font-size: 14px;
}

/* ── header ─────────────────────────────────────────────────────────────────── */
.rot-head { display: flex; flex-direction: column; gap: 4px; }
.rot-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: var(--rot-text); }
.rot-sub-lead { font-size: 13px; color: var(--rot-text-mut); max-width: 78ch; line-height: 1.45; }

/* ── internal sub-tabs ──────────────────────────────────────────────────────── */
.rot-subtabs { display: flex; gap: 6px; border-bottom: 1px solid var(--rot-border); padding-bottom: 0; }
.rot-subtab {
  border: none; background: transparent; padding: 9px 18px; border-radius: 10px 10px 0 0;
  font-weight: 600; color: var(--rot-text-2); font-family: inherit; font-size: 14px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.rot-subtab:hover { background: rgba(0, 0, 0, .04); }
.rot-subtab.active { color: var(--rot-accent-dark); border-bottom-color: var(--rot-accent); }

.rot-content { display: block; }

/* ── buttons ────────────────────────────────────────────────────────────────── */
.rot-btn {
  border: 1px solid var(--rot-border); background: #fff; color: var(--rot-text);
  padding: 8px 14px; border-radius: 10px; font-weight: 600; box-shadow: var(--rot-shadow-sm);
  font-family: inherit; font-size: 13px; cursor: pointer;
}
.rot-btn:hover { background: #f7f8fa; }
.rot-btn.rot-primary { background: linear-gradient(to top, var(--rot-accent), var(--rot-accent-dark)); color: #fff; border: none; }
.rot-btn.rot-primary:hover { filter: brightness(1.04); }
.rot-btn.rot-ghost { box-shadow: none; background: transparent; }
.rot-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── loading / error ────────────────────────────────────────────────────────── */
.rot-loading { padding: 22px 4px; font-size: 13px; color: var(--rot-text-mut); }
.rot-error { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 22px; }
.rot-error-msg { font-size: 13.5px; color: var(--rot-text-2); }

/* ── schedule toolbar ───────────────────────────────────────────────────────── */
.rot-sched-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.rot-month-nav { display: flex; align-items: center; gap: 8px; }
.rot-month-label { font-weight: 700; font-size: 18px; min-width: 160px; text-align: center; }
.rot-sched-toolbar .rot-spacer { flex: 1; }
.rot-toolbar-hint { color: var(--rot-text-mut); font-size: 12px; display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ── schedule grid ──────────────────────────────────────────────────────────── */
.rot-sched-card {
  background: #fff; border: 1px solid var(--rot-border); border-radius: var(--rot-radius-lg);
  box-shadow: var(--rot-shadow); overflow: hidden; position: relative;
}
.rot-sched-scroll { overflow-x: auto; overflow-y: visible; }
table.rot-sched { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; }
.rot-sched th, .rot-sched td { border-right: 1px solid var(--rot-border); border-bottom: 1px solid var(--rot-border); padding: 0; text-align: center; }
.rot-sched thead th { background: #f8f9fb; font-weight: 700; }

.rot-sched .rot-wk-band { color: #fff; font-size: 13px; letter-spacing: .3px; padding: 6px 4px; }
.rot-sched .rot-wk-band.rot-w-a { background: #4f9d5d; }
.rot-sched .rot-wk-band.rot-w-b { background: #3f8f8a; }
.rot-sched .rot-date-num { padding: 5px 6px; font-size: 12px; color: var(--rot-text); font-weight: 700; min-width: 74px; }
.rot-sched .rot-weekday { padding: 3px 6px 6px; font-size: 11px; color: var(--rot-text-mut); font-weight: 600; }

/* sticky name column */
.rot-sched .rot-name-col {
  position: sticky; left: 0; z-index: 5; background: #fff; text-align: left; padding: 6px 10px;
  font-weight: 600; min-width: 130px; box-shadow: 1px 0 0 var(--rot-border);
}
.rot-sched thead .rot-name-col { background: #f1f3f6; z-index: 6; }
.rot-sched tbody tr:hover .rot-name-col { background: #f6f8fc; }
.rot-sched tbody tr:hover td { background: #f6f8fc; }

.rot-sched th.rot-weekend, .rot-sched td.rot-weekend { background: var(--rot-weekend-bg); }

.rot-sched td.rot-cell { height: 30px; padding: 3px 5px; cursor: pointer; position: relative; }
.rot-sched td.rot-cell:hover { outline: 2px solid rgba(59, 130, 246, .25); outline-offset: -2px; }

.rot-empty-row { padding: 22px 12px !important; text-align: center !important; color: var(--rot-text-mut); font-size: 13px; }

/* team grouping (#180 / #166) — a banded header row per department. Its day
   cells carry that team's in-office headcount, so "who in Design is in" is a
   number on one row instead of a column of pills to count. */
.rot-sched tbody tr.rot-group-row td {
  background: #eef2f7; font-weight: 700; font-size: 11px; color: var(--rot-text-2);
  padding: 4px 6px; border-top: 2px solid var(--rot-border);
}
.rot-sched tbody tr.rot-group-row .rot-group-name {
  display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: .5px;
}
/* The name column is sticky, so its background is set on the cell itself —
   the row rule above is painted behind it and would show through. */
.rot-sched tbody tr.rot-group-row td.rot-name-col { background: #e7ecf3; }
.rot-sched tbody tr.rot-group-row:hover td,
.rot-sched tbody tr.rot-group-row:hover td.rot-name-col { background: #e7ecf3; }
.rot-group-count {
  background: rgba(0, 0, 0, .08); border-radius: 999px; padding: 1px 7px;
  font-size: 10px; letter-spacing: 0; font-weight: 700;
}
.rot-sort-select {
  border: 1px solid var(--rot-border); border-radius: 6px; padding: 3px 6px;
  font-size: 12px; font-family: inherit; background: #fff; color: var(--rot-text);
}

/* pills */
.rot-pill {
  display: inline-block; width: 100%; max-width: 100%; border-radius: 12px; padding: 3px 8px;
  font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rot-pill.b3 { background: var(--rot-b3-bg); color: var(--rot-b3-fg); border: 1px solid var(--rot-b3-br); }
.rot-pill.b4 { background: var(--rot-b4-bg); color: var(--rot-b4-fg); border: 1px solid var(--rot-b4-br); }
.rot-pill.shoot { background: var(--rot-shoot-bg); color: var(--rot-shoot-fg); }
.rot-pill.event { background: var(--rot-event-bg); color: var(--rot-event-fg); }
.rot-pill.leave { background: var(--rot-leave-bg); color: var(--rot-leave-fg); border: 1px solid var(--rot-leave-br); }
.rot-pill.birthday { background: var(--rot-bday-bg); color: var(--rot-bday-fg); border: 1px solid var(--rot-bday-br); }
.rot-pill.holiday { background: var(--rot-holiday-bg); color: var(--rot-holiday-fg); border: 1px solid var(--rot-holiday-br); }

/* Public-holiday date column — tinted end to end (header, cells, totals) so the
   closed day reads as one vertical band rather than a row of stray pink pills. */
.rot-sched th.rot-holiday-col,
.rot-sched td.rot-holiday-col { background: var(--rot-holiday-col-bg); }
.rot-sched th.rot-date-num.rot-holiday-col { color: var(--rot-holiday-col-fg); }
.rot-holiday-tag {
  display: block; margin-top: 2px; font-size: 9px; font-weight: 700; line-height: 1.1;
  letter-spacing: .01em; color: var(--rot-holiday-col-fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  /* Hard px cap, NOT max-width:100% — a nowrap block inside a table header sizes
     the column to its own text, which stretched the holiday column to 111px next
     to 75px neighbours. 62px is the 74px min-width minus the th's 6px padding, so
     the day lines up with every other column and the full name lives on the
     title tooltip. */
  max-width: 62px;
}

.rot-slot-empty { display: inline-block; width: 100%; height: 18px; border-radius: 10px; background: #eef0f3; }
.rot-sched td.rot-weekend .rot-slot-empty { background: #e2ebdd; }
.rot-bday-dot { position: absolute; top: 2px; right: 4px; font-size: 10px; }

/* totals footer */
.rot-sched tfoot td { background: #fbfbfc; font-weight: 700; font-size: 12px; padding: 5px 6px; }
.rot-sched tfoot tr.rot-total-both td { background: #fdf1e0; }
.rot-sched tfoot .rot-name-col { background: #f1f3f6; }

/* cell edit dropdown */
.rot-cell-menu {
  position: absolute; z-index: 60; background: #fff; border: 1px solid var(--rot-border);
  border-radius: 10px; box-shadow: var(--rot-shadow); padding: 4px; min-width: 130px;
}
.rot-cell-menu button {
  display: block; width: 100%; text-align: left; border: none; background: none;
  padding: 6px 10px; border-radius: 8px; font-size: 12px; font-family: inherit; cursor: pointer;
}
.rot-cell-menu button:hover { background: #f2f4f7; }

/* ── settings ───────────────────────────────────────────────────────────────── */
.rot-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.rot-panel {
  background: #fff; border: 1px solid var(--rot-border); border-radius: var(--rot-radius-lg);
  box-shadow: var(--rot-shadow); padding: 16px; position: relative;
}
.rot-panel-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.rot-sub { color: var(--rot-text-mut); font-size: 12px; margin: 0 0 12px; }
.rot-master-prompt {
  width: 100%; min-height: 340px; resize: vertical; border: 1px solid var(--rot-border);
  border-radius: var(--rot-radius-md); padding: 12px; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12.5px; line-height: 1.5; color: var(--rot-text); box-sizing: border-box;
}
.rot-master-prompt:focus { outline: 2px solid rgba(245, 166, 35, .4); border-color: var(--rot-accent); }

.rot-mp-clear { align-self: flex-start; margin: 2px 0 8px; font-size: 12px; padding: 5px 10px; }

/* purple "change" boxes */
.rot-mp-updates { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.rot-mp-updates:empty { display: none; }
.rot-mp-update {
  background: #f5f0ff; border: 1px solid #d8c7f5; border-left: 4px solid #7c3aed;
  border-radius: 10px; padding: 9px 12px; font-size: 12.5px; color: #4c1d95; line-height: 1.45;
  animation: rot-mpIn .22s ease;
}
.rot-mp-update .rot-mp-head {
  display: flex; justify-content: space-between; align-items: center; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .4px; color: #7c3aed; font-weight: 700; margin-bottom: 3px;
}
.rot-mp-update .rot-mp-time { color: #9575cd; font-weight: 600; }
@keyframes rot-mpIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* chat pane */
.rot-chat { display: flex; flex-direction: column; height: 420px; }
.rot-chat-log { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.rot-msg { max-width: 85%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; white-space: pre-wrap; }
.rot-msg.user { align-self: flex-end; background: var(--rot-blue); color: #fff; border-bottom-right-radius: 4px; }
.rot-msg.assistant { align-self: flex-start; background: #f1f3f6; color: var(--rot-text); border-bottom-left-radius: 4px; }
.rot-msg.pending { opacity: .6; font-style: italic; }
.rot-chat-input { border-top: 1px solid var(--rot-border); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.rot-chat-attachments { display: flex; gap: 6px; flex-wrap: wrap; }
.rot-chat-attachments:empty { display: none; }
.rot-chat-row { display: flex; gap: 8px; align-items: flex-end; }
.rot-chat-row textarea {
  flex: 1; resize: none; min-height: 40px; max-height: 120px; padding: 9px 12px;
  border: 1px solid var(--rot-border); border-radius: 12px; font-family: inherit; font-size: 13px; box-sizing: border-box;
}
.rot-icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--rot-border); background: #fff;
  display: grid; place-items: center; font-size: 16px; cursor: pointer; flex: none;
}
.rot-icon-btn:hover { background: #f5f6f8; }
.rot-icon-btn:disabled { opacity: .5; cursor: not-allowed; }
.rot-icon-btn.rec { background: #ef4444; color: #fff; border-color: #ef4444; animation: rot-pulse 1s infinite; }
@keyframes rot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* voice note chip */
.rot-voice-note {
  display: inline-flex; align-items: center; gap: 8px; position: relative;
  background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 999px; padding: 5px 10px 5px 8px;
  font-size: 12px; color: #3730a3; max-width: 260px;
}
.rot-voice-note .rot-vn-play {
  border: none; background: #4f46e5; color: #fff; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; cursor: pointer; flex: none;
}
.rot-voice-note .rot-vn-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }
.rot-voice-note .rot-vn-txt.empty { color: #6366f1; font-style: normal; }
.rot-voice-note .rot-rm {
  position: absolute; top: -6px; right: -6px; background: #ef4444; color: #fff; border: none;
  border-radius: 50%; width: 18px; height: 18px; font-size: 11px; line-height: 1; cursor: pointer;
}
.rot-rec-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #ef4444; font-weight: 600; }
.rot-rec-indicator .rot-rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; animation: rot-pulse 1s infinite; }

/* employees editor */
.rot-emp-panel { margin-top: 16px; }
.rot-emp-wrap { overflow-x: auto; }
.rot-emp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rot-emp-table th, .rot-emp-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--rot-border); }
.rot-emp-table th { color: var(--rot-text-mut); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.rot-emp-table select { border: 1px solid var(--rot-border); border-radius: 6px; padding: 4px 6px; font-size: 12px; font-family: inherit; }
.rot-emp-table .rot-off-row { opacity: .5; }
.rot-chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef0f3; color: var(--rot-text-2); display: inline-block; }
.rot-emp-footer { display: flex; gap: 10px; margin-top: 12px; }

/* desk capacity inputs under the department-cohesion table (#165) */
.rot-cap-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.rot-cap-label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--rot-text-mut); font-weight: 700; }
.rot-cap-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--rot-text-2); }
.rot-cap-field input {
  width: 90px; border: 1px solid var(--rot-border); border-radius: 6px; padding: 4px 6px;
  font-size: 12px; font-family: inherit; background: #fff; color: var(--rot-text);
}

/* spinner + overlay */
.rot-spinner {
  width: 16px; height: 16px; border: 2px solid rgba(0, 0, 0, .15); border-top-color: var(--rot-accent);
  border-radius: 50%; animation: rot-spin .7s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes rot-spin { to { transform: rotate(360deg); } }
.rot-loading-overlay {
  position: absolute; inset: 0; z-index: 25; border-radius: inherit;
  background: rgba(255, 255, 255, .62); backdrop-filter: blur(1.5px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  animation: rot-fade .15s ease;
}
@keyframes rot-fade { from { opacity: 0; } to { opacity: 1; } }
.rot-loading-overlay .rot-spinner-lg {
  width: 36px; height: 36px; border: 3px solid rgba(0, 0, 0, .12); border-top-color: var(--rot-accent);
  border-radius: 50%; animation: rot-spin .7s linear infinite;
}
.rot-loading-overlay .rot-lo-label { font-size: 13px; font-weight: 600; color: var(--rot-text-2); }

/* connection dot */
.rot-conn { font-size: 12px; color: var(--rot-text-mut); display: flex; align-items: center; gap: 6px; }
.rot-conn .rot-dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.rot-conn .rot-dot.ok { background: #22c55e; }
.rot-conn .rot-dot.bad { background: #ef4444; }

/* toast (local — CRM has no global one) */
.rot-toast {
  position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 60px);
  background: #1a1a1a; color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 13px;
  box-shadow: var(--rot-shadow); opacity: 0; transition: all .25s ease; z-index: 4000; pointer-events: none;
}
.rot-toast.show { transform: translate(-50%, 0); opacity: 1; }
.rot-toast.error { background: #b91c1c; }
.rot-toast.success { background: #166534; }

/* ── responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .rot-page { padding: 14px; }
  .rot-settings-grid { grid-template-columns: 1fr; }
  .rot-month-label { min-width: 120px; font-size: 16px; }
  .rot-chat { height: 360px; }
}

/* ── #134 dark mode overrides ─────────────────────────────── */
/* theme.css already flips the whole --rot-* token block on .rot-page, so the
   pills, shadows and accents follow automatically. Only the rules written with
   bare literals are repeated here. */
html[data-theme="dark"] .rot-subtab:hover { background: rgba(255, 255, 255, 0.06); }

html[data-theme="dark"] .rot-btn { background: #1e293b; }
html[data-theme="dark"] .rot-btn:hover { background: #334155; }
html[data-theme="dark"] .rot-btn.rot-ghost { background: transparent; }

/* schedule grid */
html[data-theme="dark"] .rot-sched-card,
html[data-theme="dark"] .rot-panel,
html[data-theme="dark"] .rot-cell-menu { background: #1e293b; }
html[data-theme="dark"] .rot-sched thead th,
html[data-theme="dark"] .rot-sched thead .rot-name-col,
html[data-theme="dark"] .rot-sched tfoot td,
html[data-theme="dark"] .rot-sched tfoot .rot-name-col { background: #273449; }
html[data-theme="dark"] .rot-sched .rot-name-col { background: #1e293b; }
html[data-theme="dark"] .rot-sched tbody tr:hover .rot-name-col,
html[data-theme="dark"] .rot-sched tbody tr:hover td { background: #334155; }
html[data-theme="dark"] .rot-sched td.rot-cell:hover { outline-color: rgba(96, 165, 250, 0.45); }
html[data-theme="dark"] .rot-sched tfoot tr.rot-total-both td { background: rgba(245, 166, 35, 0.14); }

/* Holiday column: the light tint is a near-white pink and disappears on dark, so
   the band is re-cut as a translucent pink wash over the dark surface. It is
   listed after the thead/tfoot rules above so it wins on the header cells too. */
html[data-theme="dark"] .rot-page { --rot-holiday-col-bg: rgba(219, 39, 119, 0.16); --rot-holiday-col-fg: #f9a8d4; }
html[data-theme="dark"] .rot-sched th.rot-holiday-col,
html[data-theme="dark"] .rot-sched td.rot-holiday-col { background: var(--rot-holiday-col-bg); }

html[data-theme="dark"] .rot-slot-empty { background: rgba(148, 163, 184, 0.10); }
html[data-theme="dark"] .rot-sched td.rot-weekend .rot-slot-empty { background: rgba(148, 163, 184, 0.18); }

html[data-theme="dark"] .rot-cell-menu button { color: var(--rot-text); }
html[data-theme="dark"] .rot-cell-menu button:hover { background: #334155; }

/* form controls — these carry no background of their own, so they are set
   explicitly rather than left to the UA field colour. */
html[data-theme="dark"] .rot-master-prompt,
html[data-theme="dark"] .rot-chat-row textarea,
html[data-theme="dark"] .rot-emp-table select,
html[data-theme="dark"] .rot-sort-select,
html[data-theme="dark"] .rot-cap-field input {
  background: #0f172a;
  color: var(--rot-text);
}

/* team-group banding — the light greys read as white-on-white here */
html[data-theme="dark"] .rot-sched tbody tr.rot-group-row td,
html[data-theme="dark"] .rot-sched tbody tr.rot-group-row td.rot-name-col,
html[data-theme="dark"] .rot-sched tbody tr.rot-group-row:hover td,
html[data-theme="dark"] .rot-sched tbody tr.rot-group-row:hover td.rot-name-col { background: #2c3a52; }
html[data-theme="dark"] .rot-group-count { background: rgba(255, 255, 255, 0.12); }
html[data-theme="dark"] .rot-master-prompt::placeholder,
html[data-theme="dark"] .rot-chat-row textarea::placeholder { color: #64748b; }

/* the purple "change" boxes */
html[data-theme="dark"] .rot-mp-update {
  background: rgba(124, 58, 237, 0.14);
  border-color: rgba(167, 139, 250, 0.34);
  border-left-color: #a78bfa;
  color: #ddd6fe;
}
html[data-theme="dark"] .rot-mp-update .rot-mp-head { color: #c4b5fd; }
html[data-theme="dark"] .rot-mp-update .rot-mp-time { color: #a78bfa; }

/* chat */
html[data-theme="dark"] .rot-msg.assistant { background: #273449; }
html[data-theme="dark"] .rot-icon-btn { background: #1e293b; }
html[data-theme="dark"] .rot-icon-btn:hover { background: #334155; }

html[data-theme="dark"] .rot-voice-note {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(165, 180, 252, 0.32);
  color: #c7d2fe;
}
html[data-theme="dark"] .rot-voice-note .rot-vn-txt.empty { color: #a5b4fc; }

html[data-theme="dark"] .rot-chip { background: rgba(148, 163, 184, 0.16); }

/* spinner + overlay flip polarity: a black ring / white wash both vanish here */
html[data-theme="dark"] .rot-spinner { border-color: rgba(255, 255, 255, 0.18); border-top-color: var(--rot-accent); }
html[data-theme="dark"] .rot-loading-overlay .rot-spinner-lg { border-color: rgba(255, 255, 255, 0.16); border-top-color: var(--rot-accent); }
html[data-theme="dark"] .rot-loading-overlay { background: rgba(15, 23, 42, 0.66); }

html[data-theme="dark"] .rot-toast { background: #334155; }

/* ── view-only mode ──────────────────────────────────────────────────────────
   Non-managers (everyone outside the rotation allowlist) get the same grid with
   every write affordance removed. The controls are not rendered at all — this
   only strips the *hints* that a cell is clickable and marks the read-only
   fields, so nothing looks interactive that isn't. */
.rot-page.rot-readonly .rot-sched td.rot-cell,
.rot-sched td.rot-cell.rot-cell-locked { cursor: default; }
.rot-page.rot-readonly .rot-sched td.rot-cell:hover,
.rot-sched td.rot-cell.rot-cell-locked:hover { outline: none; }

.rot-viewonly-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(148, 163, 184, 0.16); border: 1px solid var(--rot-border);
  color: var(--rot-text-mut); font-size: 12px; font-weight: 600; white-space: nowrap;
}
/* A team lead CAN write, just not everywhere (#189) — tinted with the page
   accent so it doesn't read as the grey "you can do nothing" badge. */
.rot-viewonly-badge.rot-scope-badge {
  background: rgba(245, 166, 35, 0.14);
  border-color: rgba(245, 166, 35, 0.42);
  color: var(--rot-accent-dark);
}

/* Rules chat is absent for view-only users, so the prompt panel spans the row. */
.rot-settings-grid.rot-settings-grid-single { grid-template-columns: 1fr; }

.rot-readonly-field { background: rgba(148, 163, 184, 0.08); cursor: default; }
.rot-readonly-field:focus { outline: none; border-color: var(--rot-border); }

.rot-page.rot-readonly .rot-emp-table input[type="checkbox"],
.rot-page.rot-readonly .rot-emp-table select { cursor: default; opacity: .75; }

html[data-theme="dark"] .rot-viewonly-badge { background: rgba(148, 163, 184, 0.16); }
html[data-theme="dark"] .rot-readonly-field { background: rgba(148, 163, 184, 0.10); }
