/* Шрифт Onest (SIL OFL 1.1, см. fonts/OFL.txt): переменный, веса 400–700 */
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/onest-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/onest-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --navy: #1b2a3d;
  --mint: #3fd0a4;
  --mail: #5b8def;
  --file: #e5a03c;
  --bg: #f7f9fb;
  --card: #ffffff;
  --line: #e2e8ef;
  --text: #1b2a3d;
  --muted: #6b7a8c;
  --danger: #c0392b;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.5 "Onest", system-ui, sans-serif;
}
a { color: var(--mail); }
h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 1rem; }

.topbar {
  display: flex; align-items: center; gap: 1rem; padding: .75rem 1.25rem;
  background: var(--navy); color: #fff;
}
.topbar .brand { color: #fff; font-weight: 700; text-decoration: none; margin-right: auto; }
.topbar-user { font-size: .9rem; color: #c9d3df; }
.inline { display: inline; margin: 0; }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; color: var(--mint); cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.page { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.page-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.topbar + .page-center { min-height: calc(100vh - 3rem); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.75rem; box-shadow: 0 1px 2px rgba(27, 42, 61, .05);
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { text-align: center; }

label { display: block; margin: .9rem 0 .3rem; font-size: .9rem; font-weight: 500; }
input[type=email], input[type=password], input[type=text] {
  width: 100%; padding: .6rem .75rem; font: inherit; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
input:focus { outline: 2px solid var(--mint); outline-offset: 1px; }
.btn {
  display: block; width: 100%; margin-top: 1.25rem; padding: .65rem 1rem;
  font: 500 1rem "Onest", sans-serif; color: var(--navy); background: var(--mint);
  border: 0; border-radius: 8px; cursor: pointer;
}
.btn:hover { filter: brightness(.95); }
.alert {
  margin: 0 0 .5rem; padding: .6rem .8rem; border-radius: 8px; font-size: .92rem;
  color: var(--danger); background: #fdeeed; border: 1px solid #f3c9c5;
}
.muted { color: var(--muted); font-size: .9rem; text-align: center; margin: 1rem 0 0; }
.page > .muted { text-align: left; }

/* Стили индикатора htmx (includeIndicatorStyles отключён из-за CSP) */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* Проекты: каркас «Хроники» */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters select, .filters input, .inline-form select, .card select, .card input[type=date] {
  padding: .5rem .6rem; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.btn-small { display: inline-block; width: auto; margin-top: 0; padding: .45rem .9rem; }
.project-list { list-style: none; padding: 0; display: grid; gap: .6rem; }
.project-list .card { padding: .9rem 1.1rem; display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; }
.chronicle { max-width: 1280px; margin: 0 auto; padding: 1.25rem; display: grid; gap: 1.25rem;
  grid-template-columns: 220px minmax(0, 1fr) 260px; }
.chr-left ul { list-style: none; padding: 0; margin: 0; }
.chr-left li { padding: .35rem .6rem; border-radius: 8px; }
.chr-left li.active { background: var(--card); border: 1px solid var(--line); font-weight: 600; }
.chr-left a { text-decoration: none; color: var(--text); }
.chr-left h2, .chr-right h2 { font-size: .85rem; text-transform: uppercase; color: var(--muted); }
.tabs { display: flex; gap: 1.25rem; border-bottom: 1px solid var(--line); margin: 1rem 0; }
.tab { padding: .5rem 0; }
.tab.active { border-bottom: 2px solid var(--mint); font-weight: 600; }
.tab.disabled { color: var(--muted); }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.chr-center h2 { font-size: 1.05rem; margin: 1.25rem 0 .4rem; }
.chr-center .muted, .chr-right .muted { text-align: left; margin: 0; }
@media (max-width: 860px) {
  .chronicle { grid-template-columns: 1fr; }
}

.topnav { display: flex; gap: 1rem; }
.topnav a { color: #c9d3df; text-decoration: none; font-size: .95rem; }
.topnav a:hover { color: #fff; }
.topbar .brand { margin-right: 0; }
.topbar .topnav + .topbar-user { margin-left: auto; }
.topbar .brand + .topbar-user { margin-left: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .85rem; color: var(--muted); font-weight: 500; }
.copy-row { display: flex; gap: .5rem; align-items: center; }
.copy-row input { flex: 1; }
.pager { display: flex; gap: 1rem; margin-top: 1rem; }
.hidden { display: none; }

/* Лента «Хроника» (вариант 1) */
.m1-tl { list-style: none; margin: 1rem 0 0; padding: 0 0 0 16px; border-left: 2px solid var(--line);
  display: flex; flex-direction: column; gap: .9rem; }
.m1-tl li { position: relative; }
.m1-tl li.ev { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: .5rem; }
.m1-tl li.ev::before { content: ""; position: absolute; left: -23px; top: 6px; width: 10px; height: 10px;
  border-radius: 50%; background: #fff; border: 2px solid #8a99ad; }
.m1-tl li.ev.meet::before { border-color: var(--mint); background: var(--mint); }
.m1-tl li.ev.mail::before { border-color: var(--mail); }
.m1-tl li.ev.file::before { border-color: var(--file); }
.m1-tl li.ev.deleted::before { border-style: dashed; }
.m1-tl time { color: var(--muted); font-size: .8rem; padding-top: .15rem; }
.m1-tl li.day { font-size: .8rem; font-weight: 600; text-transform: uppercase; color: var(--muted); margin-top: .4rem; }
.ev-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.ev .text { white-space: pre-wrap; margin: .15rem 0; overflow-wrap: anywhere; }
.ev .sys { margin: .15rem 0; color: #3a4a5e; }
.badge { font-style: normal; font-size: .7rem; padding: 1px 6px; border-radius: 4px;
  background: #e9edf2; color: #5d6b7c; }
.ev-actions { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .85rem; align-items: baseline; }
.ev-actions .link-btn { color: var(--mail); }
.ev-actions .link-btn.danger { color: var(--danger); }
.ev-actions summary { cursor: pointer; list-style: none; }
.ev-actions details textarea, .composer textarea { width: 100%; font: inherit; padding: .6rem .75rem;
  border: 1px solid var(--line); border-radius: 8px; }
.composer { padding: 1rem; }
.composer-row { display: flex; gap: 1rem; align-items: center; margin-top: .5rem; }
.composer-row .btn { margin-left: auto; }
.radio { display: inline-flex; gap: .3rem; align-items: center; margin: 0; font-weight: 400; }
.filters-tabs { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0 0; font-size: .9rem; }
.filters-tabs a { color: var(--muted); text-decoration: none; padding-bottom: 2px; }
.filters-tabs a.active { color: var(--text); border-bottom: 2px solid var(--navy); font-weight: 500; }
.count { background: var(--mint); color: #0f2a22; border-radius: 9px; font-size: .7rem; padding: 1px 6px; }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.confirm { max-width: 560px; margin: 2rem auto; }
.confirm blockquote { white-space: pre-wrap; margin: 1rem 0; padding-left: .8rem; border-left: 3px solid var(--line); }

.ev-files { list-style: none; padding: 0; margin: .3rem 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.ev-files img, .ev-files video { max-width: 240px; max-height: 240px; border-radius: 6px; display: block; }
.ev-files audio { max-width: 240px; }
.composer input[type=file] { max-width: 60%; }

/* Этапы */
.stage-strip { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0 0 .5rem; }
.stage-strip li { display: flex; gap: .4rem; align-items: center; padding: .25rem .6rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); font-size: .85rem; }
.stage-strip a { color: var(--text); text-decoration: none; }
.chip { font-size: .72rem; padding: 1px 7px; border-radius: 10px; background: #e9edf2; color: #5d6b7c; }
.chip-in_progress { background: #dce9fa; color: #25507f; }
.chip-on_approval { background: #fbefd0; color: #7a5a10; }
.chip-approved { background: #d8f0e4; color: #1d6b45; }
.chip-returned { background: #f8dede; color: #8a2d2d; }
.stage-list { list-style: none; padding: 0; display: grid; gap: .6rem; }
.stage { padding: .8rem 1rem; }
.stage-head { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.stage-head .reorder { margin-left: auto; display: inline-flex; gap: .3rem; }
.stage-actions { display: flex; gap: .9rem; flex-wrap: wrap; align-items: flex-start; margin-top: .5rem; }
.stage-actions textarea, .stage-new textarea, .stage-new input { width: 100%; font: inherit; padding: .5rem .6rem;
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: .4rem; }
.stage-actions summary { cursor: pointer; list-style: none; color: var(--mail); }
.stage-new { display: grid; gap: .2rem; margin-bottom: 1rem; padding: .9rem 1rem; }
.stage-decide { flex: 1 1 100%; }
.btn-danger-ghost { background: transparent; color: var(--danger); border: 1px solid var(--danger); }

/* Стартовые экраны */
.page-wide { max-width: 1280px; }
.banner { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; }
.banner-warn { background: #fff3e2; color: #8a5200; border: 1px solid #f1d4a6; }
.banner-block { background: #fdeeed; color: var(--danger); border: 1px solid #f3c9c5; }
.dash-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.dash-head h1 { margin: 0; }
.dash-block { margin: 1.5rem 0; }
.dash-block h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.dash-block .muted { text-align: left; margin: 0 0 .5rem; }
.dash-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.dash-row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: .55rem .8rem; }
.dash-row time { font-weight: 700; font-size: .85rem; min-width: 5.5rem; }
.dash-row.late { background: #fff3e2; border-color: #f1d4a6; }
.dash-row.late time, .dash-late { color: #b56a00; }
.dash-late { font-size: .8rem; }
.dash-main { display: flex; flex-direction: column; flex: 1 1 200px; min-width: 0; }
.dash-main .muted { margin: 0; font-size: .85rem; }
.dash-empty { color: var(--muted); font-size: .9rem; margin: 0; padding: .5rem 0; }
.count-late { background: #f3c9a0; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.bcol { background: #eef2f6; border-radius: var(--radius); padding: .7rem; display: grid; gap: .6rem;
  align-content: start; min-height: 6rem; }
.bcol h2 { font-size: .85rem; text-transform: uppercase; color: var(--muted); margin: 0; }
.bcol.drop { outline: 2px dashed var(--mint); }
.bcard { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .8rem; cursor: grab; }
.bcard.dragging { opacity: .5; }
.bcard-title { font-weight: 600; color: var(--text); text-decoration: none; }
.bcard .muted { text-align: left; margin: 0; font-size: .85rem; }
.bcard-due { font-size: .8rem; margin: .3rem 0; }
.bcard-due.late { color: #b56a00; font-weight: 600; }
.bcard-form { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.bcard-form select { padding: .35rem .4rem; font: inherit; border: 1px solid var(--line); border-radius: 8px; max-width: 100%; }
.board-paused { margin-top: 1.5rem; }
.board-paused summary { cursor: pointer; color: var(--muted); }
.empty-card { max-width: 560px; }
.m1-due { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 8px; background: #f3f6f9;
  color: var(--text); text-decoration: none; font-size: .9rem; margin-bottom: .4rem; }
.m1-due time { font-weight: 700; font-size: .8rem; }
.m1-due.warn, .m1-due.late { background: #fff3e2; }
.m1-due.warn time, .m1-due.late time { color: #b56a00; }
.c1-file { display: flex; justify-content: space-between; gap: .5rem; padding: 6px 0; border-bottom: 1px solid #eef1f5;
  font-size: .85rem; color: var(--mail); text-decoration: none; overflow-wrap: anywhere; }
.c1-file small { color: var(--muted); white-space: nowrap; }
@media (max-width: 860px) {
  .board { grid-template-columns: 1fr; }
}
