/* ═══════════════════════════════════════════════════════
   Talentium LK — account.css
   Клиентский личный кабинет
════════════════════════════════════════════════════════ */

:root {
    --tlk-bg:          #f4f6f9;
    --tlk-surface:     #ffffff;
    --tlk-border:      #e2e8f0;
    --tlk-accent:      #2563eb;
    --tlk-accent-h:    #1d4ed8;
    --tlk-ok:          #16a34a;
    --tlk-warn:        #d97706;
    --tlk-err:         #dc2626;
    --tlk-text:        #1e293b;
    --tlk-text-muted:  #64748b;
    --tlk-radius:      10px;
    --tlk-shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --tlk-shadow-md:   0 4px 12px rgba(0,0,0,.1);
}

/* ─── Обёртка ─── */
.tlk-account {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--tlk-text);
}

/* ─── Шапка ─── */
.tlk-account__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--tlk-surface);
    border-radius: var(--tlk-radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--tlk-shadow);
    border: 1px solid var(--tlk-border);
}

.tlk-account__user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tlk-account__avatar img {
    border-radius: 50%;
    display: block;
}

.tlk-account__name {
    margin: 0 0 2px;
    font-size: 16px;
    font-weight: 600;
}

.tlk-account__email {
    font-size: 13px;
    color: var(--tlk-text-muted);
}

/* ─── Пустое состояние ─── */
.tlk-empty-state {
    text-align: center;
    padding: 64px 24px;
    background: var(--tlk-surface);
    border-radius: var(--tlk-radius);
    border: 1px dashed var(--tlk-border);
}

.tlk-empty-state__icon { font-size: 48px; margin-bottom: 12px; }
.tlk-empty-state h3    { margin: 0 0 8px; font-size: 20px; }
.tlk-empty-state p     { color: var(--tlk-text-muted); margin: 0; }

/* ─── Навигация (табы) ─── */
.tlk-module-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tlk-module-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--tlk-surface);
    border: 1px solid var(--tlk-border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--tlk-text-muted);
    transition: all .15s ease;
    box-shadow: var(--tlk-shadow);
}

.tlk-module-tab:hover {
    color: var(--tlk-accent);
    border-color: var(--tlk-accent);
}

.tlk-module-tab--active {
    background: var(--tlk-accent);
    border-color: var(--tlk-accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

.tlk-module-tab__status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    margin-left: 2px;
}

.tlk-status--ok      { background: var(--tlk-ok);   color: #fff; }
.tlk-status--pending { background: var(--tlk-warn);  color: #fff; }

/* ─── Панели ─── */
.tlk-module-panel {
    display: none;
    animation: tlk-fadein .2s ease;
}

.tlk-module-panel--active { display: block; }

@keyframes tlk-fadein {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Секция ─── */
.tlk-section {
    background: var(--tlk-surface);
    border-radius: var(--tlk-radius);
    border: 1px solid var(--tlk-border);
    box-shadow: var(--tlk-shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.tlk-section__header {
    padding: 20px 24px 0;
}

.tlk-section__title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
}

.tlk-section__desc {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--tlk-text-muted);
}

/* ─── Форма полей ─── */
.tlk-credentials-form {
    padding: 20px 24px 24px;
}

.tlk-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

/* ─── Поле ─── */
.tlk-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.tlk-field__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--tlk-text);
}

.tlk-field__required { color: var(--tlk-err); margin-left: 2px; }

.tlk-field__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.tlk-field__input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--tlk-border);
    border-radius: 7px;
    font-size: 14px;
    color: var(--tlk-text);
    background: #fafbfc;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}

.tlk-field__input:focus {
    outline: none;
    border-color: var(--tlk-accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    background: #fff;
}

.tlk-field__input--error {
    border-color: var(--tlk-err) !important;
    box-shadow: 0 0 0 3px rgba(220,38,38,.12) !important;
}

.tlk-field__input--textarea {
    resize: vertical;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.5;
}

.tlk-field__toggle-vis {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--tlk-text-muted);
    padding: 0;
    display: flex;
    align-items: center;
}

.tlk-field__toggle-vis:hover { color: var(--tlk-accent); }

.tlk-field__help {
    font-size: 12px;
    color: var(--tlk-text-muted);
    margin: 0;
    line-height: 1.4;
}

.tlk-field__help a {
    color: var(--tlk-accent);
    text-decoration: none;
}

.tlk-field__status-badge {
    display: inline-block;
    font-size: 11px;
    color: var(--tlk-ok);
    font-weight: 600;
}

.tlk-field--filled .tlk-field__input {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

/* ─── Кнопки ─── */
.tlk-form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tlk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all .15s ease;
    text-decoration: none;
}

.tlk-btn--primary {
    background: var(--tlk-accent);
    color: #fff;
    border-color: var(--tlk-accent);
    position: relative;
    overflow: hidden;
}

.tlk-btn--primary:hover  { background: var(--tlk-accent-h); border-color: var(--tlk-accent-h); }
.tlk-btn--primary:active { transform: scale(.98); }

.tlk-btn--ghost {
    background: transparent;
    color: var(--tlk-text-muted);
    border-color: var(--tlk-border);
}

.tlk-btn--ghost:hover {
    background: var(--tlk-bg);
    color: var(--tlk-text);
}

.tlk-btn--sm { padding: 7px 14px; font-size: 13px; }

/* Лоадер в кнопке */
.tlk-btn__loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tlk-spin .6s linear infinite;
}

