/* Reminders - docs/2026-09-22_reminders.md
   bra- = the top-bar alarm (badge + ringing popup, rendered in the shell window)
   rm-  = the /Reminders screen (rendered inside its workspace-tab iframe) */

/* ---- Top-bar badge ------------------------------------------------------------------------ */
.bra-badge{position:absolute;top:1px;right:0;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:#d63b45;color:#fff;font-size:10px;font-weight:800;line-height:17px;text-align:center;pointer-events:none}
.bra-button.is-ringing svg{animation:bra-wiggle 1.2s ease-in-out 3;transform-origin:50% 55%}
@keyframes bra-wiggle{0%,100%{transform:rotate(0)}10%,30%,50%{transform:rotate(-14deg)}20%,40%,60%{transform:rotate(14deg)}70%{transform:rotate(0)}}
@media (prefers-reduced-motion:reduce){.bra-button.is-ringing svg{animation:none}}

/* ---- Ringing popup (bottom-right, above everything, never over the save toasts top-right) -- */
.bra-stack{position:fixed;right:16px;bottom:16px;z-index:10050;width:370px;max-width:calc(100vw - 32px);max-height:calc(100vh - 90px);display:flex;flex-direction:column;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:12px;box-shadow:0 14px 40px rgba(12,40,60,.28);overflow:hidden;font-size:13px}
.bra-stack[hidden]{display:none}
.bra-head{display:flex;align-items:center;gap:8px;padding:10px 12px;background:var(--bos-blue);color:#fff}
.bra-head svg{flex:none}
.bra-head strong{flex:1;font-size:13px}
.bra-head button{border:0;background:rgba(255,255,255,.16);color:#fff;border-radius:6px;min-width:28px;height:26px;padding:0 8px;font-weight:700;cursor:pointer}
.bra-head button:hover{background:rgba(255,255,255,.28)}
.bra-list{overflow:auto;padding:8px;display:flex;flex-direction:column;gap:8px}
.bra-more{padding:0 12px 10px;font-size:12px}
.bra-more button{border:0;background:none;color:var(--bos-blue);font-weight:700;cursor:pointer;padding:0}

.bra-card{border:1px solid var(--border);border-left:4px solid var(--bos-blue);border-radius:9px;padding:10px 10px 9px;background:var(--surface-2)}
.bra-card.is-overdue{border-left-color:var(--danger)}
.bra-title{font-weight:800;font-size:13.5px;line-height:1.3;word-break:break-word}
.bra-meta{margin-top:3px;color:var(--muted);font-size:11.5px;line-height:1.45}
.bra-meta .bra-late{color:var(--danger);font-weight:700}
.bra-notes{margin-top:6px;font-size:12px;line-height:1.4;white-space:pre-wrap;word-break:break-word;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.bra-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:9px}
.bra-actions .btn{min-height:28px;padding:4px 10px;font-size:12px;border-radius:6px;cursor:pointer}
.bra-choices{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;padding-top:8px;border-top:1px dashed var(--border)}
.bra-choices[hidden]{display:none}
.bra-choices .btn{min-height:26px;padding:3px 9px;font-size:11.5px}
.bra-choices input[type=datetime-local],.bra-choices input.bos-date-text{height:28px;border:1px solid var(--border);border-radius:6px;background:var(--surface);color:var(--text);padding:0 6px;font:inherit;font-size:12px}
.bra-error{margin-top:6px;color:var(--danger);font-size:11.5px;font-weight:700}
/* Alert cards (cheques due, recurring entries, lots expiring) - quieter than a reminder: an amber edge, red when
   something is already overdue / expired. Also used by the Alerts strip of the /Reminders screen. */
.bra-alert{border-left-color:#c98a1b}
.bra-alert--info{border-left-color:var(--bos-blue)}
.bra-alert--danger{border-left-color:var(--danger)}
.bra-alert .bra-meta{color:var(--text);font-size:12px}
.bra-alert-lines{margin:6px 0 0;padding:0 0 0 16px;color:var(--muted);font-size:11.5px;line-height:1.5}

@media (max-width:560px){.bra-stack{right:8px;left:8px;bottom:8px;width:auto;max-width:none}}

/* ---- /Reminders screen -------------------------------------------------------------------- */
.rm-page{display:flex;flex-direction:column;gap:12px;padding:14px;max-width:1100px;margin:0 auto;color:var(--text)}
.rm-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.rm-head h1{margin:0;font-size:19px;flex:1}
.rm-head .muted{font-size:12px}
.rm-alerts{display:flex;flex-direction:column;gap:6px}
.rm-alerts[hidden]{display:none}
.rm-alerts h2{margin:0 2px;font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}
.rm-alerts h2 .rm-count{margin-left:6px;font-weight:700}
.rm-alerts-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:8px}
.rm-toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.rm-seg{display:inline-flex;border:1px solid var(--border);border-radius:8px;overflow:hidden;background:var(--surface)}
.rm-seg button{border:0;background:none;color:var(--text);padding:7px 12px;font-size:12px;font-weight:700;cursor:pointer}
.rm-seg button+button{border-left:1px solid var(--border)}
.rm-seg button[aria-pressed=true]{background:var(--bos-blue);color:#fff}
.rm-search{flex:1;min-width:180px;max-width:320px;height:34px;border:1px solid var(--border);border-radius:8px;background:var(--surface);color:var(--text);padding:0 10px;font:inherit;font-size:13px}

.rm-group{display:flex;flex-direction:column;gap:6px}
.rm-group h2{margin:6px 2px 0;font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}
.rm-group h2 .rm-count{margin-left:6px;font-weight:700}
.rm-group.is-overdue h2{color:var(--danger)}

.rm-row{display:grid;grid-template-columns:auto 1fr auto;gap:10px;align-items:start;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:var(--surface)}
.rm-row.is-completed{opacity:.72}
.rm-row.is-completed .rm-title{text-decoration:line-through}
.rm-check{width:22px;height:22px;margin-top:1px;border:2px solid var(--border);border-radius:50%;background:var(--surface);display:grid;place-items:center;color:transparent;cursor:pointer;padding:0}
.rm-check:hover:not(:disabled){border-color:var(--success);color:var(--success)}
.rm-check.is-done{background:var(--success);border-color:var(--success);color:#fff}
.rm-check:disabled{cursor:default;border-style:dashed}
.rm-check svg{width:13px;height:13px}
.rm-body{min-width:0}
.rm-title{font-weight:750;font-size:13.5px;word-break:break-word}
.rm-notes{margin-top:3px;font-size:12px;color:var(--text);white-space:pre-wrap;word-break:break-word}
.rm-meta{margin-top:5px;display:flex;flex-wrap:wrap;gap:6px 10px;font-size:11.5px;color:var(--muted)}
.rm-meta .rm-late{color:var(--danger);font-weight:700}
.rm-tag{display:inline-flex;align-items:center;gap:4px;padding:1px 7px;border-radius:999px;background:var(--surface-2);border:1px solid var(--border);font-size:11px;font-weight:700;color:var(--muted)}
.rm-tag.is-person{color:var(--bos-blue-dark)}
html[data-theme=dark] .rm-tag.is-person{color:var(--bos-blue)}
.rm-actions{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-end}
.rm-actions .btn{min-height:28px;padding:4px 10px;font-size:12px;border-radius:6px;cursor:pointer}
.rm-actions .btn-danger{background:var(--surface);border-color:color-mix(in srgb,var(--danger) 45%,var(--border));color:var(--danger)}
.rm-empty{padding:34px 12px;text-align:center;color:var(--muted);border:1px dashed var(--border);border-radius:10px;background:var(--surface)}
.rm-banner{padding:12px 14px;border-radius:10px;border:1px solid color-mix(in srgb,var(--danger) 40%,var(--border));background:color-mix(in srgb,var(--danger) 8%,var(--surface));font-size:13px}

/* Editor + postpone/snooze pickers: a plain overlay, NOT a native showModal() <dialog> - a modal
   dialog makes the rest of the page inert, and the searchable select portals its dropdown to <body>
   (z-index 10050), so the Assign-to picker would stop working inside it. */
.rm-modal{position:fixed;inset:0;z-index:9000;display:grid;place-items:center;padding:16px;background:rgba(10,25,35,.45)}
.rm-modal[hidden]{display:none}
.rm-dialog{border:1px solid var(--border);border-radius:12px;padding:0;width:min(520px,100%);max-height:calc(100vh - 32px);overflow:auto;background:var(--surface);color:var(--text);box-shadow:0 18px 50px rgba(0,0,0,.3)}
.rm-dialog .rm-form{display:flex;flex-direction:column}
.rm-dialog header{padding:12px 16px;border-bottom:1px solid var(--border);font-weight:800;font-size:15px}
.rm-dialog .rm-fields{display:flex;flex-direction:column;gap:12px;padding:14px 16px}
.rm-dialog footer{display:flex;gap:8px;justify-content:flex-end;padding:12px 16px;border-top:1px solid var(--border);background:var(--surface-2)}
.rm-field{display:flex;flex-direction:column;gap:5px}
.rm-field>label{font-size:12px;font-weight:700;color:var(--muted)}
.rm-field>label .rm-req{color:#ef4444;font-weight:900;margin-left:2px}
.rm-field input,.rm-field textarea,.rm-field>select{border:1px solid var(--border);border-radius:8px;background:var(--surface);color:var(--text);padding:8px 10px;font:inherit;font-size:13px}
.rm-field textarea{min-height:84px;resize:vertical}
.rm-quick{display:flex;flex-wrap:wrap;gap:6px}
.rm-quick .btn{min-height:26px;padding:3px 9px;font-size:11.5px}
.rm-dialog .rm-error{color:var(--danger);font-size:12px;font-weight:700}
.rm-dialog .rm-error:empty{display:none}
.rm-hint{font-size:11.5px;color:var(--muted)}
/* Two-stage required validation (docs/BOS-Web-Database-Access-Rules.md, UX rule 4). */
.rm-validated .rm-field.is-invalid input,
.rm-validated .rm-field.is-invalid textarea,
.rm-validated .rm-field.is-invalid .bos-search-select-control{border-color:#ef4444!important;box-shadow:0 0 0 3px color-mix(in srgb,#ef4444 13%,transparent)!important;border-radius:8px}

@media (max-width:640px){
  .rm-row{grid-template-columns:auto 1fr}
  .rm-actions{grid-column:1 / -1;justify-content:flex-start}
}

/* ---- Recurring reminders ------------------------------------------------------------------ */
.rm-dialog [hidden]{display:none!important}
.rm-repeat{display:flex;flex-direction:column;gap:9px;margin-top:4px;padding:10px 12px;border:1px dashed var(--border);border-radius:8px;background:var(--surface-2)}
.rm-repeat-line{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.rm-repeat-line>label{font-size:12px;font-weight:700;color:var(--muted);min-width:42px}
.rm-repeat-line input,.rm-repeat-line select{border:1px solid var(--border);border-radius:8px;background:var(--surface);color:var(--text);padding:6px 8px;font:inherit;font-size:13px}
.rm-repeat-line input[type=number]{width:72px}
.rm-days{display:flex;gap:4px;flex-wrap:wrap}
.rm-days button{min-width:42px;height:30px;border:1px solid var(--border);border-radius:6px;background:var(--surface);color:var(--text);font-weight:700;font-size:12px;cursor:pointer}
.rm-days button[aria-pressed=true]{background:var(--bos-blue);border-color:var(--bos-blue);color:#fff}
.rm-repeat-summary{font-weight:700;color:var(--bos-blue-dark)}
html[data-theme=dark] .rm-repeat-summary{color:var(--bos-blue)}
.rm-tag.is-repeat{color:var(--bos-blue-dark);border-color:color-mix(in srgb,var(--bos-blue) 35%,var(--border))}
html[data-theme=dark] .rm-tag.is-repeat{color:var(--bos-blue)}
.bra-repeat{color:var(--bos-blue-dark);font-weight:700}
html[data-theme=dark] .bra-repeat{color:var(--bos-blue)}
.bra-head button[data-bra-sound]{display:inline-grid;place-items:center;padding:0 6px}
.bra-head button[data-bra-sound][aria-pressed=false]{background:rgba(0,0,0,.18);opacity:.85}
