:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #d9dee8;
    --brand: #176b87;
    --brand-dark: #0f5268;
    --ok: #12734a;
    --warn: #a15c00;
    --bad: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
}

a {
    color: var(--brand);
    text-decoration: none;
}

.layout {
    display: grid;
    grid-template-columns: 244px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: #ffffff;
    border-right: 1px solid #d8e3ef;
    box-shadow: 6px 0 24px rgba(38, 84, 124, 0.05);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 20px 12px;
    position: sticky;
    top: 0;
}

.sidebar-head {
    align-items: center;
    display: flex;
}

.sidebar-head .brand {
    flex: 1;
}

.sidebar-close,
.mobile-appbar,
.mobile-nav-backdrop {
    display: none;
}

.brand {
    align-items: center;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    color: #17212f;
    display: flex;
    gap: 12px;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.25;
    margin: 0 8px 22px;
    min-height: 54px;
    padding: 0;
}

.brand::before {
    align-items: center;
    background: url("echobot-logo.svg") center / contain no-repeat;
    content: "";
    display: inline-flex;
    flex: 0 0 40px;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: #718096;
    font-size: 13px;
    font-weight: 500;
    margin-top: 3px;
}

.nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
}

.nav a {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #516b89;
    display: flex;
    font-size: 14px;
    font-weight: 500;
    gap: 12px;
    min-height: 44px;
    padding: 10px 13px;
}

.nav a.active,
.nav a:hover {
    background: #e7f3ff;
    border-color: transparent;
    color: #0c73df;
}

.nav a::before {
    color: #516b89;
    content: "□";
    flex: 0 0 20px;
    font-size: 18px;
    text-align: center;
}

.nav a:nth-child(1)::before { content: "▥"; }
.nav a:nth-child(2)::before { content: "◌"; }
.nav a:nth-child(3)::before { content: "✓"; }
.nav a:nth-child(4)::before { content: "▱"; }
.nav a:nth-child(5)::before { content: "▣"; }
.nav a:nth-child(6)::before { content: "⚙"; }
.nav a:nth-child(7)::before { content: "↻"; }

.nav a.active::before,
.nav a:hover::before {
    color: #0c73df;
}

.nav a:last-child {
    color: #516b89;
    margin-top: auto;
}

.nav a:hover:not(.active) {
    background: #f3f8fd;
    border-color: transparent;
}

.content {
    padding: 26px;
}

