/* Shared visual layer. Existing data, permissions and form contracts stay in their modules. */
@media screen {
  .official-workspace, .staff-workspace {
    --work-ink: #122e4a;
    --work-muted: #51667a;
    --work-line: #d9e3eb;
    --work-accent: #087f83;
    background: #f1f8fb;
    color: var(--work-ink);
    position: relative;
    isolation: isolate;
  }
  :is(.official-workspace, .staff-workspace)::before {
    content: "";
    position: fixed;
    z-index: -1;
    inset: -15%;
    pointer-events: none;
    background: radial-gradient(ellipse at 14% 24%, #a7e8e499, transparent 42%), radial-gradient(ellipse at 86% 62%, #add5fc99, transparent 42%), radial-gradient(ellipse at 45% 90%, #d2f5e699, transparent 40%);
    animation: ambientDrift 12s ease-in-out infinite alternate;
    will-change: transform;
  }
  @keyframes ambientDrift {
    from { transform: translate3d(-3%, -2%, 0) scale(1); }
    to { transform: translate3d(5%, 4%, 0) scale(1.08); }
  }
  :is(.official-workspace, .staff-workspace)::after {
    content: "";
    position: fixed;
    z-index: -2;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, #f1f8fb 15%, #f1f8fb99 75%), url('/referee-action-global.webp') right center / auto 100vh no-repeat;
    opacity: .13;
  }
  .motion-toggle {
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid #b6d9dc;
    border-radius: 8px;
    background: #ffffffcf;
    color: #22646b;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
  }
  :is(.official-workspace, .staff-workspace) :is(button, summary, a, input, select, textarea):focus-visible {
    outline: 3px solid #087f83;
    outline-offset: 3px;
  }
  .official-workspace .app-header {
    background: #09254b;
    border-bottom: 2px solid #42d3cd;
    box-shadow: none;
  }
  .official-workspace .official-app-title i { animation: none; }
  .official-workspace .page-shell { width: min(1120px, calc(100% - 40px)); margin-top: 20px; }
  .official-workspace :is(.card, .quest-section, .performance-tests-section, .identified-official, .performance-cockpit) {
    border: 1px solid var(--work-line);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 3px 14px #122e4a05;
  }
  .official-workspace .identified-official { padding: 18px 22px; color: var(--work-ink); }
  .official-workspace .identified-official h1 { color: var(--work-ink); }
  .official-workspace .identified-official p { color: var(--work-muted); font-size: 14px; }
  .official-workspace :is(.identified-official .step, .cockpit-kicker, .workspace-heading .step) { color: var(--work-accent); }
  .official-workspace .official-avatar { background: #09254b; border: 0; box-shadow: none; }
  .official-workspace .verified-pill { color: #126047; background: #e8f5ee; font-size: 11px; }
  .official-workspace .logout-button { min-height: 40px; color: var(--work-muted); border-color: var(--work-line); background: #fff; font-size: 12px; }
  .official-workspace .performance-cockpit {
    min-height: 0;
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: center;
    gap: 0 24px;
    margin-bottom: 16px;
    padding: 24px;
    overflow: hidden;
    color: var(--work-ink);
    animation: none;
    background: linear-gradient(120deg, #eafaf9 0%, #fff 48%, #f1f8ff 100%);
    border-color: #bfdfe1;
  }
  .official-workspace .performance-cockpit::before {
    content: "";
    position: absolute;
    z-index: 0;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, #f2fbfc 0%, #f6fbfdfc 43%, #f5fbfbd9 59%, #f1f8fa8c 79%, #f1f8fa66 100%), url('/referee-action-global.webp') right top / auto 100% no-repeat;
    transform-origin: 85% 0%;
    animation: refereeDrift 16s ease-in-out infinite alternate;
  }
  .official-workspace .performance-cockpit::after { content: none; }
  .official-workspace .performance-cockpit > * { position: relative; z-index: 1; }
  .official-workspace .cockpit-copy { max-width: none; padding-right: 32%; }
  @keyframes refereeDrift { from { transform: scale(1); } to { transform: scale(1.045); } }
  .official-workspace .cockpit-motion { height: 148px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, #fff 30%, #c9efec66 68%, transparent 70%); }
  .cockpit-motion svg { width: 180px; max-width: 100%; height: 140px; overflow: visible; fill: none; }
  .motion-ring-track { stroke: #c5e5e6; stroke-width: 1.5; }
  .motion-ring { stroke: #42bcb8; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 100 246; transform-origin: 90px 70px; animation: ambientOrbit 10s linear infinite; }
  .motion-trace-track { stroke: #88c8cd; stroke-width: 2; opacity: .45; }
  .motion-trace { stroke: #088e9a; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 32 68; animation: ambientTrace 3.6s linear infinite; filter: drop-shadow(0 0 4px #2ac6c488); }
  @keyframes ambientOrbit { to { transform: rotate(360deg); } }
  @keyframes ambientTrace { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
  .official-workspace .cockpit-heading-row { grid-template-columns: 1fr; align-items: center; gap: 4px; }
  .official-workspace .cockpit-heading-row .technical-help-button { margin-bottom: 12px; }
  .official-workspace .cockpit-copy h2 { max-width: none; margin: 10px 0; color: var(--work-ink); font-size: clamp(26px, 3vw, 34px); line-height: 1.15; letter-spacing: -.025em; }
  .official-workspace .cockpit-copy p { max-width: 760px; color: var(--work-muted); font-size: 15px; }
  .official-workspace .cockpit-kicker { font-size: 11px; letter-spacing: .1em; }
  .official-workspace .cockpit-kicker i { background: var(--work-accent); box-shadow: none; animation: none; }
  .official-workspace .technical-help-button,
  .official-workspace .technical-help-button.quiet { min-height: 44px; padding: 8px 12px; color: var(--work-ink); border-color: var(--work-line); background: #f5f8fa; box-shadow: none; animation: none; letter-spacing: .025em; font-size: 11px; }
  .official-workspace .technical-help-button i { color: var(--work-accent); background: #e4f4f3; }
  .official-workspace .cockpit-status { margin-top: 14px; padding: 0; border: 0; background: none; flex-wrap: wrap; }
  .official-workspace .cockpit-status :is(span, strong) { color: var(--work-muted); font-size: 11px; }
  .official-workspace .daily-overview { grid-column: 1 / -1; margin-top: 18px; padding: 0 12px; border: 1px solid #d5e5e9; border-radius: 10px; background: #ffffffed; }
  .official-workspace .daily-overview > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; color: var(--work-ink); font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; }
  .official-workspace .daily-overview > summary::-webkit-details-marker { display: none; }
  .official-workspace .daily-overview > summary span { color: var(--work-accent); font-size: 23px; }
  .official-workspace .daily-overview[open] > summary span { transform: rotate(45deg); }
  .official-workspace .overview-note { margin: 0 0 14px; color: var(--work-muted); font-size: 13px; line-height: 1.5; }
  .official-workspace .cockpit-data { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .official-workspace :is(.readiness-dial, .signal-card) { grid-area: auto; min-height: 125px; padding: 16px; border: 1px solid var(--work-line); border-radius: 12px; background: #f6f9fb; box-shadow: none; color: var(--work-ink); }
  .official-workspace .readiness-dial { width: auto; height: auto; }
  .official-workspace .readiness-dial > svg { display: none; }
  .official-workspace .readiness-dial > div { position: static; }
  .official-workspace :is(.readiness-dial strong, .signal-card strong) { color: var(--work-ink); font-size: 30px; text-shadow: none; }
  .official-workspace :is(.readiness-dial span, .signal-card > span, .signal-card small) { color: var(--work-muted); font-size: 11px; }
  .official-workspace :is(.hr-signal > svg, .load-signal > i) { display: none; }
  .official-workspace .quest-section { padding: 24px; }
  .official-workspace .quest-heading h2 { color: var(--work-ink); font-size: 28px; }
  .official-workspace .quest-heading p { color: var(--work-muted); font-size: 15px; }
  .official-workspace .quest-grid { gap: 12px; }
  .official-workspace .quest-button {
    min-height: 154px;
    justify-content: flex-start;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--work-line);
    border-top: 3px solid #42bdb7;
    border-radius: 13px;
    color: var(--work-ink);
    background: #f8fafc;
    box-shadow: none;
    transform: none;
  }
  .official-workspace .quest-button::after { content: none; }
  .official-workspace .quest-button::before { color: var(--work-accent); font-size: 11px; }
  .official-workspace .quest-button .quest-number { width: 32px; height: 32px; border-radius: 9px; color: var(--work-accent); opacity: 1; font-size: 12px; }
  .official-workspace .quest-button strong { color: var(--work-ink); font-size: 17px; }
  .official-workspace .quest-button small { max-width: 100%; color: var(--work-muted); font-size: 14px; line-height: 1.4; }
  .official-workspace .quest-button:hover { border-color: var(--work-accent); background: #edf8f7; }
  .official-workspace .quest-button.completed { border-color: #68b697; background: #edf8f1; }
  .official-workspace .quest-button.completed::before { color: #126047; }
  .official-workspace .coach-inbox { padding: 20px 24px; }
  .official-workspace :is(.coach-inbox h2, .performance-tests-heading h2) { color: var(--work-ink); font-size: 24px; }
  .official-workspace :is(.coach-inbox p, .performance-tests-heading p) { color: var(--work-muted); font-size: 14px; line-height: 1.5; }
  .official-workspace :is(.coach-refresh, .news-button) { min-height: 44px; font-size: 12px; }
  .official-workspace .form-workspace { border: 1px solid var(--work-line); border-radius: 18px; background: #fff; box-shadow: none; }
  .official-workspace .form-workspace::before, .official-workspace .form-workspace::after { content: none; }
  .official-workspace .workspace-heading { min-height: 0; padding: 0 0 20px; background: none; border-bottom: 1px solid var(--work-line); }
  .official-workspace .workspace-heading h2 { color: var(--work-ink); font-size: 30px; }
  .official-workspace .workspace-heading p { color: var(--work-muted); text-shadow: none; font-size: 15px; font-weight: 400; line-height: 1.5; }
  .official-workspace .workspace-heading .back-button { min-height: 44px; color: var(--work-ink); border-color: var(--work-line); background: #f2f6f9; font-size: 12px; }
  .official-workspace .form-progress-track { background: #dbe5ec; }
  .official-workspace .form-progress span { color: var(--work-muted); font-size: 11px; }
  .official-workspace :is(.choice-option, .preset-option) { min-height: 48px; font-size: 14px; border-color: #cad9e2; box-shadow: none; }
  .official-workspace :is(.choice-option, .preset-option).active { color: #fff; border-color: #087f83; background: #087f83; box-shadow: none; }
  .official-workspace :is(input, select, textarea) { font-size: 16px; }
  .official-workspace .primary-button { min-height: 48px; color: #fff; background: #087f83; box-shadow: none; font-size: 14px; }

  .staff-workspace { --muted: #51667a; --line: #d9e3eb; --shadow: 0 3px 14px #122e4a05; }
  .staff-workspace .sidebar { background: #09254b; }
  .staff-workspace .panel { border-radius: 16px; }
  .staff-workspace .topbar { padding-bottom: 20px; border-bottom: 1px solid var(--work-line); }
  .staff-workspace .topbar h1 { font-size: clamp(28px, 3vw, 36px); letter-spacing: -.025em; }
  .staff-workspace :is(.button, .flow-link, .icon-button) { min-height: 44px; font-size: 13px; }
  .staff-workspace :is(input, select, textarea) { min-height: 44px; font-size: 16px; }
  .staff-workspace .team-strip { gap: 14px; margin-bottom: 20px; }
  .staff-workspace :is(.team-strip article, .team-review-button) { min-height: 106px; box-shadow: none; }
  .staff-workspace :is(.team-strip article > span, .team-review-button > span, .signal-grid article > span, .polar-metrics article > span) { color: var(--work-muted); font-size: 11px; letter-spacing: .06em; }
  .staff-workspace :is(.team-strip article small, .team-review-button small, .signal-grid article small) { color: var(--work-muted); font-size: 13px; line-height: 1.45; }
  .staff-workspace .official-monitor { gap: 18px; }
  .staff-workspace .official-hero { display: grid; grid-template-columns: 1fr; gap: 20px; padding: 24px; background: #fff; }
  .staff-workspace .official-hero::after { content: none; }
  .staff-workspace .official-identity p { font-size: 14px; }
  .staff-workspace .selected-avatar { width: 60px; height: 60px; border-radius: 16px; background: #09254b; box-shadow: none; }
  .staff-workspace .official-actions { justify-content: flex-start; gap: 10px; padding-top: 18px; border-top: 1px solid var(--work-line); }
  .staff-workspace .report-button, .staff-workspace .coach-button { color: #fff; border-color: #087f83; background: #087f83; }
  .staff-workspace :is(.panel-heading p, .data-empty, .selected-review p) { font-size: 14px; line-height: 1.55; }
  .staff-workspace :is(.source-pill, .monitor-status, .kicker) { font-size: 11px; }
  .staff-workspace .roster-heading > div > span { font-size: 11px; }

  @media (max-width: 760px) {
    .official-workspace .page-shell { width: calc(100% - 24px); margin-top: 12px; }
    .official-workspace .identified-official { grid-template-columns: 44px minmax(0, 1fr); padding: 14px; gap: 12px; }
    .official-workspace .official-avatar { width: 44px; height: 44px; }
    .official-workspace .identified-official h1 { font-size: 20px; }
    .official-workspace .identified-official p { max-width: none; white-space: normal; font-size: 12px; }
    .official-workspace .profile-photo-actions { grid-column: 2; display: flex; justify-content: flex-start; flex-wrap: wrap; }
    .official-workspace .logout-button { width: auto; height: auto; min-height: 40px; padding: 8px 12px; border-radius: 8px; overflow: visible; }
    .official-workspace .logout-button::after { content: none; }
    .official-workspace .identified-official .step { font-size: 10px; }
    .official-workspace .performance-cockpit { min-height: 0; grid-template-columns: 1fr; padding: 18px; border-radius: 16px; }
    .official-workspace .performance-cockpit::before { inset: 0 0 auto; height: 178px; background: linear-gradient(180deg, #f4fbfd00 44%, #f4fbfd 100%), linear-gradient(90deg, #f4fbfdfa 4%, #f4fbfdad 40%, #f4fbfd30 100%), url('/referee-action-global.webp') 84% top / auto 220px no-repeat; transform-origin: 70% 0%; }
    .official-workspace .cockpit-copy { padding-right: 0; }
    .official-workspace .cockpit-motion { height: 110px; width: 100%; margin-bottom: 10px; border-radius: 12px; background: none; justify-items: start; }
    .official-workspace .cockpit-motion svg { width: 125px; height: 100px; }
    .official-workspace .cockpit-heading-row { grid-template-columns: 1fr; gap: 0; }
    .official-workspace .cockpit-copy h2 { font-size: 27px; }
    .official-workspace .technical-help-button { margin-bottom: 12px; }
    .official-workspace .cockpit-data { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .official-workspace .quest-section { padding: 18px; }
    .official-workspace .quest-heading { grid-template-columns: minmax(0, 1fr) 160px; align-items: start; gap: 12px; padding: 0; }
    .official-workspace .date-control { width: 160px; padding: 9px; }
    .official-workspace .quest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .official-workspace .quest-button { min-height: 154px; padding: 14px 12px 28px; }
    .official-workspace .quest-button strong { font-size: 15px; }
    .official-workspace .quest-button small { font-size: 13px; }
    .official-workspace .coach-inbox { padding: 18px; }
    .official-workspace .coach-inbox-heading { flex-wrap: wrap; gap: 12px; }
    .official-workspace .mobile-dock { bottom: 0; left: 0; width: 100%; transform: none; padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); gap: 3px; border-radius: 0; border: 0; background: #09254b; }
    .official-workspace .mobile-dock button { min-width: 0; min-height: 52px; padding: 6px 2px; font-size: 11px; color: #d8e5f0; }
    .official-workspace .mobile-dock button.active { color: #fff; background: #087f83; box-shadow: none; }
    .official-workspace .workspace-heading .back-button { width: auto; }
    .staff-workspace .official-hero { padding: 18px; }
    .staff-workspace .team-strip { gap: 10px; }
  }
  @media (max-width: 360px) {
    .official-workspace .quest-heading { grid-template-columns: 1fr; }
    .official-workspace .date-control { width: 100%; }
  }
  :is(.official-workspace, .staff-workspace).motion-paused::before,
  .motion-paused :is(.motion-ring, .motion-trace),
  .official-workspace.motion-paused .performance-cockpit::before { animation-play-state: paused; }
  @media (prefers-reduced-motion: reduce) {
    :is(.official-workspace, .staff-workspace):not(.motion-enabled)::before,
    body:not(.motion-enabled) :is(.motion-ring, .motion-trace),
    .official-workspace:not(.motion-enabled) .performance-cockpit::before { animation: none; }
  }
}
