/* ──────────────────────────────────────────────
   Базовые стили — mobile-first, адаптивные
   ────────────────────────────────────────────── */

:root {
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #65676b;
    --accent: #2a6df4;
    --accent-hover: #1a5ce0;
    --border: #ddd;
    --success: #2e7d32;
    --error: #c62828;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1a1a;
        --card-bg: #2a2a2a;
        --text: #e4e4e4;
        --text-secondary: #999;
        --accent: #4a8df6;
        --accent-hover: #5a9dff;
        --border: #3a3a3a;
        --shadow: 0 1px 3px rgba(0,0,0,0.3);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 12px;
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* ──────────────────────────────────────────────
   Экраны (SPA)
   ────────────────────────────────────────────── */

.screen {
    display: none;
    max-width: 600px;
    margin: 0 auto;
}

.screen.active {
    display: block;
}

/* ──────────────────────────────────────────────
   Заголовки
   ────────────────────────────────────────────── */

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

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.header h2 {
    font-size: 18px;
    font-weight: 600;
}

.back-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

.back-btn:active {
    background: rgba(42, 109, 244, 0.1);
}

/* ──────────────────────────────────────────────
   Меню (главный экран)
   ────────────────────────────────────────────── */

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.menu-card {
    background: var(--card-bg);
    border: none;
    border-radius: 14px;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.1s;
}

.menu-card:active {
    transform: scale(0.96);
}

.card-icon {
    font-size: 32px;
}

.card-label {
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
}

/* ──────────────────────────────────────────────
   Поиск
   ────────────────────────────────────────────── */

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    background: var(--card-bg);
    color: var(--text);
    margin-bottom: 16px;
    outline: none;
}

.search-input:focus {
    border-color: var(--accent);
}

/* ──────────────────────────────────────────────
   Списки результатов
   ────────────────────────────────────────────── */

.results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow);
}

.result-card .name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.result-card .info {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.result-card .phone {
    color: var(--accent);
    font-weight: 500;
}

.result-card a {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
    word-break: break-all;
}

.result-card a:active {
    opacity: 0.7;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-size: 14px;
}

/* ──────────────────────────────────────────────
   Формы
   ────────────────────────────────────────────── */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    background: var(--card-bg);
    color: var(--text);
    outline: none;
    font-family: inherit;
}

.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:active {
    background: var(--accent-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
}

.result-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    display: none;
}

.result-message.success {
    display: block;
    background: rgba(46, 125, 50, 0.1);
    color: var(--success);
}

.result-message.error {
    display: block;
    background: rgba(198, 40, 40, 0.1);
    color: var(--error);
}

/* ──────────────────────────────────────────────
   Бейдж статуса заявки
   ────────────────────────────────────────────── */

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-new      { background: #e3f2fd; color: #1565c0; }
.status-progress { background: #fff3e0; color: #e65100; }
.status-done     { background: #e8f5e9; color: #2e7d32; }
.status-closed   { background: #f5f5f5; color: #757575; }

@media (prefers-color-scheme: dark) {
    .status-new      { background: #1a3a5c; color: #64b5f6; }
    .status-progress { background: #3e2723; color: #ffab40; }
    .status-done     { background: #1b5e20; color: #81c784; }
    .status-closed   { background: #3a3a3a; color: #999; }
}

.ticket-id {
    font-weight: 700;
    color: var(--accent);
}
