:root {
  --bg-page: #f4f2ed; --bg-rail: #faf9f5; --bg-canvas: #eceae4;
  --surface: #ffffff; --border: #e9e5db; --border-strong: #e6e2d8;
  --border-input: #d8d3c6; --divider: #f0ede5;
  --text: #23281f; --text-secondary: #5c6355; --text-muted: #8a9082; --text-faint: #a9ae9f;
  --primary: #2f6f4f; --primary-hover: #24583e;
  --green-mid: #4d9b72; --green-soft: #8db9a0; --green-tint: #eef4ef;
  --accent-warm: #c07a3d; --accent-warm-hover: #a9682f;
  --bar-neutral: #ddd8cc;
  --danger: #8c3d2c; --danger-hover: #75311f; --danger-bg: #f7e9e6; --danger-border: #e0bcb3;
  --warn-bg: #faeee4; --warn-border: #e5c9ad; --warn-text: #7c4a1e;
  --gold-bg: #fbf7ea; --gold-border: #e8dcb8;
  --toast-bg: #23281f;
  /* Stage-2: доп. токены дашборда (не входили в токены этапа 1) */
  --hover-bg: #efece4; --empty-border: #cfd8cf; --spinner-track: #c9d8cf; --row-current-bg: #f7faf8;
  /* Stage-4: токены /settings (Settings.dc.html — фон карточки соединения) */
  --ok-bg: #f7faf8; --ok-border: #dbe8e0;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg-page); color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased;
}
a.link { color: var(--primary); text-decoration: none; }
a.link:hover { color: var(--primary-hover); }
.muted { color: var(--text-muted); font-size: 12.5px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 26px; }
.btn {
  display: inline-block; border: 1px solid transparent; border-radius: 9px;
  padding: 10px 16px; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-input); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { display: block; width: 100%; text-align: center; }
.input {
  width: 100%; border: 1px solid var(--border-input); border-radius: 9px;
  padding: 11px 13px; font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text);
}
.input:focus { outline: none; border-color: var(--primary); }
.input-error { border-color: #c48577; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.alert { border-radius: 10px; padding: 11px 13px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger); }
.alert-success { background: var(--green-tint); border: 1px solid #d3e2d8; color: var(--primary); }
.chip {
  display: inline-block; background: var(--green-tint); border: 1px solid #d3e2d8;
  color: var(--primary); border-radius: 7px; padding: 4px 10px; font-size: 12px; font-weight: 700;
}
.logo-row { display: flex; align-items: center; gap: 9px; }
.logo-square {
  width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.logo-name { font-weight: 700; font-size: 15px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.checkbox-row input { accent-color: var(--primary); }
.checkbox-row label { margin: 0; font-weight: 400; }
/* Auth-канвас (макет Auth.dc.html) */
.auth-canvas {
  min-height: 100vh; background: var(--bg-canvas);
  display: flex; align-items: center; justify-content: center; padding: 24px 16px;
}
.auth-card { max-width: 340px; width: 100%; }
.auth-card .logo-row { margin-bottom: 18px; }
.auth-title { font-size: 19px; font-weight: 700; margin: 0 0 14px; }
.auth-foot { font-size: 13px; color: var(--text-secondary); margin-top: 14px; }
/* Лендинг (Landing.dc.html, README §1) */
.landing-header {
  max-width: 1200px; margin: 0 auto; padding: 22px clamp(16px, 4vw, 40px);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.landing-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.landing-nav-link { color: var(--text-secondary); font-size: 14px; }
.landing-nav-link:hover { color: var(--text); }
.landing-login { color: var(--text); font-size: 14px; font-weight: 700; text-decoration: none; }
.landing-login:hover { color: var(--primary); }
.landing-notice { max-width: 1200px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); box-sizing: border-box; }
.hero-title {
  font-size: clamp(30px, 5.5vw, 44px); line-height: 1.12; font-weight: 700;
  letter-spacing: -1.2px; margin: 0 0 18px;
}
.hero-sub { font-size: 17px; color: var(--text-secondary); margin: 0 0 30px; max-width: 460px; }

/* Hero: 2-колоночный грид + карточка-миниатюра дашборда */
.hero-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: clamp(28px, 4vw, 56px);
  align-items: center; max-width: 1200px; margin: 0 auto; box-sizing: border-box;
  padding: clamp(32px, 6vw, 64px) clamp(16px, 4vw, 40px) 72px;
}
.hero-chip { margin-bottom: 22px; }
.hero-cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.hero-cta-note { font-size: 13px; color: var(--text-muted); line-height: 1.4; }
.hero-security { display: flex; align-items: center; gap: 9px; margin-top: 26px; font-size: 13px; color: var(--text-muted); }
.hero-security .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-mid); display: inline-block; flex: none; }

.hero-card {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(35, 40, 31, .12); padding: 22px; box-sizing: border-box;
}
.hero-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.hero-card-title { font-size: 12.5px; font-weight: 700; }
.hero-card-sync { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.hero-card-sync .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green-mid); display: inline-block; }
.hero-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.hero-kpi { background: var(--bg-rail); border: 1px solid var(--hover-bg); border-radius: 10px; padding: 10px; }
.hero-kpi-val { font-size: 20px; font-weight: 700; letter-spacing: -.5px; }
.hero-kpi-val.good { color: var(--primary); }
.hero-kpi-label { font-size: 10.5px; color: var(--text-muted); margin-top: 3px; }

