/* Crown Standard Solutions — official colors, exact, never darkened:
   navy #002050 · teal #10A0B0 · coral #F0643F · white #FFFFFF
   jrr455-cso-v4 refinement (§9): stronger hierarchy, sticky header,
   44px touch targets, clearer status pills, communications ledger
   styling, visible focus, reduced-motion support. */
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
       color: #002050; background: #FFFFFF; line-height: 1.45; }
.skip { position: absolute; left: -999px; top: 0; background: #002050;
        color: #FFFFFF; padding: 10px 16px; z-index: 20; }
.skip:focus { left: 8px; top: 8px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex;
          align-items: center; gap: 14px; background: #002050;
          color: #FFFFFF; padding: 10px 18px;
          box-shadow: 0 2px 8px rgba(0, 32, 80, .25); }
.logo { height: 52px; width: auto; background: #FFFFFF; border-radius: 6px;
        padding: 3px; }
.brand-name { font-weight: 700; letter-spacing: .04em; font-size: 1.05rem; }
.brand-sub { font-size: .8rem; opacity: .85; }
.session-box { margin-left: auto; display: flex; gap: 10px; align-items: center;
               flex-wrap: wrap; }
.session-box button { background: #10A0B0; color: #FFFFFF; border: 0;
  border-radius: 6px; padding: 10px 14px; min-height: 44px;
  font-size: .95rem; cursor: pointer; font-weight: 600; }
main { max-width: 1120px; margin: 0 auto; padding: 20px 18px 40px; }
.card { border: 1px solid #d7dee8; border-radius: 12px; padding: 24px;
        max-width: 480px; margin: 36px auto;
        box-shadow: 0 4px 18px rgba(0, 32, 80, .08); }
.card h1 { margin-top: 0; font-size: 1.5rem; }
label { display: block; margin: 14px 0 4px; font-weight: 600; }
input, select { width: 100%; padding: 10px; border: 1px solid #9db2c8;
        border-radius: 6px; font-size: 1rem; min-height: 44px;
        background: #FFFFFF; color: #002050; }
input:focus-visible, select:focus-visible, button:focus-visible,
a:focus-visible { outline: 3px solid #10A0B0; outline-offset: 2px; }
.btn { background: #FFFFFF; color: #002050; border: 1.5px solid #002050;
       border-radius: 6px; padding: 10px 16px; min-height: 44px;
       font-size: .95rem; cursor: pointer; margin: 6px 4px 6px 0; }
.btn:hover { background: #eef3f8; }
.btn.primary { background: #F0643F; border-color: #F0643F; color: #FFFFFF;
       font-weight: 700; font-size: 1.05rem; width: 100%; margin-top: 16px; }
.btn.primary:hover { background: #F0643F; }
.btn.teal { background: #10A0B0; border-color: #10A0B0; color: #FFFFFF;
       font-weight: 600; }
.btn.teal:hover { background: #10A0B0; }
.btn.link { border: 0; color: #0b6e7d; font-weight: 700; padding: 2px 4px;
            min-height: 0; }
.err { color: #b3261e; min-height: 1.2em; font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tab { background: #eef3f8; border: 1px solid #c4d2e0; border-radius: 999px;
       padding: 10px 16px; min-height: 44px; cursor: pointer;
       font-size: .95rem; color: #002050; }
.tab.active { background: #002050; color: #FFFFFF; border-color: #002050;
              font-weight: 700; }
.badge { background: #F0643F; color: #FFFFFF; border-radius: 999px;
         padding: 0 7px; font-weight: 700; }
.panel { border: 1px solid #d7dee8; border-radius: 12px; padding: 20px;
         box-shadow: 0 2px 10px rgba(0, 32, 80, .05); }
.panel h2 { margin-top: 0; border-bottom: 3px solid #10A0B0;
            padding-bottom: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px; }
.stat { background: #eef3f8; border-radius: 8px; padding: 14px 12px;
        text-align: center; border-top: 4px solid #10A0B0; }
.stat-n { font-size: 1.8rem; font-weight: 800; color: #002050; }
.stat-l { font-size: .85rem; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
       padding: 10px 4px; border-bottom: 1px solid #e4ebf2; }
.pill { background: #eef3f8; border-radius: 999px; padding: 2px 10px;
        font-size: .82rem; font-weight: 600; }
.pill.ok { background: #10A0B0; color: #FFFFFF; }
.pill.warn { background: #F0643F; color: #FFFFFF; }
.pill.comm-internal_note { background: #5a6b7d; color: #FFFFFF; }
.pill.comm-draft { background: #FFFFFF; color: #002050;
                   border: 1.5px solid #002050; }
.pill.comm-external_response { background: #10A0B0; color: #FFFFFF; }
.pill.comm-delivery_attempt { background: #F0643F; color: #FFFFFF; }
.plain { padding-left: 18px; }
.mono { font-family: ui-monospace, monospace; font-size: .8rem;
        word-break: break-all; }
.note { background: #fff7f2; border-left: 4px solid #F0643F;
        padding: 10px 12px; border-radius: 0 6px 6px 0; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
         background: #002050; color: #FFFFFF; padding: 12px 18px;
         border-radius: 8px; max-width: 90vw; z-index: 30;
         box-shadow: 0 4px 16px rgba(0, 32, 80, .35); }
.ended { background: #F0643F; color: #FFFFFF; padding: 12px; border-radius: 8px;
         margin-top: 14px; font-weight: 600; }
.actions { margin: 8px 0; }
form { margin: 10px 0; }
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .logo { height: 40px; }
  main { padding: 12px 10px 32px; }
  .row { flex-direction: column; align-items: flex-start; gap: 3px; }
  .panel { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* v5 (JRR-456): delivery evidence classes are visually distinct -
   machine-verified delivery uses the .ok pill; a human attestation
   is never styled as verified delivery (it uses .warn). */


/* JRR-460: CS Connect care-report summaries wrap inside their card */
#connect-reports pre { white-space: pre-wrap; word-break: break-word; }

/* JRR-464 sec.9: management interfaces — tables, two-column forms,
   responsive module layout (desktop / tablet / mobile). */
table.tbl { width: 100%; border-collapse: collapse; margin: 10px 0; }
table.tbl th, table.tbl td { border-bottom: 1px solid #e4ebf2;
  padding: 8px 6px; text-align: left; vertical-align: top;
  font-size: .92rem; }
table.tbl th { background: #eef3f8; }
.searchbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.searchbar input { flex: 1 1 220px; width: auto; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
textarea { width: 100%; padding: 10px; border: 1px solid #9db2c8;
  border-radius: 6px; font-size: 1rem; min-height: 64px;
  font-family: inherit; }
fieldset { border: 1px solid #c4d2e0; border-radius: 8px; margin: 12px 0; }
legend { font-weight: 700; padding: 0 6px; }
.checkrow { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.checkrow input[type=checkbox] { width: auto; min-height: 0; }
.detail-card { border: 1px solid #d7dee8; border-radius: 8px;
  padding: 14px; margin: 12px 0; background: #fbfcfe; }
pre.wrap { white-space: pre-wrap; word-break: break-word; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  table.tbl th, table.tbl td { font-size: .85rem; padding: 6px 4px; }
  .tabs { gap: 4px; } .tab { padding: 8px 10px; font-size: .88rem; }
}

/* JRR-477 WS-D polish: state chips in brand colors (no darkened variants) */
.state-chip{display:inline-block;padding:.3rem .6rem;margin:.15rem;border-radius:999px;background:#002050;color:#fff;font-weight:600}
.state-chip:nth-child(even){background:#10A0B0}
#patty-voice{background:#F0643F;color:#fff;font-weight:700}
#patty-escalate{background:#10A0B0;color:#fff;font-weight:700}

/* JRR-485/JRR-486 MeladOS attribution — shared component (.powered-by),
   single definition used by the one shared page template
   (web486/index.html). 0.72em of the 16px base = 11.52px at default
   scaling; relative units respect user text scaling. This build has
   NO dark theme — the page background stays white in both color
   schemes, so the light-on-dark color #c3cedd is gated behind an
   actual dark surface (.dark-theme / [data-theme="dark"]). */
.powered-by { text-align: center; font-size: 0.72em; color: #44546a;
  padding: 18px 12px calc(18px + env(safe-area-inset-bottom)); margin: 0 auto;
  max-width: 1120px; }
.powered-by .footer-signature { height: 1.6em; width: auto;
  display: inline-block; vertical-align: middle; }
@media (prefers-color-scheme: dark) {
  .dark-theme .powered-by, [data-theme="dark"] .powered-by { color: #c3cedd; }
}

.v17panel { background: var(--card, #fff); border: 1px solid #d8dee6; border-radius: 10px; padding: 18px; margin: 18px auto; max-width: 1120px; }

/* JRR-486 dark theme (data-theme="dark" on <html>): real dark
   surfaces for the whole app, toggled by #theme-toggle. */
[data-theme="dark"] body { background: #0d1b2e; color: #e6ecf5; }
[data-theme="dark"] .panel, [data-theme="dark"] .v17panel {
  background: #132a45; color: #e6ecf5; border-color: #2a425f; }
[data-theme="dark"] input, [data-theme="dark"] select,
[data-theme="dark"] textarea { background: #0d1b2e; color: #e6ecf5;
  border-color: #2a425f; }
[data-theme="dark"] .tab { background: #132a45; color: #c3cedd;
  border-color: #2a425f; }
[data-theme="dark"] .stat, [data-theme="dark"] .pill {
  background: #1a3557; color: #e6ecf5; }
[data-theme="dark"] .note { color: #a9bcd4; }
[data-theme="dark"] .powered-by { color: #c3cedd; }
