﻿/* mod-ops: Overview, Notifications, Calendar, Training Schedule, Announcements, Settings. Prefix: op-.
   Colors come from the shared variables only, so light and dark both keep 4.5:1 text contrast. */

/* ---------- event type colors (each pairs a background and a text color). Color is never the only cue: every chip, tag, and filter
   also carries the type's symbol, and the type's name is always in the text (see TYPE_ICON in mod-ops.js). Types 4 and 7 used to be two greens
   that looked alike, so the graduation ceremony is now a dark slate with light text and a gold edge (fixed palette colors, the same in both
   themes). --op-edge is the chip's left bar and the filter's border; it defaults to the text color. ---------- */
.op-t0 { --op-bg: var(--info-bg); --op-fg: var(--info); }
.op-t1 { --op-bg: var(--warn-bg); --op-fg: var(--warn); }
.op-t2 { --op-bg: var(--exam-bg); --op-fg: var(--exam); }
.op-t3 { --op-bg: var(--tag-volunteer-bg); --op-fg: var(--tag-volunteer); }
.op-t4 { --op-bg: var(--good-bg); --op-fg: var(--good-fg); }
.op-t5 { --op-bg: var(--gold); --op-fg: var(--navy); }
.op-t6 { --op-bg: var(--surface-2); --op-fg: var(--info); }
.op-t7 { --op-bg: var(--navy-3); --op-fg: var(--cream); --op-edge: var(--gold); }
.op-t8 { --op-bg: var(--bad-bg); --op-fg: var(--bad-fg); }
.op-tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; line-height: 1.5; background: var(--op-bg); color: var(--op-fg); max-width: 100%; overflow-wrap: anywhere; }
.op-tag svg { width: 12px; height: 12px; flex: none; }

/* a button that looks like a text link; long unbroken text (a web address in a title) wraps instead of pushing the page sideways */
.op-linkbtn { background: none; border: 0; padding: 0; margin: 0; font-weight: 700; text-align: left; cursor: pointer; color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; overflow-wrap: anywhere; max-width: 100%; }
.op-linkbtn:hover { text-decoration-color: var(--gold); }
.op-wrap { overflow-wrap: anywhere; }
.op-quiet { padding: 4px 0 8px; }
.op-pad { padding: 16px 20px; }
.op-time { white-space: nowrap; }

/* ---------- icon discs ---------- */
.op-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text); }
.op-ico.good { background: var(--good-bg); color: var(--good-fg); }
.op-ico.bad { background: var(--bad-bg); color: var(--bad-fg); }
.op-ico.review { background: var(--warn-bg); color: var(--warn); }
.op-ico.info { background: var(--info-bg); color: var(--info); }
.op-ico.exam { background: var(--exam-bg); color: var(--exam); }
.op-ico.gold { background: var(--gold); color: var(--navy); }

/* ---------- Overview ---------- */
.op-group-title { font-family: var(--font-body); font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; color: var(--muted); margin: 0 0 10px; }
.op-stats .op-kpis + .op-group-title { margin-top: 22px; }
.grid.kpis.op-k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.kpis.op-k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.op-kpi { text-decoration: none; color: inherit; transition: border-color 0.15s, transform 0.15s; }
/* a tile is a link only when the list it opens holds what it counts; a tile with no list to open is plain text and does not react to the pointer */
a.op-kpi:hover { border-color: var(--gold); }
.op-kpi:focus-visible { outline-offset: 3px; }
.op-attn { border-left: 4px solid var(--gold); }
.op-kpi .kpi-value { font-size: 44px; }
/* Recent activity and the notification center share the first row of the grid, Coming up and the phase bars the second (the page lists them in that
   order). A row is as tall as its taller card and both cards fill it, so no column is left with a blank stretch under it. */
.grid.split.op-two { align-items: stretch; }
/* Tiles in one row line their numbers up whether a label takes one line, two, or three. Each tile spans three rows of the grid (label, number,
   line under it) and shares them with its neighbours, so the tallest label in a row sets the height of the label row for every tile in it.
   The grid has no row gap of its own (a tile may not be split by one); each tile carries the 20px below it, and the grid takes the last one back. */
