/* Targetorium Dashboard — black & lime, mobile-first */
:root {
  --bg: #0b0d10;
  --bg2: #13161b;
  --bg3: #1b1f26;
  --bg4: #242933;
  --border: #23282f;
  --border2: #333a44;
  --text: #f2f4f6;
  --muted: #8f99a3;
  --lime: #c9f73a;
  --lime2: #a5d62a;
  --lime-soft: rgba(201, 247, 58, .1);
  --lime-border: rgba(201, 247, 58, .3);
  --green: #3ecf8e;
  --red: #ff5c5c;
  --yellow: #ffcf5c;
  --radius: 16px;
  --shadow: 0 10px 34px rgba(0, 0, 0, .45);
  --nav-h: calc(60px + env(safe-area-inset-bottom, 0px));
  --font-head: "Space Grotesk", "Inter", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
html, body { height: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .page-title, .side-logo, .auth-logo { font-family: var(--font-head); }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; font-size: 16px; /* 16px = без автозуму iOS */
  color: var(--text); background: var(--bg); border: 1px solid var(--border2);
  border-radius: 11px; padding: 12px 14px; width: 100%; outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238f99a3' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
input:focus, select:focus, textarea:focus { border-color: var(--lime); box-shadow: 0 0 0 3px var(--lime-soft); }
a { color: var(--lime); }
::selection { background: var(--lime); color: #0b0d10; }

/* иконки */
.ic { width: 20px; height: 20px; flex-shrink: 0; vertical-align: -4px; }
.ic-s { width: 16px; height: 16px; }
.ic-lg { width: 24px; height: 24px; }

/* сетка-фон (футуристика) */
.grid-bg {
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 34px 34px;
}

/* ================= auth ================= */
.auth-screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px calc(16px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  background:
    radial-gradient(800px 440px at 85% -5%, rgba(201, 247, 58, .09) 0%, transparent 60%),
    radial-gradient(600px 460px at -5% 108%, rgba(201, 247, 58, .05) 0%, transparent 55%),
    var(--bg);
  position: relative;
}
.auth-screen::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(70% 60% at 50% 40%, #000 0%, transparent 100%);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000 0%, transparent 100%);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 22px; padding: 34px 26px; box-shadow: var(--shadow); position: relative;
}
.auth-logo { font-size: 25px; font-weight: 700; text-align: center; letter-spacing: -.02em;
  display: flex; align-items: center; justify-content: center; gap: 10px; }
.auth-logo .ic { width: 26px; height: 26px; color: var(--lime); }
.logo-mark { stroke: none; }
.auth-logo .logo-mark { width: 30px; height: 30px; }
.side-logo .logo-mark { width: 26px; height: 26px; }
.auth-sub { color: var(--muted); text-align: center; font-size: 13px; margin: 8px 0 24px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: 13px; padding: 4px; margin-bottom: 20px; }
.auth-tab { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 10px; border-radius: 10px; font-weight: 600; transition: all .15s; }
.auth-tab.active { background: var(--bg3); color: var(--lime); }
.auth-error { background: rgba(255,92,92,.09); color: var(--red); border: 1px solid rgba(255,92,92,.35);
  border-radius: 11px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }
.auth-ok { background: rgba(62,207,142,.09); color: var(--green); border-color: rgba(62,207,142,.35); }
.auth-note { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 18px; line-height: 1.5; }

/* ================= buttons ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border2); background: var(--bg3); color: var(--text);
  border-radius: 12px; padding: 11px 18px; font-weight: 600; min-height: 44px;
  transition: filter .15s, transform .05s, border-color .15s; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.18); }
.btn-primary {
  background: var(--lime); border-color: var(--lime); color: #0b0d10;
  box-shadow: 0 4px 20px rgba(201, 247, 58, .22); font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger { background: transparent; border-color: rgba(255,92,92,.4); color: var(--red); }
.btn-sm { padding: 7px 13px; font-size: 13.5px; min-height: 36px; border-radius: 10px; }
.btn-block { width: 100%; }
.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }

/* ================= layout (mobile-first) ================= */
.layout { min-height: 100vh; min-height: 100dvh; }
.content-wrap { display: flex; flex-direction: column; min-height: 100dvh; }
main#view {
  flex: 1; width: 100%; max-width: 1200px; margin: 0 auto;
  padding: 18px 16px calc(var(--nav-h) + 28px);
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
}

/* topbar (mobile) */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 16, .82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 40;
}
.burger { display: flex; align-items: center; justify-content: center; background: var(--bg3);
  border: 1px solid var(--border2); border-radius: 11px; color: var(--text); width: 40px; height: 40px; flex-shrink: 0; }
#topbar-title { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-head); }

/* sidebar = drawer на мобилке */
.sidebar {
  position: fixed; z-index: 90; left: 0; top: 0; height: 100dvh; width: min(312px, 86vw);
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(-105%); transition: transform .22s ease;
  overflow-y: auto; overscroll-behavior: contain;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}
.sidebar.open { transform: none; box-shadow: 30px 0 60px rgba(0,0,0,.55); }
.side-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s; }
.side-backdrop.show { opacity: 1; pointer-events: auto; }
.side-logo { font-size: 17px; font-weight: 700; padding: 20px 18px 10px; display: flex; align-items: center; gap: 9px; letter-spacing: -.01em; }
.side-logo .ic { color: var(--lime); width: 22px; height: 22px; }
.side-logo .spacer { flex: 1; }
.side-close { display: flex; align-items: center; justify-content: center; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 10px; color: var(--muted); width: 34px; height: 34px; }
#side-nav { flex: 1; padding: 4px 12px 12px; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  margin: 18px 8px 7px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0;
  color: var(--text); padding: 11px 12px; border-radius: 11px; font-size: 14.5px; margin-bottom: 1px; min-height: 44px;
}
.nav-item .ic { color: var(--muted); width: 18px; height: 18px; }
.nav-item:hover { background: var(--bg3); }
.nav-item.active { background: var(--lime-soft); color: var(--lime); font-weight: 600; }
.nav-item.active .ic { color: var(--lime); }
.side-user { border-top: 1px solid var(--border); padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#side-username { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* bottom tab bar (mobile) */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; justify-content: space-around; align-items: stretch;
  background: rgba(11, 13, 16, .92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--muted); font-size: 10.5px; font-weight: 600;
  padding: 9px 2px 7px; min-height: 58px; max-width: 110px; position: relative;
}
.bn-item .ic { width: 22px; height: 22px; transition: transform .12s; }
.bn-item.active { color: var(--lime); }
.bn-item.active .ic { transform: translateY(-1px); }
.bn-item.active::before { content: ""; position: absolute; top: 0; width: 22px; height: 2.5px; border-radius: 3px; background: var(--lime); }

