/* Officer hub: docs section (public/js/hub/docs*.js). The list of docs, one doc's editor, and the
   docs dialogs (new doc, history, conflict, action items). Tokens and shared pieces come from app.css
   and hub.css, so light and dark both work. */

.hub-section-docs .hub-icon, .hub-dialog .hub-icon { flex: none; display: block; }

/* ---------- kinds ---------- */

.doc-kind {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px 2px 7px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap;
  color: var(--c);
  background: var(--surface-2);
  background: color-mix(in srgb, var(--c) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
}
.doc-kind.kind-notes { --c: var(--accent); }
.doc-kind.kind-plan { --c: var(--free); }
.doc-kind.kind-guide { --c: var(--warn); }
.doc-kind.kind-other { --c: var(--muted); }

/* ---------- the list ---------- */

.doc-new .hub-icon { margin-left: -3px; }

.docs-toolbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.docs-search { position: relative; flex: 1 1 260px; max-width: 400px; min-width: 0; }
.docs-search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.hub input.docs-search-input[type="search"] { padding-left: 40px; background: var(--surface); }
.hub input.docs-search-input[type="search"]::placeholder { color: var(--muted); opacity: 0.85; }

.docs-filters { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.docs-kinds {
  display: flex; flex-wrap: wrap; gap: 3px; padding: 3px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
}
.docs-kind, .docs-archived-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 38px; padding: 0 11px; border-radius: 9px;
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 650; white-space: nowrap; cursor: pointer;
}
.docs-kind:hover, .docs-archived-toggle:hover { color: var(--text); background: var(--surface-2); }
.docs-kind[aria-pressed="true"] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent); }
.docs-kind:focus-visible, .docs-archived-toggle:focus-visible { outline-offset: -2px; }
.docs-kind-count {
  min-width: 20px; padding: 0 6px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--muted);
}
.docs-kind[aria-pressed="true"] .docs-kind-count { color: var(--text); }
.docs-archived-toggle { min-height: 44px; border: 1px solid var(--line); background: var(--surface); }
.docs-archived-toggle[aria-pressed="true"] { color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.docs-summary { margin: 14px 0 16px; color: var(--muted); font-size: 14px; }

.docs-group + .docs-group { margin-top: 30px; }
.docs-group-title {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 10px; font-size: 12px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.docs-group-count { font-size: 12px; letter-spacing: 0; font-variant-numeric: tabular-nums; color: var(--muted); opacity: 0.8; }
.docs-group-count::before { content: "("; }
.docs-group-count::after { content: ")"; }

.docs-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px;
}
.docs-grid > li { display: flex; min-width: 0; }

.doc-card {
  position: relative; flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 196px; padding: 16px 18px 14px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.15s, transform 0.15s;
}
.doc-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.doc-card:has(.doc-card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.doc-card.is-pinned { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.doc-card.is-archived { background: transparent; border-style: dashed; }
.doc-card.is-archived .doc-card-title, .doc-card.is-archived .doc-card-preview { opacity: 0.8; }

.doc-card-top { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; min-height: 24px; }
.doc-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.doc-flag.is-pinned { color: var(--accent); }

.doc-card-title { margin: 2px 0 0; font-size: 17px; line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.doc-card-link { color: var(--text); text-decoration: none; }
.doc-card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.doc-card-link:focus-visible { outline: none; }
.doc-card:hover .doc-card-link { color: var(--accent); }

.doc-card-preview {
  flex: 1 1 auto; margin: 0;
  color: var(--muted); font-size: 14px; line-height: 1.5;
  white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.doc-card-preview.is-snippet { white-space: normal; }
.doc-card-preview.is-empty { font-style: italic; opacity: 0.8; }
.doc-card mark, .doc-history mark {
  color: var(--text); border-radius: 3px; padding: 0 1px;
  background: color-mix(in srgb, var(--warn) 32%, transparent);
}
.doc-card-meta {
  display: flex; align-items: center; gap: 8px; margin: 4px 0 0; padding-top: 10px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.doc-card-meta span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card-meta .hub-avatar.size-sm { width: 24px; height: 24px; font-size: 11px; }

.docs-empty { padding: 36px 22px 32px; }
.docs-empty-kinds {
  list-style: none; margin: 20px auto 0; padding: 0; max-width: 560px;
  display: grid; gap: 8px; text-align: left;
}
.docs-empty-kinds li {
  display: grid; grid-template-columns: 130px minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}
.docs-empty-kinds .doc-kind { justify-self: start; }
.hub-empty-action.docs-empty-actions, .docs-empty .hub-empty-action { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* ---------- new doc dialog ---------- */

.doc-kind-set { margin: 4px 0 0; }
.doc-kind-set legend { margin-bottom: 8px; }
.doc-kind-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.doc-kind-option { position: relative; margin: 0; font-weight: 650; }
.doc-kind-option input { position: absolute; opacity: 0; pointer-events: none; }
.doc-kind-face {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 78px; padding: 10px 6px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--muted);
  font-size: 14px; text-align: center; cursor: pointer;
}
.doc-kind-face:hover { color: var(--text); border-color: var(--accent); }
.doc-kind-option input:checked + .doc-kind-face { color: var(--text); background: var(--surface-2); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.doc-kind-option input:checked + .doc-kind-face .hub-icon { color: var(--accent); }
.doc-kind-option input:focus-visible + .doc-kind-face { outline: 2px solid var(--accent); outline-offset: 2px; }
.doc-kind-hint { margin: 10px 0 0; min-height: 1.5em; }
.hub-dialog input.doc-new-title[aria-invalid="true"] { border-color: var(--danger); }
.form-error.doc-title-error { margin: 6px 0 0; font-size: 14px; }
/* Kept in the page while empty, so its alert is read out when a message appears. */
.form-error.doc-title-error:empty { display: block; margin: 0; }

/* ---------- one doc ---------- */

.doc-back {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 36px; margin: -4px 0 6px -4px; padding: 0 8px 0 4px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 650; font-size: 14px;
}
.doc-back:hover { color: var(--text); background: var(--surface); }

.doc-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; align-items: start; }
.doc-main { min-width: 0; display: flex; flex-direction: column; }

.doc-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.doc-kind-field { flex: none; }
select.doc-kind-select {
  width: auto; min-height: 38px; padding: 0 34px 0 14px;
  border-radius: 999px; background-color: var(--surface); border-color: var(--line-strong);
  font-size: 14px; font-weight: 700; background-position: right 12px center;
}
.doc-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn.small.doc-tool { gap: 6px; min-height: 38px; }
.doc-tool[aria-pressed="true"] {
  color: var(--accent); border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
}
.doc-tool-items { border-color: color-mix(in srgb, var(--ok) 55%, var(--line-strong)); }
.doc-tool-items .hub-icon { color: var(--ok); }
/* Every action item is an assignment already: no count, no green. */
.doc-tool-items.is-done { border-color: var(--line-strong); }
.doc-tool-items.is-done .hub-icon { color: var(--muted); }
.doc-tool-count:empty { display: none; }
.doc-tool-count {
  min-width: 20px; padding: 0 6px; border-radius: 999px;
  font-size: 12px; font-weight: 750; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--muted);
}
.doc-tool:disabled { cursor: default; }

.doc-more { position: relative; }
.doc-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  min-width: 250px; padding: 6px;
  display: grid; gap: 2px;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); box-shadow: var(--shadow), 0 16px 40px rgba(0, 0, 0, 0.25);
}
.doc-menu.is-start { right: auto; left: 0; }
.doc-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 42px; padding: 0 12px; border-radius: 8px;
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
}
.doc-menu-item .hub-icon { color: var(--muted); }
.doc-menu-item:hover, .doc-menu-item:focus-visible { background: var(--surface-2); outline: none; }
.doc-menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.doc-menu-item.is-danger, .doc-menu-item.is-danger .hub-icon { color: var(--danger); }
.doc-menu-item.is-danger { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }

/* The title: a one row textarea that wraps and grows, so a long title shows whole. */
.hub textarea.doc-title-input {
  display: block; width: calc(100% + 20px); margin: 0 -10px; padding: 7px 10px;
  min-height: calc(1.2em + 16px); height: auto; resize: none; overflow: hidden;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text);
  font-size: clamp(24px, 3.2vw, 32px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.2;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.hub textarea.doc-title-input.grows { field-sizing: content; }
.hub textarea.doc-title-input:hover { border-color: var(--line); }
.hub textarea.doc-title-input:focus { border-color: var(--accent); background: var(--surface); }
.hub textarea.doc-title-input::placeholder { color: var(--muted); opacity: 0.6; }

.doc-meta { margin: 6px 0 16px; color: var(--muted); font-size: 14px; }

.doc-notices { display: grid; gap: 8px; margin-bottom: 14px; }
.doc-notices:empty { margin: 0; }
.doc-notice {
  --c: var(--accent);
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
  padding: 10px 12px 10px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c);
  font-size: 14px;
}
.doc-notice > .hub-icon { color: var(--c); }
.doc-notice p { flex: 1 1 240px; margin: 0; }
.doc-notice-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-notice-actions a { font-weight: 650; }
.doc-notice.is-danger { --c: var(--danger); }
.doc-notice.is-archived { --c: var(--muted); }
.doc-notice.is-remote { --c: var(--warn); }
.doc-notice.is-draft { --c: var(--accent); }
.doc-notice.is-made { --c: var(--ok); }

/* The editor and the hidden copy used to find where a line sits share every measurement. */
.doc-sheet { position: relative; }
.hub .doc-sheet .doc-editor {
  display: block; width: 100%; min-height: 58vh; margin: 0;
  padding: 26px 30px 30px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 17px; line-height: 1.7; letter-spacing: 0;
  white-space: pre-wrap; overflow-wrap: break-word; tab-size: 4;
  resize: none; overflow: hidden;
  box-shadow: var(--shadow);
}
.hub .doc-sheet .doc-editor.grows { field-sizing: content; }
.hub .doc-sheet textarea.doc-editor:focus { border-color: var(--line-strong); outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.hub .doc-sheet textarea.doc-editor::placeholder { color: var(--muted); opacity: 0.75; }
.hub .doc-sheet .doc-mirror {
  position: absolute; top: 0; left: 0; min-height: 0; height: auto;
  visibility: hidden; pointer-events: none; box-shadow: none;
}

.doc-bar {
  position: sticky; bottom: 12px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding: 7px 7px 7px 16px;
  border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow), 0 -6px 24px color-mix(in srgb, var(--bg) 70%, transparent);
}
.doc-bar-left { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; min-width: 0; }
.doc-words { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-limit { color: var(--warn); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.doc-limit:empty { display: none; }
.doc-limit.is-over { color: var(--danger); }
.doc-bar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.doc-status { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 650; color: var(--muted); min-width: 0; }
.doc-status span { overflow-wrap: anywhere; }
.doc-bar[data-state="saved"] .doc-status .hub-icon { color: var(--ok); }
.doc-bar[data-state="dirty"] .doc-status { color: var(--warn); }
.doc-bar[data-state="error"] .doc-status, .doc-bar[data-state="conflict"] .doc-status { color: var(--danger); }
.doc-save { flex: none; gap: 8px; min-width: 92px; transition: none; }
.doc-kbd {
  padding: 0 6px; border-radius: 6px;
  font: 600 12px/20px ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  background: color-mix(in srgb, currentColor 14%, transparent);
}
@media (hover: none) { .doc-kbd { display: none; } }

.doc-aside { display: none; }
.doc-side-card { padding: 16px 16px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.doc-side-card + .doc-side-card { margin-top: 12px; }
.doc-side-card h3 { margin: 0 0 10px; font-size: 12px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.doc-outline { list-style: none; margin: 0 -6px; padding: 0; display: grid; gap: 1px; }
.doc-outline-item {
  width: 100%; min-height: 34px; padding: 5px 8px; border-radius: 8px;
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.doc-outline-item:hover { background: var(--surface-2); color: var(--accent); }
.doc-outline-empty { padding: 0 6px; color: var(--muted); font-size: 13px; }
.doc-tips ul { margin: 0; padding-left: 18px; display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.doc-tips code, .doc-tips kbd {
  padding: 1px 5px; border-radius: 5px; background: var(--surface-2); color: var(--text);
  font: 600 12px ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; white-space: nowrap;
}

.doc-gone { margin-top: 8px; }

@media (min-width: 1100px) {
  .doc-page { grid-template-columns: minmax(0, 820px) 260px; justify-content: space-between; }
  .doc-aside { display: block; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
}

/* ---------- dialogs: differences ---------- */

.doc-diff-summary { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.doc-diff {
  max-height: 44vh; overflow: auto;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  font-size: 14px; line-height: 1.55;
}
.doc-diff-line { --c: var(--muted); display: grid; grid-template-columns: 66px minmax(0, 1fr); }
.doc-diff-line.is-del { --c: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.doc-diff-line.is-add { --c: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.doc-diff-line.is-same .doc-diff-text { color: var(--muted); }
.doc-diff-line .doc-diff-mark {
  padding: 2px 8px; color: var(--c);
  font: 750 10.5px/1.9 ui-sans-serif, system-ui, -apple-system, sans-serif; letter-spacing: 0.05em; text-transform: uppercase;
  border-right: 1px solid var(--line);
}
.doc-diff-text { padding: 1px 10px; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.55em; }
.doc-diff-skip {
  padding: 3px 10px; text-align: center; color: var(--muted);
  font: 600 12px/1.6 ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--surface-2); border-block: 1px solid var(--line);
}
.doc-diff-skip:first-child { border-top: 0; }
.doc-diff-skip:last-child { border-bottom: 0; }
.doc-diff-same { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--ok); font-weight: 650; }
span.doc-diff-mark.is-del, span.doc-diff-mark.is-add {
  --c: var(--warn);
  display: inline-block; padding: 0 7px; border-radius: 999px; margin-right: 4px;
  font-size: 11px; font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.7;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
}
span.doc-diff-mark.is-add { --c: var(--accent); }

.doc-conflict-choices { margin: 0 0 16px; padding-left: 18px; display: grid; gap: 4px; color: var(--muted); font-size: 14px; }
.doc-conflict-choices strong { color: var(--text); }
.doc-conflict-field + .doc-conflict-field { margin-top: 16px; }
.doc-conflict-field p { margin: 0 0 4px; overflow-wrap: anywhere; }
.doc-conflict-label { font-size: 12px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px !important; }

/* ---------- dialogs: history ---------- */

.doc-history-intro { margin: 0 0 12px; }
.doc-history { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 16px; min-height: 340px; }
.doc-history-list {
  list-style: none; margin: 0; padding: 0 4px 0 0;
  display: grid; gap: 4px; align-content: start;
  max-height: 50vh; overflow: auto;
}
.doc-history-item {
  display: grid; gap: 1px; width: 100%; padding: 9px 11px;
  border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.doc-history-item:hover { background: var(--surface-2); }
.doc-history-item[aria-pressed="true"] { background: var(--surface-2); border-color: var(--accent); }
.doc-history-when { font-size: 14px; font-weight: 700; }
.doc-history-who, .doc-history-title { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.doc-history-view { min-width: 0; }
.doc-history-head { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 14px; margin-bottom: 10px; }
.doc-history-head .hint { margin: 0; }
.doc-history-saved { margin: 0; font-weight: 700; flex-basis: 100%; }
.doc-history-toggle { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 0 auto; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 32px; }
.doc-history-text {
  max-height: 46vh; overflow: auto; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.doc-history-empty { display: grid; justify-items: center; gap: 6px; padding: 10px 0 4px; text-align: center; }
.doc-history-empty .hub-icon { color: var(--muted); }
.doc-history-empty .hint { max-width: 380px; margin: 0; }

/* ---------- dialogs: action items ---------- */

.doc-items { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.doc-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 12px;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
}
.doc-item input[type="checkbox"] { margin: 3px 0 0; }
.doc-item-body { display: grid; gap: 6px; margin: 0; cursor: pointer; }
.doc-item-title { font-weight: 700; overflow-wrap: anywhere; }
.doc-item-chips { display: flex; flex-wrap: wrap; gap: 6px; font-weight: 500; }
.doc-chip {
  padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 650; line-height: 1.6;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--line);
}
.doc-chip.is-owner { color: var(--text); }
.doc-chip.is-due, .doc-chip.is-hours { color: var(--text); }
.doc-chip.is-priority { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.doc-chip.is-warn { color: var(--warn); border-style: dashed; border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.doc-item-state { color: var(--ok); font-size: 13px; font-weight: 750; }
.doc-item.is-made { opacity: 0.75; }
.doc-item.is-made .doc-item-title { text-decoration: line-through; text-decoration-thickness: 1px; }

/* ---------- phones ---------- */

@media (max-width: 759px) {
  .docs-toolbar { flex-direction: column; align-items: stretch; }
  .docs-search { max-width: none; flex-basis: auto; }
  .docs-filters { align-items: stretch; }
  .docs-kinds { flex: 1 1 100%; }
  .docs-kind { min-height: 44px; flex: none; }
  .docs-archived-toggle { flex: 1 1 100%; justify-content: center; }
  .docs-summary { margin: 12px 0 12px; }
  .docs-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .doc-card { min-height: 0; padding: 14px 16px 12px; }
  .docs-empty-kinds li { grid-template-columns: minmax(0, 1fr); gap: 6px; }

  .doc-kind-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-kind-face { min-height: 64px; flex-direction: row; }

  .doc-back { min-height: 44px; }
  .doc-toolbar { gap: 8px; }
  select.doc-kind-select { min-height: 44px; font-size: 16px; }
  .btn.small.doc-tool { min-height: 44px; min-width: 44px; padding: 0 10px; }
  .doc-tool .doc-tool-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  /* The tools can wrap under the kind picker, with More anywhere in the row, so the menu opens the
     full width of the page under the toolbar instead of hanging off More. */
  .doc-toolbar { position: relative; }
  .doc-more { position: static; }
  .doc-menu, .doc-menu.is-start { left: 0; right: 0; min-width: 0; }
  .doc-menu-item { min-height: 46px; }
  .hub textarea.doc-title-input { font-size: 24px; padding: 8px 10px; }
  .doc-meta { margin-bottom: 12px; font-size: 13px; }
  .hub .doc-sheet .doc-editor { min-height: 52vh; padding: 18px 16px 22px; font-size: 16px; line-height: 1.65; border-radius: 12px; }
  .doc-bar { bottom: 8px; padding: 6px 6px 6px 12px; }
  .doc-status { font-size: 13px; }
  .doc-save { min-width: 0; min-height: 44px; }

  .doc-history { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .doc-history-list { max-height: 26vh; padding: 0; }
  .doc-history-text, .doc-diff { max-height: 40vh; }
  .doc-diff-line { grid-template-columns: 54px minmax(0, 1fr); }
  .doc-item { padding: 12px; gap: 10px; }
  .doc-item input[type="checkbox"] { width: 22px; height: 22px; }
}

@media (max-width: 400px) {
  .doc-bar-left .doc-words { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .doc-card { transition: none; }
  .doc-card:hover { transform: none; }
}
