:root {
  --bg: #ffffff; --fg: #1b1d22; --muted: #6c737e; --line: #e3e8f0; --chip: #f0f3f7; --hover: #f6f8fb;
  --brand: #e30611; --brand-fg: #ffffff; --ok: #0a9d6e; --warn: #c9730a; --err: #d12d2d; --accent: #0b6bcb;
}
@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) { --bg: #15191e; --fg: #edf3ff; --muted: #a9b2bc; --line: #2b3038; --chip: #21262c;
                            --hover: #1c2127; --ok: #2bd19b; --warn: #f0a646; --err: #ff6b6b; --accent: #6cb4ff; }
}
:root.theme-dark { --bg: #15191e; --fg: #edf3ff; --muted: #a9b2bc; --line: #2b3038; --chip: #21262c;
                   --hover: #1c2127; --ok: #2bd19b; --warn: #f0a646; --err: #ff6b6b; --accent: #6cb4ff; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { display: flex; flex-direction: column; background: var(--bg); color: var(--fg);
       font: 13px/1.4 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
/* прежняя полоса виджета — скрыта, её кнопки нажимает оболочка (shell.css, shell.js) */
.bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.spacer { flex: 1; }
button { flex: none; padding: 6px 12px; border: 0; border-radius: 6px; cursor: pointer; background: var(--brand);
         color: var(--brand-fg); font: inherit; font-weight: 600; }
button:disabled { opacity: .55; cursor: default; }
button.ghost { background: var(--chip); color: var(--fg); font-weight: 500; }
button.icon { padding: 4px 8px; }
a.btn { flex: none; padding: 6px 12px; border-radius: 6px; font: inherit; font-weight: 500; text-decoration: none;
        white-space: nowrap; background: var(--brand); color: var(--brand-fg); }
a.btn.ghost { background: var(--chip); color: var(--fg); }
.teams { display: flex; gap: 6px; flex-wrap: wrap; }
.team { display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 9px; border-radius: 999px;
        background: var(--chip); font-size: 12px; white-space: nowrap; }
.team b { font-weight: 700; }
.team .t { color: var(--muted); }
.team.stale .t { color: var(--warn); font-weight: 600; }
.team.err { box-shadow: inset 0 0 0 1px var(--err); }
.team.err .t { color: var(--err); }
.team button { background: none; color: var(--muted); padding: 0 6px; font-size: 14px; line-height: 20px; }
.team button:hover { color: var(--fg); }
.team.busy button { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px;
         background: var(--brand); color: var(--brand-fg); font-size: 11px; line-height: 18px; text-align: center; }
#status { font-size: 12px; color: var(--muted); }
#status:empty { display: none; }
#status .err { color: var(--err); }
main { flex: 1; min-height: 0; display: flex; }
#report { flex: 1; width: 100%; border: 0; background: var(--bg); }
#report.ready { background: #fff; }
.notice { flex: 1; padding: 24px 16px; max-width: 560px; margin: 0 auto; }
.notice h2 { font-size: 16px; }
.notice.wide { display: flex; flex-direction: column; max-width: none; padding: 8px; }
#login-frame { flex: 1; width: 100%; min-height: 360px; border: 0; border-radius: 8px; background: #111; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 5; }
.sheet-card { background: var(--bg); border-radius: 12px; width: min(720px, 100%); max-height: 100%;
              display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.sheet-head, .sheet-foot { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.sheet-head { border-bottom: 1px solid var(--line); justify-content: space-between; }
.sheet-foot { border-top: 1px solid var(--line); }
.sheet-foot small { flex: 1; color: var(--muted); }
.sheet-body { overflow-y: auto; padding: 6px 14px 12px; }
.sheet-body h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 4px; }
.note { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--line); }
.note input { margin-top: 3px; flex: none; }
.note .k { font-weight: 700; color: var(--accent); white-space: nowrap; }
.note .x { white-space: pre-wrap; overflow-wrap: anywhere; }
.note .h { color: var(--muted); font-size: 12px; }
.note.sent { opacity: .55; }
.empty-list { color: var(--muted); padding: 16px 0; text-align: center; }
@media (max-width: 600px) {
  .bar > button, .bar > a.btn { flex: 1; text-align: center; }
  .spacer { display: none; }
  .teams { width: 100%; }
}