/* ================= home ================= */
.page-title { font-size: 23px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px;
  display: flex; align-items: center; gap: 10px; }
.page-title .ic { color: var(--lime); width: 24px; height: 24px; }
.page-sub { color: var(--muted); margin-bottom: 22px; font-size: 13.5px; }
.home-hero {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 18px; margin-bottom: 22px; position: relative; overflow: hidden;
  background:
    radial-gradient(400px 200px at 90% -30%, rgba(201,247,58,.13), transparent 65%),
    var(--bg2);
}
.home-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(90% 100% at 85% 0%, #000, transparent);
  -webkit-mask-image: radial-gradient(90% 100% at 85% 0%, #000, transparent);
}
.home-hero h1 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; position: relative; }
.home-hero h1 em { font-style: normal; color: var(--lime); }
.home-hero p { color: var(--muted); font-size: 13.5px; margin-top: 5px; position: relative; }
.hero-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; position: relative; }
.hero-chip { display: inline-flex; align-items: center; gap: 7px; background: rgba(11,13,16,.55);
  border: 1px solid var(--lime-border); color: var(--text); border-radius: 10px; padding: 6px 12px;
  font-size: 12.5px; font-weight: 600; }
.hero-chip:empty { display: none; }
.hero-chip .ic { color: var(--lime); }
.hero-red { color: var(--red); }
.cards-team { margin-bottom: 4px; }
.card-accent { background: linear-gradient(160deg, rgba(201,247,58,.09), var(--bg2) 55%);
  border-color: var(--lime-border); }
