body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 16px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: #111;
}

#app {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: visible;
}

h1 {
    margin: 0 0 8px;
    font-size: 22px;
    text-align: center;
}

h2, h3 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-size: 18px;
}

.package-description {
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.4;
    color: #555;
    font-style: italic;
}

#packages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.package-btn,
.duration-btn,
.time-btn {
    display: block;
    width: 100%;
    margin: 0;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: #f5f7fb;
    color: #111;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.package-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.package-desc {
    font-size: 14px;
    color: #555;
}

.package-btn.selected,
.duration-btn.selected,
.time-btn.selected {
    background: #2a6fdb;
    color: #fff;
    box-shadow: 0 0 0 2px rgba(42, 111, 219, 0.4);
}

.section {
    margin-top: 16px;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

.hint {
    margin: 0 0 8px;
    font-size: 13px;
    color: #777;
}

#start-date-input,
#prac-date,
#sleep-morning-time,
#sleep-evening-time {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 2px solid #2a6fdb;
    font-size: 15px;
    box-sizing: border-box;
    background-color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* Время опроса «Как ты провёл день?» и «Трекер сна» — одинаковые размер и рамка */
#compass-settings-section .compass-time-input,
.compass-time-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 2px solid #2a6fdb;
    font-size: 15px;
    box-sizing: border-box;
    background-color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* Чекбоксы «Дневник дня» и «Отслеживание в моменте» — такой же размер, как у слотов времени (06:00, 07:00…) */
.compass-setting-checkbox-row {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 0;
}
.compass-setting-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 15px;
    line-height: 1.4;
    cursor: pointer;
}
.compass-setting-checkbox-label span {
    flex: 1;
}
.compass-setting-checkbox {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    margin: 0;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #2a6fdb;
}

.error {
    margin-top: 6px;
    font-size: 13px;
    color: #d33;
}

#summary {
    margin-top: 20px;
    padding: 16px;
    background: #f5f7fb;
    border-radius: 12px;
}

#summary-text {
    margin-bottom: 12px;
    white-space: pre-line;
}

.compass-moment-table-wrap {
    overflow-x: auto;
    margin-bottom: 16px;
}
.compass-moment-table {
    font-size: 13px;
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}
.compass-moment-table th,
.compass-moment-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #c0c4cc;
    text-align: left;
    vertical-align: top;
}
.compass-moment-table th:last-child,
.compass-moment-table td:last-child {
    border-right: none;
}
.compass-moment-table thead th {
    border-bottom: 2px solid #2a6fdb;
    font-weight: 600;
}
.compass-moment-table .compass-moment-datetime {
    font-size: 12px;
    color: #666;
    display: block;
    margin-top: 4px;
}
.compass-moment-table td {
    white-space: pre-wrap;
}
.compass-moment-table .compass-moment-cell-state {
    white-space: normal;
}

.compass-standup-entries {
    margin-top: 12px;
}
.compass-standup-entry {
    margin-bottom: 16px;
    padding: 12px;
    background: #f5f7fb;
    border-radius: 10px;
    border: 1px solid #e8ecf4;
}
.compass-standup-entry-footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e8ecf4;
}
.compass-diary-edited-badge {
    font-size: 11px;
    font-weight: 600;
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 3px 8px;
    margin-right: auto;
}
.compass-standup-entry-footer .primary-btn.compass-diary-edit-open-btn {
    width: auto;
    margin: 0;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}
.compass-standup-entry-footer .primary-btn.compass-diary-edit-open-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
.compass-standup-text {
    font-size: 14px;
    line-height: 1.4;
    color: #444;
    white-space: normal;
}

body.compass-diary-modal-open {
    overflow: hidden;
}

