/* Сетка карточек */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.card {
    position: relative;
    overflow: hidden;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(var(--blur-sm));
    -webkit-backdrop-filter: blur(var(--blur-sm));
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    transition: transform var(--t-fast), box-shadow var(--t-base), opacity var(--t-base);
    cursor: pointer;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    text-align: left;
    color: inherit;
    font: inherit;
}
.card:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.card:active:not(:disabled) { transform: translateY(0); }
.card:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.card-accent {
    background: var(--card-gradient, var(--gradient-warm));
    color: var(--text-on-accent);
    border: none;
    box-shadow: var(--shadow-md);
}
.card-accent .card-meta { color: rgba(255, 255, 255, 0.85); }

.card-title {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-1);
    line-height: 1.2;
}
.card-meta {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-full);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    transition: transform var(--t-fast), box-shadow var(--t-base), background var(--t-base);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--gradient-aurora);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-md);
}
.btn-primary:hover {
    box-shadow: var(--shadow-lg), 0 0 24px -4px rgba(167, 107, 255, 0.4);
}

.btn-ghost {
    background: var(--bg-glass-strong);
    color: var(--text-primary);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-sm);
}
.btn-ghost:hover {
    box-shadow: var(--shadow-md);
}

/* Список (для пабликов / чатов) */
.list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.list-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-glass-strong);
    backdrop-filter: blur(var(--blur-sm));
    -webkit-backdrop-filter: blur(var(--blur-sm));
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--t-fast), box-shadow var(--t-base);
    cursor: pointer;
}
.list-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.list-item:active { transform: translateY(0); }

.list-item-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
.list-item-body {
    flex: 1;
    min-width: 0;
}
.list-item-title {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.list-item-meta {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Дополнительные ярлычки */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    background: var(--bg-glass-strong);
    color: var(--text-secondary);
    border: 1px solid var(--border-soft);
}
.badge-accent {
    background: var(--gradient-warm);
    color: var(--text-on-accent);
    border: none;
}

/* ===== Подэкраны (sub-views) ===== */
.view-header-sub {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.view-header-sub .view-title {
    flex: 1;
    font-size: var(--text-2xl);
}

/* Универсальная круглая иконочная кнопка (back, info, copy и т.д.) */
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    flex-shrink: 0;
    transition: transform var(--t-fast), box-shadow var(--t-base);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { box-shadow: var(--shadow-md); }
.icon-btn:active { transform: scale(0.93); }
.icon-btn-sm { width: 32px; height: 32px; }
.icon-btn-sm svg { width: 16px; height: 16px; }

.view-sub {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-5);
    line-height: 1.5;
}
.view-sub code {
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-soft);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.92em;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ===== Формы / инпуты ===== */
.form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.input,
.select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: inherit;
    font-size: var(--text-base);
    color: var(--text-primary);
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder { color: var(--text-tertiary); }
.input:focus,
.select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: var(--shadow-md), 0 0 0 4px rgba(167, 107, 255, 0.15);
}

/* Select — нативная стрелка → своя через background-image */
.select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 36px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236e6e80' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-color: var(--bg-glass-strong);
}

@media (min-width: 480px) {
    .form {
        flex-direction: row;
        align-items: stretch;
    }
    .form .input { flex: 1; }
    .form .btn { flex-shrink: 0; }
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== Результат запроса ===== */
.result {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(var(--blur-sm));
    -webkit-backdrop-filter: blur(var(--blur-sm));
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    animation: viewFadeIn var(--t-base) both;
}
.result-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-soft);
}
.result-row:last-child { border-bottom: none; }
.result-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    flex-shrink: 0;
}
.result-value {
    font-size: var(--text-sm);
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
}
.result-value.mono {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: var(--text-sm);
}
.result-error {
    color: var(--accent-red);
    font-size: var(--text-sm);
    line-height: 1.5;
}

/* ===== Карточка инфы о тебе (используется во всех утилитах сверху экрана) ===== */
.self-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-4);
}
/* Вертикальная компоновка для много-строчных значений (дата + возраст) */
.self-card-stack {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
}
.self-card-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}
.self-card-value {
    flex: 1;
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.01em;
}
.self-card-value.mono {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    letter-spacing: 0;
}
.self-card-sub {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}
.self-card-loading {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    font-style: italic;
}
.self-card-error {
    font-size: var(--text-sm);
    color: var(--accent-red);
}

/* ===== Модальное окно (для info, подтверждений) ===== */
.modal {
    border: none;
    background: transparent;
    padding: 0;
    margin: auto;
    max-width: 420px;
    width: calc(100% - var(--space-4) * 2);
    color: var(--text-primary);
}
.modal::backdrop {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.modal[open] {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-soft);
    padding: var(--space-5);
    animation: viewFadeIn var(--t-base) both;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.modal-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    margin: 0;
}
.modal-body {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.5;
    white-space: pre-line;
}

/* ===== Кратковременный «галочка» при копировании ===== */
.icon-btn.is-copied {
    color: var(--accent-green);
}