/* Мини-график месяцев в hero-карточке (переиспользует .mbar/.created/.closed/.ontime) */
.shot-chart { border: 1px solid var(--hover-bg); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.shot-bars { display: flex; align-items: flex-end; gap: 5px; height: 74px; }
.shot-col { flex: 1; display: flex; align-items: flex-end; gap: 1.5px; height: 100%; }
.shot-col-1 .mbar.created { height: 44%; } .shot-col-1 .mbar.closed { height: 27%; } .shot-col-1 .mbar.ontime { height: 15%; }
.shot-col-2 .mbar.created { height: 50%; } .shot-col-2 .mbar.closed { height: 32%; } .shot-col-2 .mbar.ontime { height: 19%; }
.shot-col-3 .mbar.created { height: 56%; } .shot-col-3 .mbar.closed { height: 36%; } .shot-col-3 .mbar.ontime { height: 22%; }
.shot-col-4 .mbar.created { height: 62%; } .shot-col-4 .mbar.closed { height: 40%; } .shot-col-4 .mbar.ontime { height: 25%; }
.shot-col-5 .mbar.created { height: 68%; } .shot-col-5 .mbar.closed { height: 45%; } .shot-col-5 .mbar.ontime { height: 29%; }
.shot-col-6 .mbar.created { height: 76%; } .shot-col-6 .mbar.closed { height: 50%; } .shot-col-6 .mbar.ontime { height: 33%; }
.shot-col-7 .mbar.created { height: 86%; } .shot-col-7 .mbar.closed { height: 58%; } .shot-col-7 .mbar.ontime { height: 38%; }
.shot-col-8 .mbar.created { height: 100%; } .shot-col-8 .mbar.closed { height: 66%; } .shot-col-8 .mbar.ontime { height: 44%; }
.shot-banner { display: flex; align-items: center; gap: 11px; background: var(--primary); border-radius: 10px; padding: 11px 14px; }
.shot-banner-icon { font-size: 13px; }
.shot-banner-text { font-size: 11.5px; color: #fff; line-height: 1.4; }

/* Заголовок секции (центрированный, «Три шага») */
.landing-section-head { text-align: center; margin: 0 auto 40px; max-width: 560px; }
.landing-section-head h2 { margin: 0 0 8px; font-size: 28px; font-weight: 700; letter-spacing: -.6px; }
.landing-section-head p { margin: 0; font-size: 15px; color: var(--text-muted); line-height: 1.5; }

/* Три шага */
.landing-section-steps { max-width: 1200px; margin: 0 auto; box-sizing: border-box; padding: 24px clamp(16px, 4vw, 40px) 64px; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 26px 24px; }
.step-num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--green-tint); color: var(--primary);
  font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.step-title { font-size: 16px; font-weight: 700; margin: 0 0 8px; }
.step-text { font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; margin: 0; }

/* Фичи 2×2 */
.landing-section-features { max-width: 1200px; margin: 0 auto; box-sizing: border-box; padding: 0 clamp(16px, 4vw, 40px) 64px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.feature-card { display: flex; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
.feature-icon {
  flex: none; width: 42px; height: 42px; border-radius: 11px; background: var(--green-tint);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.feature-title { font-size: 15.5px; font-weight: 700; margin: 0 0 6px; }
.feature-text { font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; margin: 0; }

/* Ачивки — широкая карточка (переиспользует .medal/.medal-sm/.gold/.silver/.bronze) */
.land-ach-card {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: clamp(24px, 4vw, 56px);
  align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: clamp(20px, 4vw, 48px); box-sizing: border-box; max-width: 1200px; margin: 0 auto 64px;
}
.land-ach-title { margin: 0 0 14px; font-size: 28px; font-weight: 700; letter-spacing: -.6px; }
.land-ach-text { margin: 0 0 20px; font-size: 15px; color: var(--text-secondary); line-height: 1.6; }
.land-ach-note { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; }
.land-ach-list { display: flex; flex-direction: column; gap: 10px; }
.land-ach-row {
  display: flex; align-items: center; gap: 14px; background: var(--bg-rail); border: 1px solid var(--hover-bg);
  border-radius: 13px; padding: 13px 16px;
}
.land-ach-info { flex: 1; min-width: 0; }
.land-ach-name { font-size: 13.5px; font-weight: 700; }
.land-ach-descr { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.land-ach-bar-wrap { flex: none; display: flex; align-items: center; gap: 8px; }
.land-ach-bar { width: 70px; height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; }
.land-ach-bar-fill { height: 100%; background: var(--green-soft); }
.land-ach-bar-fill.p88 { width: 88%; }
.land-ach-progress-label { font-size: 11px; font-weight: 700; color: var(--text-secondary); }

/* Приватность — 3 колонки с галочками (переиспользует .check-list-стиль отметки) */
.privacy-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px;
  max-width: 1200px; margin: 0 auto 72px; box-sizing: border-box; padding: 0 clamp(16px, 4vw, 40px);
}
.privacy-item { display: flex; gap: 13px; align-items: flex-start; padding: 4px 8px; }
.privacy-check {
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--green-tint); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.privacy-text { font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; }
.privacy-text b { color: var(--text); }

/* Финальный CTA */
.cta-band {
  background: var(--primary); border-radius: 20px; padding: clamp(28px, 5vw, 56px) clamp(20px, 4vw, 48px);
  text-align: center; max-width: 1200px; margin: 0 auto 56px; box-sizing: border-box;
}
.cta-band h2 { margin: 0 0 12px; font-size: 30px; font-weight: 700; letter-spacing: -.6px; color: #fff; }
/* rgba(255,255,255,.82) вместо неучтённого в Design Tokens хекса #c4d8cc (бриф запрещает новые hex) */
.cta-band p { margin: 0 auto 28px; font-size: 15px; color: rgba(255, 255, 255, .82); max-width: 440px; line-height: 1.55; }

/* Футер */
.landing-footer {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  max-width: 1200px; margin: 0 auto; box-sizing: border-box; padding: 0 clamp(16px, 4vw, 40px) 36px;
  font-size: 12.5px; color: var(--text-faint);
}
.landing-footer-links { display: flex; gap: 20px; }
.landing-footer-links a { color: var(--text-muted); }
.landing-footer-links a:hover { color: var(--text); }
/* MS connect (макет Auth.dc.html, экран перед OAuth) */
.ms-logo { display: inline-grid; grid-template-columns: 10px 10px; gap: 2px; vertical-align: middle; }
.ms-logo span { width: 10px; height: 10px; display: block; }
.check-list { list-style: none; padding: 0; margin: 0 0 16px; }
.check-list li { padding-left: 22px; position: relative; margin-bottom: 8px; font-size: 13px; color: var(--text-secondary); }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green-mid); font-weight: 700; }

/* ==================== Layout: app shell & nav rail (Dashboard.dc.html) ==================== */
.app { display: flex; max-width: 1520px; margin: 0 auto; }
.rail {
  width: 216px; flex: 0 0 216px; background: var(--bg-rail); border-right: 1px solid var(--border-strong);
  display: flex; flex-direction: column; justify-content: space-between;
}
.rail-nav { display: flex; flex-direction: column; gap: 2px; padding: 16px 12px; }
.rail-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  font-size: 13.5px; font-weight: 700; color: var(--text-secondary); text-decoration: none; cursor: pointer;
}
.rail-item:hover { background: var(--hover-bg); }
.rail-item.active { background: var(--primary); color: #fff; }
.rail-item.active:hover { background: var(--primary); }
.rail-item.disabled { color: var(--text-faint); cursor: default; }
.rail-item.disabled:hover { background: transparent; }
.rail-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
  margin-left: auto; padding: 0 5px; background: var(--accent-warm); color: #fff; border-radius: 9px;
  font-size: 11px; font-weight: 700; line-height: 18px;
}
.rail-badge:empty { display: none; }
.rail-foot { padding: 14px 12px; border-top: 1px solid var(--divider); display: flex; flex-direction: column; gap: 12px; }
.lang-switch { display: inline-flex; background: var(--hover-bg); border-radius: 8px; padding: 2px; gap: 2px; }
.lang-switch button, .lang-switch a {
  border: none; background: transparent; padding: 5px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 700; color: var(--text-secondary); cursor: pointer; text-decoration: none; display: inline-block;
}
.lang-switch button.active, .lang-switch a.active { background: var(--surface); color: var(--text); }
.sync-status { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-secondary); }
.sync-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-mid); display: inline-block; flex: none; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--green-tint); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.content { flex: 1; min-width: 0; padding: 32px 40px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }

