/* Планировщик рассылок — оформление */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #eef2ff;
  --green: #047857;
  --green-soft: #d1fae5;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --rose: #be123c;
  --rose-soft: #ffe4e6;
  --sky: #0369a1;
  --sky-soft: #e0f2fe;
  --slate-soft: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --topbar-h: 66px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- базовые элементы ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font-weight: 550; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible, .chip:focus-visible,
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn--primary {
  background: linear-gradient(180deg, #5b52ea, var(--accent)); border-color: var(--accent);
  color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .35);
}
.btn--primary:hover { background: linear-gradient(180deg, #5148e0, var(--accent-strong)); border-color: var(--accent-strong); }
.btn--success { background: var(--green); border-color: var(--green); color: #fff; }
.btn--success:hover { background: #065f46; border-color: #065f46; }
.btn--danger { background: var(--surface); border-color: #fecdd3; color: var(--rose); }
.btn--danger:hover { background: var(--rose-soft); border-color: #fda4af; }
.btn--danger-solid { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn--soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-strong); }
.btn--soft:hover { background: #e0e7ff; border-color: transparent; }
.btn--ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn--lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 8px; border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }

.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .14);
}
.textarea { min-height: 104px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 30px;
  background: #fff 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' fill='none' stroke='%2364748b' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 11px center;
}
.input[type="date"] { padding-right: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-grid { display: grid; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ---------- топбар ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 22px;
  min-height: var(--topbar-h); padding: 10px 24px; background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 11px; background: none; border: 0; padding: 0; color: inherit; text-align: left; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; max-width: 240px; }
.brand-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(140deg, #6366f1, #4338ca); color: #fff; box-shadow: 0 4px 12px rgba(67, 56, 202, .32);
}
.brand-logo svg { width: 20px; height: 20px; }
.brand-title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.tabs { display: flex; gap: 2px; background: var(--surface-3); padding: 3px; border-radius: 10px; }
.tab {
  border: 0; background: transparent; padding: 7px 13px; border-radius: 8px; color: var(--muted);
  font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.tab .icon { width: 16px; height: 16px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-summary { display: flex; gap: 6px; }
.sum-chip {
  border: 1px solid transparent; background: var(--surface-2); color: var(--muted);
  height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.sum-chip:hover { filter: brightness(.97); }
.sum-chip b { font-weight: 800; }
.sum-chip--review { background: var(--amber-soft); color: var(--amber); }
.sum-chip--rework { background: var(--rose-soft); color: var(--rose); }
.user-menu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 9px; border: 1px solid transparent; background: transparent;
  padding: 4px 6px 4px 4px; border-radius: 10px;
}
.user-chip:hover { background: var(--surface-2); border-color: var(--border); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: 12.5px;
  flex: none; text-transform: uppercase;
}
.user-meta { text-align: left; line-height: 1.2; display: none; }
.user-meta b { display: block; font-size: 13px; }
.user-meta span { font-size: 11px; color: var(--muted); }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; z-index: 60;
}
.menu-item {
  display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border: 0;
  background: none; border-radius: 7px; font-size: 13.5px; color: var(--text-2); text-align: left;
}
.menu-item:hover { background: var(--surface-3); }
.menu-item--danger { color: var(--rose); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* ---------- контент ---------- */
.view { flex: 1; width: 100%; max-width: 1500px; margin: 0 auto; padding: 22px 24px 40px; }
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-group { display: flex; align-items: center; gap: 9px; }
.toolbar-spacer { flex: 1; }
.month-nav { display: flex; align-items: center; gap: 4px; }
.month-label { font-size: 17px; font-weight: 700; min-width: 172px; text-transform: capitalize; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .select, .filters .input { height: 36px; min-height: 36px; width: auto; }
.filters .select { min-width: 150px; }
.filters .input { min-width: 190px; }
.search-wrap { position: relative; }
.search-wrap .input { padding-left: 34px; }
.search-wrap .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); width: 15px; height: 15px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 15px; font-weight: 700; }
.panel-sub { color: var(--muted); font-size: 12.5px; }
.panel-body { padding: 16px 18px; }

/* ---------- календарь ---------- */
.calendar-wrap { overflow-x: auto; }
.calendar { min-width: 780px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow {
  padding: 9px 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.cal-dow:not(:last-child) { border-right: 1px solid var(--border); }
.cal-cell {
  min-height: 124px; padding: 6px 7px 8px; border-bottom: 1px solid var(--border);
  background: #fff; position: relative; transition: background .12s;
}
.cal-cell:not(:nth-child(7n)) { border-right: 1px solid var(--border); }
.cal-cell:hover { background: #fbfcff; }
.cal-cell.is-other { background: var(--surface-2); }
.cal-cell.is-other .cal-date { color: var(--muted-2); }
.cal-cell.is-other:hover { background: var(--surface-3); }
.cal-cell.is-weekend { background: #fcfdff; }
.cal-cell.is-today { box-shadow: inset 0 0 0 2px var(--accent); background: #f9f8ff; }
.cal-date {
  display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px;
  border-radius: 999px; font-size: 12.5px; font-weight: 650; color: var(--text-2); padding: 0 4px;
}
.cal-cell.is-today .cal-date { background: var(--accent); color: #fff; }
.cal-date-add {
  position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 6px;
  border: 0; background: transparent; color: var(--muted-2); font-size: 16px; line-height: 1;
  opacity: 0; transition: opacity .12s, background .12s;
}
.cal-cell:hover .cal-date-add { opacity: 1; }
.cal-date-add:hover { background: var(--surface-3); color: var(--text); }
.cal-items { display: flex; flex-direction: column; gap: 3px; margin-top: 3px; }
.chip {
  display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--muted-2);
  background: var(--surface-2); padding: 4px 6px; border-radius: 5px; line-height: 1.25; overflow: hidden;
}
.chip:hover { filter: brightness(.97); }
.chip-title { display: block; font-size: 11.5px; font-weight: 650; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-sub { display: block; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { min-width: 0; }
.chip--draft { border-left-color: #94a3b8; background: #f8fafc; }
.chip--review { border-left-color: #f59e0b; background: #fffbeb; }
.chip--rework { border-left-color: #fb7185; background: #fff1f2; }
.chip--approved { border-left-color: #10b981; background: #ecfdf5; }
.chip--sent { border-left-color: #0ea5e9; background: #f0f9ff; }
.cal-deadline {
  display: flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--rose);
  background: #fff1f2; border-radius: 4px; padding: 3px 5px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: 0; width: 100%; text-align: left;
}
.cal-more { font-size: 10.5px; color: var(--muted); padding-left: 2px; background: none; border: 0; text-align: left; }
.cal-more:hover { color: var(--accent); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 11px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot--draft { background: #94a3b8; } .dot--review { background: #f59e0b; }
.dot--rework { background: #fb7185; } .dot--approved { background: #10b981; }
.dot--sent { background: #0ea5e9; }

/* ---------- канбан ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(232px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 180px; }
.kcol.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 11px 12px 9px; }
.kcol-title { font-size: 12.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.kcol-count { font-size: 11px; font-weight: 700; background: #fff; color: var(--muted); border-radius: 999px; padding: 1px 7px; border: 1px solid var(--border); }
.kcol-add { margin-left: auto; width: 24px; height: 24px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); font-size: 17px; }
.kcol-add:hover { background: #fff; color: var(--accent); }
.kcol-body { display: flex; flex-direction: column; gap: 9px; padding: 0 9px 11px; min-height: 60px; }
.kcard {
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 11px 11px 10px;
  box-shadow: var(--shadow-sm); cursor: pointer; transition: box-shadow .15s, transform .1s, border-color .15s;
}
.kcard:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.kcard.dragging { opacity: .45; }
.kcard.is-review { border-top: 3px solid #f59e0b; }
.kcard.is-rework { border-top: 3px solid #fb7185; }
.kcard.is-approved { border-top: 3px solid #10b981; }
.kcard.is-sent { border-top: 3px solid #0ea5e9; opacity: .85; }
.kcard.is-draft { border-top: 3px solid #cbd5e1; }
.kcard-title { font-size: 13.5px; font-weight: 650; line-height: 1.35; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.kcard-base { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 8px; }
.kcard-meta { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.kcard-meta .avatar { width: 21px; height: 21px; font-size: 9.5px; }
.kcard-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border); }
.progress { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: var(--green); transition: width .3s; }
.progress-text { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.deadline-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 650; color: var(--rose); background: var(--rose-soft); border-radius: 4px; padding: 2px 5px; }
.deadline-badge.is-soon { color: var(--amber); background: var(--amber-soft); }
.deadline-badge.is-done { color: var(--muted); background: var(--surface-3); }
.kcol-empty { border: 1px dashed var(--border-strong); border-radius: 9px; padding: 14px 10px; text-align: center; color: var(--muted-2); font-size: 12px; }

/* ---------- пилюли ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill--draft { background: var(--slate-soft); color: #475569; }
.pill--review { background: var(--amber-soft); color: var(--amber); }
.pill--rework { background: var(--rose-soft); color: var(--rose); }
.pill--approved { background: var(--green-soft); color: var(--green); }
.pill--sent { background: var(--sky-soft); color: var(--sky); }
.pill--muted { background: var(--surface-3); color: var(--muted); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 650; }

/* ---------- базы ---------- */
.bases-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.base-tile { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; }
.base-tile-head { display: flex; align-items: flex-start; gap: 10px; }
.base-tile-title { font-size: 15px; font-weight: 700; line-height: 1.3; }
.base-tile-actions { margin-left: auto; display: flex; gap: 2px; }
.base-tile-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.base-line { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; }
.base-line b { color: var(--text-2); font-weight: 600; }
.base-note { font-size: 12px; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; }
.base-tile-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

/* ---------- настройки ---------- */
.settings { display: grid; gap: 18px; max-width: 980px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { padding: 16px 18px 0; }
.card-title { font-size: 15px; font-weight: 700; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.card-body { padding: 16px 18px 18px; }
.table { width: 100%; border-collapse: collapse; }
.table-wrap { overflow-x: auto; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 700; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 13px; }
.table tr:last-child td { border-bottom: 0; }
.table .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { min-width: 160px; flex: 1; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }

/* ---------- drawer ---------- */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, .42);
  display: flex; justify-content: flex-end; animation: fadeIn .16s ease;
}
.drawer {
  width: min(1020px, 100%); height: 100%; background: var(--bg); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: slideIn .2s ease;
}
@keyframes slideIn { from { transform: translateX(28px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer-head { background: #fff; border-bottom: 1px solid var(--border); padding: 16px 22px 14px; }
.drawer-top { display: flex; align-items: flex-start; gap: 12px; }
.drawer-eyebrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.drawer-title { font-size: 22px; line-height: 1.25; font-weight: 720; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.drawer-sub { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-top: 7px; overflow-wrap: anywhere; }
.drawer-close { margin-left: auto; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 13px; }
.drawer-scroll { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }
.drawer-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.drawer-main, .drawer-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.drawer-side { position: sticky; top: 0; }
.section { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.section-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.section-title { font-size: 13px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.section-head .btn { margin-left: auto; }
.section-body { padding: 15px 16px; }
.section-body--flush { padding: 0; }
.goal-text { color: var(--text-2); font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.meta-list { display: grid; gap: 0; }
.meta-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.meta-row:last-child { border-bottom: 0; }
.meta-label { color: var(--muted); }
.meta-value { font-weight: 600; text-align: right; }
.base-card { display: grid; gap: 8px; min-width: 0; }
.base-card-name { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.base-kv { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 5px 10px; font-size: 12.5px; }
.base-kv dt { color: var(--muted); }
.base-kv dd { margin: 0; color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.base-empty { display: flex; align-items: center; gap: 12px; justify-content: space-between; color: var(--muted); font-size: 13px; }

/* ---------- цепочка ---------- */
.steps { display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; position: relative; padding: 14px 16px; }
.step:not(:last-child) { border-bottom: 1px solid var(--border); }
.step-rail { display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 2px; }
.step-num {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 750; font-size: 12.5px;
}
.step-day { font-size: 10.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
.step-date { font-size: 10.5px; color: var(--muted); }
.step-card { min-width: 0; overflow-wrap: anywhere; }
.step-head { display: flex; align-items: flex-start; gap: 8px; }
.step-subject { font-size: 14.5px; font-weight: 650; line-height: 1.35; margin: 5px 0 2px; overflow-wrap: anywhere; }
.step-subject.is-empty { color: var(--muted-2); font-style: italic; font-weight: 500; }
.step-preview { font-size: 12px; color: var(--muted); margin-bottom: 6px; overflow-wrap: anywhere; }
.step-details { margin: 7px 0; }
.step-details summary { cursor: pointer; color: var(--accent); font-size: 12.5px; font-weight: 600; }
.step-text { white-space: pre-wrap; font-size: 13px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 11px 12px; margin: 8px 0 0; font-family: inherit; line-height: 1.6; overflow-wrap: anywhere; }
.step-goal { font-size: 12px; color: var(--muted); margin-top: 5px; }
.step-goal b { color: var(--text-2); }
.step-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.step-comments { display: grid; gap: 7px; margin-top: 9px; }
.step-comment { background: #fffbeb; border: 1px solid #fde68a; border-radius: 7px; padding: 7px 9px; font-size: 12.5px; }
.step-comment.is-approve { background: #ecfdf5; border-color: #a7f3d0; }
.step-comment-head { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; margin-bottom: 2px; }

/* ---------- комментарии ---------- */
.comments { display: flex; flex-direction: column; }
.comment { padding: 13px 16px; display: flex; gap: 10px; }
.comment:not(:last-child) { border-bottom: 1px solid var(--border); }
.comment-body { min-width: 0; flex: 1; }
.comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.comment-author { font-size: 13px; font-weight: 650; }
.comment-time { font-size: 11px; color: var(--muted-2); }
.comment-text { font-size: 13px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.system-note { font-size: 12.5px; color: var(--text-2); }
.system-note b { color: var(--text); }
.composer { border-top: 1px solid var(--border); padding: 13px 16px; display: grid; gap: 8px; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.composer textarea { min-height: 68px; background: #fff; }
.composer-row { display: flex; gap: 8px; align-items: center; }
.composer-row .select { width: auto; min-width: 170px; height: 34px; min-height: 34px; }
.composer-row .btn { margin-left: auto; }

/* ---------- empty / loading ---------- */
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-icon { width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 14px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted-2); }
.empty-title { font-size: 15px; font-weight: 650; color: var(--text-2); margin-bottom: 5px; }
.empty-text { font-size: 13px; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.noscript { padding: 30px; text-align: center; }

/* ---------- модальные окна ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto;
  animation: fadeIn .14s ease;
}
.modal {
  width: 560px; max-width: 100%; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; max-height: 90vh; animation: popIn .16s ease;
}
.modal--wide { width: 720px; }
@keyframes popIn { from { transform: translateY(-8px) scale(.99); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 0; }
.modal-head h3 { font-size: 17px; line-height: 1.3; }
.modal-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.alert { padding: 10px 12px; border-radius: 8px; font-size: 12.5px; }
.alert--error { background: var(--rose-soft); color: #9f1239; }
.alert--warn { background: var(--amber-soft); color: #92400e; }
.alert--info { background: var(--accent-soft); color: var(--accent-strong); }

/* ---------- тосты ---------- */
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
  background: #0f172a; color: #f8fafc; border-radius: 10px; padding: 11px 14px; font-size: 13px;
  box-shadow: var(--shadow-lg); border-left: 3px solid #64748b; animation: toastIn .18s ease;
}
.toast--success { border-left-color: #10b981; }
.toast--error { border-left-color: #fb7185; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- вход ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 10% -10%, #e0e7ff 0%, transparent 60%),
    radial-gradient(700px 420px at 100% 100%, #dbeafe 0%, transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 410px; background: rgba(255, 255, 255, .96); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-lg); padding: 28px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .brand-logo { width: 44px; height: 44px; border-radius: 13px; }
.login-title { font-size: 20px; font-weight: 720; letter-spacing: -0.02em; }
.login-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.login-card .form-grid { gap: 14px; }
.login-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); text-align: center; }
.login-card .btn { width: 100%; justify-content: center; }

/* ---------- адаптив ---------- */
@media (max-width: 1180px) {
  .top-summary { display: none; }
  .drawer-grid { grid-template-columns: minmax(0, 1fr) 260px; }
}
@media (max-width: 980px) {
  .view { padding: 16px 16px 32px; }
  .topbar { padding: 9px 14px; gap: 12px; flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .brand-sub { display: none; }
  .drawer-grid { grid-template-columns: 1fr; }
  .drawer-side { position: static; order: -1; }
  .drawer-side .section { display: none; }
  .drawer-side .section.is-important { display: block; }
  .kanban { grid-template-columns: repeat(5, minmax(250px, 1fr)); }
}
@media (max-width: 720px) {
  .user-meta { display: none; }
  .top-actions .btn--primary span { display: none; }
  .month-label { min-width: 0; font-size: 15px; }
  .filters { width: 100%; }
  .filters .select, .filters .input { flex: 1; min-width: 0; }
  .search-wrap { flex: 1 1 100%; }
  .drawer-head { padding: 13px 15px 12px; }
  .drawer-scroll { padding: 14px 12px 30px; }
  .drawer-title { font-size: 18px; }
  .drawer-actions { gap: 6px; }
  .drawer-actions .btn { flex: 1; }
  .field-row { grid-template-columns: 1fr; }
  .step { grid-template-columns: 46px minmax(0, 1fr); padding: 12px; }
  .step-num { width: 26px; height: 26px; font-size: 11.5px; }
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal { width: 100%; max-height: 100%; border-radius: 0; }
  .modal-foot { border-radius: 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .toast-stack { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .base-tile { padding: 13px; }
  .comments, .composer { padding-left: 12px; padding-right: 12px; }
}