.compass-diary-edit-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    box-sizing: border-box;
}
.compass-diary-edit-modal.is-open {
    display: flex;
}
.compass-diary-edit-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.compass-diary-edit-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    max-height: min(calc(100dvh - 20px), calc(100vh - 20px), 720px);
    min-height: min(200px, 42vh);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.28);
    box-sizing: border-box;
    overflow: hidden;
}
.compass-diary-edit-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px 8px;
    flex-shrink: 0;
}
.compass-diary-edit-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.25;
}
.compass-diary-edit-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}
.compass-diary-edit-close:hover {
    background: #e2e8f0;
}
.compass-diary-edit-dialog--moment {
    max-width: 380px;
    min-height: 0;
}
.compass-diary-edit-dialog--moment .compass-diary-edit-title {
    font-size: 15px;
}
.compass-diary-edit-fields {
    flex: 1 1 auto;
    min-height: min(11rem, 32vh);
    max-height: min(52vh, 420px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    margin: 0 14px 8px;
    padding-right: 2px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}
.compass-diary-edit-fields--moment {
    gap: 4px;
    min-height: 0;
    max-height: min(30vh, 200px);
    margin-top: 0;
}
.compass-diary-edit-field {
    flex-shrink: 0;
}
.compass-diary-edit-field--long .compass-diary-edit-field-input {
    min-height: 72px;
    max-height: 200px;
}
.compass-diary-edit-field--moment .compass-diary-edit-field-label {
    font-size: 12px;
    margin-bottom: 2px;
    font-weight: 600;
}
.compass-diary-edit-field--moment .compass-diary-edit-field-input {
    min-height: 48px;
    max-height: 120px;
    padding: 6px 8px;
    font-size: 14px;
    line-height: 1.3;
    border-radius: 8px;
}
.compass-diary-edit-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 3px;
    letter-spacing: -0.01em;
    line-height: 1.25;
}
.compass-diary-edit-field-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 42px;
    max-height: 120px;
    resize: vertical;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.35;
    color: #0f172a;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.compass-diary-edit-field-input:focus {
    border-color: #2a6fdb;
    box-shadow: 0 0 0 2px rgba(42, 111, 219, 0.2);
}

.compass-diary-edit-field-select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 42px;
    max-height: 120px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.35;
    color: #0f172a;
    -webkit-tap-highlight-color: transparent;
}

.compass-diary-edit-field-select:focus {
    border-color: #2a6fdb;
    box-shadow: 0 0 0 2px rgba(42, 111, 219, 0.2);
}
.compass-diary-edit-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 14px max(12px, env(safe-area-inset-bottom));
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #f1f5f9;
}
.compass-diary-edit-actions .compass-diary-edit-cancel {
    padding: 10px 14px;
    font-size: 15px;
    margin-right: auto;
}
.compass-diary-edit-actions .primary-btn {
    width: auto;
    min-width: 118px;
    padding: 10px 18px;
    font-size: 15px;
    flex-shrink: 0;
}

.compass-goals-table-wrap {
    overflow-x: auto;
    margin-top: 12px;
    margin-bottom: 16px;
}