/* ==================== KPI cards ==================== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -0.8px; margin: 0 0 4px; }
.kpi-value.good { color: var(--primary); }
.kpi-label { font-size: 12.5px; color: var(--text-muted); }
.kpi-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.kpi-sub.warn { color: var(--accent-warm); }

/* ==================== Chart cards & legend ==================== */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.legend { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); }
.legend-dot { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text-faint); }
.legend-dot.c-ontime::before { background: var(--green-mid); }
.legend-dot.c-late::before { background: var(--accent-warm); }
.legend-dot.c-created::before { background: var(--bar-neutral); }
.legend-dot.c-closed::before { background: var(--green-soft); }
.legend-dot.c-strict::before { background: var(--primary); }
.legend-dot.c-pct::before { background: var(--accent-warm); }

/* ==================== Лента дней (ribbon) ==================== */
.ribbon { display: flex; align-items: flex-end; gap: clamp(1px, 0.3vw, 3px); height: 96px; }
.ribbon-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; flex: 1; gap: 1px; height: 100%; }
.ribbon-seg { width: 100%; border-radius: 2px; }
.ribbon-seg.ontime { background: var(--green-mid); }
.ribbon-seg.late { background: var(--accent-warm); }
.ribbon-seg.blank { background: var(--divider); }
.ribbon-months { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--text-muted); }