.content-dashboard {
    background:
        linear-gradient(180deg, #eef6f8 0, #f7fafc 320px),
        #f7fafc;
    padding: 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.25;
}

h2 {
    font-size: 18px;
    margin: 0 0 14px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.panel,
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.stat {
    font-size: 28px;
    font-weight: 700;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.stat-card {
    color: var(--text);
    min-height: 126px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.stat-card:hover {
    border-color: #8eb5c3;
    box-shadow: 0 4px 12px rgba(31, 41, 55, 0.08);
}

.stat-detail {
    color: var(--muted);
    font-size: 13px;
    margin-top: 7px;
}

.stats-dashboard {
    display: grid;
    gap: 24px;
    grid-template-columns: 320px minmax(0, 1fr);
    margin: 0 auto;
    max-width: 1500px;
}

.stats-side {
    align-self: start;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #cfe0ea;
    border-radius: 8px;
    box-shadow: 0 18px 38px rgba(31, 41, 55, 0.08);
    overflow: hidden;
    position: sticky;
    top: 22px;
}

.stats-side-hero {
    align-items: center;
    background: #122235;
    color: #ffffff;
    display: flex;
    gap: 14px;
    padding: 20px;
}

.stats-side-hero strong,
.stats-side-hero span,
.stats-side-note span,
.stats-side-note small {
    display: block;
}

.stats-side-hero strong {
    font-size: 18px;
}

.stats-side-hero span,
.stats-side-note small {
    color: #dbe8ef;
}

.stats-side-score {
    align-items: center;
    background:
        radial-gradient(circle at center, #122235 56%, transparent 57%),
        conic-gradient(#78d3a6 calc(var(--value) * 1%), rgba(255,255,255,0.22) 0);
    border-radius: 50%;
    color: #ffffff;
    display: inline-flex;
    flex: 0 0 72px;
    font-size: 22px;
    font-weight: 800;
    height: 72px;
    justify-content: center;
    width: 72px;
}

.stats-side-nav {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.stats-side-nav a {
    background: #f7fbfd;
    border: 1px solid #dce8f2;
    border-radius: 8px;
    color: var(--text);
    display: grid;
    grid-template-columns: 1fr auto;
    justify-content: space-between;
    gap: 12px;
    min-height: 66px;
    padding: 13px 14px;
}

.stats-side-nav a.active,
.stats-side-nav a:hover {
    background: #43a3d5;
    border-color: #43a3d5;
    box-shadow: 0 10px 22px rgba(67, 163, 213, 0.22);
    color: #ffffff;
}

.stats-side-nav span {
    color: #65758a;
}

.stats-side-nav strong {
    color: #0f6b86;
    white-space: nowrap;
}

.stats-side-nav a.active span,
.stats-side-nav a.active strong,
.stats-side-nav a:hover span,
.stats-side-nav a:hover strong {
    color: #ffffff;
}

.stats-side-note {
    background: #f3f8fc;
    border-top: 1px solid var(--line);
    padding: 18px 20px;
}

.stats-side-note strong {
    color: #17212f;
    display: block;
    font-size: 30px;
}

.stats-main {
    display: grid;
    gap: 20px;
    min-width: 0;
}

.stats-hero,
.stats-section,
.stats-kpi-card {
    background: #ffffff;
    border: 1px solid #dce5ef;
    border-radius: 8px;
    box-shadow: 0 14px 30px rgba(31, 41, 55, 0.06);
}

.stats-hero {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(18, 34, 53, 0.96), rgba(28, 117, 139, 0.94) 58%, rgba(120, 211, 166, 0.88)),
        #122235;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    gap: 26px;
    min-height: 260px;
    overflow: hidden;
    padding: 30px;
    position: relative;
}

.stats-hero::after {
    background:
        linear-gradient(90deg, rgba(255,255,255,0.18), rgba(255,255,255,0)),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.18) 0 1px, transparent 1px 34px);
    bottom: 0;
    content: "";
    height: 86px;
    left: 0;
    opacity: 0.45;
    position: absolute;
    right: 0;
}

.stats-hero h1 {
    color: #ffffff;
    font-size: 44px;
    margin: 0 0 8px;
    max-width: 720px;
}

.stats-hero p {
    color: #dcecf2;
    font-size: 18px;
    line-height: 1.45;
    margin: 0;
    max-width: 780px;
}

.stats-eyebrow {
    color: #0f6b86;
    font-size: 12px;
    font-weight: 800;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.stats-hero .stats-eyebrow {
    color: #b9ead0;
}

.stats-hero-copy,
.stats-hero-widgets {
    position: relative;
    z-index: 1;
}

.stats-hero-widgets {
    align-items: stretch;
    display: grid;
    gap: 12px;
    grid-template-columns: 132px 190px;
}

.stats-hero-score,
.stats-hero-badge {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    color: #ffffff;
    min-height: 132px;
    padding: 16px;
}

.stats-hero-score {
    align-items: center;
    background:
        radial-gradient(circle at center, rgba(18, 34, 53, 0.92) 49%, transparent 50%),
        conic-gradient(#78d3a6 calc(var(--value) * 1%), rgba(255,255,255,0.24) 0);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stats-hero-score strong {
    font-size: 34px;
}

.stats-hero-score span {
    color: #dcecf2;
    font-weight: 700;
}

.stats-hero-badge {
    min-width: 180px;
    text-align: left;
}

.stats-hero-badge span {
    display: block;
    font-size: 32px;
    font-weight: 800;
}

.stats-hero-badge small {
    color: #dcecf2;
}

.stats-kpi-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
}

.stats-kpi-card {
    color: var(--text);
    display: grid;
    gap: 8px;
    min-height: 150px;
    overflow: hidden;
    padding: 18px;
    position: relative;
}

.stats-kpi-card::before {
    background: #43a3d5;
    content: "";
    height: 5px;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.stats-kpi-card:nth-child(2)::before {
    background: #78b66f;
}

.stats-kpi-card:nth-child(3)::before {
    background: #f0b95c;
}

.stats-kpi-card:nth-child(4)::before {
    background: #e78373;
}

.stats-kpi-card:nth-child(5)::before {
    background: #7b8bd6;
}

.stats-kpi-card:nth-child(6) {
    background: #122235;
    border-color: #122235;
    color: #ffffff;
}

.stats-kpi-card:nth-child(6)::before {
    background: #78d3a6;
}

.stats-kpi-card span,
.stats-kpi-card small {
    color: var(--muted);
}

.stats-kpi-card:nth-child(6) span,
.stats-kpi-card:nth-child(6) small {
    color: #dcecf2;
}

.stats-kpi-card strong {
    color: #17212f;
    font-size: 32px;
    line-height: 1.15;
}

.stats-kpi-card:nth-child(6) strong {
    color: #ffffff;
}

.stats-section {
    padding: 22px;
}

.stats-section-head {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.stats-section-head h2 {
    font-size: 26px;
    margin: 0 0 6px;
}

.stats-section-head p {
    color: var(--muted);
    margin: 0;
}

.quality-rail {
    display: grid;
    gap: 0;
    grid-template-columns: repeat(4, 1fr);
    margin: 34px 0 20px;
    position: relative;
}

.quality-band {
    min-height: 122px;
    padding: 18px;
}

.quality-band:first-child {
    border-radius: 8px 0 0 8px;
}

.quality-band:last-of-type {
    border-radius: 0 8px 8px 0;
}

.quality-band strong,
.quality-band span {
    display: block;
}

.quality-band span {
    color: #5c6b7b;
    margin-top: 6px;
}

.quality-band.low {
    background: #fff0ed;
}

.quality-band.ok {
    background: #fff3ce;
}

.quality-band.good {
    background: #ddf3e9;
}

.quality-band.great {
    background: #dff1f7;
}

.quality-marker {
    bottom: calc(100% + 5px);
    left: clamp(20px, calc(var(--value) * 1%), calc(100% - 20px));
    position: absolute;
    transform: translateX(-50%);
}

.quality-marker span {
    background: #17212f;
    border-radius: 8px;
    color: #ffffff;
    display: block;
    font-size: 13px;
    font-weight: 800;
    padding: 6px 9px;
    white-space: nowrap;
}

.quality-marker span::after {
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #17212f;
    content: "";
    left: 50%;
    position: absolute;
    top: 100%;
    transform: translateX(-50%);
}

.dialog-depth-grid,
.reply-funnel,
.health-grid,
.ops-grid {
    display: grid;
    gap: 12px;
}

.dialog-depth-grid {
    grid-template-columns: repeat(4, 1fr);
}

.depth-card,
.reply-funnel > div,
.health-grid > div,
.ops-card,
.time-card {
    background: #f7fafc;
    border: 1px solid #dce5ef;
    border-radius: 8px;
    padding: 14px;
}

.depth-card span,
.depth-card small,
.reply-funnel span,
.health-grid span,
.ops-card span,
.ops-card small,
.time-card span,
.time-card small {
    color: var(--muted);
    display: block;
}

.depth-card strong,
.reply-funnel strong,
.health-grid strong,
.ops-card strong,
.time-card strong {
    color: #17212f;
    display: block;
    font-size: 24px;
    margin: 5px 0;
}

.depth-bar {
    background: #dce8f2;
    border-radius: 999px;
    overflow: hidden;
}

.depth-bar {
    height: 8px;
    margin: 10px 0;
}

.depth-bar i {
    background: #46a6d7;
    display: block;
    height: 100%;
}

.stats-two-columns {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.reply-funnel {
    grid-template-columns: repeat(2, 1fr);
}

.stats-meter {
    margin-top: 16px;
}

.stats-meter > div {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.stats-meter span {
    color: var(--muted);
}

.stats-meter strong {
    color: #17212f;
}

.stats-meter > span {
    background: #dce8f2;
    border-radius: 999px;
    display: block;
    height: 12px;
    overflow: hidden;
}

.stats-meter i {
    background: #46a6d7;
    display: block;
    height: 100%;
}

.stats-insight-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.insight-list {
    display: grid;
    gap: 10px;
}

.insight-row {
    background: #f7fafc;
    border: 1px solid #dce5ef;
    border-radius: 8px;
    padding: 12px 13px;
}

.insight-row strong,
.insight-row span {
    display: block;
}

.insight-row strong {
    color: #17212f;
}

.insight-row span {
    color: var(--muted);
    margin-top: 4px;
}

.time-card strong {
    font-size: 42px;
}

.daily-bars {
    align-items: end;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(14, minmax(26px, 1fr));
    min-height: 210px;
}

.daily-bar {
    align-items: center;
    display: grid;
    gap: 6px;
    grid-template-rows: 150px auto auto;
    justify-items: center;
    min-width: 0;
}

.daily-bar i {
    align-self: end;
    background: #46a6d7;
    border-radius: 8px 8px 3px 3px;
    display: block;
    width: 100%;
}

.daily-bar span,
.daily-bar strong {
    font-size: 11px;
}

.daily-bar span {
    color: var(--muted);
}

.daily-bar strong {
    color: #17212f;
}

.health-grid,
.ops-grid {
    grid-template-columns: repeat(2, 1fr);
}

.ops-grid {
    grid-template-columns: repeat(3, 1fr);
}

.content-dashboard {
    background: #f8fbff;
    padding: 24px 26px 16px;
}

.stats-dashboard-reference {
    display: block;
    margin: 0 auto;
    max-width: 1320px;
}

.stats-page-head {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.stats-page-head h1 {
    color: #111b2b;
    font-size: 30px;
    margin: 0 0 5px;
}

.stats-page-head p {
    color: #53677d;
    font-size: 16px;
    margin: 0;
}

.stats-head-actions {
    display: flex;
    gap: 12px;
}

.stats-period,
.stats-refresh {
    align-items: center;
    background: #ffffff;
    border: 1px solid #ccdbe9;
    border-radius: 7px;
    color: #2c3e53;
    display: inline-flex;
    gap: 8px;
    min-height: 38px;
    padding: 8px 14px;
}

.stats-period::before {
    color: #2f86e9;
    content: "□";
}

.stats-refresh::before {
    color: #2f86e9;
    content: "↻";
}

.stats-reference-kpis {
    display: grid;
    gap: 13px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}

.stats-dashboard-reference .stats-kpi-card {
    align-content: center;
    background: #ffffff;
    border: 1px solid #ccdae8;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(38, 84, 124, 0.04);
    color: #111b2b;
    display: grid;
    gap: 2px 12px;
    grid-template-columns: 54px 1fr;
    min-height: 130px;
    padding: 18px 16px;
}

.stats-dashboard-reference .stats-kpi-card::before {
    display: none;
}

.stats-dashboard-reference .stats-kpi-card i {
    align-items: center;
    background: #e7f3ff;
    border-radius: 50%;
    color: #2f86e9;
    display: flex;
    font-style: normal;
    grid-row: 1 / span 3;
    height: 48px;
    justify-content: center;
    width: 48px;
}

.stats-dashboard-reference .stats-kpi-card i::before {
    content: "▥";
    font-size: 24px;
}

.stats-dashboard-reference .stats-kpi-check i { background: #e6f6e9; color: #25a94f; }
.stats-dashboard-reference .stats-kpi-adapt i { background: #edf4ff; color: #346fd6; }
.stats-dashboard-reference .stats-kpi-token i { background: #efe8ff; color: #884de3; }
.stats-dashboard-reference .stats-kpi-users i { background: #e7f3ff; color: #2f86e9; }
.stats-dashboard-reference .stats-kpi-calendar i { background: #fff2d9; color: #d58512; }
.stats-dashboard-reference .stats-kpi-spark i { background: #e8f7f2; color: #158f68; }
.stats-dashboard-reference .stats-kpi-chat i::before { content: "••"; }
.stats-dashboard-reference .stats-kpi-send i::before { content: "➤"; }
.stats-dashboard-reference .stats-kpi-check i::before { content: "✓"; }
.stats-dashboard-reference .stats-kpi-adapt i::before { content: "≋"; }
.stats-dashboard-reference .stats-kpi-token i::before { content: "◎"; }
.stats-dashboard-reference .stats-kpi-users i::before { content: "☷"; }
.stats-dashboard-reference .stats-kpi-calendar i::before { content: "□"; }
.stats-dashboard-reference .stats-kpi-spark i::before { content: "✦"; }

.stats-dashboard-reference .stats-kpi-card span {
    align-self: end;
    color: #102033;
    font-size: 14px;
}

.stats-dashboard-reference .stats-kpi-card strong {
    color: #111b2b;
    font-size: 29px;
    line-height: 1.1;
}

.stats-dashboard-reference .stats-kpi-card small {
    color: #4773a2;
    font-size: 13px;
}

.stats-primary-grid,
.stats-secondary-grid,
.stats-bottom-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.stats-primary-grid {
    grid-template-columns: minmax(0, 0.78fr) minmax(0, 1fr);
}

.stats-secondary-grid {
    grid-template-columns: minmax(0, 0.9fr) minmax(300px, 0.72fr) minmax(350px, 0.95fr);
}

.stats-bottom-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.stats-panel,
.stats-mini-card {
    background: #ffffff;
    border: 1px solid #ccdae8;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(38, 84, 124, 0.04);
    padding: 18px;
}

.stats-panel h2,
.stats-mini-card span {
    color: #111b2b;
    font-size: 17px;
    margin: 0;
}

.adaptation-v2-panel {
    margin-bottom: 16px;
}

.adaptation-v2-panel > header {
    align-items: flex-start;
    display: flex;
    gap: 18px;
    justify-content: space-between;
}

.adaptation-v2-panel > header span,
.adaptation-v2-score span {
    color: #6b7f94;
    display: block;
    font-size: 12px;
    margin-top: 4px;
}

.adaptation-v2-score {
    text-align: right;
}

.adaptation-v2-score strong {
    color: #176f52;
    font-size: 30px;
    line-height: 1;
}

.adaptation-alert-list {
    border-bottom: 1px solid #d9e5f0;
    border-top: 1px solid #d9e5f0;
    margin-top: 16px;
}

.adaptation-alert-heading,
.adaptation-alert-row {
    align-items: center;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(180px, 0.7fr) minmax(170px, 0.65fr) minmax(260px, 1.3fr);
    padding: 12px 0;
}

.adaptation-alert-heading {
    color: #526170;
    display: flex;
    font-size: 12px;
    justify-content: space-between;
    padding-bottom: 8px;
}

.adaptation-alert-heading span,
.adaptation-alert-row span {
    color: #6b7f94;
    display: block;
    font-size: 12px;
}

.adaptation-alert-row {
    border-top: 1px solid #e5edf4;
    box-shadow: inset 3px 0 0 #d99021;
    padding-left: 12px;
}

.adaptation-alert-row.critical {
    box-shadow: inset 3px 0 0 #c74343;
}

.adaptation-alert-row > div > strong {
    color: #263746;
    display: block;
    font-size: 13px;
}

.adaptation-alert-change strong {
    color: #a65819 !important;
}

.adaptation-alert-row.critical .adaptation-alert-change strong {
    color: #b32f36 !important;
}

.adaptation-alert-factors {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
}

.adaptation-resolved-alerts {
    border-top: 1px solid #d9e5f0;
    color: #526170;
    font-size: 12px;
    margin-top: 16px;
    padding-top: 12px;
}

.adaptation-resolved-alerts summary {
    cursor: pointer;
    font-weight: 700;
}

.adaptation-resolved-alerts > div {
    align-items: center;
    border-top: 1px solid #e5edf4;
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 9px;
}

.adaptation-resolved-alerts span,
.adaptation-resolved-alerts small {
    display: block;
}

.adaptation-resolved-alerts small {
    color: #7890a8;
    margin-top: 2px;
}

.adaptation-resolved-alerts em {
    color: #176f52;
    font-style: normal;
    font-weight: 700;
}

.improvement-loop-list {
    border-top: 1px solid #d9e5f0;
    margin-top: 18px;
}

.improvement-loop-row {
    border-top: 1px solid #e5edf4;
}

.improvement-loop-row > summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 12px 0;
}

.improvement-loop-row > summary span:first-child,
.improvement-loop-row > summary small {
    display: block;
}

.improvement-loop-row > summary strong {
    color: #263746;
    font-size: 13px;
}

.improvement-loop-row > summary small,
.improvement-loop-meta {
    color: #6b7f94;
    font-size: 12px;
}

.improvement-loop-body {
    padding: 0 0 14px 18px;
}

.improvement-loop-body > p {
    color: #263746;
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 10px;
}

.improvement-loop-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 8px 0;
}

.improvement-comparison {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    margin: 12px 0;
    max-width: 620px;
}

.improvement-comparison span {
    border-left: 2px solid #b9c9d7;
    color: #6b7f94;
    font-size: 11px;
    padding-left: 9px;
}

.improvement-comparison strong {
    color: #17212b;
    display: block;
    font-size: 18px;
    margin-top: 3px;
}

.improvement-proposal-text {
    background: #f5f8fb;
    border-left: 3px solid #2f86e9;
    color: #263746;
    font-size: 13px;
    line-height: 1.45;
    margin: 10px 0;
    padding: 10px 12px;
}

.improvement-proposal-text strong,
.improvement-proposal-text span {
    display: block;
}

.improvement-proposal-text strong {
    margin-bottom: 4px;
}

.adaptation-v2-body {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.55fr);
    margin-top: 18px;
}

.adaptation-factor-list {
    display: grid;
    gap: 10px;
}

.adaptation-factor-list > div,
.adaptation-account-list > div {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(210px, 0.9fr) minmax(150px, 1fr) 54px;
}

.adaptation-factor-list span,
.adaptation-account-list span {
    color: #263746;
    font-size: 13px;
    min-width: 0;
}

.adaptation-factor-list small,
.adaptation-account-list small {
    color: #7890a8;
    display: block;
    font-size: 11px;
    margin-top: 2px;
}

.adaptation-factor-list i,
.adaptation-account-list i {
    background: #e8eef3;
    display: block;
    height: 8px;
    overflow: hidden;
}

.adaptation-factor-list i b,
.adaptation-account-list i b {
    background: #2f86e9;
    display: block;
    height: 100%;
}

.adaptation-factor-list > div:nth-child(2) i b { background: #20a267; }
.adaptation-factor-list > div:nth-child(3) i b { background: #d99021; }
.adaptation-factor-list > div:nth-child(4) i b { background: #8058c9; }
.adaptation-factor-list > div:nth-child(5) i b { background: #526170; }

.adaptation-factor-list > div > strong {
    color: #17212b;
    font-size: 14px;
    text-align: right;
}

.adaptation-history > span {
    color: #526170;
    font-size: 12px;
    font-weight: 700;
}

.adaptation-history > div {
    align-items: flex-end;
    border-bottom: 1px solid #b9c9d7;
    display: flex;
    gap: 3px;
    height: 116px;
    margin-top: 9px;
    min-width: 0;
    padding: 0 2px;
}

.adaptation-history > div > i {
    background: #2f86e9;
    flex: 1 1 8px;
    max-width: 12px;
    min-width: 4px;
}

.adaptation-history > div > small {
    align-self: center;
    color: #7890a8;
    font-size: 12px;
}

.adaptation-account-list {
    border-top: 1px solid #d9e5f0;
    display: grid;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
}

.adaptation-account-list em {
    color: #17212b;
    font-size: 14px;
    font-style: normal;
    text-align: right;
}

.adaptation-account-list em small {
    white-space: nowrap;
}

.stats-info {
    align-items: center;
    border: 1px solid #9eb2c7;
    border-radius: 50%;
    color: #7890a8;
    display: inline-flex;
    font-size: 11px;
    height: 15px;
    justify-content: center;
    margin-left: 4px;
    width: 15px;
}

.learning-gauge {
    margin: 10px auto 0;
    max-width: 440px;
    min-height: 266px;
    position: relative;
    text-align: center;
}

.learning-gauge-svg {
    display: block;
    height: auto;
    margin: 0 auto;
    max-width: 100%;
    overflow: visible;
    width: 100%;
}

.gauge-face {
    fill: #e3e6ea;
}

.gauge-arc {
    fill: none;
    filter: drop-shadow(0 7px 10px rgba(31, 70, 105, 0.08));
    stroke-linecap: butt;
    stroke-width: 62;
}

.gauge-arc-min { stroke: #e44a1d; }
.gauge-arc-low { stroke: #ff941f; }
.gauge-arc-medium { stroke: #cdd21c; }
.gauge-arc-high { stroke: #15c720; }
.gauge-arc-max { stroke: #0a9414; }

.gauge-text {
    dominant-baseline: middle;
    fill: #101826;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0;
    pointer-events: none;
    text-anchor: middle;
}

.gauge-needle-svg {
    transform: rotate(var(--needle));
    transform-box: view-box;
    transform-origin: 250px 230px;
}

.gauge-needle-body {
    fill: #4984ec;
}

.gauge-needle-gloss {
    fill: rgba(255, 255, 255, 0.22);
}

.gauge-hub-outer {
    fill: rgba(39, 46, 61, 0.78);
    filter: drop-shadow(0 2px 5px rgba(17, 27, 43, 0.14));
}

.gauge-hub-inner {
    fill: rgba(73, 72, 101, 0.66);
}

.learning-gauge strong {
    color: #2c7d3f;
    display: block;
    font-size: 22px;
    margin-top: -18px;
}

.learning-gauge small {
    color: #586b80;
    display: block;
    margin-top: 8px;
}

.response-funnel {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.funnel-row {
    align-items: center;
    display: grid;
    gap: 18px;
    grid-template-columns: 150px minmax(160px, 1fr) 70px;
}

.funnel-row > div strong,
.funnel-row > div span,
.funnel-row em small {
    display: block;
}

.funnel-row > div strong {
    color: #111b2b;
}

.funnel-row > div span,
.funnel-row em small {
    color: #6b7f94;
    font-size: 12px;
}

.funnel-row i {
    border-radius: 5px;
    clip-path: polygon(0 0, 100% 0, calc(100% - 11px) 100%, 11px 100%);
    display: block;
    height: 43px;
}

.funnel-blue { background: #2f86f4; }
.funnel-green { background: #33b96b; }
.funnel-orange { background: #ffac29; }
.funnel-red { background: #f55355; }

.funnel-row em {
    color: #111b2b;
    font-style: normal;
    text-align: right;
}

.stats-line-chart svg {
    display: block;
    height: 190px;
    width: 100%;
}

.chart-grid line {
    stroke: #dce7f2;
    stroke-dasharray: 2 2;
}

.stats-line-chart polyline {
    fill: none;
    stroke: #2f86f4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 4;
}

.stats-line-chart circle {
    fill: #ffffff;
    stroke: #2f86f4;
    stroke-width: 4;
}

.chart-labels {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-left: 28px;
}

.chart-labels span,
.stats-line-chart small {
    color: #6b7f94;
    font-size: 12px;
}

.scope-wrap {
    align-items: center;
    display: grid;
    gap: 20px;
    grid-template-columns: 160px 1fr;
    margin-top: 20px;
}

.scope-donut {
    align-items: center;
    background: radial-gradient(circle at center, #ffffff 0 42%, transparent 43%), conic-gradient(#2f86f4 calc(var(--group) * 1%), #4cc36f 0);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    height: 154px;
    justify-content: center;
    width: 154px;
}

.scope-donut strong {
    color: #111b2b;
    font-size: 26px;
}

.scope-donut span,
.scope-legend span {
    color: #53677d;
}

.scope-legend {
    display: grid;
    gap: 18px;
}

.scope-legend div {
    display: grid;
    gap: 3px 10px;
    grid-template-columns: 12px 1fr;
}

.scope-legend i {
    border-radius: 50%;
    grid-row: 1 / span 2;
    height: 12px;
    margin-top: 4px;
    width: 12px;
}

.scope-legend .blue { background: #2f86f4; }
.scope-legend .green { background: #4cc36f; }

.stats-saving-panel {
    align-items: center;
    background: linear-gradient(135deg, #f3f9ff, #ffffff);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    overflow: hidden;
    position: relative;
}

.stats-saving-panel strong {
    color: #162238;
    display: block;
    font-size: 45px;
    line-height: 1.05;
    margin: 20px 0 8px;
}

.stats-saving-panel p {
    color: #53677d;
    margin: 0;
}

.saving-illustration {
    height: 170px;
    position: relative;
}

.saving-clock {
    background: #eef6ff;
    border: 9px solid #2f86e9;
    border-radius: 50%;
    bottom: 20px;
    height: 112px;
    left: 20px;
    position: absolute;
    width: 112px;
}

.saving-clock::before,
.saving-clock::after {
    background: #173255;
    content: "";
    left: 48px;
    position: absolute;
    top: 24px;
    transform-origin: bottom center;
    width: 4px;
}

.saving-clock::before {
    height: 32px;
}

.saving-clock::after {
    height: 42px;
    transform: rotate(55deg);
}

.saving-cup {
    background: #ffffff;
    border-radius: 0 0 22px 22px;
    bottom: 34px;
    box-shadow: inset 0 0 0 3px #d7e4ef;
    height: 76px;
    position: absolute;
    right: 24px;
    width: 78px;
}

.saving-cup::before {
    background: #5c3b25;
    border-radius: 50%;
    content: "";
    height: 16px;
    left: 8px;
    position: absolute;
    right: 8px;
    top: -7px;
}

.saving-cup::after {
    border: 8px solid #d7e4ef;
    border-left: 0;
    border-radius: 0 20px 20px 0;
    content: "";
    height: 32px;
    position: absolute;
    right: -24px;
    top: 18px;
    width: 24px;
}

.saving-mask {
    background: #347dea;
    border-radius: 42px 42px 30px 30px;
    bottom: 5px;
    height: 50px;
    left: 80px;
    position: absolute;
    transform: rotate(5deg);
    width: 118px;
}

.saving-mask::before,
.saving-mask::after {
    background: #123563;
    border-radius: 999px;
    content: "";
    height: 4px;
    position: absolute;
    top: 23px;
    width: 22px;
}

.saving-mask::before { left: 30px; transform: rotate(18deg); }
.saving-mask::after { right: 30px; transform: rotate(-18deg); }

.stats-mini-card {
    min-height: 112px;
}

.stats-mini-card span,
.stats-mini-card small {
    color: #53677d;
    display: block;
}

.stats-mini-card strong {
    color: #111b2b;
    display: block;
    font-size: 24px;
    line-height: 1.2;
    margin: 10px 0 4px;
}

.stats-page-foot {
    border-top: 1px solid #d9e5f0;
    color: #6b7f94;
    display: flex;
    font-size: 12px;
    justify-content: space-between;
    margin: 10px -26px -16px;
    padding: 12px 26px;
}

@media (max-width: 1180px) {
    .stats-reference-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stats-primary-grid,
    .stats-secondary-grid {
        grid-template-columns: 1fr;
    }

    .stats-bottom-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .adaptation-v2-body {
        grid-template-columns: 1fr;
    }

    .adaptation-alert-row {
        grid-template-columns: minmax(180px, 0.8fr) minmax(150px, 0.6fr) minmax(220px, 1fr);
    }
}

.muted {
    color: var(--muted);
}

.setting-caption {
    color: var(--muted);
    display: block;
    font-size: 12px;
    line-height: 1.35;
    margin: -2px 0 8px 26px;
}

.setting-subcheck {
    margin-left: 26px;
}

.setting-subcaption {
    margin-left: 52px;
}

.section-title {
    margin-top: 24px;
}

.section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    margin: 0 0 18px;
}

.section-tabs a {
    color: var(--muted);
    padding: 9px 11px;
    border-bottom: 2px solid transparent;
}

.section-tabs a.active,
.section-tabs a:hover {
    color: var(--brand-dark);
    border-bottom-color: var(--brand);
}

.status-tabs {
    margin-top: 22px;
}

.stats-columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    gap: 20px;
}

.system-grid {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    background: #edf2f7;
    font-size: 13px;
    color: #42526b;
}

tr:last-child td {
    border-bottom: 0;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="url"],
input[type="email"],
textarea,
select {
    width: 100%;
    border: 1px solid #c9d2df;
    border-radius: 6px;
    padding: 9px 10px;
    font: inherit;
    background: #ffffff;
}

textarea {
    min-height: 110px;
}

label {
    display: block;
    font-weight: 600;
    margin: 12px 0 6px;
}

.settings-section + .settings-section {
    border-top: 1px solid var(--line);
    margin-top: 22px;
    padding-top: 22px;
}

.settings-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 920px);
    gap: 20px;
    align-items: start;
}

.settings-nav {
    position: sticky;
    top: 20px;
    display: grid;
    gap: 8px;
}

.settings-nav a {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    padding: 10px;
}

.settings-nav a:hover {
    color: var(--brand-dark);
    background: #eaf2f5;
}

.settings-nav a.active {
    background: var(--brand);
    color: #ffffff;
}

.settings-nav a.active small,
.settings-nav a.active em {
    color: rgba(255, 255, 255, 0.78);
}

.settings-nav-mark {
    align-items: center;
    background: #e7f4fb;
    border-radius: 50%;
    color: var(--brand-dark);
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.settings-nav a.active .settings-nav-mark {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.settings-nav strong {
    display: block;
    color: inherit;
    font-size: 15px;
    line-height: 1.15;
}

.settings-nav small {
    color: var(--muted);
    display: block;
    font-size: 12px;
    line-height: 1.25;
    margin-top: 3px;
}

.settings-nav em {
    background: #e7f4fb;
    border-radius: 999px;
    color: var(--brand-dark);
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
    min-width: 28px;
    padding: 4px 8px;
    text-align: center;
}

.settings-nav a.active em {
    background: rgba(255, 255, 255, 0.2);
}

.settings-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.settings-section {
    scroll-margin-top: 18px;
}

.settings-layout .settings-content > .settings-section {
    border-top: 1px solid var(--line);
    margin-top: 22px;
    padding-top: 22px;
}

.settings-section#autoreplies {
    border-top: 0;
    margin-top: 0;
    order: 1;
    padding-top: 0;
}

.onboarding-shell {
    display: grid;
    gap: 24px;
    grid-template-columns: 320px minmax(0, 760px);
    min-height: calc(100vh - 48px);
}

.onboarding-side {
    background: #ffffff;
    border: 1px solid #d7e3ef;
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(32, 82, 124, 0.06);
    padding: 22px;
    position: sticky;
    top: 20px;
}

.onboarding-brand {
    margin: 0 0 22px;
}

.onboarding-progress {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.onboarding-progress span {
    color: #0c73df;
    font-weight: 800;
}

.onboarding-progress i {
    background: #e5eef7;
    border-radius: 999px;
    display: block;
    height: 9px;
    overflow: hidden;
}

.onboarding-progress b {
    background: linear-gradient(90deg, #2f86e9, #35b87f);
    border-radius: inherit;
    display: block;
    height: 100%;
}

.onboarding-steps {
    display: grid;
    gap: 10px;
    margin-bottom: 22px;
}

.onboarding-steps span {
    align-items: center;
    color: #65768a;
    display: flex;
    font-weight: 700;
    gap: 10px;
}

.onboarding-steps b {
    align-items: center;
    background: #eef4fa;
    border-radius: 50%;
    color: #64748b;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    width: 30px;
}

.onboarding-steps span.active {
    color: #0c73df;
}

.onboarding-steps span.active b {
    background: #2f86e9;
    color: #ffffff;
}

.onboarding-steps span.done b {
    background: #dff3e9;
    color: #12734a;
}

.onboarding-side p,
.onboarding-card p {
    color: #6b7b8e;
    font-size: 16px;
    line-height: 1.45;
}

.onboarding-main {
    min-width: 0;
}

.onboarding-card {
    background: #ffffff;
    border: 1px solid #d7e3ef;
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(32, 82, 124, 0.06);
    padding: 34px;
}

.onboarding-card h1 {
    font-size: 34px;
    line-height: 1.1;
    margin: 8px 0 12px;
}

.onboarding-kicker {
    color: #0c73df;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.onboarding-tip,
.onboarding-telegram-card {
    background: #eef7ff;
    border: 1px solid #cde4fb;
    border-radius: 8px;
    color: #176b87;
    line-height: 1.45;
    margin-top: 16px;
    padding: 14px 16px;
}

.onboarding-telegram-card {
    display: grid;
    gap: 6px;
}

.onboarding-telegram-card strong {
    color: #17212f;
    font-size: 17px;
}

.onboarding-choice-grid,
.onboarding-finish-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 22px 0;
}

.onboarding-choice-grid label,
.onboarding-finish-grid div {
    border: 1px solid #d7e3ef;
    border-radius: 8px;
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 16px;
}

.onboarding-choice-grid input {
    height: 20px;
    margin: 0;
    width: 20px;
}

.onboarding-choice-grid strong,
.onboarding-finish-grid strong {
    color: #17212f;
    font-size: 18px;
}

.onboarding-choice-grid span,
.onboarding-finish-grid span {
    color: #6b7b8e;
    font-weight: 500;
}

.onboarding-subcheck {
    margin-left: 34px;
}

.onboarding-actions {
    align-items: center;
    border-top: 1px solid #d7e3ef;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
    padding-top: 20px;
}

.onboarding-actions .ghost {
    background: transparent;
    border-color: transparent;
    color: #6b7b8e;
    box-shadow: none;
}

.settings-section#automation {
    order: 2;
}

.settings-section#ai {
    order: 3;
}

.settings-section#telegram {
    order: 4;
}

.max-chat-picker {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.max-chat-picker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.max-chat-list {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    max-height: 420px;
    overflow: auto;
}

.max-chat-row {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    display: grid;
    gap: 10px;
    grid-template-columns: auto minmax(0, 1fr);
    margin: 0;
    padding: 10px 12px;
}

.max-chat-row:last-child {
    border-bottom: 0;
}

.max-chat-row:hover {
    background: #f8fbfd;
}

.max-chat-row input {
    margin-top: 3px;
}

.max-chat-main {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.max-chat-main strong {
    overflow-wrap: anywhere;
}

.max-chat-meta {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.settings-section#calendar {
    order: 5;
}

.settings-section#service {
    order: 6;
}

.settings-content > .actions {
    order: 20;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
}

.conversation-section + .conversation-section {
    border-top: 1px solid var(--line);
    margin-top: 22px;
    padding-top: 22px;
}

.conversation-topbar {
    margin-bottom: 10px;
}

.conversation-subtitle {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
    overflow-wrap: anywhere;
}

.conversation-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 18px;
}

.conversation-tabs {
    margin-top: 6px;
}

.conversation-toolbar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 190px auto auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
}

.conversation-toolbar label {
    margin: 0;
}

.conversation-toolbar label span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
}

.timeline-count {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 10px;
}

.conversation-feed-wrap {
    background: #98b985;
    border-color: #c4d8bc;
    padding: 0;
    overflow: visible;
}

.conversation-feed {
    background-color: #b9d39f;
    background-image:
        radial-gradient(circle at 18px 18px, rgba(75, 111, 63, 0.13) 0 1px, transparent 1px),
        radial-gradient(circle at 58px 46px, rgba(75, 111, 63, 0.11) 0 1.5px, transparent 1.5px),
        linear-gradient(120deg, rgba(255, 255, 255, 0.18), rgba(101, 147, 103, 0.2));
    background-size: 76px 76px, 92px 92px, cover;
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 440px;
    padding: 18px;
}

.empty-state {
    color: var(--muted);
    padding: 18px;
}

.inline-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.field-status {
    margin-top: 8px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    font-weight: 500;
}

.check input {
    width: 18px;
    height: 18px;
}

.check.is-disabled {
    color: var(--muted);
    opacity: 0.65;
}

.settings-content .check {
    align-items: flex-start;
    background: #ffffff;
    border: 1px solid #cfe0ef;
    border-radius: 8px;
    display: grid;
    font-size: 18px;
    font-weight: 800;
    gap: 14px;
    grid-template-columns: 72px minmax(0, 1fr);
    line-height: 1.24;
    margin: 12px 0;
    min-height: 74px;
    padding: 18px 20px;
}

.settings-content .check input[type="checkbox"] {
    appearance: none;
    background: #c9d6e5;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    height: 30px;
    margin: 0;
    position: relative;
    transition: background 0.16s ease, opacity 0.16s ease;
    width: 58px;
}

.settings-content .check input[type="checkbox"]::after {
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(23, 42, 61, 0.22);
    content: "";
    height: 24px;
    left: 3px;
    position: absolute;
    top: 3px;
    transition: transform 0.16s ease;
    width: 24px;
}

.settings-content .check input[type="checkbox"]:checked {
    background: #2383ea;
}

.settings-content .check input[type="checkbox"]:checked::after {
    transform: translateX(28px);
}

.settings-content .check input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.settings-content .check.is-disabled {
    opacity: 0.58;
}

.settings-content .setting-subcheck {
    margin-left: 0;
}

.settings-content .setting-subcaption {
    margin-left: 0;
}

.settings-content .check:has(+ .setting-caption) {
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    min-height: 64px;
    padding-bottom: 8px;
}

.settings-content .check + .setting-caption {
    background: #ffffff;
    border: 1px solid #cfe0ef;
    border-radius: 0 0 8px 8px;
    border-top: 0;
    color: #6f7f91;
    font-size: 16px;
    line-height: 1.35;
    margin: 0 0 14px;
    padding: 0 20px 18px 106px;
}

.settings-content .form-grid {
    gap: 14px;
    margin-top: 14px;
}

.settings-content .form-grid > div {
    background: #ffffff;
    border: 1px solid #d7e3ee;
    border-radius: 8px;
    padding: 14px;
}

.settings-content .form-grid > div > label:first-child {
    margin-top: 0;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #ffffff;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 6px;
    font: inherit;
    cursor: pointer;
}

.button.secondary,
button.secondary {
    background: #ffffff;
    color: var(--brand);
}

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    background: #e8f2f6;
    color: var(--brand-dark);
}

.badge.bad {
    background: #fde7e7;
    color: var(--bad);
}

.badge.ok {
    background: #e6f4ee;
    color: var(--ok);
}

.badge.deleted {
    background: rgba(226, 232, 240, 0.9);
    color: #64748b;
}

.badge.has-info {
    align-items: center;
    display: inline-flex;
    gap: 5px;
}

.badge-info {
    align-items: center;
    border: 1px solid currentColor;
    border-radius: 999px;
    display: inline-flex;
    font-family: Arial, sans-serif;
    font-size: 9px;
    font-weight: 700;
    height: 13px;
    justify-content: center;
    line-height: 1;
    opacity: 0.82;
    text-transform: none;
    width: 13px;
}

.notice {
    background: #eaf4ff;
    border: 1px solid #b7d8ff;
    color: #1f4e79;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.error {
    background: #fff0ed;
    border-color: #ffc9c0;
    color: var(--bad);
}

.login {
    max-width: 380px;
    margin: 10vh auto;
}

.message {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.15);
    max-width: min(76%, 760px);
    padding: 7px 10px 6px;
    position: relative;
}

.message:last-child {
    border-bottom: 0;
}

.message .meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    gap: 4px 6px;
    line-height: 1.3;
    color: var(--muted);
    margin-bottom: 4px;
}

.message.direction-owner,
.message.direction-bot {
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    margin-left: auto;
}

.message.direction-owner {
    background: #ddf8cb;
}

.message.direction-owner .meta {
    color: #5f8f58;
}

.message.direction-bot {
    background: #e1f2ff;
    box-shadow: inset 3px 0 0 rgba(52, 152, 219, 0.35), 0 1px 1px rgba(15, 23, 42, 0.15);
}

.message.direction-bot .meta {
    color: #477ea3;
}

.message.direction-incoming {
    align-self: flex-start;
    background: #ffffff;
    border-bottom-left-radius: 5px;
    margin-right: auto;
}

.message.direction-system,
.message.direction-unknown {
    align-self: center;
    background: rgba(255, 255, 255, 0.82);
    max-width: min(86%, 760px);
}

.message.is-deleted {
    opacity: 0.82;
}

.message.is-deleted .message-body,
.message.is-deleted .message-media {
    filter: grayscale(0.25);
}

.message-body {
    color: #17212b;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.message.is-optimistic .message-body {
    white-space: pre-wrap;
}

.message-body a {
    color: #168acd;
    text-decoration: none;
}

.message-body a:hover {
    text-decoration: underline;
}

.inline-status-popover {
    display: inline-block;
    margin-left: 6px;
    position: relative;
    vertical-align: middle;
}

.inline-status-popover summary {
    display: inline-flex;
    align-items: center;
    list-style: none;
    cursor: pointer;
}

.inline-status-popover summary::-webkit-details-marker {
    display: none;
}

.inline-status-popover[open] {
    z-index: 5;
}

.inline-status-tip {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
    color: var(--text);
    display: flex;
    flex-direction: column;
    font-size: 13px;
    gap: 6px;
    left: 0;
    line-height: 1.35;
    margin-top: 6px;
    max-width: min(320px, calc(100vw - 64px));
    padding: 8px 10px;
    position: absolute;
    top: 100%;
    width: max-content;
}

.inline-status-action {
    background: #edf7fc;
    border: 1px solid #cfeaf6;
    border-radius: 8px;
    color: #0b5f79;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 9px;
}

.inline-status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.inline-status-action.primary {
    background: #229ed9;
    border-color: #229ed9;
    color: #ffffff;
}

.inline-status-action:hover {
    background: #dff1fa;
}

.inline-status-action.primary:hover {
    background: #1688c3;
}

.inline-status-action:disabled {
    cursor: default;
    opacity: 0.7;
}

.inline-reply-status.is-static {
    cursor: default;
}

.timeline-status {
    align-self: center;
    background: rgba(255, 255, 255, 0.72);
    border: 0;
    border-radius: 12px;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.12);
    color: #51606f;
    max-width: min(76%, 760px);
    padding: 6px 10px;
}

.timeline-status.status-sent,
.timeline-status.is-success {
    background: rgba(230, 244, 238, 0.86);
}

.timeline-status.status-error,
.timeline-status.is-error {
    background: rgba(255, 248, 246, 0.92);
}

.timeline-status.status-suppressed,
.timeline-status.status-canceled {
    background: rgba(248, 250, 252, 0.9);
}

.status-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.status-detail,
.status-related {
    color: #4b5563;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.status-related {
    margin-top: 5px;
}

.status-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
}

.status-line .meta {
    margin-bottom: 0;
}

.status-disclosure {
    display: inline-block;
}

.status-disclosure[open] {
    display: block;
    flex-basis: 100%;
}

.status-disclosure summary {
    display: inline-flex;
    align-items: center;
    list-style: none;
    cursor: pointer;
}

.status-disclosure summary::-webkit-details-marker {
    display: none;
}

.status-disclosure-body {
    margin-top: 8px;
}

.timeline-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 56px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.72);
    border-top: 0;
    padding: 10px;
}

.timeline-loader.is-hidden {
    display: none;
}

.timeline-loader.is-loading button {
    opacity: 0.65;
    pointer-events: none;
}

.message-media {
    margin: 2px 0 5px;
}

.media-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 12px;
}

.message-media audio {
    display: block;
    width: min(100%, 430px);
    height: 42px;
}

.message-media video {
    display: block;
    width: min(100%, 520px);
    max-height: 480px;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #111827;
    border-radius: 10px;
}

.media-photo-link {
    display: block;
}

.media-photo {
    border-radius: 10px;
    display: block;
    max-height: 420px;
    max-width: min(100%, 420px);
    object-fit: contain;
}

.media-error {
    color: var(--bad);
    font-size: 13px;
}

.media-transcript {
    border-left: 2px solid rgba(113, 128, 142, 0.34);
    color: #1f2937;
    font-size: 13px;
    line-height: 1.34;
    margin: 0 0 4px;
    max-width: min(100%, 520px);
    padding: 0 0 0 6px;
    white-space: pre-wrap;
}

.media-transcript strong {
    color: #71808e;
    display: block;
    font-size: 10px;
    line-height: 1;
    margin-bottom: 1px;
    text-transform: uppercase;
}

.media-transcript span {
    display: block;
}

@media (max-width: 900px) {
    .layout {
        display: block;
        min-height: 100dvh;
    }

    .sidebar {
        background: #ffffff;
        bottom: 0;
        box-shadow: 14px 0 32px rgba(15, 23, 42, 0.18);
        left: 0;
        min-height: 100dvh;
        overflow-y: auto;
        padding: 18px 12px;
        position: fixed;
        top: 0;
        transform: translateX(-105%);
        transition: transform 180ms ease;
        width: min(86vw, 320px);
        z-index: 30;
    }

    .layout.is-nav-open .sidebar {
        transform: translateX(0);
    }

    .mobile-nav-backdrop {
        background: rgba(15, 23, 42, 0.36);
        border: 0;
        bottom: 0;
        cursor: pointer;
        display: block;
        left: 0;
        opacity: 0;
        padding: 0;
        pointer-events: none;
        position: fixed;
        right: 0;
        top: 0;
        transition: opacity 180ms ease;
        width: 100%;
        z-index: 20;
    }

    .layout.is-nav-open .mobile-nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-close {
        align-items: center;
        background: transparent;
        border: 0;
        color: #718096;
        cursor: pointer;
        display: inline-flex;
        font-size: 30px;
        font-weight: 300;
        height: 40px;
        justify-content: center;
        line-height: 1;
        padding: 0;
        width: 40px;
    }

    .sidebar-close:hover {
        background: #f3f8fd;
        color: #17212f;
    }

    .brand {
        margin: 0 6px 22px;
    }

    .nav {
        gap: 6px;
        overflow: visible;
    }

    .nav a {
        flex: none;
        margin: 0;
        white-space: normal;
        width: 100%;
    }

    .mobile-appbar {
        align-items: center;
        background: rgba(245, 247, 251, 0.96);
        display: flex;
        gap: 12px;
        justify-content: space-between;
        min-height: 54px;
        padding: 9px 14px;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .mobile-appbar strong {
        color: #17212f;
        font-size: 17px;
    }

    .mobile-menu-toggle {
        align-items: center;
        background: #ffffff;
        border: 1px solid #cbd9e7;
        border-radius: 7px;
        color: #176b87;
        cursor: pointer;
        display: inline-flex;
        font: inherit;
        font-weight: 700;
        gap: 8px;
        min-height: 38px;
        padding: 7px 11px;
    }

    .mobile-menu-toggle span:first-child {
        font-size: 18px;
        line-height: 1;
    }

    .mobile-menu-toggle:hover {
        background: #f3f8fd;
    }

    .content {
        min-height: 100dvh;
        padding: 0 14px 24px;
        min-width: 0;
    }

    .content-messenger {
        padding-top: 54px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    table {
        display: block;
        overflow-x: auto;
    }

    .stats-grid,
    .system-grid,
    .stats-columns,
    .stats-dashboard,
    .stats-kpi-grid,
    .stats-primary-grid,
    .stats-secondary-grid,
    .stats-bottom-grid,
    .stats-two-columns,
    .stats-insight-grid,
    .dialog-depth-grid,
    .reply-funnel,
    .health-grid,
    .ops-grid,
    .settings-layout,
    .onboarding-shell,
    .onboarding-choice-grid,
    .onboarding-finish-grid,
    .form-grid,
    .conversation-toolbar {
        grid-template-columns: 1fr;
    }

    .stats-side {
        position: static;
    }

    .settings-nav {
        position: static;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .settings-nav a {
        min-width: 260px;
    }

    .onboarding-side {
        position: static;
    }

    .onboarding-steps {
        display: flex;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .onboarding-steps span {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .onboarding-card {
        padding: 22px;
    }

    .onboarding-card h1 {
        font-size: 28px;
    }

    .onboarding-subcheck {
        margin-left: 0;
    }

    .stats-page-head,
    .stats-head-actions {
        flex-direction: column;
    }

    .stats-head-actions,
    .stats-period,
    .stats-refresh {
        width: 100%;
    }

    .stats-reference-kpis {
        grid-template-columns: 1fr;
    }

    .funnel-row,
    .scope-wrap,
    .stats-saving-panel {
        grid-template-columns: 1fr;
    }

    .funnel-row em {
        text-align: left;
    }

    .learning-gauge {
        overflow: hidden;
    }

    .learning-gauge-arc {
        transform: scale(0.82);
        transform-origin: top center;
    }

    .adaptation-v2-panel > header {
        flex-direction: column;
    }

    .adaptation-v2-score {
        text-align: left;
    }

    .adaptation-alert-row {
        align-items: start;
        grid-template-columns: 1fr auto;
    }

    .adaptation-alert-factors {
        grid-column: 1 / -1;
    }

    .improvement-comparison {
        grid-template-columns: 1fr;
    }

    .adaptation-factor-list > div,
    .adaptation-account-list > div {
        grid-template-columns: 1fr 54px;
    }

    .adaptation-factor-list i,
    .adaptation-account-list i {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .adaptation-factor-list > div > strong,
    .adaptation-account-list em {
        grid-column: 2;
        grid-row: 1;
    }

    .stats-side-nav {
        grid-template-columns: repeat(4, minmax(170px, 1fr));
        overflow-x: auto;
    }

    .stats-hero,
    .stats-section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats-hero-badge {
        text-align: left;
        width: 100%;
    }

    .stats-hero-widgets {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .stats-hero-score,
    .stats-hero-badge {
        min-height: 112px;
    }

    .quality-rail {
        grid-template-columns: 1fr;
        margin-top: 34px;
    }

    .quality-band:first-child,
    .quality-band:last-of-type,
    .quality-band {
        border-radius: 8px;
    }

    .daily-bars {
        grid-template-columns: repeat(14, 42px);
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .settings-nav {
        position: static;
        display: flex;
        overflow-x: auto;
        border-left: 0;
        border-bottom: 1px solid var(--line);
    }

    .settings-nav a {
        white-space: nowrap;
    }

    .conversation-feed {
        padding: 12px;
    }

    .message {
        max-width: 92%;
    }

    .timeline-status {
        max-width: 92%;
    }

    .media-photo {
        max-height: 320px;
    }

    .message-media video {
        max-height: 320px;
    }
}

/* Telegram-style conversation workspace */
.content-messenger {
    min-width: 0;
    overflow: hidden;
    padding: 16px;
}

.messenger-shell {
    background: #ffffff;
    border: 1px solid #d5dce5;
    border-radius: 8px;
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    height: calc(100vh - 32px);
    min-height: 620px;
    overflow: hidden;
}

.content-messenger > .notice + .messenger-shell {
    height: calc(100vh - 98px);
}

.messenger-dialogs {
    background: #ffffff;
    border-right: 1px solid #dfe4ea;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    min-height: 0;
    min-width: 0;
}

.messenger-dialogs-header {
    align-items: center;
    display: flex;
    min-height: 68px;
    padding: 12px 16px 8px;
}

.messenger-dialogs-header h1 {
    font-size: 21px;
}

.messenger-dialogs-header span {
    color: #7a8794;
    display: block;
    font-size: 12px;
    margin-top: 2px;
}

.messenger-dialog-search,
.messenger-message-search {
    align-items: center;
    background: #f2f4f7;
    border: 1px solid transparent;
    border-radius: 8px;
    display: flex;
    font-weight: 400;
    gap: 8px;
    margin: 6px 10px 10px;
    padding: 0 11px;
}

.messenger-dialog-search:focus-within,
.messenger-message-search:focus-within {
    background: #ffffff;
    border-color: #57a8d5;
}

.messenger-dialog-search span,
.messenger-message-search span {
    color: #8696a6;
    font-size: 22px;
}

.messenger-dialog-search input,
.messenger-message-search input {
    background: transparent;
    border: 0;
    min-height: 38px;
    outline: 0;
    padding: 7px 0;
}

.messenger-dialog-list {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.messenger-dialog {
    align-items: center;
    color: #17212b;
    display: grid;
    gap: 11px;
    grid-template-columns: 48px minmax(0, 1fr);
    min-height: 70px;
    padding: 8px 10px;
}

.messenger-dialog:hover {
    background: #f2f5f7;
}

.messenger-dialog.active {
    background: #419fd9;
    color: #ffffff;
}

.messenger-dialog[hidden] {
    display: none;
}

.messenger-dialog.is-disabled {
    filter: grayscale(1);
    opacity: 0.52;
}

.dialog-avatar-wrap {
    display: inline-flex;
    position: relative;
}

.pending-clock {
    align-items: center;
    background: #ffffff;
    border: 2px solid #419fd9;
    border-radius: 50%;
    bottom: -2px;
    color: #419fd9;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    height: 20px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: -4px;
    width: 20px;
    z-index: 3;
}

.messenger-dialog.active .pending-clock {
    border-color: #ffffff;
}

.chat-avatar {
    align-items: center;
    background: #4b9fc8;
    border-radius: 50%;
    color: #ffffff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 15px;
    font-weight: 700;
    height: 48px;
    justify-content: center;
    line-height: 1;
    overflow: hidden;
    position: relative;
    width: 48px;
}

.chat-avatar > span {
    position: relative;
    z-index: 0;
}

.chat-avatar img {
    height: 100%;
    inset: 0;
    object-fit: cover;
    position: absolute;
    width: 100%;
    z-index: 1;
}

.chat-avatar.small {
    height: 42px;
    width: 42px;
}

.chat-avatar.large {
    font-size: 24px;
    height: 76px;
    width: 76px;
}

.messenger-dialog.active .chat-avatar {
    background: rgba(255, 255, 255, 0.24);
}

.messenger-dialog-copy {
    min-width: 0;
}

.messenger-dialog-line {
    align-items: baseline;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    min-width: 0;
}

.messenger-dialog-line strong {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.messenger-dialog-line time {
    color: #8b98a5;
    flex: 0 0 auto;
    font-size: 10px;
}

.messenger-dialog.active .messenger-dialog-line time,
.messenger-dialog.active .preview {
    color: rgba(255, 255, 255, 0.82);
}

.messenger-dialog-line.preview {
    color: #758391;
    font-size: 12px;
    margin-top: 5px;
}

.messenger-dialog-line.preview > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dialog-counter {
    align-items: center;
    background: #55b76c;
    border-radius: 999px;
    color: #ffffff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 10px;
    height: 20px;
    justify-content: center;
    min-width: 20px;
    padding: 0 6px;
}

.messenger-dialog.active .dialog-counter {
    background: #ffffff;
    color: #419fd9;
}

.app-toast {
    background: #17212b;
    border-radius: 6px;
    bottom: 22px;
    color: #ffffff;
    max-width: min(420px, calc(100vw - 28px));
    opacity: 0;
    padding: 12px 16px;
    pointer-events: none;
    position: fixed;
    right: 22px;
    transform: translateY(12px);
    transition: opacity 160ms ease, transform 160ms ease;
    z-index: 1000;
}

.app-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.app-confirm-modal {
    align-items: center;
    background: rgba(23, 33, 43, 0.34);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 18px;
    position: fixed;
    z-index: 1200;
}

.app-confirm-dialog {
    background: #ffffff;
    border: 1px solid #d7e0e8;
    border-radius: 8px;
    box-shadow: 0 18px 60px rgba(23, 33, 43, 0.22);
    max-width: 460px;
    padding: 22px;
    position: relative;
    width: min(100%, 460px);
}

.app-confirm-dialog h2 {
    color: #17212b;
    font-size: 22px;
    line-height: 1.2;
    margin: 0 36px 10px 0;
}

.app-confirm-dialog p {
    color: #526170;
    font-size: 16px;
    line-height: 1.45;
    margin: 0;
}

.app-confirm-close {
    align-items: center;
    background: #f2f6fa;
    border: 1px solid #dce6ef;
    border-radius: 999px;
    color: #708191;
    cursor: pointer;
    display: inline-flex;
    font-size: 22px;
    height: 32px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 16px;
    top: 16px;
    width: 32px;
}

.app-confirm-close:hover {
    border-color: #b8cad8;
    color: #17212b;
}

.app-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
}

.app-confirm-primary,
.app-confirm-secondary {
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    min-height: 42px;
    padding: 0 16px;
}

.app-confirm-primary {
    background: #0f6f8e;
    border: 1px solid #0f6f8e;
    color: #ffffff;
}

.app-confirm-primary:hover {
    background: #0b607c;
    border-color: #0b607c;
}

.app-confirm-secondary {
    background: #ffffff;
    border: 1px solid #cbd8e3;
    color: #526170;
}

.app-confirm-secondary:hover {
    border-color: #419fd9;
    color: #0f6f8e;
}

.messenger-chat {
    background: #a9c997;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.messenger-chat.is-empty {
    display: block;
}

.messenger-empty {
    align-items: center;
    display: flex;
    height: 100%;
    justify-content: center;
}

.messenger-empty span {
    background: rgba(36, 54, 68, 0.58);
    border-radius: 999px;
    color: #ffffff;
    font-size: 13px;
    padding: 6px 12px;
}

.messenger-chat-header {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #dfe4ea;
    display: flex;
    gap: 11px;
    min-height: 68px;
    padding: 8px 13px;
    z-index: 3;
}

.messenger-chat-identity {
    min-width: 0;
}

.messenger-chat-profile-link {
    align-items: center;
    color: inherit;
    display: flex;
    gap: 11px;
    min-width: 0;
}

.messenger-chat-identity strong,
.messenger-chat-identity span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.messenger-chat-identity strong {
    color: #17212b;
    font-size: 15px;
}

.messenger-chat-identity span {
    color: #7c8b98;
    font-size: 12px;
    margin-top: 3px;
}

.messenger-chat-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.messenger-chat-actions a,
.messenger-mobile-back {
    align-items: center;
    border-radius: 50%;
    color: #7f8d99;
    display: inline-flex;
    font-size: 19px;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.messenger-chat-actions .settings-trigger {
    font-size: 30px;
    height: 46px;
    width: 46px;
}

.messenger-chat-actions .settings-back {
    font-size: 28px;
    height: 44px;
    width: 44px;
}

.messenger-chat-actions a:hover,
.messenger-chat-actions a.active,
.messenger-mobile-back:hover {
    background: #eef3f6;
    color: #2688c5;
}

.messenger-mobile-back {
    display: none;
    font-size: 29px;
}

.messenger-message-search {
    background: #ffffff;
    border-color: #dfe4ea;
    margin: 8px 12px;
    min-height: 40px;
}

.messenger-message-search a {
    color: #7f8d99;
    font-size: 22px;
}

.messenger-feed-wrap {
    background-color: #b9d39f;
    background-image:
        radial-gradient(circle at 18px 18px, rgba(75, 111, 63, 0.13) 0 1px, transparent 1px),
        radial-gradient(circle at 58px 46px, rgba(75, 111, 63, 0.11) 0 1.5px, transparent 1.5px);
    background-size: 76px 76px, 92px 92px;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.messenger-feed-wrap .conversation-feed {
    background: transparent;
    gap: 5px;
    justify-content: flex-end;
    min-height: 100%;
    padding: 16px clamp(12px, 4vw, 54px);
}

.messenger-feed-wrap .timeline-loader {
    background: transparent;
    min-height: 44px;
    padding: 8px;
}

.messenger-feed-wrap .timeline-loader button {
    background: rgba(255, 255, 255, 0.88);
    border-color: transparent;
    border-radius: 999px;
    color: #55707f;
    min-height: 30px;
    padding: 5px 11px;
}

.telegram-feed .message {
    max-width: min(76%, 720px);
    padding: 7px 9px 5px;
}

.telegram-feed .message.direction-owner {
    background: #dcf8c6;
}

.telegram-feed .message.direction-bot {
    background: #dff1fb;
    box-shadow: inset 3px 0 0 #57a8d5, 0 1px 1px rgba(15, 23, 42, 0.15);
}

.message-sender {
    color: #3489b8;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 3px;
}

.message-footer {
    align-items: center;
    color: #78909c;
    display: flex;
    flex-wrap: wrap;
    font-size: 10px;
    gap: 3px 5px;
    justify-content: flex-end;
    line-height: 1.2;
    margin-top: 3px;
    min-height: 13px;
}

.message-footer time {
    margin-left: auto;
    white-space: nowrap;
}

.message-footer .badge {
    font-size: 10px;
    padding: 2px 6px;
}

.message-forwarded {
    color: #2b8cc4;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 3px;
}

.message-footer .inline-status-popover {
    margin-left: 0;
}

.message.direction-owner .inline-status-tip,
.message.direction-bot .inline-status-tip {
    left: auto;
    right: 0;
}

.message-checks {
    color: #43a047;
    flex: 0 0 auto;
    display: inline-block;
    font-size: 0;
    height: 13px;
    line-height: 1;
    margin-left: 1px;
    position: relative;
    vertical-align: -2px;
    white-space: nowrap;
    width: 17px;
}

.message-checks::before,
.message-checks::after {
    border-color: currentColor;
    border-style: solid;
    border-width: 0 2px 2px 0;
    content: "";
    height: 9px;
    position: absolute;
    top: 0;
    transform: rotate(45deg);
    width: 4px;
}

.message-checks::before {
    left: 2px;
}

.message-checks::after {
    left: 8px;
}

.telegram-feed .media-meta {
    display: none;
}

.media-document {
    align-items: center;
    background: rgba(255, 255, 255, 0.58);
    border-radius: 7px;
    color: #1f2937;
    display: flex;
    gap: 9px;
    min-width: min(300px, 100%);
    padding: 9px;
}

.media-document:hover {
    background: rgba(255, 255, 255, 0.8);
}

.media-document-icon {
    align-items: center;
    background: #419fd9;
    border-radius: 50%;
    color: #ffffff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 19px;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.media-document strong,
.media-document small {
    display: block;
    overflow-wrap: anywhere;
}

.media-document strong {
    font-size: 13px;
}

.media-document small {
    color: #71808e;
    font-size: 11px;
    margin-top: 2px;
}

.messenger-chat.is-loading {
    position: relative;
}

.messenger-chat.is-loading::after {
    background: rgba(255, 255, 255, 0.58);
    content: "";
    inset: 68px 0 0;
    pointer-events: none;
    position: absolute;
    z-index: 6;
}

.messenger-composer {
    align-items: flex-end;
    background: #f7f9fa;
    border-top: 1px solid #dfe4ea;
    display: grid;
    gap: 9px;
    grid-template-columns: minmax(0, 1fr) 42px;
    padding: 9px 12px;
}

.messenger-composer.has-draft {
    grid-template-columns: minmax(0, 1fr) 42px 42px;
}

.messenger-composer textarea {
    background: #ffffff;
    border: 1px solid #dce2e8;
    border-radius: 8px;
    line-height: 1.4;
    max-height: 132px;
    min-height: 42px;
    overflow-y: auto;
    padding: 10px 12px;
    resize: none;
}

.messenger-composer button {
    border-radius: 50%;
    font-size: 20px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    width: 42px;
}

.messenger-composer .draft-button {
    background: #e8f3f8;
    color: var(--brand);
}

.form-inline-error {
    color: var(--bad);
    font-size: 12px;
    grid-column: 1 / -1;
    padding: 2px 4px 0;
}

.form-inline-notice {
    color: var(--ok);
    font-size: 12px;
    grid-column: 1 / -1;
    padding: 2px 4px 0;
}

.mtproto-accounts-panel {
    margin-top: 18px;
}

.mtproto-account-form {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 12px 0 18px;
    padding: 14px;
}

.mtproto-account-list {
    display: grid;
    gap: 12px;
}

.mtproto-account {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    padding: 14px;
}

.mtproto-account > div:first-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mtproto-account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mtproto-account-actions form {
    align-items: center;
    display: flex;
    gap: 8px;
}

.mtproto-account-actions input {
    min-width: 150px;
}

button.mtproto-submit-loading {
    color: transparent !important;
    position: relative;
}

button.mtproto-submit-loading::after {
    animation: mtproto-submit-spin 0.8s linear infinite;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    border-top-color: #ffffff;
    content: "";
    height: 16px;
    left: 50%;
    margin: -8px 0 0 -8px;
    position: absolute;
    top: 50%;
    width: 16px;
}

button.secondary.mtproto-submit-loading::after {
    border-color: rgba(25, 112, 143, 0.25);
    border-top-color: var(--brand);
}

@keyframes mtproto-submit-spin {
    to {
        transform: rotate(360deg);
    }
}

.button.secondary.danger,
button.secondary.danger {
    color: var(--bad);
}

.messenger-composer-unavailable {
    background: #f7f9fa;
    border-top: 1px solid #dfe4ea;
    color: #7a8794;
    font-size: 13px;
    padding: 14px;
    text-align: center;
}

.messenger-settings-scroll {
    background: #f2f4f7;
    grid-row: 2 / -1;
    min-height: 0;
    overflow-y: auto;
}

.messenger-profile {
    background: #ffffff;
    border-bottom: 1px solid #dfe4ea;
    padding: 26px 20px 20px;
    text-align: center;
}

.messenger-profile h2 {
    margin: 12px 0 4px;
}

.messenger-profile div {
    color: #7c8b98;
    font-size: 13px;
}

.messenger-settings-form {
    background: #ffffff;
    margin: 12px auto;
    max-width: 720px;
    padding: 20px;
}

.messenger-settings-section + .messenger-settings-section {
    border-top: 1px solid #dfe4ea;
    margin-top: 22px;
    padding-top: 22px;
}

.messenger-settings-section h3 {
    color: #2688c5;
    font-size: 14px;
    margin: 0 0 12px;
}

.webhook-shell {
    background: #ffffff;
    border: 1px solid #d9e0e7;
    border-radius: 8px;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    height: calc(100vh - 52px);
    min-height: 640px;
    overflow: hidden;
}

.tasks-shell {
    background: #ffffff;
    border: 1px solid #d9e0e7;
    border-radius: 8px;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    height: calc(100vh - 52px);
    min-height: 640px;
    overflow: hidden;
}

.webhook-sidebar {
    background: #ffffff;
    border-right: 1px solid #dfe4ea;
    min-width: 0;
}

.webhook-sidebar-header {
    align-items: center;
    border-bottom: 1px solid #dfe4ea;
    display: flex;
    gap: 12px;
    min-height: 68px;
    padding: 10px 14px;
}

.webhook-sidebar-header strong,
.webhook-sidebar-header span {
    display: block;
}

.webhook-sidebar-header strong {
    color: #17212b;
    font-size: 15px;
}

.webhook-sidebar-header span {
    color: #7c8b98;
    font-size: 12px;
    margin-top: 3px;
}

.webhook-list {
    padding: 8px 0;
}

.webhook-list a {
    color: #17212b;
    display: block;
    padding: 12px 16px;
}

.webhook-list a.active,
.webhook-list a:hover {
    background: #419fd9;
    color: #ffffff;
}

.webhook-list span,
.webhook-list small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.webhook-list span {
    font-weight: 700;
}

.webhook-list small {
    color: #7d8b99;
    font-size: 12px;
    margin-top: 4px;
}

.webhook-list a.active small,
.webhook-list a:hover small {
    color: rgba(255, 255, 255, 0.82);
}

.webhook-chat {
    background: #a9c997;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-width: 0;
}

.webhook-feed {
    background-color: #b9d39f;
    background-image:
        radial-gradient(circle at 18px 18px, rgba(75, 111, 63, 0.13) 0 1px, transparent 1px),
        radial-gradient(circle at 58px 46px, rgba(75, 111, 63, 0.11) 0 1.5px, transparent 1.5px);
    background-size: 76px 76px, 92px 92px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 0;
    overflow-y: auto;
    padding: 18px clamp(12px, 4vw, 54px);
}

.webhook-bubble {
    overflow-wrap: anywhere;
}

.webhook-form label {
    margin-top: 10px;
}

.webhook-form .check {
    font-weight: 600;
}

.webhook-code {
    max-width: min(86%, 860px);
}

.webhook-code pre {
    background: rgba(255, 255, 255, 0.58);
    border-radius: 7px;
    font-size: 12px;
    line-height: 1.45;
    margin: 8px 0 0;
    max-height: 360px;
    overflow: auto;
    padding: 10px;
    white-space: pre-wrap;
}

.webhook-builder {
    display: grid;
    gap: 16px;
}

.webhook-builder-head {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.webhook-builder-head .check {
    margin: 0;
}

.webhook-builder-actions {
    display: flex;
    gap: 10px;
}

.webhook-options-grid {
    margin-top: 0;
}

.webhook-table-head,
.webhook-row {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(260px, 1fr) minmax(320px, 0.95fr) 44px;
}

.webhook-table-head {
    color: #708191;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.webhook-row {
    align-items: start;
}

.webhook-row input[type="url"] {
    margin: 0;
    min-height: 48px;
}

.webhook-event-picker {
    position: relative;
}

.webhook-event-picker summary {
    align-items: center;
    background: #ffffff;
    border: 1px solid #cbd6e2;
    border-radius: 8px;
    color: #17212b;
    cursor: pointer;
    display: flex;
    font-weight: 700;
    justify-content: space-between;
    list-style: none;
    min-height: 48px;
    padding: 10px 14px;
}

.webhook-event-picker summary::-webkit-details-marker {
    display: none;
}

.webhook-event-picker summary::after {
    border: solid #708191;
    border-width: 0 2px 2px 0;
    content: "";
    height: 8px;
    margin-left: 12px;
    transform: rotate(45deg);
    width: 8px;
}

.webhook-event-picker[open] summary::after {
    transform: translateY(4px) rotate(225deg);
}

.webhook-event-list {
    background: #ffffff;
    border: 1px solid #cbd6e2;
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
    display: grid;
    gap: 4px;
    left: 0;
    margin-top: 6px;
    max-height: 380px;
    overflow: auto;
    padding: 8px;
    position: absolute;
    right: 0;
    z-index: 12;
}

.webhook-event-option {
    border-radius: 8px;
    display: grid;
    gap: 2px 10px;
    grid-template-columns: 24px minmax(0, 1fr);
    padding: 8px;
}

.webhook-event-option:hover {
    background: #f3f8fc;
}

.webhook-event-option input {
    grid-row: 1 / span 2;
    margin-top: 2px;
}

.webhook-event-label {
    color: #17212b;
    font-weight: 700;
}

.webhook-event-option small {
    color: #708191;
    font-size: 12px;
    line-height: 1.35;
}

.webhook-event-all {
    background: #f6f9fb;
    margin-bottom: 4px;
}

.webhook-rows {
    display: grid;
    gap: 12px;
}

.webhook-remove {
    align-items: center;
    background: #fff0f0;
    border: 0;
    border-radius: 8px;
    color: #bb1f1a;
    cursor: pointer;
    display: inline-flex;
    height: 44px;
    justify-content: center;
    margin: 2px 0 0;
    padding: 0;
    width: 44px;
}

.webhook-remove:hover {
    background: #ffe2e2;
}

.webhook-remove svg {
    fill: currentColor;
    height: 22px;
    width: 22px;
}

.webhook-add {
    justify-self: start;
}

.webhook-event-help-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    margin-top: 12px;
}

.webhook-event-help-grid article {
    background: #f6f9fb;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    padding: 12px;
}

.webhook-event-help-grid strong,
.webhook-event-help-grid code,
.webhook-event-help-grid p {
    display: block;
}

.webhook-event-help-grid strong {
    color: #17212b;
}

.webhook-event-help-grid code {
    color: #2688c5;
    margin-top: 4px;
}

.webhook-event-help-grid p {
    color: #526170;
    line-height: 1.45;
    margin: 8px 0 0;
}

.webhook-bubble details {
    background: rgba(255, 255, 255, 0.45);
    border-radius: 7px;
    margin-top: 8px;
    padding: 8px 10px;
}

.webhook-bubble summary {
    color: #17212b;
    cursor: pointer;
    font-weight: 700;
}

.webhook-bubble p {
    margin: 8px 0 0;
}

.task-bubble p {
    margin: 7px 0 0;
}

.task-from {
    color: #607583;
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
}

.task-meta {
    color: #607583;
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    gap: 5px 10px;
    margin-top: 8px;
}

.task-status-form {
    align-items: center;
    display: flex;
    gap: 7px;
    margin-top: 10px;
}

.task-status-form select {
    max-width: 160px;
}

.task-status-form button {
    min-height: 34px;
    padding: 6px 10px;
}

.pattern-bubble p {
    margin: 7px 0 0;
}

.pattern-block {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 7px;
    color: #17212b;
    margin-top: 8px;
    padding: 8px 10px;
}

.pattern-block span {
    color: #2688c5;
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 3px;
}

.pattern-example {
    background: rgba(255, 255, 255, 0.45);
    border-radius: 7px;
    margin-top: 8px;
    padding: 8px 10px;
}

.pattern-example summary {
    cursor: pointer;
    font-weight: 700;
}

.pattern-example div {
    margin-top: 6px;
}

.pattern-refresh-form {
    margin-top: 12px;
}

.patterns-shell .webhook-chat {
    min-height: 0;
    overflow: hidden;
}

.patterns-shell .webhook-feed {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.patterns-shell .telegram-feed .message,
.patterns-shell .webhook-feed .message {
    max-width: min(88%, 1080px);
}

.training-shell {
    background: #ffffff;
    border: 1px solid #d9e0e7;
    border-radius: 8px;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    height: calc(100vh - 52px);
    min-height: 680px;
    overflow: hidden;
}

.tasks-training-shell {
    grid-template-columns: minmax(0, 1fr);
}

.webhook-plain-shell {
    grid-template-columns: minmax(0, 1fr);
}

.logs-training-shell {
    grid-template-columns: 300px minmax(0, 1fr);
}

.training-sidebar {
    background: #ffffff;
    border-right: 1px solid #dfe4ea;
    min-width: 0;
}

.training-sidebar-header {
    align-items: center;
    border-bottom: 1px solid #dfe4ea;
    display: flex;
    gap: 12px;
    min-height: 72px;
    padding: 12px 16px;
}

.training-sidebar-header strong,
.training-sidebar-header span {
    display: block;
}

.training-sidebar-header strong {
    color: #17212b;
    font-size: 17px;
}

.training-sidebar-header span {
    color: #7c8b98;
    font-size: 12px;
    margin-top: 3px;
}

.training-list {
    padding: 8px;
}

.training-list a,
.training-pattern-item {
    border-radius: 10px;
    color: #17212b;
    display: block;
    padding: 12px 14px;
}

.training-list a.active,
.training-list a:hover,
.training-pattern-item.active,
.training-pattern-item:hover {
    background: #419fd9;
    color: #ffffff;
}

.training-list span,
.training-list small,
.training-pattern-item strong,
.training-pattern-item span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.training-list span,
.training-pattern-item strong {
    font-weight: 700;
}

.training-list small,
.training-pattern-item span {
    color: #7d8b99;
    font-size: 12px;
    margin-top: 4px;
}

.training-list a.active small,
.training-list a:hover small,
.training-pattern-item.active span,
.training-pattern-item:hover span {
    color: rgba(255, 255, 255, 0.82);
}

.training-workspace {
    background: #f6f9fb;
    min-width: 0;
    overflow: auto;
    padding: 22px;
}

.training-header {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin: 0 auto 16px;
    max-width: 1120px;
}

.training-header h1 {
    font-size: 25px;
}

.training-header p,
.training-pattern-editor header p {
    color: #708191;
    margin-top: 4px;
}

.training-card {
    background: #ffffff;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    margin: 0 auto;
    max-width: 1120px;
    padding: 18px;
}

.training-stack {
    display: grid;
    gap: 14px;
    margin: 0 auto;
    max-width: 1120px;
}

.training-stack > .training-card {
    margin: 0;
    max-width: none;
}

.training-card > p {
    color: #526170;
    line-height: 1.5;
    margin: 8px 0 0;
}

.log-sidebar-metrics {
    border-top: 1px solid #dfe4ea;
    display: grid;
    gap: 8px;
    padding: 12px 16px;
}

.log-sidebar-metrics div {
    align-items: center;
    background: #f6f9fb;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
}

.log-sidebar-metrics span {
    color: #708191;
    font-size: 12px;
}

.log-sidebar-metrics strong {
    color: #17212b;
    font-size: 18px;
}

.log-event-list {
    display: grid;
    gap: 12px;
    margin: 0 auto;
    max-width: 1120px;
}

.log-event-card {
    display: grid;
    gap: 12px;
    margin: 0;
    max-width: none;
}

.log-event-card.is-error {
    border-color: #f2c2c2;
}

.log-event-card.is-neutral {
    border-color: #dce3ea;
}

.log-event-main {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.log-event-title {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.log-event-title strong {
    color: #17212b;
    font-size: 16px;
}

.log-event-meta,
.log-message-meta {
    color: #708191;
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    gap: 8px;
    margin-top: 5px;
}

.log-event-meta a {
    color: #1877b8;
}

.log-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.log-error-text,
.log-info-text,
.log-ok-text {
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
    padding: 10px 12px;
}

.log-error-text {
    background: #fff2f2;
    color: #9f1d1d;
}

.log-ok-text {
    background: #eef9f1;
    color: #287a3e;
}

.log-info-text {
    background: #eef5fb;
    color: #245477;
}

.trace-card {
    display: grid;
    gap: 12px;
    margin: 0;
    max-width: none;
}

.trace-card.error {
    border-color: #f2c2c2;
}

.trace-card header {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.trace-card header strong,
.trace-card header span {
    display: block;
}

.trace-card header strong {
    color: #17212b;
    font-size: 16px;
}

.trace-card header span {
    color: #708191;
    font-size: 12px;
    margin-top: 4px;
}

.trace-card header em {
    background: #e8f7f2;
    border-radius: 999px;
    color: #158f68;
    flex: 0 0 auto;
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
    padding: 6px 9px;
}

.trace-card.error header em {
    background: #fff2f2;
    color: #9f1d1d;
}

.trace-step-list {
    display: grid;
    gap: 8px;
}

.trace-step {
    background: #f7fafc;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    overflow: hidden;
}

.trace-step[open] {
    background: #ffffff;
}

.trace-step summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    list-style: none;
    padding: 11px 12px;
}

.trace-step summary::-webkit-details-marker {
    display: none;
}

.trace-step summary span {
    color: #17212b;
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trace-step summary small {
    color: #708191;
    flex: 0 0 auto;
    font-size: 12px;
}

.trace-step p {
    color: #526170;
    line-height: 1.45;
    margin: 0;
    padding: 0 12px 10px;
}

.trace-step pre {
    background: #101820;
    border-radius: 0 0 8px 8px;
    color: #e8f1f8;
    font-size: 12px;
    line-height: 1.45;
    margin: 0;
    max-height: 360px;
    overflow: auto;
    padding: 12px;
    white-space: pre-wrap;
}

.trace-provenance {
    border-top: 1px solid #e3e9ee;
    margin-top: 2px;
}

.trace-provenance-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
}

.trace-provenance-stats span {
    background: #edf3f7;
    color: #526170;
    font-size: 12px;
    padding: 4px 7px;
}

.trace-usage-summary {
    align-items: baseline;
    background: #eef8f3;
    color: #286449;
    display: flex;
    flex-wrap: wrap;
    font-size: 13px;
    gap: 7px;
    padding: 10px 12px;
}

.trace-usage-summary strong {
    color: #1f563e;
}

.trace-provenance-list {
    border-top: 1px solid #e3e9ee;
}

.trace-provenance-item {
    padding: 12px;
}

.trace-provenance-item + .trace-provenance-item {
    border-top: 1px solid #e3e9ee;
}

.trace-card .trace-provenance-item > header {
    align-items: flex-start;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.trace-card .trace-provenance-item > header strong {
    font-size: 14px;
}

.trace-card .trace-provenance-item > header span {
    margin-top: 2px;
}

.trace-source-badges,
.trace-source-meta,
.trace-source-factors div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.trace-source-badges {
    justify-content: flex-end;
}

.trace-source-meta {
    color: #708191;
    font-size: 12px;
    margin-top: 7px;
}

.trace-source-meta span + span::before {
    content: "·";
    margin-right: 6px;
}

.trace-step .trace-provenance-item > p {
    color: #455463;
    padding: 8px 0 0;
}

.trace-provenance-item blockquote {
    background: #f1f6f9;
    border-left: 3px solid #6d91ad;
    color: #334353;
    line-height: 1.5;
    margin: 9px 0 0;
    padding: 9px 11px;
    white-space: pre-wrap;
}

.trace-step .trace-source-factors,
.trace-step .trace-raw {
    border-top: 1px solid #e3e9ee;
    margin-top: 10px;
}

.trace-step .trace-source-factors > summary,
.trace-step .trace-raw > summary {
    color: #245477;
    display: block;
    font-size: 12px;
    font-weight: 700;
    padding: 9px 0 0;
}

.trace-step .trace-raw > summary {
    padding: 10px 12px;
}

.trace-source-factors div {
    color: #708191;
    font-size: 12px;
    padding-top: 7px;
}

.trace-source-factors div span {
    background: #f1f4f6;
    padding: 4px 6px;
}

.eval-management {
    border-bottom: 1px solid #dce3ea;
    margin: 0 auto 16px;
    max-width: 1120px;
    padding-bottom: 14px;
}

.eval-management > header {
    align-items: baseline;
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.eval-management h2 {
    font-size: 18px;
    margin: 0;
}

.eval-management header span {
    color: #708191;
    font-size: 12px;
}

.eval-case-create,
.eval-case-editor {
    background: #ffffff;
    border: 1px solid #dce3ea;
    border-radius: 6px;
}

.eval-case-create > summary,
.eval-case-editor > summary {
    color: #245477;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    padding: 11px 12px;
}

.eval-case-editor > summary {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.eval-case-editor > summary strong,
.eval-case-editor > summary small {
    display: block;
}

.eval-case-editor > summary small {
    color: #708191;
    font-size: 12px;
    font-weight: 400;
    margin-top: 3px;
}

.eval-case-editor-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.eval-case-form {
    border-top: 1px solid #e5ebf0;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 12px;
}

.eval-case-form label {
    min-width: 0;
}

.eval-case-form select,
.eval-case-form textarea {
    margin-top: 5px;
    width: 100%;
}

.eval-case-form textarea {
    resize: vertical;
}

.eval-case-form label.is-disabled {
    opacity: 0.55;
}

.eval-case-form .eval-field-wide {
    grid-column: 1 / -1;
}

.eval-run-list {
    display: flex;
    gap: 8px;
    margin: 0 auto 14px;
    max-width: 1120px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.eval-run-list a {
    background: #ffffff;
    border: 1px solid #dce3ea;
    border-radius: 6px;
    color: #526170;
    flex: 0 0 auto;
    min-width: 150px;
    padding: 9px 11px;
    text-decoration: none;
}

.eval-run-list a.active {
    border-color: #1877b8;
    box-shadow: inset 0 0 0 1px #1877b8;
}

.eval-run-list strong,
.eval-run-list span {
    display: block;
}

.eval-run-list strong {
    color: #17212b;
    font-size: 13px;
}

.eval-run-list span {
    font-size: 12px;
    margin-top: 4px;
}

.eval-summary-strip {
    background: #f7fafc;
    border-bottom: 1px solid #dce3ea;
    border-top: 1px solid #dce3ea;
    display: grid;
    gap: 0;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin: 0 auto 14px;
    max-width: 1120px;
}

.eval-summary-strip div {
    border-right: 1px solid #dce3ea;
    min-width: 0;
    padding: 12px 14px;
}

.eval-summary-strip div:last-child {
    border-right: 0;
}

.eval-summary-strip span,
.eval-summary-strip strong {
    display: block;
}

.eval-summary-strip span {
    color: #708191;
    font-size: 12px;
}

.eval-summary-strip strong {
    color: #17212b;
    font-size: 20px;
    margin-top: 4px;
}

.eval-account-list {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    margin: 0 auto 14px;
    max-width: 1120px;
}

.eval-account-list div {
    background: #eef5fb;
    border-left: 3px solid #1877b8;
    min-width: 0;
    padding: 10px 12px;
}

.eval-account-list strong,
.eval-account-list span {
    display: block;
    overflow-wrap: anywhere;
}

.eval-account-list strong {
    color: #17212b;
    font-size: 14px;
}

.eval-account-list span {
    color: #526170;
    font-size: 12px;
    margin-top: 3px;
}

.eval-case-list {
    display: grid;
    gap: 12px;
    margin: 0 auto;
    max-width: 1120px;
}

.eval-case-card {
    display: grid;
    gap: 12px;
    margin: 0;
    max-width: none;
}

.eval-case-card.is-failed {
    border-color: #edc6a8;
}

.eval-case-card > header {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.eval-case-card > header strong,
.eval-case-card > header span {
    display: block;
}

.eval-case-card > header strong {
    color: #17212b;
    font-size: 16px;
}

.eval-case-card > header div > span {
    color: #708191;
    font-size: 12px;
    margin-top: 4px;
}

.badge.warn {
    background: #fff4e5;
    color: #9a5411;
}

.eval-incoming {
    border-left: 3px solid #6c7a86;
    padding: 2px 0 2px 12px;
}

.eval-incoming span,
.eval-comparison span {
    color: #708191;
    display: block;
    font-size: 12px;
    font-weight: 700;
}

.eval-incoming p,
.eval-comparison p {
    color: #263746;
    line-height: 1.5;
    margin: 5px 0 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.eval-comparison {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.eval-comparison section {
    background: #f7fafc;
    border: 1px solid #dce3ea;
    min-width: 0;
    padding: 11px 12px;
}

.eval-comparison section:first-child {
    border-left: 3px solid #158f68;
}

.eval-comparison section:last-child {
    border-left: 3px solid #1877b8;
}

.eval-case-card > footer {
    color: #526170;
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    gap: 7px 14px;
}

.eval-error-text {
    background: #fff2f2;
    color: #9f1d1d;
    line-height: 1.45;
    margin: 0;
    padding: 10px 12px;
}

.eval-reason {
    border-top: 1px solid #e5ebf0;
    color: #526170;
    padding-top: 10px;
}

.eval-reason summary {
    color: #245477;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.eval-reason p {
    line-height: 1.45;
    margin: 8px 0 0;
}

.trace-step-ok {
    border-color: #cae8d2;
}

.trace-step-error {
    border-color: #f2c2c2;
}

.log-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 auto 14px;
    max-width: 1120px;
}

.log-filter-pills a {
    align-items: center;
    background: #ffffff;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    color: #526170;
    display: inline-flex;
    font-size: 13px;
    font-weight: 700;
    gap: 8px;
    min-height: 36px;
    padding: 8px 12px;
}

.log-filter-pills a.active,
.log-filter-pills a:hover {
    background: #419fd9;
    border-color: #419fd9;
    color: #ffffff;
}

.log-filter-pills span {
    background: rgba(23, 33, 43, 0.08);
    border-radius: 999px;
    display: inline-flex;
    min-width: 24px;
    justify-content: center;
    padding: 2px 7px;
}

.log-filter-pills a.active span,
.log-filter-pills a:hover span {
    background: rgba(255, 255, 255, 0.22);
}

.log-message-box {
    background: #f6f9fb;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    padding: 12px;
}

.log-message-text {
    color: #17212b;
    font-size: 14px;
    line-height: 1.45;
    margin-top: 8px;
    white-space: pre-wrap;
}

.log-media-note {
    color: #9f1d1d;
    font-size: 13px;
    line-height: 1.4;
    margin-top: 8px;
}

.log-action-form {
    margin: 0;
}

.log-empty {
    color: #708191;
}

.task-bubble h2 {
    margin: 4px 0 0;
}

.task-board {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(260px, 1fr)) 48px;
    margin: 0 auto;
    max-width: 1180px;
    transition: grid-template-columns 180ms ease, max-width 180ms ease;
}

.task-board.is-archive-open {
    grid-template-columns: repeat(3, minmax(240px, 1fr));
    max-width: 1360px;
}

.task-board > input[type="hidden"] {
    display: none;
}

.task-board-empty {
    align-items: center;
    background: #ffffff;
    border: 1px dashed #c9d6e2;
    border-radius: 8px;
    color: #708191;
    display: flex;
    justify-content: center;
    min-height: 180px;
    padding: 24px;
}

.task-column {
    background: #eef3f7;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    min-height: 520px;
    min-width: 0;
    padding: 10px;
}

.task-column-inner {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.task-column header {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 4px 10px;
}

.task-column h2 {
    font-size: 17px;
    margin: 0;
}

.task-column header span {
    color: #708191;
    display: block;
    font-size: 12px;
    margin-top: 3px;
}

.task-column header strong {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d7e0e8;
    border-radius: 999px;
    color: #526170;
    display: inline-flex;
    font-size: 12px;
    height: 26px;
    justify-content: center;
    min-width: 28px;
    padding: 0 8px;
}

.task-column-actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.task-column-archive {
    background: #f7fafc;
    overflow: hidden;
    padding: 0;
    position: relative;
    transition: background 180ms ease, border-color 180ms ease, padding 180ms ease;
}

.task-board.is-archive-open .task-column-archive {
    background: #eef3f7;
    padding: 10px;
}

.task-board:not(.is-archive-open) .task-column-archive {
    align-self: flex-start;
    flex: 0 0 48px;
    height: 520px;
    min-height: 520px;
    min-width: 48px;
}

.task-board:not(.is-archive-open) .task-column-archive .task-column-inner {
    display: none;
    opacity: 0;
    pointer-events: none;
    transform: translateX(18px);
}

.task-column-archive .task-column-inner {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 160ms ease, transform 180ms ease;
}

.task-archive-tab {
    align-items: center;
    background: #ffffff;
    border: 0;
    color: #0f6f8e;
    cursor: pointer;
    display: flex;
    gap: 10px;
    inset: 0 auto auto 0;
    justify-content: flex-start;
    padding: 10px 0;
    position: absolute;
    height: 100%;
    width: 100%;
    writing-mode: vertical-rl;
    z-index: 2;
}

.task-archive-tab span {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0;
    transform: rotate(180deg);
}

.task-archive-tab strong {
    align-items: center;
    background: #e7f4fb;
    border-radius: 999px;
    color: #0f6f8e;
    display: inline-flex;
    font-size: 12px;
    height: 26px;
    justify-content: center;
    min-width: 26px;
    padding: 0 7px;
    transform: rotate(180deg);
}

.task-board.is-archive-open .task-archive-tab {
    opacity: 0;
    pointer-events: none;
}

.task-archive-hide {
    background: #ffffff;
    border: 1px solid #d7e0e8;
    border-radius: 6px;
    color: #526170;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    height: 28px;
    padding: 0 10px;
}

.task-archive-hide:hover {
    border-color: #419fd9;
    color: #0f6f8e;
}

.task-column-list {
    display: grid;
    gap: 8px;
    grid-auto-rows: max-content;
    min-height: 420px;
}

.task-column.is-drag-over {
    border-color: #419fd9;
    box-shadow: inset 0 0 0 1px #419fd9;
}

.task-card {
    background: #ffffff;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    cursor: grab;
    min-height: 98px;
    padding: 12px;
    position: relative;
    transition: border-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.task-card:hover {
    border-color: #b8cad8;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.task-card.is-dragging {
    cursor: grabbing;
    opacity: 0.55;
}

.task-card.is-saving {
    opacity: 0.7;
}

.task-card h3 {
    color: #17212b;
    font-size: 15px;
    line-height: 1.35;
    margin: 0;
}

.task-card-person {
    color: #708191;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    padding-right: 34px;
}

.task-card-description {
    color: #627384;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 10px;
    padding-right: 34px;
}

.task-card-description summary {
    color: #0f6f8e;
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

.task-card-description summary::-webkit-details-marker {
    display: none;
}

.task-card-description summary::after {
    content: " +";
    font-weight: 800;
}

.task-card-description[open] summary::after {
    content: " -";
}

.task-card-description p {
    color: #627384;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    margin: 6px 0 0;
    white-space: pre-wrap;
}

.task-archive-form {
    bottom: 8px;
    position: absolute;
    right: 8px;
}

.task-card[data-task-status="archived"] .task-archive-form {
    display: none;
}

.task-archive-form button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: #8a98a8;
    cursor: pointer;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    padding: 0;
    width: 30px;
}

.task-archive-form button:hover {
    background: #e8f4fb;
    color: #0f6f8e;
}

.task-archive-form svg {
    fill: currentColor;
    height: 18px;
    width: 18px;
}

.task-tidy-modal[hidden] {
    display: none;
}

.task-tidy-modal {
    align-items: center;
    bottom: 0;
    display: flex;
    justify-content: center;
    left: 0;
    padding: 24px;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 80;
}

.task-tidy-backdrop {
    background: rgba(23, 33, 43, 0.38);
    bottom: 0;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.task-tidy-dialog {
    background: #ffffff;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
    max-height: calc(100vh - 48px);
    max-width: 560px;
    overflow: auto;
    padding: 0;
    position: relative;
    width: min(100%, 560px);
    z-index: 1;
}

.task-tidy-dialog header {
    align-items: flex-start;
    border-bottom: 1px solid #dfe4ea;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 18px;
}

.task-tidy-dialog h2 {
    font-size: 20px;
    margin: 0;
}

.task-tidy-dialog header p {
    color: #708191;
    margin-top: 4px;
}

.task-tidy-close {
    align-items: center;
    background: #f2f6f9;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    color: #526170;
    cursor: pointer;
    display: inline-flex;
    font-size: 18px;
    height: 34px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 34px;
}

.task-tidy-close:hover {
    background: #e8f2fa;
    color: #17212b;
}

.task-tidy-options {
    display: grid;
    gap: 4px;
    padding: 18px;
}

.task-tidy-options .setting-caption {
    margin-bottom: 10px;
}

.task-tidy-runner {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.task-tidy-options[hidden],
.task-tidy-runner[hidden],
.task-tidy-finish[hidden],
.task-tidy-dialog .actions[hidden] {
    display: none;
}

.task-tidy-progress {
    background: #f4f8fb;
    border: 1px solid #dce8f2;
    border-radius: 8px;
    padding: 14px;
}

.task-tidy-progress-head {
    align-items: center;
    color: #526170;
    display: flex;
    font-size: 14px;
    justify-content: space-between;
    margin-bottom: 10px;
}

.task-tidy-progress-head strong {
    color: #17212b;
    font-size: 18px;
}

.task-tidy-progress-bar {
    background: #dbe7ef;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}

.task-tidy-progress-bar span {
    background: linear-gradient(90deg, #1f8bb7, #42a5d8);
    border-radius: inherit;
    display: block;
    height: 100%;
    transition: width 0.28s ease;
    width: 0;
}

.task-tidy-stage {
    background: #eaf5fc;
    border: 1px solid #cde6f6;
    border-radius: 8px;
    color: #0f5f7d;
    font-size: 15px;
    line-height: 1.45;
    padding: 12px 14px;
}

.task-tidy-compare {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-tidy-compare section {
    background: #ffffff;
    border: 1px solid #dfe6ed;
    border-radius: 8px;
    min-height: 148px;
    padding: 14px;
    transition: background 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

.task-tidy-compare section.is-lit {
    background: #f0f9f4;
    border-color: #9ed9b2;
    box-shadow: 0 0 0 3px rgba(46, 160, 88, 0.12);
}

.task-tidy-compare span {
    color: #728294;
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.task-tidy-compare h3 {
    font-size: 16px;
    line-height: 1.35;
    margin: 0 0 8px;
}

.task-tidy-compare p {
    color: #627284;
    font-size: 14px;
    line-height: 1.45;
    margin: 0;
    white-space: pre-wrap;
}

.task-tidy-edit-title,
.task-tidy-edit-details {
    background: #f8fbfd;
    border: 1px solid #d7e2ea;
    border-radius: 8px;
    color: #17212b;
    display: block;
    font: inherit;
    line-height: 1.4;
    padding: 10px 11px;
    resize: vertical;
    width: 100%;
}

.task-tidy-edit-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

.task-tidy-edit-details {
    color: #435466;
    min-height: 112px;
}

.task-tidy-edit-title:focus,
.task-tidy-edit-details:focus {
    background: #ffffff;
    border-color: #42a5d8;
    box-shadow: 0 0 0 3px rgba(66, 165, 216, 0.14);
    outline: 0;
}

.task-tidy-step-actions {
    gap: 10px;
}

.task-tidy-log {
    background: #17212b;
    border-radius: 8px;
    color: #d7e2ea;
    display: grid;
    font-size: 14px;
    gap: 8px;
    line-height: 1.45;
    max-height: 168px;
    overflow: auto;
    padding: 12px;
}

.task-tidy-log div {
    border-left: 3px solid #5f7180;
    padding-left: 9px;
}

.task-tidy-log .is-info {
    border-color: #42a5d8;
}

.task-tidy-log .is-success {
    border-color: #59b879;
    color: #e8fff0;
}

.task-tidy-log .is-error {
    border-color: #e26161;
    color: #ffdede;
}

.task-tidy-dialog .actions {
    border-top: 1px solid #dfe4ea;
    margin: 0;
    padding: 14px 18px 18px;
}

.task-tidy-dialog.is-running .task-tidy-close {
    cursor: default;
    opacity: 0.45;
}

.task-tidy-finish {
    border: 0;
    padding: 0;
}

body.has-task-tidy-modal {
    overflow: hidden;
}

.training-form textarea {
    min-height: 140px;
}

.training-inline-form {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.check.compact {
    margin: 0;
}

.training-pattern-layout {
    display: grid;
    gap: 16px;
    grid-template-columns: 300px minmax(0, 1fr);
    margin: 0 auto;
    max-width: 1120px;
}

.training-pattern-list {
    background: #ffffff;
    border: 1px solid #dce3ea;
    border-radius: 8px;
    max-height: calc(100vh - 184px);
    overflow: auto;
    padding: 8px;
}

.training-pattern-editor {
    margin: 0;
    max-width: none;
}

.training-pattern-editor header {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.training-pattern-editor .pattern-example {
    background: #f7fbff;
    border: 1px solid #dcebf5;
    margin-top: 12px;
}

.training-knowledge-layout {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(320px, 0.9fr) minmax(380px, 1.1fr);
    margin: 0 auto;
    max-width: 1120px;
}

.training-knowledge-layout > .training-card {
    align-self: start;
    margin: 0;
    max-width: none;
}

.training-knowledge-sources {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.training-knowledge-sources .training-card {
    margin: 0;
    max-width: none;
}

.training-test-layout {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(320px, 0.9fr) minmax(380px, 1.1fr);
    margin: 0 auto;
    max-width: 1120px;
}

.training-test-layout > .training-card {
    align-self: start;
    margin: 0;
    max-width: none;
}

.training-test-result > header {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.training-test-result h2 {
    font-size: 18px;
}

.training-test-result header p {
    color: #708191;
    margin-top: 4px;
}

.training-test-answer {
    background: #e8f7dc;
    border: 1px solid #cbe7bb;
    border-radius: 8px;
    color: #17212b;
    font-size: 16px;
    line-height: 1.5;
    min-height: 96px;
    padding: 16px;
    white-space: normal;
}

.training-test-details {
    background: #f7fbff;
    border: 1px solid #dcebf5;
    margin-top: 14px;
}

.training-test-details p {
    color: #526170;
    margin-top: 8px;
}

.training-test-empty {
    align-items: center;
    color: #708191;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
    min-height: 260px;
    text-align: center;
}

.training-test-empty strong {
    color: #17212b;
}

.knowledge-source-card header {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.knowledge-source-card h2 {
    font-size: 17px;
}

.knowledge-source-card header p,
.knowledge-source-card > p {
    color: #708191;
    margin-top: 4px;
}

.memory-review-list,
.memory-history-list {
    display: grid;
    gap: 12px;
    margin: 0 auto;
    max-width: 1120px;
}

.memory-review-card,
.memory-history-item {
    margin: 0;
    max-width: none;
}

.memory-review-card > header,
.memory-history-item > header,
.memory-history > header {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.memory-review-card h2,
.memory-history > header h2 {
    font-size: 18px;
}

.memory-review-card header p,
.memory-history > header p,
.memory-history-item header span {
    color: #708191;
    margin-top: 4px;
}

.memory-comparison {
    border-bottom: 1px solid #dfe4ea;
    border-top: 1px solid #dfe4ea;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 14px 0;
}

.memory-comparison section {
    min-width: 0;
    padding: 14px;
}

.memory-comparison section:first-child {
    background: #f7fafc;
    border-right: 1px solid #dfe4ea;
}

.memory-comparison section:last-child {
    background: #f1f8ee;
}

.memory-comparison span {
    color: #708191;
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.memory-comparison p,
.memory-history-item > p {
    color: #334353;
    line-height: 1.5;
    white-space: pre-wrap;
}

.pattern-revision-comparison {
    margin-bottom: 10px;
}

.pattern-revision-reason {
    background: #f7fafc;
    border-left: 3px solid #4f708d;
    color: #334353;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.pattern-revision-reason strong {
    display: block;
    font-size: 13px;
    margin-bottom: 5px;
}

.pattern-revision-reason p {
    line-height: 1.5;
    white-space: pre-wrap;
}

.memory-history {
    margin: 26px auto 0;
    max-width: 1120px;
}

.memory-history > header {
    margin-bottom: 10px;
}

@media (max-width: 900px) {
    .training-shell {
        border: 0;
        border-radius: 0;
        display: block;
        height: auto;
        min-height: 0;
    }

    .training-sidebar {
        border-right: 0;
        border-bottom: 1px solid #dfe4ea;
    }

    .training-list {
        display: flex;
        gap: 6px;
        overflow-x: auto;
    }

    .training-list a {
        flex: 0 0 auto;
        min-width: 180px;
    }

    .training-workspace {
        padding: 14px;
    }

    .training-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .log-event-main {
        flex-direction: column;
    }

    .log-action-form,
    .log-action-form button {
        width: 100%;
    }

    .log-card-actions {
        justify-content: stretch;
        width: 100%;
    }

    .trace-card .trace-provenance-item > header,
    .trace-step > summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .trace-source-badges {
        justify-content: flex-start;
    }

    .trace-step > summary small {
        white-space: normal;
    }

    .eval-summary-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .eval-summary-strip div {
        border-bottom: 1px solid #dce3ea;
    }

    .eval-case-form {
        grid-template-columns: 1fr;
    }

    .eval-case-form .eval-field-wide {
        grid-column: auto;
    }

    .eval-case-editor > summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .eval-comparison {
        grid-template-columns: 1fr;
    }

    .eval-case-card > header {
        align-items: flex-start;
        flex-direction: column;
    }

    .training-pattern-layout {
        grid-template-columns: 1fr;
    }

    .training-knowledge-layout {
        grid-template-columns: 1fr;
    }

    .training-test-layout {
        grid-template-columns: 1fr;
    }

    .memory-review-card > header,
    .memory-history-item > header,
    .memory-history > header {
        flex-direction: column;
    }

    .memory-comparison {
        grid-template-columns: 1fr;
    }

    .memory-comparison section:first-child {
        border-bottom: 1px solid #dfe4ea;
        border-right: 0;
    }

    .task-board {
        grid-template-columns: 1fr;
    }

    .task-board.is-archive-open {
        grid-template-columns: 1fr;
    }

    .task-column {
        min-height: 360px;
    }

    .task-board:not(.is-archive-open) .task-column-archive {
        flex-basis: auto;
        height: 360px;
        min-height: 360px;
    }

    .task-archive-tab {
        flex-direction: row;
        padding: 0 14px;
        writing-mode: horizontal-tb;
    }

    .task-archive-tab span,
    .task-archive-tab strong {
        transform: none;
    }

    .task-column-list {
        min-height: 260px;
    }

    .task-tidy-modal {
        align-items: flex-end;
        padding: 12px;
    }

    .task-tidy-dialog {
        max-height: calc(100vh - 24px);
        overflow: auto;
    }

    .task-tidy-compare {
        grid-template-columns: 1fr;
    }

    .training-pattern-list {
        display: flex;
        gap: 6px;
        max-height: none;
        overflow-x: auto;
    }

    .training-pattern-item {
        flex: 0 0 220px;
    }
}

@media (max-width: 1080px) {
    .messenger-shell {
        grid-template-columns: 300px minmax(0, 1fr);
    }

    .messenger-dialog-line time {
        max-width: 86px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 760px) {
    .content-messenger {
        padding: 0;
    }

    .content-messenger > .notice {
        border-radius: 0;
        margin: 0;
    }

    .messenger-shell,
    .content-messenger > .notice + .messenger-shell {
        border: 0;
        border-radius: 0;
        display: block;
        height: calc(100dvh - 112px);
        min-height: 520px;
    }

    .messenger-dialogs,
    .messenger-chat {
        height: 100%;
    }

    .messenger-shell.has-active-chat .messenger-dialogs {
        display: none;
    }

    .messenger-shell:not(.has-active-chat) .messenger-chat {
        display: none;
    }

    .messenger-mobile-back {
        display: inline-flex;
    }

    .messenger-chat-header {
        min-height: 60px;
        padding: 7px 8px 7px 4px;
    }

    .messenger-chat-header .chat-avatar {
        height: 38px;
        width: 38px;
    }

    .messenger-chat-actions {
        gap: 0;
    }

    .messenger-chat-actions a {
        height: 36px;
        width: 36px;
    }

    .messenger-chat-actions .settings-trigger,
    .messenger-chat-actions .settings-back {
        font-size: 27px;
        height: 42px;
        width: 42px;
    }

    .messenger-message-search {
        margin: 6px 8px;
    }

    .messenger-feed-wrap .conversation-feed {
        padding: 12px 8px;
    }

    .telegram-feed .message {
        max-width: 90%;
    }

    .message-footer {
        max-width: 100%;
    }

    .messenger-composer {
        gap: 7px;
        padding: 7px 8px;
    }

    .messenger-settings-form {
        margin: 8px 0 0;
        padding: 16px;
    }

    .webhook-shell {
        border: 0;
        border-radius: 0;
        display: block;
        height: auto;
        min-height: 0;
    }

    .tasks-shell {
        border: 0;
        border-radius: 0;
        display: block;
        height: auto;
        min-height: 0;
    }

    .webhook-sidebar {
        border-right: 0;
    }

    .webhook-list {
        display: flex;
        overflow-x: auto;
        padding: 6px;
    }

    .webhook-list a {
        border-radius: 999px;
        flex: 0 0 auto;
        padding: 8px 12px;
    }

    .webhook-chat {
        min-height: 640px;
    }

    .webhook-feed {
        padding: 12px 8px;
    }

    .webhook-code,
    .webhook-feed .message {
        max-width: 96%;
    }

    .webhook-builder-head {
        align-items: stretch;
        flex-direction: column;
    }

    .webhook-builder-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .webhook-builder-actions button,
    .webhook-builder-actions .button,
    .webhook-add {
        width: 100%;
    }

    .webhook-table-head {
        display: none;
    }

    .webhook-row {
        background: #f6f9fb;
        border: 1px solid #dce3ea;
        border-radius: 8px;
        grid-template-columns: minmax(0, 1fr) 44px;
        padding: 10px;
    }

    .webhook-row input[type="url"] {
        grid-column: 1;
        grid-row: 1;
    }

    .webhook-event-picker {
        grid-column: 1 / -1;
    }

    .webhook-remove {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    .webhook-event-list {
        position: static;
    }
}