.grid.kpis.op-kpis { row-gap: 0; margin-bottom: -20px; }
.op-kpi { margin-bottom: 20px; }
@supports (grid-template-rows: subgrid) {
  .op-kpi { display: grid; grid-row: span 3; grid-template-rows: subgrid; gap: 0; align-content: start; }
  .op-kpi .kpi-value { margin-top: 6px; }
  .op-kpi .kpi-sub { margin-top: 4px; }
}
/* a browser without subgrid reserves two label lines instead, which is right at most widths */
@supports not (grid-template-rows: subgrid) {
  .op-kpi .kpi-label { min-height: 3em; }
}
@media (max-width: 1100px) {
  .grid.kpis.op-k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.kpis.op-k5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid.kpis.op-k5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.kpis.op-k4, .grid.kpis.op-k5 { column-gap: 12px; }
  .op-kpi { padding: 14px; margin-bottom: 12px; }
  .grid.kpis.op-kpis { margin-bottom: -12px; }
  .op-kpi .kpi-value { font-size: 34px; }
}
.op-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.op-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: var(--navy); font-size: 12px; font-weight: 800; }
.btn-primary .op-count { background: var(--navy); color: var(--gold); }
@media (max-width: 480px) { .op-actions .btn { flex: 1 1 100%; justify-content: flex-start; } }

.op-feed { list-style: none; margin: 0; padding: 0; }
.op-feed-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.op-feed-item:last-child { border-bottom: 0; }
.op-feed-main { min-width: 0; }
.op-feed-line { overflow-wrap: anywhere; }
.op-feed-sub { font-size: 14px; overflow-wrap: anywhere; }
.op-time { padding-top: 2px; }
@media (max-width: 520px) {
  .op-feed-item { grid-template-columns: 32px minmax(0, 1fr); padding: 12px 16px; }
  .op-feed-item .op-time { grid-column: 2; padding-top: 0; }
}
.op-nc .card-head { flex-wrap: wrap; }
.op-nc .card-head .row { gap: 6px; }
.op-center .op-sec-title { font-family: var(--font-body); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; margin: 4px 0 4px; }
.op-center .op-sec-title:not(:first-child) { margin-top: 18px; }
.op-more-link { display: inline-block; margin-top: 6px; font-weight: 600; font-size: 14px; }
.op-tasks { list-style: none; margin: 0; padding: 0; }
.op-task { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.op-task.op-unread { align-items: center; }
.op-tasks li:last-child > .op-task { border-bottom: 0; }
.op-task:hover .op-task-text { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.op-task .op-ico { width: 28px; height: 28px; }
.op-task-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* a task's sentence takes the whole row width, and the word for its kind sits under it, small, instead of beside it */
.op-task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.op-task-body .op-task-text { flex: none; max-width: 100%; }
.op-task .pill { flex: none; }
.op-tasks-full .op-task { padding: 12px 20px; }
.op-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--gold); }
.op-unread .op-task-text { font-weight: 700; }
.op-mini li { flex-wrap: wrap; }
.op-mini .grow { overflow-wrap: anywhere; }
.op-date { display: grid; place-items: center; width: 46px; height: 50px; flex: none; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; line-height: 1.1; }
.op-date b { font-family: var(--font-head); font-size: 19px; color: var(--text); font-weight: 600; }