/* ==================== Теплокарта ритма ==================== */
.heat-body { display: flex; gap: 8px; }
.heatmap { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; }
.heat-cell { height: 16px; border-radius: 3px; background: var(--divider); }
.heat-cell.h1 { background: rgba(47, 111, 79, .12); }
.heat-cell.h2 { background: rgba(47, 111, 79, .32); }
.heat-cell.h3 { background: rgba(47, 111, 79, .55); }
.heat-cell.h4 { background: rgba(47, 111, 79, .75); }
.heat-cell.h5 { background: rgba(47, 111, 79, .97); }
.heat-rows { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.heat-hours { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: var(--text-muted); }
.heat-insight { margin-top: 10px; font-size: 12.5px; color: var(--text-muted); }

/* ==================== Помесячный график (mini + /months big) ==================== */
.mbars { display: flex; align-items: flex-end; gap: clamp(3px, 1vw, 14px); height: 150px; }
.mbars.big { height: 190px; }
.mgroup { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1; height: 100%; gap: 4px; }
.mgroup-bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; flex: 1; }
.mbar { flex: 1; border-radius: 2px 2px 0 0; }
.mbar.created { background: var(--bar-neutral); }
.mbar.closed { background: var(--green-soft); }
.mbar.ontime { background: var(--primary); }
.mgroup-pct { font-size: 10.5px; font-weight: 700; color: var(--primary); }
.mgroup-pct.pct-warm { color: var(--accent-warm); display: flex; align-items: center; gap: 3px; justify-content: center; }
.pct-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-warm); border: 2px solid #fff; display: inline-block; }
.mgroup-label { margin-top: 2px; font-size: 11px; color: var(--text-muted); }

