/* Task 141: the cabinet of the project — one column on a phone, wider on a big screen; buttons under a finger.
   No external fonts, no external addresses.
   154: the menu — a panel on the left (≥ 720 px), a bar of five at the bottom of a phone («Ещё» — the rest, <details>,
   no script); the hints — hover, a long press (:active), the keyboard (:focus-visible); the smooth change of pages —
   View Transitions between documents (none with prefers-reduced-motion); the labels of a state — a colour AND a word.
   Both themes: the text and the labels ≥ 4.5:1 (WCAG AA), the pairs are listed in docs/reports/154.md. */
:root { --fg: #1b1f24; --muted: #4f5864; --line: #d5dbe2; --bg: #f5f7fa; --card: #fff; --accent: #0b5cd5;
        --on-accent: #fff; --ok: #1a7f37; --bad: #c4161c; --on-bad: #fff; --warn: #8a5a00; --tip-bg: #1b1f24;
        --tip-fg: #fff; --soft: #eef2f7; --shadow: 0 6px 24px rgba(15, 23, 42, .14);
        --going-fg: #0b5cd5; --going-bg: #e7f0fd; --yours-fg: #8a4b00; --yours-bg: #fff3dc;
        --check-fg: #6a3fb5; --check-bg: #f1ebfb; --live-fg: #17692f; --live-bg: #e4f5e8;
        --error-fg: #b3141a; --error-bg: #fde9ea; --out-fg: #4f5864; --out-bg: #eceff3; color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
  :root { --fg: #e6e9ed; --muted: #a3adb8; --line: #2f3742; --bg: #0e1319; --card: #161c23; --accent: #6cb0ff;
          --on-accent: #0b1220; --ok: #4cc764; --bad: #ff7b72; --on-bad: #1a0505; --warn: #e3b341; --tip-bg: #e6e9ed;
          --tip-fg: #0e1319; --soft: #1d252e; --shadow: 0 6px 24px rgba(0, 0, 0, .5);
          --going-fg: #8cc2ff; --going-bg: #13263d; --yours-fg: #f2c45a; --yours-bg: #33270b;
          --check-fg: #c9a8ff; --check-bg: #261c3b; --live-fg: #6fdc85; --live-bg: #0f2c18;
          --error-fg: #ff9a92; --error-bg: #3a1414; --out-fg: #b4bdc7; --out-bg: #232b34; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--fg);
       background: var(--bg); }
main { max-width: 960px; margin: 0 auto; padding: 16px 20px 32px; min-width: 0; }
footer { margin: 32px 0 0; color: var(--muted); font-size: 13px; }
h1 { font-size: 22px; margin: 8px 0 16px; }
h2 { font-size: 18px; margin: 24px 0 8px; }
h3 { font-size: 16px; margin: 12px 0 6px; }
a { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 22px; height: 22px; flex: none; }

/* -- the header: the brand, the project, the name, «Выйти» ------------------------------------------------------- */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 6;
       view-transition-name: top; }
.top .bar { padding: 8px 16px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; }
.brand .icon { color: var(--accent); }
.top .project { color: var(--muted); }
.top .name { margin-left: auto; color: var(--muted); }

/* -- the menu ---------------------------------------------------------------------------------------------------- */
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu-link, .more summary { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px;
                            color: var(--fg); text-decoration: none; position: relative; min-height: 44px;
                            -webkit-touch-callout: none; cursor: pointer; }
.menu-link .text { display: flex; flex-direction: column; min-width: 0; }
.menu-link .label, .more summary .label { font-weight: 600; }
.menu-link .hint { color: var(--muted); font-size: 13px; line-height: 1.35; }
.menu-link:hover { background: var(--soft); }
.menu-link[aria-current="page"] { background: var(--soft); box-shadow: inset 3px 0 0 var(--accent); }
.menu-link[aria-current="page"] .icon { color: var(--accent); }
.menu-link:focus-visible, .more summary:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible,
input:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.count { margin-left: auto; align-self: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px;
         background: var(--bad); color: var(--on-bad); font: 700 13px/24px system-ui, sans-serif; text-align: center; }
.new { margin-left: auto; align-self: center; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 700;
       color: var(--going-fg); background: var(--going-bg); border: 1px solid currentColor; }
.menu .group { margin: 16px 12px 4px; color: var(--muted); font-size: 12px; text-transform: uppercase;
               letter-spacing: .06em; }