/* ---------- Notifications ---------- */
.op-tabs .tabs { flex-wrap: wrap; }
@media (max-width: 560px) {
  .op-tabs .tabs a { flex: 1 1 0; min-width: 0; text-align: center; padding: 10px 4px; font-size: 13px; }
}
/* the list clips to the card's rounded bottom corners, so an unread last row (a filled background and a gold bar) cannot square them off */
.op-notes { list-style: none; margin: 0; padding: 0; overflow: hidden; border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px); }
.op-note { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.op-note:last-child { border-bottom: 0; }
.op-note-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 4px 0; }
.op-note-link:hover .op-task-text { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.op-note.op-unread { background: var(--hover); box-shadow: inset 4px 0 0 var(--gold); }
.op-note:not(.op-unread) .op-dot { background: transparent; border: 1px solid var(--line); }
.op-note .btn { flex: none; }
@media (max-width: 560px) {
  .op-note { flex-wrap: wrap; padding: 10px 16px; }
  .op-note-link { flex-basis: 100%; flex-wrap: wrap; }
  .op-note-link .op-time { flex-basis: 100%; padding-left: 22px; }
}

/* ---------- Calendar ---------- */
.op-cal-head { flex-wrap: wrap; }
.op-cal-nav { gap: 8px; }
.op-flip svg { transform: scaleX(-1); }
.op-cal-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.op-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.op-filter { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 3px 11px; min-height: 30px; font-size: 12px; font-weight: 700; cursor: pointer; }
.op-filter svg { width: 13px; height: 13px; flex: none; }
.op-filter.op-typed { background: var(--op-bg); color: var(--op-fg); border-color: var(--op-edge, var(--op-fg)); }
.op-filter[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 1px; }
.op-filter:not(.op-typed)[aria-pressed="true"] { background: var(--btn-dark); color: var(--btn-dark-fg); border-color: var(--btn-dark); }
.op-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.op-grid th { padding: 8px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); text-align: center; }
.op-cell { height: 112px; vertical-align: top; padding: 4px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.op-cell.op-out { background: var(--bg); }
.op-cell.op-out .op-daynum { color: var(--muted); }
.op-cell.op-today { background: var(--hover); box-shadow: inset 0 0 0 2px var(--gold); }
.op-daynum { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border: 0; border-radius: 999px; background: transparent; color: var(--text); font-weight: 700; font-size: 13px; cursor: pointer; }
button.op-daynum:hover { background: var(--surface-2); }
.op-daynum.op-static { cursor: default; }
.op-today .op-daynum { background: var(--gold); color: var(--navy); }
.op-cell-ev { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
/* A chip shows the type's symbol, the time, and the whole title. The title wraps (a cell may grow taller), so nothing is cut off, at any
   width and with wide text spacing. */
.op-chip { display: flex; align-items: flex-start; gap: 5px; width: 100%; min-width: 0; max-width: 100%; min-height: 24px; padding: 3px 6px; border: 0; border-left: 3px solid var(--op-edge, var(--op-fg)); border-radius: 5px; background: var(--op-bg); color: var(--op-fg); font-size: 12px; font-weight: 600; line-height: 1.3; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.op-chip:hover { filter: brightness(0.95); }
/* a grid cell clips what leaves it, and a chip fills the cell, so the focus ring is drawn inside the control instead of around it */
.op-cell .op-chip:focus-visible, .op-cell .op-daynum:focus-visible, .op-cell .op-more:focus-visible { outline-offset: -3px; }
.op-chip-ico { flex: none; display: inline-flex; padding-top: 1px; }
.op-chip-ico svg { width: 12px; height: 12px; }
.op-chip-main { flex: 1; min-width: 0; }
.op-chip-time { font-variant-numeric: tabular-nums; font-weight: 700; }
.op-chip-check { font-weight: 800; }
.op-chip-type { display: block; font-size: 12px; font-weight: 600; }
.op-tag-sub { margin-top: 4px; }
.op-more { background: none; border: 0; padding: 1px 4px; color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; cursor: pointer; text-decoration: underline; }
.op-cal-compact { display: none; }
.op-mlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.op-mday { font-family: var(--font-body); font-size: 14px; text-transform: none; margin-bottom: 6px; }
/* a column is 280px wide at most, and never wider than the card: a fixed 280px minimum pushed the page sideways on a 320px phone */
.op-mchips { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 6px; }
.op-mchips > *, .op-mlist > li { min-width: 0; }
.op-cal-compact .op-chip { min-height: 44px; font-size: 14px; padding: 8px 10px; align-items: center; }
.op-cal-compact .op-chip-ico svg { width: 16px; height: 16px; }
/* Up to 1100px a grid cell is under 110px wide, too narrow to read an event title in, so the month becomes the list of its days. */
@media (max-width: 1100px) {
  .op-cal-wide { display: none; }
  .op-cal-compact { display: block; }
}
@media (max-width: 640px) {
  .op-cal-body { padding: 14px 16px 16px; }
  /* nine 44px filter buttons one under another would fill a phone screen: two to a row, with "All types" across the top */
  .op-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .op-filters .op-filter:first-child { grid-column: 1 / -1; }
  .op-filter { justify-content: flex-start; text-align: left; border-radius: 14px; }
}
.op-agenda-list li { flex-wrap: wrap; }
.op-agenda-list .grow { overflow-wrap: anywhere; }
.op-daylist li { justify-content: space-between; flex-wrap: wrap; padding-left: 0; padding-right: 0; overflow-wrap: anywhere; }

/* event modal */
.op-att { list-style: none; margin: 0; padding: 0; }
.op-att-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.op-att-row:last-child { border-bottom: 0; }
.op-att-who { min-width: 0; overflow-wrap: anywhere; }
.op-att-btns { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.op-att-btns .op-excused { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.op-att-btns .op-excused:hover { background: var(--warn-bg); filter: brightness(0.95); }
.op-att-sum { margin-top: 8px; }
.checks[aria-labelledby="f-fm-attendeeIds-l"] { grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
.checks[aria-labelledby="f-fm-attendeeIds-l"] .check span { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Training Schedule ---------- */
.op-sched-controls { border-bottom: 0; }
.op-evlist { list-style: none; margin: 0; padding: 0; }
.op-ev-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 8px 16px; align-items: start; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.op-ev-row:last-child { border-bottom: 0; }
.op-ev-time { display: flex; flex-direction: column; line-height: 1.35; }
.op-ev-main { min-width: 0; }
.op-ev-title { overflow-wrap: anywhere; }
.op-ev-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 4px; overflow-wrap: anywhere; }
.op-ev-meta > .muted { min-width: 0; overflow-wrap: anywhere; }
.op-ev-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 720px) {
  .op-ev-row { grid-template-columns: 74px minmax(0, 1fr); padding: 12px 16px; }
  .op-ev-acts { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ---------- Announcements ---------- */
.op-chipbar { padding-top: 14px; padding-bottom: 14px; }
.op-ann-tools { border-bottom: 1px solid var(--line); }
.op-chipbar .chip { min-height: 32px; }
.op-pinned { border-color: var(--gold); box-shadow: inset 4px 0 0 var(--gold), var(--shadow); }
/* Every card has the same two fixed rows: the category and the date on top, who posted it and the buttons at the foot. The tags wrap inside their
   own column, so the date stays at the top right and the buttons (Delete last) stay at the bottom right, however long the category or the author line is. */
.op-ann-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: start; }
.op-ann-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.op-ann-date { white-space: nowrap; padding-top: 3px; }
/* Pinned is an outlined badge with a pin: every category already has its own filled color, and a second filled pill read as a copy of it. */
.op-pin { display: inline-flex; align-items: center; gap: 5px; padding: 1px 10px; border: 1px solid var(--text); border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.6; color: var(--text); white-space: nowrap; }
.op-pin svg { width: 12px; height: 12px; flex: none; }
.op-ann-title { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-size: 19px; font-weight: 700; margin: 12px 0 8px; line-height: 1.25; overflow-wrap: anywhere; }
.op-ann-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.op-ann-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.op-ann-foot > :first-child { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
/* Edit, Pin, and Delete sit together at the right. When the author line and the buttons do not fit on one row, the buttons drop under it and stay at the right. */
.op-ann-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-left: auto; }

/* ---------- Settings ---------- */
.op-msg { font-size: 13px; font-weight: 600; color: var(--muted); }
.op-msg.bad { color: var(--bad-fg); }
.op-tools { display: flex; flex-direction: column; gap: 22px; }
.op-tool { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.op-tool > div:first-child { flex: 1 1 260px; min-width: 0; }
.op-tool .field, .op-tool > .btn { flex: 0 1 320px; min-width: 0; }
.op-tool h3 { margin-bottom: 2px; }
.op-danger { display: flex; flex-direction: column; gap: 18px; border: 1px solid var(--bad); border-radius: 12px; padding: 16px; }
.op-danger > h3 { color: var(--bad-fg); text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; }
.op-donly { border-top: 1px solid var(--line); }
.op-donly h3 { margin-bottom: 6px; }
.op-list { margin: 0; padding-left: 20px; }
.op-list li { margin: 4px 0; }
/* The permission matrix is wider than a phone, so it scrolls sideways (the shared hint line under it says so). The Section column stays in
   view while it does, so a pill is never separated from the row it belongs to. A collapsed border does not travel with a sticky cell, so the
   column's right edge is drawn with a shadow. */
.op-matrix th:first-child, .op-matrix td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.op-matrix th:first-child { background: var(--surface-2); z-index: 2; }
.op-matrix td:first-child { min-width: 112px; max-width: 180px; }
.op-matrix-note { border-top: 1px solid var(--line); }

/* ---------- Tap targets on phones and touch screens: 44px, the size of a thumb ---------- */
@media (max-width: 640px), (pointer: coarse) {
  .op-linkbtn { display: inline-flex; align-items: center; min-height: 44px; }
  .op-ev-acts .btn, .op-note .btn, .op-ann-foot .btn, .op-att-btns .btn, .op-cal-nav .btn, .op-chipbar .chip, .op-filter, .op-sched-controls .seg button, .op-overview .btn-sm { min-height: 44px; }
  .op-more-link { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ---------- Print ----------
   The shared print rules ask the browser to keep every fill, but a browser may ignore that (or the person may have turned "Background graphics"
   off in a browser that lets them), so nothing here may rest on its fill. Every chip, tag, and filter prints dark text on a light ground with its
   own outline, which reads the same with the fill printed or dropped. The dark chip (the graduation ceremony) and the pressed "All types" filter
   are cream on navy on screen; on paper they are dark text on a light ground like the others. The event type is always in the words and in the
   symbol, never in the color alone. A dark theme prints with these light colors (styles.css keeps its dark tokens on screen only). */
@media print {
  .op-t7 { --op-bg: var(--surface-2); --op-fg: var(--navy); --op-edge: var(--navy); }
  .op-tag { border: 1px solid var(--op-edge, var(--op-fg)); }
  .op-chip { border: 1px solid var(--op-edge, var(--op-fg)); border-left-width: 4px; }
  .op-filter:not(.op-typed)[aria-pressed="true"] { background: var(--surface-2); color: var(--text); border-color: var(--text); font-weight: 800; }
  .op-date { border: 1px solid var(--line); }
}