/* ==================== Табы, строки списков, зависшие задачи ==================== */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tab {
  border: none; background: transparent; padding: 7px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 700; color: var(--text-secondary); cursor: pointer;
}
.tab.active { background: var(--green-tint); color: var(--primary); }
.list-row {
  display: grid; grid-template-columns: minmax(80px, 140px) 1fr minmax(60px, 90px) minmax(60px, 90px);
  align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--divider); font-size: 13px;
}
.list-row .list-open { color: var(--text-muted); }
.list-row .list-overdue { color: var(--accent-warm); font-weight: 700; }
.progress { height: 6px; border-radius: 4px; background: var(--divider); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--green-mid); }
.stuck-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--divider); font-size: 13px; }
.stuck-row .stuck-name { color: var(--text); }
.stuck-row .stuck-list { color: var(--text-muted); }
.stuck-days { color: var(--accent-warm); font-weight: 700; white-space: nowrap; }

/* ==================== Баннеры и кнопки-модификаторы ==================== */
.banner-warn { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); border-radius: 10px; padding: 11px 13px; margin-bottom: 14px; }
.banner-error { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger); border-radius: 10px; padding: 11px 13px; margin-bottom: 14px; }
.banner-verify { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.btn-warn { background: var(--accent-warm); color: #fff; }
.btn-warn:hover { background: var(--accent-warm-hover); }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ==================== Пустое состояние и спиннер ==================== */
.empty-card { border: 1.5px dashed var(--empty-border); border-radius: 14px; padding: 40px 20px; text-align: center; color: var(--text-muted); }
.empty-icon {
  width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; background: var(--green-tint);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.spinner {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block;
  border: 2px solid var(--spinner-track); border-top-color: var(--primary);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== Таблица месяцев (/months) ==================== */
.table-wrap { overflow-x: auto; }
.months-table { min-width: 540px; width: 100%; border-collapse: collapse; font-size: 13px; }
.months-table th {
  padding: 8px 10px; text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  color: var(--text-muted); border-bottom: 1.5px solid var(--border);
}
.months-table td { padding: 9px 10px; border-bottom: 1px solid var(--divider); }
.delta-up { color: var(--primary); font-weight: 700; }
.delta-down { color: var(--accent-warm); font-weight: 700; }
.row-current { background: var(--row-current-bg); font-weight: 700; }

/* ==================== Графики в ряд (2 колонки, дашборд) ==================== */
.charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

/* ==================== Адаптив (breakpoint 760px) ==================== */
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .rail {
    width: auto; flex: none; position: sticky; top: 0; z-index: 10;
    border-right: none; border-bottom: 1px solid var(--border-strong);
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bg-rail);
  }
  .rail-nav {
    order: 3; width: 100%; flex-direction: row; flex-wrap: nowrap; overflow-x: auto;
    padding: 0; gap: 8px;
  }
  .rail-item { border-radius: 18px; padding: 8px 14px; white-space: nowrap; }
  .rail-foot { flex-direction: row; align-items: center; border-top: none; padding: 0; }
  .content { padding: 20px 16px; }
  .charts-row { grid-template-columns: 1fr; }
}

/* ==================== Медали ачивок (Achievements.dc.html, Design Tokens/Медали) ==================== */
.medal {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.medal-lg { width: 62px; height: 62px; font-size: 26px; }
/* 38px — тост новой ачивки; вариант 36px (баннер прогресса ачивки) вне v1-этапа-3, не реализуется */
.medal-sm { width: 38px; height: 38px; font-size: 17px; }
.medal.gold { background: radial-gradient(circle at 32% 28%, #f3e6bd, #d9b95c 55%, #a8853a); }
.medal.silver { background: radial-gradient(circle at 32% 28%, #f2f4f6, #c3cad2 55%, #8f99a5); }
.medal.bronze { background: radial-gradient(circle at 32% 28%, #e8c5a4, #c98d5e 55%, #8a5a2e); }
.medal.plain { background: radial-gradient(circle at 32% 28%, #dff0e5, #a9cdb7 55%, #6f9e85); }
.medal.gold, .medal.silver, .medal.bronze, .medal.plain {
  box-shadow: inset 0 -3px 5px rgba(60, 50, 20, .3), 0 2px 6px rgba(20, 25, 18, .15);
}
.medal.locked {
  background: #e7e4db; box-shadow: inset 0 0 0 1.5px #d5d1c5;
  filter: grayscale(1) opacity(.45);
}

/* ==================== Карточки ачивок (/achievements) ==================== */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ach-card {
  display: flex; gap: 15px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 17px 18px;
}
.ach-card[hidden] { display: none; }
.ach-card.locked { background: var(--bg-rail); border: 1.5px dashed var(--bar-neutral); }
.ach-card.locked .ach-title { color: var(--text-faint); }
.ach-card.new {
  position: relative; border: 1.5px solid #d9b95c; box-shadow: 0 4px 16px rgba(217, 185, 92, .25);
}
.ach-new-chip {
  position: absolute; top: -8px; right: 12px; background: var(--accent-warm); color: #fff;
  border-radius: 7px; padding: 2px 8px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
}
.ach-title { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.ach-descr { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.ach-earned { font-size: 12px; font-weight: 600; color: var(--green-mid); margin-top: 8px; }
.ach-progress { display: flex; align-items: center; gap: 9px; margin-top: 9px; }
.ach-progress-track { flex: 1; height: 6px; border-radius: 3px; background: var(--divider); overflow: hidden; }
.ach-progress-fill { height: 100%; border-radius: 3px; background: var(--green-soft); }
.ach-progress-label { font-size: 11px; color: var(--text-muted); }

/* ==================== Группы ачивок (заголовок + общий прогресс) ==================== */
.ach-group-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px;
  font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-secondary);
}
.ach-group-head .ach-group-count {
  font-size: 12.5px; font-weight: 400; text-transform: none; letter-spacing: normal; color: var(--text-faint);
}
.ach-total { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 32px; font-size: 13.5px; color: var(--text-muted); }
.ach-total-bar { width: 220px; height: 8px; background: var(--border-strong); border-radius: 5px; overflow: hidden; }
.ach-total-fill { height: 100%; background: var(--green-mid); border-radius: 5px; }

/* ==================== Фильтры ачивок (переиспользуют .tabs/.tab) ==================== */
.tabs.on-canvas .tab.active { background: var(--surface); }

/* ==================== Тост новой ачивки ==================== */
@keyframes toast-in {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.toast {
  position: fixed; top: 18px; right: 18px; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  background: var(--toast-bg); color: #fff; border-radius: 14px; padding: 14px 18px;
  box-shadow: 0 10px 30px rgba(20, 25, 18, .25);
  animation: toast-in .35s ease;
}
.toast-overline { font-size: 11.5px; color: #b9c0ae; text-transform: uppercase; letter-spacing: .6px; }
.toast-title { font-size: 14px; font-weight: 700; color: #fff; }
.toast-close {
  border: none; background: transparent; color: #b9c0ae; font-size: 16px; cursor: pointer;
  padding: 2px 4px; margin-left: 6px;
}
.toast-close:hover { color: #fff; }

/* ==================== Баннер декомпозиции (дашборд) ==================== */
.banner-decomp {
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px 20px;
  background: var(--primary); border-radius: 14px; padding: 16px 22px; margin-bottom: 14px;
  color: #fff; font-size: 14px; line-height: 1.45;
}
.banner-decomp-icon {
  flex: none; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .15);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.btn-on-primary { background: #fff; color: var(--primary); }
.btn-on-primary:hover { background: var(--green-tint); }
.banner-decomp .btn-on-primary { margin-left: auto; }
.decomp-list { flex-basis: 100%; margin-top: 10px; }
.decomp-list .decomp-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .2); font-size: 13px;
}
.decomp-list .decomp-row:last-child { border-bottom: none; }

/* ==================== Утилиты (замена inline-стилей этапа 1) ==================== */
.ms-sq-red { background: #f25022; }
.ms-sq-green { background: #7fba00; }
.ms-sq-blue { background: #00a4ef; }
.ms-sq-yellow { background: #ffb900; }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn-text); }
.card-title { font-size: 15px; font-weight: 700; margin: 0; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; margin: 0; }
.title-16 { font-size: 16px; font-weight: 700; margin: 0; }
.muted-line { margin: 0; }

/* ==================== /settings (Settings.dc.html) ==================== */
.settings-col { max-width: 640px; display: flex; flex-direction: column; gap: 14px; }
.field-hint { display: block; margin-top: 2px; }
.text-ok { color: var(--green-mid); font-weight: 400; }
.danger-text { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }

/* Карточка соединения Microsoft */
.ms-conn-card {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 14px;
  background: var(--ok-bg); border: 1px solid var(--ok-border); border-radius: 11px; padding: 14px 16px;
  margin-bottom: 14px;
}
.ms-logo-box {
  flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--surface);
  border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center;
}
.ms-conn-info { flex: 1; min-width: 0; }
.ms-conn-email { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ms-conn-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.disconnect-panel { margin-top: 4px; }
.disconnect-panel[hidden] { display: none; }
.radio-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.radio-row input { accent-color: var(--primary); }
.radio-row label { margin: 0; font-weight: 400; }

/* Тумблер писем (46×26, Settings.dc.html) */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.switch { position: relative; display: inline-block; flex: none; width: 46px; height: 26px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; border-radius: 14px; background: var(--border-input); transition: background .2s; pointer-events: none; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch-knob {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .2s; pointer-events: none;
}
.switch input:checked ~ .switch-knob { left: 23px; }

/* Опасная зона + кнопка danger */
.danger-zone { border: 1.5px solid var(--danger-border); }
.danger-zone .card-title { color: var(--danger); margin-bottom: 10px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-outline-danger { background: var(--surface); border: 1px solid var(--border-input); color: var(--danger); }
.btn-outline-danger:hover { border-color: var(--danger); }

/* Модал удаления аккаунта */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(35, 40, 31, .45);
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface); border-radius: 16px; box-sizing: border-box;
  width: min(440px, calc(100vw - 40px)); padding: clamp(20px, 4vw, 30px) clamp(18px, 4vw, 32px);
  box-shadow: 0 24px 60px rgba(20, 25, 18, .3);
}
.modal-title { font-size: 18px; font-weight: 700; margin: 0 0 12px; }
.modal-text { font-size: 13.5px; color: var(--text-secondary); line-height: 1.6; margin: 0 0 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Утилиты отступов — держать последними: побеждают компонентные margin по source order */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-14 { margin-bottom: 14px; }
.mb-18 { margin-bottom: 18px; }