.compass-goals-day {
    margin-bottom: 28px;
}
.compass-goals-day-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.compass-goals-day-date {
    font-weight: 700;
    font-size: 17px;
    color: #0c1e3c;
    letter-spacing: -0.02em;
    flex: 1;
    min-width: 0;
}
.compass-goals-day-pct {
    font-size: 16px;
    font-weight: 600;
    color: #2563eb;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}
.compass-goals-progress {
    height: 10px;
    border-radius: 999px;
    background: #e8edf3;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.07);
}
.compass-goals-progress-fill {
    display: block;
    height: 100%;
    width: 0;
    min-width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #38bdf8 0%, #2563eb 55%, #1d4ed8 100%);
    box-shadow: 0 0 14px rgba(37, 99, 235, 0.35);
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1), background 0.35s ease, box-shadow 0.35s ease;
}
.compass-goals-day.is-all-done .compass-goals-progress-fill {
    background: linear-gradient(90deg, #4ade80 0%, #22c55e 45%, #16a34a 100%);
    box-shadow: 0 0 14px rgba(22, 163, 74, 0.4);
}
.compass-goals-day.is-all-done .compass-goals-day-pct {
    color: #15803d;
}
.compass-goals-day-divider {
    height: 2px;
    margin: 12px 0 16px;
    border-radius: 1px;
    background: linear-gradient(90deg, #3b82f6 0%, rgba(59, 130, 246, 0.12) 100%);
}
.compass-goal-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 18px;
    background: #eef2f7;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin-bottom: 5px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.22s ease;
}
.compass-goal-row.is-done {
    background: #ecfdf5;
    border-color: #bbf7d0;
    box-shadow: 0 1px 3px rgba(22, 163, 74, 0.08);
}
.compass-goal-check {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    color: inherit;
    font: inherit;
}
.compass-goal-check-box {
    display: block;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: transparent;
    box-sizing: border-box;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
/* Невыполнено: внешнее и внутреннее синие кольца */
.compass-goal-check:not(.is-done) .compass-goal-check-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    border: 2px solid #2563eb;
    border-radius: 50%;
    box-sizing: border-box;
    background: transparent;
}
.compass-goal-check:not(.is-done) .compass-goal-check-box::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 11px;
    height: 11px;
    margin: -5.5px 0 0 -5.5px;
    border: 1.5px solid #2563eb;
    border-radius: 50%;
    box-sizing: border-box;
    background: #eef2f7;
}
.compass-goal-check:hover:not(.is-done) .compass-goal-check-box::before,
.compass-goal-check:hover:not(.is-done) .compass-goal-check-box::after {
    border-color: #1d4ed8;
}
.compass-goal-check:hover:not(.is-done) .compass-goal-check-box::after {
    background: #eef2f7;
}
.compass-goal-check:active:not(:disabled):not(.is-done) .compass-goal-check-box {
    transform: scale(0.94);
}
/* Выполнено: зелёный круг с белой галочкой */
.compass-goal-check.is-done .compass-goal-check-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: none;
    box-sizing: border-box;
    background: linear-gradient(155deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 2px 10px rgba(22, 163, 74, 0.38);
}
.compass-goal-check.is-done .compass-goal-check-box::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 45%;
    width: 5px;
    height: 9px;
    margin: -5px 0 0 -3px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    box-sizing: border-box;
    background: none;
    border-radius: 0;
}
.compass-goal-check:focus {
    outline: none;
}
.compass-goal-check:focus-visible:not(.is-done) .compass-goal-check-box::before {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}
.compass-goal-check:focus-visible.is-done .compass-goal-check-box::before {
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.35);
}
.compass-goal-check:disabled {
    opacity: 0.55;
    cursor: wait;
}
.compass-goal-check:disabled .compass-goal-check-box {
    filter: grayscale(0.15);
}
.compass-goal-text {
    font-size: 15px;
    line-height: 1.45;
    color: #334155;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.compass-goal-row.is-done .compass-goal-text {
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    color: #166534;
}
.compass-goal-row:has(.compass-goal-check.is-done) .compass-goal-text {
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
    color: #166534;
}

.compass-goals-table {
    font-size: 14px;
    width: 100%;
    border-collapse: collapse;
}
.compass-goals-table th,
.compass-goals-table td {
    padding: 10px 12px;
    border: 1px solid #c0c4cc;
    text-align: left;
    vertical-align: top;
}
.compass-goals-table thead th {
    background: #2a6fdb;
    color: #fff;
    font-weight: 600;
    border-color: #2a6fdb;
}
.compass-goals-table tbody tr:nth-child(even) {
    background: #f5f7fb;
}
.compass-goals-table tbody td {
    line-height: 1.5;
}

