/* Assistant cabinet shell + auth (assistant.smyalichi.ru) */

body.assistant-app { margin-top: 0; }

.assistant-shell {
    display: flex;
    min-height: 100vh;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: #f8f9fa;
    color: #111827;
}

.assistant-sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #1e293b;
    color: #fff;
}

.assistant-sidebar__brand {
    padding: 20px 16px 8px;
    font-weight: 700;
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.assistant-sidebar__brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.assistant-sidebar__version {
    padding: 0 16px 12px;
    font-size: 11px;
    color: rgba(255,255,255,.5);
}

.assistant-sidebar__user {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    border-bottom: 1px solid rgba(255,255,255,.08);
    font-size: 13px;
    color: rgba(255,255,255,.75);
}

.assistant-sidebar nav {
    padding: 8px 0;
    flex: 1;
}

.assistant-sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.assistant-sidebar__link:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
    text-decoration: none;
}

.assistant-sidebar__link--active {
    background: rgba(37,99,235,.35);
    color: #fff;
}

.assistant-sidebar__footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.assistant-sidebar__logout {
    display: block;
    text-align: center;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
}

.assistant-main {
    flex: 1;
    min-width: 0;
    padding: 20px 24px 32px;
}

.assistant-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}

.assistant-breadcrumb__link {
    color: #2563eb;
    text-decoration: none;
}

.assistant-breadcrumb__link:hover { text-decoration: underline; }

.assistant-breadcrumb__sep { color: #9ca3af; }

.assistant-breadcrumb__current {
    color: #374151;
    font-weight: 500;
}

.assistant-page-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 16px;
}

.assistant-alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 14px;
}

.assistant-alert--success { background: #dcfce7; color: #166534; }
.assistant-alert--error { background: #fee2e2; color: #991b1b; }

/* Auth page */
body.assistant-auth { margin-top: 0; background: #f0f4f8; }

.assistant-auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px;
}

.assistant-auth-header { text-align: center; margin-bottom: 24px; }

.assistant-auth-logo {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
}

.assistant-auth-tagline { color: #6b7280; font-size: 14px; margin-top: 8px; }

.assistant-auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

.assistant-auth-title { font-size: 20px; margin: 0 0 8px; }

.assistant-auth-hint { font-size: 13px; color: #6b7280; margin-bottom: 16px; }

.assistant-auth-form label { display: block; font-size: 13px; margin: 12px 0 4px; }

.assistant-auth-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.assistant-auth-submit {
    width: 100%;
    margin-top: 16px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.assistant-auth-flash {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

.assistant-auth-flash--error { background: #fee2e2; color: #991b1b; }
.assistant-auth-flash--success { background: #dcfce7; color: #166534; }

/* Shared panel components (dashboard, procurement, integration) */
.assistant-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    border: 1px solid #e5e7eb;
    margin-bottom: 20px;
    overflow: hidden;
}

.assistant-card__header {
    padding: 14px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.assistant-card__header h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.assistant-card__body { padding: 16px 20px; }

.assistant-card__hint {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 16px;
}

.assistant-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.assistant-stat {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.assistant-stat__label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 4px;
}

.assistant-stat__value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    color: #111827;
}

.assistant-stat__sub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.assistant-stat--ok .assistant-stat__value { color: #16a34a; }
.assistant-stat--warn .assistant-stat__value { color: #d97706; }
.assistant-stat--muted .assistant-stat__value { color: #2563eb; }

.assistant-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background .15s, filter .15s;
    font-family: inherit;
}

.assistant-btn:disabled { opacity: .55; cursor: not-allowed; }

.assistant-btn--secondary {
    background: #dbeafe;
    color: #2563eb;
}

.assistant-btn--secondary:hover:not(:disabled) { background: #bfdbfe; }

.assistant-btn--primary {
    background: #2563eb;
    color: #fff;
}

.assistant-btn--primary:hover:not(:disabled) { background: #1d4ed8; }

.assistant-btn--ghost {
    background: transparent;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.assistant-btn--ghost:hover:not(:disabled) { background: #f9fafb; color: #374151; }

.assistant-form-grid {
    display: grid;
    grid-template-columns: minmax(140px, 180px) 1fr auto;
    gap: 12px;
    align-items: end;
}

.assistant-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.assistant-field input,
.assistant-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #111827;
}

.assistant-field input:focus,
.assistant-field select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.assistant-type-hint {
    grid-column: 1 / -1;
    font-size: 13px;
    color: #6b7280;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    line-height: 1.45;
}

.assistant-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
}

.assistant-badge--ok { background: #dcfce7; color: #166534; }
.assistant-badge--miss { background: #fee2e2; color: #991b1b; }
.assistant-badge--neutral { background: #f3f4f6; color: #4b5563; }
.assistant-badge--active { background: #dbeafe; color: #1d4ed8; }
.assistant-badge--error { background: #fee2e2; color: #991b1b; }

.assistant-cap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.assistant-cap-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #fafafa;
    font-size: 13px;
    font-weight: 500;
}

.assistant-cap-item--ok {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.assistant-cap-item--miss {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.assistant-source-table-wrap { overflow-x: auto; }

.assistant-source-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.assistant-source-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.assistant-source-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.assistant-source-table tr:last-child td { border-bottom: none; }

.assistant-source-table tr:hover td { background: #f9fafb; }

.assistant-source-name { font-weight: 600; color: #111827; }

.assistant-source-meta {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.assistant-code-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.assistant-code-row:last-child { margin-bottom: 0; }

.assistant-code-row__label {
    min-width: 88px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}

.assistant-code-block {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 10px;
    word-break: break-all;
    color: #1e293b;
}

.assistant-api-key-panel {
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 1px solid #93c5fd;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 20px;
}

.assistant-api-key-panel__title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #1e40af;
}

.assistant-api-key-panel__hint {
    font-size: 13px;
    color: #475569;
    margin: 0 0 10px;
}

.assistant-api-key-panel__value {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}

.assistant-api-key-panel__value code {
    flex: 1;
    min-width: 200px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 12px;
    word-break: break-all;
}

.assistant-empty {
    text-align: center;
    padding: 28px 16px;
    color: #6b7280;
}

.assistant-empty__icon { font-size: 32px; margin-bottom: 8px; }

.assistant-empty__title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.assistant-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6b7280;
    font-size: 13px;
    padding: 8px 0;
}

.assistant-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: assistant-spin .65s linear infinite;
}

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

.assistant-toast-container {
    position: fixed;
    top: 72px;
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.assistant-toast {
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    animation: assistant-toast-in .25s ease;
}

.assistant-toast--ok { background: #16a34a; }
.assistant-toast--err { background: #dc2626; }

@keyframes assistant-toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.assistant-hidden { display: none !important; }

.assistant-missing-list {
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.assistant-onboarding {
    margin-top: 16px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.assistant-onboarding__title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 10px;
}

.assistant-onboarding__steps {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.assistant-onboarding__step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 13px;
    color: #4b5563;
}

.assistant-onboarding__step p {
    margin: 4px 0 0;
    color: #6b7280;
    line-height: 1.45;
}

.assistant-onboarding__num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .assistant-form-grid {
        grid-template-columns: 1fr;
    }

    .assistant-form-grid .assistant-btn { width: 100%; }

    .assistant-shell { flex-direction: column; }
    .assistant-sidebar { width: 100%; }
    .assistant-sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
    .assistant-sidebar__link { padding: 8px 12px; border-radius: 8px; }
}