.more { display: none; }
.more summary { list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.tour-on .menu-link, .more:has(.tour-on) summary { outline: 3px solid var(--accent); outline-offset: -3px; }

@media (min-width: 720px) {
  body.with-menu .layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); }
  .menu { position: sticky; top: 56px; align-self: start; height: calc(100vh - 56px); overflow-y: auto;
          padding: 12px 8px; border-right: 1px solid var(--line); background: var(--card); view-transition-name: menu; }
  .menu .main { display: flex; flex-direction: column; gap: 2px; }
  h1 { font-size: 26px; }
}
@media (max-width: 719.98px) {
  body.with-menu main { padding-bottom: 104px; }
  .menu { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; display: flex; background: var(--card);
          border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
          view-transition-name: menu; }
  .menu .main { display: flex; flex: 4; }
  .menu .item { flex: 1; min-width: 0; }
  .menu .overflow, .menu .group, .menu .owner { display: none; }
  .menu .main .menu-link, .more summary { flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
                                          min-height: 56px; text-align: center; font-size: 11.5px; line-height: 1.2; }
  .menu .main .menu-link[aria-current="page"] { box-shadow: inset 0 3px 0 var(--accent); }
  .menu .main .text { align-items: center; }
  .menu .main .hint, .more summary .hint { position: absolute; bottom: calc(100% + 8px); left: 50%;
       transform: translateX(-50%); width: max-content; max-width: min(260px, 80vw); padding: 6px 10px;
       border-radius: 8px; background: var(--tip-bg); color: var(--tip-fg); font-size: 13px; font-weight: 400;
       box-shadow: var(--shadow); visibility: hidden; opacity: 0; pointer-events: none; z-index: 9; }
  .menu .main .item:first-child .hint { left: 4px; transform: none; }
  .menu .main .menu-link:active .hint, .menu .main .menu-link:focus-visible .hint, .more summary:active .hint,
  .more summary:focus-visible .hint { visibility: visible; opacity: 1; }
  .count { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 20px; height: 20px; font-size: 12px;
           line-height: 20px; padding: 0 5px; margin: 0; }
  .new { position: absolute; top: 2px; left: calc(50% + 4px); margin: 0; font-size: 10px; padding: 0 5px; }
  .more { display: block; flex: 1; position: static; }
  .more[open] > ul { position: fixed; left: 8px; right: 8px; bottom: calc(72px + env(safe-area-inset-bottom));
                     background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px;
                     box-shadow: var(--shadow); max-height: 70vh; overflow-y: auto; }
  .more[open] summary { color: var(--accent); }
}

/* -- the hints of the action buttons ----------------------------------------------------------------------------- */
.tip-wrap { position: relative; display: inline-block; }
.tip { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 9; width: max-content; max-width: min(300px, 86vw);
       padding: 6px 10px; border-radius: 8px; background: var(--tip-bg); color: var(--tip-fg); font-size: 13px;
       line-height: 1.35; box-shadow: var(--shadow); visibility: hidden; opacity: 0; pointer-events: none;
       transition: opacity .12s ease-out; }
@media (hover: hover) {
  .tip-wrap:hover .tip { visibility: visible; opacity: 1; transition-delay: .25s; }
}
.tip-wrap:active .tip, .tip-wrap:has(:focus-visible) .tip { visibility: visible; opacity: 1; }
.tip-wrap button { -webkit-touch-callout: none; }

/* -- the labels of a state --------------------------------------------------------------------------------------- */
.state { display: inline-block; padding: 0 8px; border-radius: 10px; font-size: 12.5px; font-weight: 650;
         line-height: 20px; border: 1px solid currentColor; vertical-align: 1px; white-space: nowrap; }
.state-going { color: var(--going-fg); background: var(--going-bg); }
.state-yours { color: var(--yours-fg); background: var(--yours-bg); }
.state-check { color: var(--check-fg); background: var(--check-bg); }
.state-live { color: var(--live-fg); background: var(--live-bg); }
.state-error { color: var(--error-fg); background: var(--error-bg); }
.state-out { color: var(--out-fg); background: var(--out-bg); }

/* -- «Главная» and the acquaintance ------------------------------------------------------------------------------ */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line);
        border-radius: 14px; padding: 14px 16px; color: var(--fg); text-decoration: none; }