.compass-summary {
    font-size: 14px;
    line-height: 1.4;
    color: #444;
    white-space: pre-line;
}
.compass-ai-report-text {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #222;
    white-space: pre-line;
}
.compass-legend-title {
    margin-bottom: 0.25rem;
}
#compass-legend {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
}
#compass-legend li {
    position: relative;
    padding-left: 20px;
    margin: 2px 0;
    font-size: 14px;
    color: #222;
}
#compass-legend li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transform: translateY(-50%);
}
#compass-legend li[data-state="apathy"]::before {
    background-color: #800080;
}
#compass-legend li[data-state="passive"]::before {
    background-color: #0000ff;
}
#compass-legend li[data-state="relaxed"]::before {
    background-color: #00bcd4;
}
#compass-legend li[data-state="balance"]::before {
    background-color: #4caf50;
}
#compass-legend li[data-state="engaged"]::before {
    background-color: #ffeb3b;
}
#compass-legend li[data-state="overaroused"]::before {
    background-color: #ff9800;
}
#compass-legend li[data-state="panic"]::before {
    background-color: #f44336;
}
.compass-settings {
    margin-top: 12px;
}
.compass-settings-block {
    border: 2px solid #2F80ED;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    background: #fff;
    box-sizing: border-box;
}
.sleep-tracker-settings-block {
    /* Только выделяем контур синей линией слева */
    border-left: 2px solid #4da3ff;
}
.compass-settings-block-intro {
    margin-top: 0;
}
.compass-settings-save-btn {
    margin-top: 4px;
}
.compass-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin: 8px 0 12px;
}
.compass-slot {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f3f5fb;
}
.compass-slot input[type="checkbox"] {
    accent-color: #2a6fdb;
}
.chart-container {
    position: relative;
    width: 100%;
    height: 220px;
}

.compass-sleep-duration-chart {
    height: 260px; /* немного вытягиваем график длительности сна */
}

.sleep-duration-summary {
    text-align: center;
    font-size: 15px;
    color: #333;
    margin: 8px 0 16px 0;
    padding: 10px 16px;
    background: linear-gradient(135deg, #e8f4fd 0%, #f0f7ff 100%);
    border-radius: 10px;
    border-left: 4px solid #4da3ff;
}
.sleep-duration-summary .duration-value {
    font-weight: 600;
    color: #2a6fdb;
    font-size: 17px;
}

#confirm-btn,
#prac-confirm-btn,
.primary-btn {
    background: #2a6fdb;
    color: #fff;
    border: none;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 17px;
    cursor: pointer;
    width: 100%;
}
#prac-confirm-btn:disabled {
    cursor: not-allowed;
}

/* Кнопка «Дневник Практикума» в мини‑приложении — крупная и заметная */
.prac-journal-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #2a6fdb, #1e5bb8);
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(42, 111, 219, 0.35);
}
.prac-journal-btn:active {
    transform: scale(0.98);
}

/* Трекер сна */
.sleep-settings-row {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sleep-settings-group {
    margin-top: 12px;
    margin-bottom: 8px;
}

.sleep-settings-group h3 {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 15px;
}

.sleep-settings-group label {
    display: block;
    font-size: 14px;
    margin: 4px 0;
}

/* Мигающий синий текст для индикаторов загрузки */
.blink-blue {
    color: #1a5a9e;
    animation: blink-blue-pulse 1s infinite;
}

@keyframes blink-blue-pulse {
    0%, 50% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0.3;
    }
}

/* Форма записи на консультацию — крупные поля ввода */
.consult-form-row label {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 6px;
}
.consult-form .consult-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 17px;
    line-height: 1.4;
    min-height: 48px;
    border-radius: 10px;
    border: 2px solid #2a6fdb;
    box-sizing: border-box;
    background-color: #fff;
}
.consult-form .consult-textarea {
    min-height: 120px;
    resize: vertical;
    padding: 14px 16px;
    font-size: 16px;
    line-height: 1.5;
}

.compass-hero {
    margin: 0 0 14px;
    padding: 16px 54px 14px 14px;
    border-radius: 18px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
    text-align: center;
    position: relative;
}

.compass-hero-sub {
    font-size: 14px;
    font-weight: 800;
    color: #2a6fdb;
    letter-spacing: 0.01em;
    margin-bottom: 8px;
}