.tlk-btn__loader--visible { display: block; }
.tlk-btn__text--hidden    { display: none; }

/* ─── Сообщения ─── */
.tlk-form-msg, .tlk-save-msg {
    font-size: 13px;
    font-weight: 600;
}

.tlk-msg--ok  { color: var(--tlk-ok); }
.tlk-msg--err { color: var(--tlk-err); }

/* ─── Дашборд ─── */
.tlk-dashboard-section {
    background: var(--tlk-surface);
    border-radius: var(--tlk-radius);
    border: 1px solid var(--tlk-border);
    box-shadow: var(--tlk-shadow);
    padding: 24px;
    min-height: 120px;
}

.tlk-dashboard-loader,
.tlk-dashboard-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 120px;
    color: var(--tlk-text-muted);
    font-size: 14px;
}

.tlk-dashboard-stub {
    text-align: center;
    padding: 32px;
    color: var(--tlk-text-muted);
}

.tlk-module-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--tlk-err);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
}

.tlk-notice {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
}

.tlk-notice a { color: var(--tlk-accent); }

/* ─── Спиннер ─── */
.tlk-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--tlk-border);
    border-top-color: var(--tlk-accent);
    border-radius: 50%;
    animation: tlk-spin .7s linear infinite;
}

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

/* ─── Адаптив ─── */
@media (max-width: 640px) {
    .tlk-account__header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .tlk-fields-grid     { grid-template-columns: 1fr; }
    .tlk-module-tabs     { gap: 6px; }
    .tlk-module-tab      { font-size: 13px; padding: 7px 12px; }
    .tlk-section__header,
    .tlk-credentials-form { padding: 16px; }
}

/* ─── Дашборд: бар с датпикером ─── */
.tlk-date-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--tlk-surface);
    border: 1px solid var(--tlk-border);
    border-radius: var(--tlk-radius);
    box-shadow: var(--tlk-shadow);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.tlk-date-bar__left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tlk-date-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--tlk-text-muted);
}

.tlk-date-input {
    padding: 6px 10px;
    border: 1.5px solid var(--tlk-border);
    border-radius: 7px;
    font-size: 13px;
    color: var(--tlk-text);
    background: #fafbfc;
    transition: border-color .15s;
}

.tlk-date-input:focus {
    outline: none;
    border-color: var(--tlk-accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.tlk-date-sep {
    color: var(--tlk-text-muted);
    font-size: 13px;
}

@media (max-width: 640px) {
    .tlk-date-bar        { flex-direction: column; align-items: flex-start; }
    .tlk-date-bar__left  { width: 100%; }
}

/* ─── Дашборд: вертикальные блоки ─── */
.tlk-dash-page .tlk-dash-block {
    background: var(--tlk-surface);
    border: 1px solid var(--tlk-border);
    border-radius: var(--tlk-radius);
    box-shadow: var(--tlk-shadow);
    margin-bottom: 20px;
    /* НЕ overflow:hidden — мешает корректному ресайзу canvas Chart.js */
}

/* Заголовок — явные размеры чтобы * {margin:0;padding:0} внутри модуля не ломал */
.tlk-dash-block__header {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 14px 20px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    border-bottom: 1px solid var(--tlk-border);
    background: #fafbfc;
    border-radius: var(--tlk-radius) var(--tlk-radius) 0 0;
}

.tlk-dash-block__icon  { font-size: 18px !important; line-height: 1 !important; flex-shrink: 0; }
.tlk-dash-block__title { font-size: 15px !important; font-weight: 600 !important; color: var(--tlk-text) !important; margin: 0 !important; padding: 0 !important; }

/* Тело модуля — padding и ограничение ширины */
.tlk-dash-block__body {
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
    /* Не даём дочерним элементам вылезать за блок */
    overflow: hidden;
}

/* Canvas внутри модулей — не должен диктовать ширину родителю */
.tlk-dash-block__body canvas {
    max-width: 100% !important;
}

/* KPI-карточки — min-width:0 обязателен для грида чтобы колонки не росли от контента */
.tlk-dash-block__body .ym-kpi,
.tlk-dash-block__body .dir-kpi {
    min-width: 0;
    box-sizing: border-box;
}

/* Гриды модулей — не вылезают за родителя */
.tlk-dash-block__body .ym-kpi-grid,
.tlk-dash-block__body .dir-kpi-grid,
.tlk-dash-block__body .g,
.tlk-dash-block__body .g2,
.tlk-dash-block__body .g3,
.tlk-dash-block__body .g4 {
    box-sizing: border-box;
    width: 100%;
}

/* Дашборд — на всю ширину */
.tlk-dash-page.tlk-account {
    max-width: none;
    padding-left: 20px;
    padding-right: 80px;
}