a.tile:hover { border-color: var(--accent); }
.tile.attention { border-color: var(--yours-fg); box-shadow: inset 4px 0 0 var(--yours-fg); }
.tile-head { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.tile-more { color: var(--muted); font-size: 14px; }
.tile-link { margin-top: auto; color: var(--accent); font-size: 14px; }
.tile-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.tour { position: fixed; z-index: 20; top: 72px; left: 280px; width: min(380px, calc(100vw - 296px));
        background: var(--card); border: 2px solid var(--accent); border-radius: 14px; padding: 14px 16px;
        box-shadow: var(--shadow); }
.tour h2 { margin: 0 0 6px; font-size: 16px; }
.tour-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 719.98px) {
  .tour { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* -- the forms and the buttons ------------------------------------------------------------------------------------ */
.groups { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.groups a { padding: 10px 12px; text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent;
            color: var(--fg); min-height: 44px; }
.groups a.on { border-bottom-color: var(--accent); font-weight: 600; }
form { margin: 0; }
.switch, .logout, .search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
label { display: block; margin: 8px 0; }
input, select { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
                background: var(--card); color: var(--fg); min-height: 44px; }
.narrow input { width: 100%; display: block; margin-top: 4px; }
button, a.button { font: inherit; min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
                   background: var(--card); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center;
                   justify-content: center; gap: 6px; text-decoration: none; }
button[type=submit], a.button { background: var(--accent); border-color: var(--accent); color: var(--on-accent);
                                font-weight: 600; }
button:hover { filter: brightness(1.06); }
.logout button, .switch button, button.quiet { background: var(--card); color: var(--fg); border-color: var(--line);
                                               font-weight: 400; }
.buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.buttons .tip-wrap, .buttons button { width: 100%; }
.buttons .code-r, .buttons .code-u, .code-x, .act-disable { background: var(--bad); border-color: var(--bad);
                                                             color: var(--on-bad); }
.buttons .code-l { background: var(--card); color: var(--fg); border-color: var(--line); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
        margin: 12px 0; }
.card.warn { border-color: var(--warn); box-shadow: inset 4px 0 0 var(--warn); }
.card h2 { margin-top: 0; }
pre.text { white-space: pre-wrap; word-wrap: break-word; font: 14px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
           margin: 8px 0; }
pre.doc { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 70vh;
          overflow: auto; }
.rows { padding-left: 20px; }
.rows li { margin: 8px 0; }
.empty, .hint { color: var(--muted); }
.ok { color: var(--ok); }
.error { color: var(--bad); }
.narrow { max-width: 420px; margin: 0 auto; }
/* 141c: the svg has a viewBox and no size of its own — it scales to this square; the quiet zone is in the drawing */
.qr { margin: 8px 0; }
.qr svg { display: block; width: min(100%, 280px); min-width: 240px; height: auto; aspect-ratio: 1 / 1;
          background: #fff; shape-rendering: crispEdges; }
.secret { font: 18px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1px; word-break: break-all; }
.codes { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; columns: 2; }
.pages { display: flex; gap: 16px; }
/* 143: the dialogue «Задачи» — the form of a request, the feed, the three actions */
textarea { font: inherit; width: 100%; min-height: 120px; padding: 10px 12px; border: 1px solid var(--line);
           border-radius: 8px; background: var(--card); color: var(--fg); resize: vertical; }
.feed { list-style: none; padding: 0; }
.feed > li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px;
             margin: 10px 0; }
.feed .person { border-left: 4px solid var(--accent); }
.feed .architect, .feed .agent { border-left: 4px solid var(--ok); }  /* 153: agent */
.feed .system { border-left: 4px solid var(--warn); color: var(--muted); }
.feed .meta { color: var(--muted); font-size: 13px; }
.feed .assumed { color: var(--muted); }
.said { white-space: pre-wrap; word-wrap: break-word; margin: 6px 0; }
/* 151: «Журнал» and «Люди» — a table that scrolls sideways on a phone */
table.journal { display: block; overflow-x: auto; border-collapse: collapse; width: 100%; font-size: 14px; }
table.journal th, table.journal td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line);
                                     vertical-align: top; }
table.journal .buttons { margin-top: 0; }
span.warn { color: var(--warn); font-weight: 600; }
@media (min-width: 720px) {
  .buttons { flex-direction: row; flex-wrap: wrap; }
  .buttons .tip-wrap, .buttons button { width: auto; }
}

/* -- 154: the smooth change of pages (a browser without View Transitions — the usual one) ------------------------- */
@view-transition { navigation: auto; }
main { view-transition-name: page; }
::view-transition-old(page) { animation: 90ms ease-out both cab-out; }
::view-transition-new(page) { animation: 160ms ease-out both cab-in; }
@keyframes cab-out { to { opacity: 0; } }
@keyframes cab-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .tip { transition: none; }
}