.compass-hero-title {
    font-size: 34px;
    font-weight: 900;
    line-height: 1.05;
    color: #0f172a;
    letter-spacing: -0.03em;
    margin-bottom: 10px;
}

.compass-hero-desc {
    margin: 0;
    font-size: 15px;
    line-height: 1.4;
    color: #334155;
}

.compass-hero-instruction-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    border: 1px solid #dbe3f0;
    background: #eef2ff;
    color: #2a6fdb;
    font-size: 18px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.compass-hero-instruction-btn.selected {
    border-color: #1e5bb8;
    color: #fff;
    background: linear-gradient(135deg, #2a6fdb, #1e5bb8);
    box-shadow: 0 0 0 2px rgba(42, 111, 219, 0.25), 0 18px 36px rgba(42, 111, 219, 0.22);
}

.compass-hero-instruction-btn:active {
    transform: scale(0.98);
}

@media (max-width: 420px) {
    .compass-hero-title {
        font-size: 30px;
    }
}

.tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.tab-btn {
    width: 100%;
    padding: 12px 10px;
    border-radius: 16px;
    border: 1px solid #dbe3f0;
    background: #ffffff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    color: #1e293b;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
    text-align: center;
    line-height: 1.05;
    min-height: 60px;
}

.tab-btn.selected {
    border-color: #1e5bb8;
    color: #fff;
    background: linear-gradient(135deg, #2a6fdb, #1e5bb8);
    box-shadow: 0 0 0 2px rgba(42, 111, 219, 0.25), 0 18px 36px rgba(42, 111, 219, 0.22);
}

/* Кнопка «Проекты (краткая версия)»: отдельная форма, эмодзи в тексте */
.compass-sprint-short-btn {
    display: inline-block;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 20px;
    border: 1px solid #d0d5dd;
    background: #e0e5ed;
    color: #4a5568;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
/* При нажатии (открыта краткая версия) — синяя */
.compass-sprint-short-btn.active {
    background: #2F80ED;
    color: #fff;
    border-color: #2F80ED;
}

/* Названия проектов спринта: не обрезать многострочный текст */
.sprint-project-name-input {
    min-height: 38px !important;
    overflow-y: auto !important;
}
/* В краткой версии — больше высота, чтобы многострочное название было видно полностью */
.sprint-short-name-input {
    min-height: 44px !important;
    overflow-y: auto !important;
}

.consult-tabs {
    margin-top: 8px;
    margin-bottom: 8px;
}

.secondary-btn {
    margin-top: 8px;
    margin-bottom: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    background: #f5f7fb;
    font-size: 15px;
    cursor: pointer;
    width: 100%;
}

.sleep-notes-toggle {
    margin-top: 12px;
}

.sleep-notes {
    margin-top: 16px;
    padding: 12px;
    border-radius: 10px;
    background: #f7f8fc;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.sleep-note-entry {
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.consult-entry {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.consult-entry-main {
    flex: 1;
}

.consult-entry-actions {
    flex-shrink: 0;
}

.consult-reschedule-btn {
    padding: 6px 10px;
    border-radius: 8px;
    border: none;
    background: #f5f7fb;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.consult-cancel-btn {
    padding: 6px 10px;
    border-radius: 8px;
    border: none;
    background: #ffe6e6;
    color: #b71c1c;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 6px;
}

.consult-status-done {
    font-size: 13px;
    font-weight: 600;
    color: #4caf50;
}

.sleep-note-entry:last-child {
    border-bottom: none;
}

.sleep-note-date {
    font-size: 13px;
    font-weight: 600;
    color: #1a5a9e;
    margin-bottom: 4px;
}

.sleep-note-text {
    font-size: 14px;
    color: #111;
    white-space: pre-line;
}

.version {
    text-align: center;
    font-size: 10px;
    color: #999;
    margin-top: 16px;
}

/* Дневник Практикума */
.journal-day {
    margin-top: 12px;
    padding: 12px;
    border-radius: 10px;
    background: #f7f8fc;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.journal-day-header {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.journal-block {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.journal-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #888;
    margin-bottom: 4px;
}

.journal-question {
    font-size: 13px;
    color: #555;
    white-space: pre-line;
    margin-bottom: 4px;
}

.journal-answer {
    font-size: 14px;
    color: #111;
    white-space: pre-line;
    padding: 8px 10px;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(42, 111, 219, 0.1);
}

.journal-summary {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(42, 111, 219, 0.06) 0%, rgba(42, 111, 219, 0.02) 100%);
    border-left: 3px solid rgba(42, 111, 219, 0.4);
}
.journal-summary-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #2a6fdb;
    margin-bottom: 4px;
}
.journal-summary-text {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}

/* Экран «Дневник»: выбор категории */
.diary-category-section {
    position: relative;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}
.diary-category-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    border: 2px solid #2a6fdb;
    border-radius: 10px;
    background: #f5f7fb;
    cursor: pointer;
    font-size: 16px;
}
.diary-category-label {
    font-weight: 600;
    color: #333;
}
.diary-category-value {
    flex: 1;
    text-align: right;
    color: #2a6fdb;
    padding: 0 8px;
}
.diary-category-arrow {
    font-size: 12px;
    color: #2a6fdb;
}
.diary-category-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    padding: 6px 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 10;
}
.diary-category-dropdown.open {
    display: block;
    /* Позиция задаётся в JS (position: fixed), чтобы список не обрезался белой карточкой */
}
.diary-category-dropdown button {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
    color: #111;
}
.diary-category-dropdown button:hover {
    background: #f0f4ff;
}
.diary-category-dropdown button:active {
    background: #e0e8ff;
}
.diary-current-practicum {
    margin: 12px 0;
    padding: 10px 12px;
    background: #e8f4fd;
    border-radius: 8px;
    font-size: 14px;
    color: #1a5a9e;
}
.diary-entries-section {
    margin-top: 16px;
}

/* Всплывающее уведомление (активный практикум) */
.prac-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.prac-modal {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    max-width: 340px;
    width: 100%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.prac-modal-message {
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.45;
    color: #222;
}
.prac-modal-close {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: #2a5298;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}
.prac-modal-close:active {
    opacity: 0.9;
}

/* Управление практикумом: пропуск дня, пауза */
.practicum-controls {
    margin-top: 12px;
    padding: 14px;
    background: #f8f9fc;
    border-radius: 12px;
    border: 1px solid #e4e8f0;
}
.practicum-day-status {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: #1a237e;
}
.practicum-controls-hint {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.4;
    color: #555;
}
.practicum-controls-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.prac-action-btn {
    padding: 10px 14px;
    border: 1px solid #2a5298;
    border-radius: 8px;
    background: #fff;
    color: #2a5298;
    font-size: 14px;
    cursor: pointer;
}
.prac-action-btn:active {
    opacity: 0.9;
}
.prac-action-btn-primary {
    background: #2a5298;
    color: #fff;
}
.practicum-action-message {
    margin: 10px 0 0;
    font-size: 13px;
    color: #1a5a9e;
}

/* Психолог 24/7 — полноэкранный чат: скролл только у сообщений */
html.psych-page {
    height: 100%;
    overflow: hidden;
    touch-action: pan-y;
}
body.psych-body {
    margin: 0;
    padding: 0;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    background: var(--tg-theme-bg-color, #f9f5f0);
    color: var(--tg-theme-text-color, #111);
}

.psych-app {
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Переопределяем базовый #app (белая карточка) для мини-чатов Telegram */
#app.psych-app {
    background: var(--tg-theme-bg-color, #f9f5f0);
    border-radius: 0;
    box-shadow: none;
}

/* Шапка — первый flex-элемент, не скроллится */
.psych-header {
    flex-shrink: 0;
    position: relative;
    padding: 12px 12px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--tg-theme-bg-color, #f9f5f0);
    z-index: 20;
    box-sizing: border-box;
}

.psych-header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--tg-theme-text-color, #3c2a4d);
    flex: 1 1 auto;
}

.psych-menu-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: none;
    background: var(--tg-theme-secondary-bg-color, rgba(60, 42, 77, 0.08));
    cursor: pointer;
    position: relative;
}

.psych-menu-btn span {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 3px;
    border-radius: 2px;
    background: var(--tg-theme-text-color, #3c2a4d);
}

.psych-menu-btn span:nth-child(1) { top: 8px; }
.psych-menu-btn span:nth-child(2) { top: 50%; margin-top: -1.5px; }
.psych-menu-btn span:nth-child(3) { bottom: 8px; }

.psych-menu {
    position: absolute;
    top: 48px;
    right: 12px;
    background: var(--tg-theme-secondary-bg-color, #fff);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 6px 0;
    z-index: 50;
    min-width: 180px;
    display: none;
}

.psych-menu.open {
    display: block;
}

.psych-menu-item {
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 15px;
    color: var(--tg-theme-text-color, #111);
    cursor: pointer;
}

.psych-menu-item:hover,
.psych-menu-item:active {
    background: color-mix(in srgb, var(--tg-theme-button-color, #2a5298) 14%, transparent);
}

/* Одна прокручиваемая зона: сообщения + поле ввода вместе */
.psych-main {
    flex: 1 1 0;
    min-height: 0;
    padding: 0 8px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.psych-messages {
    padding: 4px 2px 8px;
    min-height: 0;
}

.psych-message {
    display: flex;
    margin-bottom: 8px;
}

.psych-message-user {
    justify-content: flex-end;
}

.psych-message-assistant {
    justify-content: flex-start;
}

.psych-bubble {
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.psych-message-user .psych-bubble {
    background: var(--tg-theme-button-color, #2a5298);
    color: var(--tg-theme-button-text-color, #fff);
    border-bottom-right-radius: 4px;
    border: 1px solid color-mix(in srgb, var(--tg-theme-button-text-color, #fff) 22%, transparent);
}

.psych-message-assistant .psych-bubble {
    background: var(--tg-theme-secondary-bg-color, #f3e7ff);
    color: var(--tg-theme-text-color, #2c1249);
    border-bottom-left-radius: 4px;
    border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #8a8a8a) 40%, transparent);
}

.psych-message-time {
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.2;
    opacity: 0.78;
    text-align: right;
}

.psych-message-user .psych-message-time {
    color: var(--tg-theme-button-text-color, #fff);
}

.psych-message-assistant .psych-message-time {
    color: var(--tg-theme-hint-color, #8a8a8a);
}

.psych-typing {
    margin: 4px 4px 0;
    font-size: 13px;
    color: var(--tg-theme-hint-color, #777);
}

/* Подвал с полем ввода — в конце прокручиваемой зоны, всегда рядом с последним сообщением */
.psych-footer {
    padding: 6px 0 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--tg-theme-bg-color, #0f1720) 86%, #000 14%);
    box-sizing: border-box;
    border-top: 1px solid color-mix(in srgb, var(--tg-theme-text-color, #fff) 14%, transparent);
}

.psych-body.keyboard-open .psych-footer {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* История диалогов */
.psych-history-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.psych-history-modal {
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    background: var(--tg-theme-bg-color, #fff);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    padding: 14px 14px 12px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.psych-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.psych-history-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #3c2a4d);
}

.psych-history-close {
    border: none;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}

.psych-history-list {
    flex: 1;
    overflow-y: auto;
    margin: 4px 0 0;
}

.psych-history-empty {
    margin: 6px 0 0;
    font-size: 14px;
    color: var(--tg-theme-hint-color, #777);
}

.psych-history-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 8px;
    border-radius: 10px;
    cursor: pointer;
}

.psych-history-item:hover {
    background: color-mix(in srgb, var(--tg-theme-button-color, #2a5298) 12%, transparent);
}

.psych-history-main {
    flex: 1;
    min-width: 0;
}

.psych-history-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--tg-theme-text-color, #2c1249);
    margin-bottom: 2px;
}

.psych-history-meta {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #777);
}

.psych-history-delete {
    flex-shrink: 0;
    border: none;
    background: color-mix(in srgb, #ff4d4f 18%, transparent);
    color: #ff6b6b;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    cursor: pointer;
}

.psych-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #163a63;
    border: 2px solid #4aa3ff;
    border-radius: 16px;
    padding: 8px 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.psych-input-row:focus-within {
    border-color: #6bb8ff;
    box-shadow: 0 0 0 4px rgba(74, 163, 255, 0.35);
}

.psych-input {
    flex: 1;
    border: 1px solid #5caef7;
    border-radius: 12px;
    resize: none;
    font-size: 15px;
    line-height: 1.4;
    max-height: 200px;
    min-height: 22px;
    outline: none;
    overflow-y: auto;
    box-sizing: border-box;
    color: #eaf4ff;
    background: #1f4d80;
    padding: 10px 12px;
}

.psych-input::placeholder {
    color: #b8d8f7;
}

.psych-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--tg-theme-button-color, #2a5298);
    cursor: pointer;
    position: relative;
}

.psych-send-btn::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 2px;
    border-right: 2px solid var(--tg-theme-button-text-color, #fff);
    border-bottom: 2px solid var(--tg-theme-button-text-color, #fff);
    transform: rotate(45deg) translate(-1px, -1px);
}

.psych-send-btn.sending {
    opacity: 0.6;
}

/* Всплывающее уведомление Шкалы НейроБаланса (по центру, с кнопкой Ок) */
html.compass-toast-open,
body.compass-toast-open {
    overflow: hidden;
}
.compass-toast-wrap {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.compass-toast-wrap.compass-toast-visible {
    opacity: 1;
}
.compass-toast {
    padding: 18px 28px;
    background: #2a6fdb;
    color: #fff;
    border-radius: 14px;
    font-size: 16px;
    text-align: center;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transform: scale(0.95);
    transition: transform 0.25s ease;
}
.compass-toast-wrap.compass-toast-visible .compass-toast {
    transform: scale(1);
}
.compass-toast.compass-toast-error {
    background: #c62828;
}

/* Легенда состояний в статистике */
.compass-legend-list {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}
.compass-legend-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 15px;
}
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Кнопки периода (Сегодня, Неделя, Месяц) */
.period-btn {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}
.period-btn:hover {
    border-color: #4da3ff;
    color: #4da3ff;
}
.period-btn.selected {
    background: #4da3ff;
    border-color: #4da3ff;
    color: #fff;
}

/* Строка «Ваш часовой пояс» + кнопка 🕒 (мини-приложение Компас) */
.compass-tz-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 4px;
    flex-wrap: nowrap;
}
.compass-tz-row .compass-tz-text {
    flex: 1;
    min-width: 0;
    margin: 0;
    text-align: left;
}
.compass-tz-clock-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 2px solid #1976d2;
    border-radius: 10px;
    background: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}
.compass-tz-clock-btn:active {
    opacity: 0.88;
}

.compass-timezone-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.compass-timezone-modal-card {
    background: #fff;
    border-radius: 12px;
    max-width: 360px;
    width: 100%;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}
.compass-timezone-modal-title {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 600;
}
.compass-timezone-modal-hint {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.4;
}
.compass-timezone-modal-actions {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}
.compass-timezone-modal-btn {
    min-width: 88px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border: none;
}
.compass-timezone-modal-btn-yes {
    background: #1565c0;
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.compass-timezone-modal-btn-yes:active {
    opacity: 0.92;
}
.compass-timezone-modal-btn-no {
    background: #e8e8e8;
    color: #333;
}
.compass-timezone-modal-btn-no:active {
    opacity: 0.88;
}