.card-accent:hover { border-color: var(--lime); box-shadow: 0 6px 26px rgba(201,247,58,.1); }
.card-accent h3 { font-size: 17px; }
.card p b { color: var(--text); }
.cards-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 4px; position: relative;
}
.card:active { transform: scale(.985); }
.card:hover { border-color: var(--lime-border); box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.card h3 { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card h3 .ic { color: var(--lime); width: 18px; height: 18px; }
.card p { color: var(--muted); font-size: 13px; }
.card .tag { align-self: flex-start; font-size: 10px; color: var(--lime); background: var(--lime-soft);
  border: 1px solid var(--lime-border); border-radius: 6px; padding: 2px 8px; margin-bottom: 7px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.card .card-num { position: absolute; top: 14px; right: 16px; font-family: var(--font-head);
  font-size: 13px; color: var(--border2); font-weight: 700; }

/* ================= kb doc ================= */
.doc-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.doc-head h1 { font-size: 21px; letter-spacing: -.02em; }
.doc-head-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.doc-search { flex: 1; min-width: 180px; }
.doc-layout { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
.doc-toc-desktop { display: none; }
.doc-toc-mobile {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg2); overflow: hidden;
}
.doc-toc-mobile summary {
  padding: 13px 16px; font-weight: 700; font-size: 14px; cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 9px;
}
.doc-toc-mobile summary .ic { color: var(--lime); width: 17px; height: 17px; }
.doc-toc-mobile summary::-webkit-details-marker { display: none; }
.doc-toc-mobile summary::after { content: "▾"; color: var(--muted); margin-left: auto; transition: transform .15s; }
.doc-toc-mobile[open] summary::after { transform: rotate(180deg); }
.doc-toc-mobile .toc-list { padding: 0 16px 12px; max-height: 45vh; overflow-y: auto; }
.toc-list a { display: block; color: var(--muted); text-decoration: none; padding: 6px 0; font-size: 13.5px;
  border-bottom: 1px solid rgba(255,255,255,.03); }
.toc-list a:hover { color: var(--lime); }
.toc-list a.h3 { padding-left: 16px; font-size: 12.5px; }

/* бейдж-точка уведомлений */
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block;
  margin-left: 6px; box-shadow: 0 0 6px rgba(255,92,92,.8); }
.bn-ico { position: relative; }
.bn-ico .nav-dot { position: absolute; top: -2px; right: -6px; margin: 0; }

/* уведомления в задачах */
.notif-box { display: flex; gap: 10px; align-items: flex-start; background: rgba(201,247,58,.06);
  border: 1px solid var(--lime-border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.notif-box > .ic { color: var(--lime); margin-top: 2px; }
.notif-item { font-size: 13.5px; padding: 2px 0; }
.notif-item span { color: var(--muted); font-size: 12px; }

/* «Твой день» */
.day-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
.day-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px; }
.day-card .obj-block-head { color: var(--lime); font-size: 14px; margin-bottom: 8px; }
.day-window { border-color: var(--lime-border); background: linear-gradient(160deg, rgba(201,247,58,.07), var(--bg2) 60%); }
.day-list { display: flex; flex-direction: column; gap: 4px; }
.day-task { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 9px; cursor: pointer; }
.day-task:hover { background: var(--bg3); }
.day-task-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.day-task-dot.waiting { background: var(--yellow); }
.day-task-dot.progress { background: var(--lime); }
.day-task-title { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* звонки */
.call-upload > summary { list-style: none; display: inline-flex; cursor: pointer; }
.call-upload > summary::-webkit-details-marker { display: none; }
.call-upload { border: 0; background: none; padding: 0; margin-bottom: 20px; }
.call-upload[open] > summary { opacity: .6; }
.call-upload > div { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
input[type="file"] { padding: 9px 12px; font-size: 13.5px; color: var(--muted); }
input[type="file"]::file-selector-button { font: inherit; background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text); border-radius: 8px; padding: 6px 12px; margin-right: 10px; cursor: pointer; }
.call-item { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 10px; overflow: hidden; }
.call-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
.call-head:hover { background: var(--bg3); }
.call-head-body { flex: 1; min-width: 0; }
.call-arrow { color: var(--muted); transition: transform .15s; }
.call-body { padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.transcript { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; max-height: 60vh; overflow-y: auto; margin-top: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* лента активности */
.activity-list { padding: 4px 16px 14px; max-height: 50vh; overflow-y: auto; }
.activity-row { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px;
  padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.activity-time { color: var(--muted); font-size: 11.5px; font-family: ui-monospace, Menlo, monospace; flex-shrink: 0; }
.activity-act { color: var(--lime); }
.activity-detail { color: var(--muted); }

/* мини-гайд «Как пользоваться?» */
.help-box { border: 1px dashed var(--border2); border-radius: 12px; background: rgba(255,255,255,.015);
  margin: 2px 0 14px; flex: 1 1 100%; }
.help-box summary { padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
  list-style: none; display: flex; align-items: center; gap: 8px; }
.help-box summary::-webkit-details-marker { display: none; }
.help-box summary .ic { color: var(--lime); }
.help-box summary::after { content: "▾"; margin-left: auto; transition: transform .15s; }
.help-box[open] summary::after { transform: rotate(180deg); }
.help-box ul { margin: 0; padding: 0 16px 12px 32px; color: var(--muted); font-size: 13px; }
.help-box li { margin: 5px 0; }
.help-box li::marker { color: var(--lime2); }

/* таймлайн запуска */
.tl-wrap { margin: 4px 0 22px; }
.timeline { display: flex; gap: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity; padding: 2px 16px 10px; margin: 0 -16px; scrollbar-width: none; }
.timeline::-webkit-scrollbar { display: none; }
.tl-step { flex: 0 0 220px; scroll-snap-align: start; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 14px; position: relative; }
.tl-step .tl-dot { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 9px; background: var(--bg3); border: 1px solid var(--border2); color: var(--muted); margin-bottom: 8px; }
.tl-step.past { opacity: .55; }
.tl-step.past .tl-dot { color: var(--green); }
.tl-step.now { border-color: var(--lime); background: linear-gradient(160deg, rgba(201,247,58,.1), var(--bg2) 60%); }
.tl-step.now .tl-dot { background: var(--lime); border-color: var(--lime); color: #0b0d10; }
.tl-dates { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tl-now { color: var(--lime); }
.tl-title { font-weight: 700; font-size: 14.5px; margin: 3px 0 2px; font-family: var(--font-head); }
.tl-desc { color: var(--muted); font-size: 12px; line-height: 1.45; }

/* банк возражений */
.obj-card h3 { text-transform: capitalize; }
.obj-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; background: var(--bg2); }
.obj-block-head { display: flex; align-items: center; gap: 9px; font-weight: 700; font-family: var(--font-head);
  font-size: 15px; margin-bottom: 6px; }
.obj-dig { border-color: rgba(255,207,92,.35); }
.obj-dig .obj-block-head { color: var(--yellow); }
.obj-close { border-color: var(--lime-border); background: linear-gradient(160deg, rgba(201,247,58,.06), var(--bg2) 55%); }
.obj-close .obj-block-head { color: var(--lime); }
.obj-block .md ol > li, .obj-block .md ul > li { margin: 10px 0; }
.obj-more { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg2);
  margin-bottom: 12px; overflow: hidden; }
.obj-more summary { padding: 13px 16px; font-weight: 700; font-size: 14px; cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 9px; color: var(--muted); }
.obj-more summary .ic { color: var(--lime); }
.obj-more summary::-webkit-details-marker { display: none; }
.obj-more summary::after { content: "▾"; margin-left: auto; transition: transform .15s; }
.obj-more[open] summary::after { transform: rotate(180deg); }
.obj-more > .md { padding: 0 16px 14px; }

/* комментарии к задачам */
.comments-list { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 4px 2px; margin-bottom: 8px; }
.comment { background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; }
.comment.mine { border-color: var(--lime-border); }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.comment-head b { color: var(--text); }
.comment-del { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 12px; padding: 2px 6px; }
.comment-del:hover { color: var(--red); }
.comment-text { font-size: 14px; white-space: pre-wrap; overflow-wrap: break-word; }
.comment-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 10px 0; }
.comment-form { display: flex; gap: 8px; }
.comment-form .btn { flex-shrink: 0; width: 48px; padding: 0; }

/* чипы листов xlsx (как вкладки Excel) */
.sheet-chips { display: flex; gap: 7px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 2px 2px 6px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.sheet-chips::-webkit-scrollbar { display: none; }
.sheet-chip { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 10px; padding: 8px 13px; font-size: 13px; font-weight: 600; white-space: nowrap;
  min-height: 38px; transition: all .15s; }
.sheet-chip:hover { border-color: var(--border2); color: var(--text); }
.sheet-chip.on { background: var(--lime); border-color: var(--lime); color: #0b0d10; }
.sheet-chip.dim { opacity: .38; }
.sheet-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); display: inline-block; }
.sheet-chip.on .dot { background: #0b0d10; }
.sheet-hint { color: var(--muted); font-size: 12px; margin: 2px 0 14px; }

.md { min-width: 0; overflow-wrap: break-word; }
.md > :first-child { margin-top: 0 !important; }
.md h1 { font-size: 21px; margin: 26px 0 12px; letter-spacing: -.02em; }
.md h2 { font-size: 18.5px; margin: 30px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); letter-spacing: -.01em; }
.md h3 { font-size: 16px; margin: 22px 0 8px; color: var(--lime); }
.md h4 { font-size: 14.5px; margin: 16px 0 6px; }
.md p { margin: 10px 0; }
.md ul, .md ol { margin: 10px 0 10px 22px; }
.md li { margin: 5px 0; }
.md li::marker { color: var(--lime2); }
.md blockquote { border-left: 3px solid var(--lime); background: var(--bg2); padding: 10px 16px;
  border-radius: 0 12px 12px 0; margin: 14px 0; color: #ccd3da; }
.md code { background: var(--bg3); border-radius: 5px; padding: 1px 6px; font-size: 13px; color: var(--lime); }
.md pre { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; overflow-x: auto; margin: 12px 0; }
.md pre code { background: none; padding: 0; color: var(--text); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.md table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 13px; display: block;
  overflow-x: auto; -webkit-overflow-scrolling: touch; }
.md th, .md td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top;
  min-width: 90px; max-width: 460px; }
.md th { background: var(--bg3); }
.md tr:nth-child(even) td { background: rgba(255,255,255,.02); }
/* режим листов: воздух и читабельность */
.md-sheet table { font-size: 13.5px; }
.md-sheet th { position: sticky; top: -1px; z-index: 2; }
.md-sheet td { line-height: 1.6; }
.md-sheet p { max-width: 74ch; }

/* ================= links ================= */
.links-form { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 20px; }
.link-item { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; display: flex; gap: 12px; align-items: flex-start;
  transition: border-color .15s; }
.link-item:hover { border-color: var(--border2); }
.link-ico { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 11px; background: var(--lime-soft); border: 1px solid var(--lime-border); color: var(--lime); flex-shrink: 0; }
.link-ico .ic { width: 17px; height: 17px; }
.link-body { flex: 1; min-width: 0; }
.link-title { font-weight: 700; font-size: 15px; }
.link-url { font-size: 13px; word-break: break-all; margin-top: 2px; }
.link-desc { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.link-meta { color: var(--muted); font-size: 11.5px; margin-top: 7px; opacity: .8; }

/* ================= kanban ================= */
.kanban {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; padding: 2px 16px 14px; margin: 0 -16px;
  scrollbar-width: none;
}
.kanban::-webkit-scrollbar { display: none; }
.kcol {
  flex: 0 0 84%; max-width: 340px; scroll-snap-align: center;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; min-height: 240px; align-self: flex-start;
}
.kcol.drag-over { border-color: var(--lime); background: rgba(201,247,58,.04); }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; font-weight: 700; font-size: 14.5px; }
.kcol-head .ic { width: 17px; height: 17px; }
.kcol[data-col="waiting"] .kcol-head .ic { color: var(--yellow); }
.kcol[data-col="progress"] .kcol-head .ic { color: var(--lime); }
.kcol[data-col="done"] .kcol-head .ic { color: var(--green); }
.kcol-count { margin-left: auto; background: var(--bg3); border-radius: 20px; font-size: 12px; padding: 2px 10px; color: var(--muted); font-weight: 600; }
.kanban-dots { display: flex; justify-content: center; gap: 6px; margin-top: 2px; }
.kanban-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--border2); transition: background .2s, transform .2s; }
.kanban-dots span.on { background: var(--lime); transform: scale(1.25); }
.kcard { background: var(--bg3); border: 1px solid var(--border); border-radius: 13px; padding: 12px 13px;
  margin-bottom: 9px; cursor: pointer; transition: border-color .15s; }
.kcard:hover { border-color: var(--lime-border); }
.kcard-title { font-weight: 600; font-size: 14px; line-height: 1.4; }
.kcard.done .kcard-title { text-decoration: line-through; color: var(--muted); }
.kcard-note { color: var(--muted); font-size: 12.5px; margin-top: 5px; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kcard-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; padding: 2px 9px; color: var(--muted); }
.chip .ic { width: 12px; height: 12px; }
.chip.overdue { color: var(--red); border-color: rgba(255,92,92,.5); background: rgba(255,92,92,.07); }
.chip.soon { color: var(--yellow); border-color: rgba(255,207,92,.4); background: rgba(255,207,92,.06); }
.kcard-actions { display: flex; gap: 7px; margin-top: 10px; }
.karrow { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  background: var(--bg); border: 1px solid var(--border); color: var(--muted); border-radius: 9px;
  font-size: 12px; font-weight: 600; padding: 7px 6px; min-height: 34px; white-space: nowrap; overflow: hidden; }
.karrow .ic { width: 13px; height: 13px; }
.karrow:hover { color: var(--lime); border-color: var(--lime-border); }

/* ================= admin ================= */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 24px; }
.stat { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat b { font-size: 22px; display: block; letter-spacing: -.02em; font-family: var(--font-head); color: var(--lime); }
.stat span { color: var(--muted); font-size: 12px; }
.user-row { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; }
.user-row.pending { border-color: rgba(255,207,92,.45); }
.user-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-top b { font-size: 15.5px; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 7px; font-weight: 700; }
.badge.active { background: rgba(62,207,142,.12); color: var(--green); }
.badge.pending { background: rgba(255,207,92,.12); color: var(--yellow); }
.badge.blocked { background: rgba(255,92,92,.12); color: var(--red); }
.badge.admin { background: var(--lime-soft); color: var(--lime); border: 1px solid var(--lime-border); }
.perm-grid { display: grid; grid-template-columns: 1fr; gap: 2px; margin: 12px 0 4px; }
.perm-grid label { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--muted);
  cursor: pointer; padding: 7px 8px; border-radius: 9px; min-height: 40px; }
.perm-grid label:hover { background: var(--bg3); }
.perm-grid input { width: 19px; height: 19px; min-height: 0; padding: 0; accent-color: var(--lime); appearance: auto; -webkit-appearance: auto; flex-shrink: 0; }
.user-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ================= modal / bottom-sheet ================= */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.62); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 24px 24px 0 0; padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  animation: sheetUp .22s ease;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px;
  background: var(--border2); margin: 4px auto 12px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700;
  font-size: 17px; margin-bottom: 16px; font-family: var(--font-head); }
.modal-x { display: flex; align-items: center; justify-content: center; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 10px; color: var(--muted); width: 34px; height: 34px; }
.modal-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.empty { color: var(--muted); text-align: center; padding: 44px 0; }

/* ================= desktop ================= */
@media (min-width: 901px) {
  .layout { display: flex; }
  .sidebar {
    position: sticky; top: 0; transform: none; width: 274px; flex-shrink: 0; height: 100vh;
    box-shadow: none; transition: none;
  }
  .side-close { display: none; }
  .side-backdrop { display: none; }
  .topbar { display: none; }
  .bottom-nav { display: none; }
  main#view { padding: 36px 40px 60px; }
  .page-title { font-size: 27px; }
  .home-hero { padding: 28px 30px; }
  .home-hero h1 { font-size: 25px; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 14px; }
  .form-grid { grid-template-columns: 1fr 1fr 1fr; }
  .links-form .form-grid { grid-template-columns: 1fr 1.3fr; }
  .doc-head { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .doc-head h1 { flex: 1 1 100%; font-size: 25px; }
  .doc-layout { grid-template-columns: minmax(0, 1fr) 235px; gap: 36px; }
  .doc-toc-mobile { display: none; }
  .doc-toc-desktop {
    display: block; position: sticky; top: 24px; border-left: 2px solid var(--border);
    padding-left: 14px; max-height: 88vh; overflow-y: auto;
  }
  .doc-toc-desktop .toc-list a { border-bottom: 0; padding: 4px 0; }
  .md h1 { font-size: 24px; }
  .md h2 { font-size: 20px; }
  .md table { font-size: 13.5px; }
  .kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; overflow: visible; margin: 0; padding: 0; }
  .kcol { flex: none; max-width: none; scroll-snap-align: none; }
  .kcard { cursor: grab; }
  .kanban-dots { display: none; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .day-grid { grid-template-columns: 1.2fr 1fr; }
  .perm-grid { grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 2px 14px; }
  .perm-grid label { min-height: 34px; padding: 5px 8px; }
  .modal-back { align-items: center; padding: 20px; }
  .modal { border-radius: 20px; padding: 24px; animation: none; }
  .modal::before { display: none; }
  main#view { padding-bottom: 60px; }
}

/* усередині Telegram Mini App: шапка Telegram плаває поверх - опускаємо контент */
.in-telegram .topbar {
  padding-top: calc(12px + var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 46px));
}
.in-telegram .auth-screen {
  padding-top: calc(24px + var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 46px));
  align-items: flex-start;
}
.in-telegram .sidebar {
  padding-top: calc(var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 46px));
}

@media (max-width: 380px) {
  .kcol { flex-basis: 92%; }
}
