* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
header h1 {
    font-size: 24px;
    font-weight: 600;
}
.header-right { display: flex; align-items: center; gap: 15px; }
.user-info { display: flex; align-items: center; gap: 8px; }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; }
.user-name { color: rgba(255,255,255,0.9); font-size: 13px; }
.btn-logout { background: rgba(255,255,255,0.2); border: none; border-radius: 4px; padding: 4px 8px; cursor: pointer; font-size: 14px; }
.btn-logout:hover { background: rgba(255,255,255,0.3); }

/* Google Auth */
.google-auth { text-align: center; max-width: 400px; margin: 0 auto; }
.auth-title { font-size: 18px; font-weight: 600; color: #333; margin-bottom: 8px; }
.auth-subtitle { color: #888; font-size: 14px; margin-bottom: 25px; }
.google-btn-container { display: flex; justify-content: center; margin-bottom: 15px; }

/* No Access */
.no-access-message { text-align: center; padding: 40px 20px; }
.no-access-icon { font-size: 48px; margin-bottom: 15px; }
.no-access-message h3 { color: #333; margin-bottom: 10px; }
.no-access-message p { color: #666; margin-bottom: 20px; }

/* Admin Panel */
.admin-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.admin-header h3 { margin-bottom: 5px; }
.admin-hint { color: #666; font-size: 14px; margin: 0; }
.admin-users-list { display: flex; flex-direction: column; gap: 12px; }
.admin-user-card { display: flex; align-items: center; gap: 15px; padding: 15px; background: #f8f9fa; border-radius: 8px; border: 1px solid #e0e0e0; }
.admin-user-info { flex: 1; }
.admin-user-info strong { display: block; color: #333; }
.admin-user-email { color: #888; font-size: 13px; }
.admin-badge { background: #ffd700; color: #333; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; margin-left: 8px; }
.admin-user-perms { display: flex; gap: 15px; }
.admin-user-perms label { display: flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn-delete-user { background: none; border: none; cursor: pointer; font-size: 18px; padding: 5px; opacity: 0.5; }
.btn-delete-user:hover { opacity: 1; }

.section {
    padding: 30px;
}

.hidden {
    display: none !important;
}

/* Форма пароля */
.password-form {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.password-form label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #333;
}

.password-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

.password-form input:focus {
    outline: none;
    border-color: #667eea;
}

.password-form button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.password-form button:hover {
    background: #5568d3;
}

/* Статус сообщение */
.status-message {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Форма группа */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Информация о версии */
.version-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.version-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.version-badge {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-left: 10px;
}

.version-header button {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.version-header button:hover {
    background: #218838;
}

/* Зона загрузки */
.upload-section {
    margin-bottom: 30px;
}

.upload-section h3 {
    margin-bottom: 10px;
    color: #333;
}

.upload-hint {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.upload-area {
    border: 3px dashed #d0d0d0;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-area.drag-over {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.upload-area p {
    color: #666;
    margin-bottom: 15px;
}

.upload-area button {
    padding: 10px 25px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.upload-area button:hover {
    background: #5568d3;
}

/* Предпросмотр */
.preview-section {
    margin-top: 30px;
}

.preview-section h3 {
    margin-bottom: 15px;
    color: #333;
}

#preview-table {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.preview-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    border-bottom: 1px solid #e0e0e0;
}

.preview-row:last-child {
    border-bottom: none;
}

.preview-row:nth-child(even) {
    background: #f8f9fa;
}

.preview-locale {
    padding: 15px;
    font-weight: 600;
    color: #667eea;
    border-right: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
}

.preview-text {
    padding: 15px;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Кнопки действий */
.action-buttons {
    display: flex;
    gap: 15px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #28a745;
    color: white;
}

.btn-primary:hover {
    background: #218838;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Сообщения */
.message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.error {
    color: #dc3545;
    margin-top: 10px;
    font-size: 14px;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
}

/* Загрузка */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== ТАБЫ ===== */
.tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 25px;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #667eea;
    background: #f8f9ff;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== СЕЛЕКТОР ПЛАТФОРМЫ ===== */
.platform-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.platform-btn {
    flex: 1;
    padding: 20px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.platform-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.platform-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    color: #667eea;
}

.platform-section {
    margin-bottom: 20px;
}

.platform-section.hidden {
    display: none;
}

/* ===== ANDROID SETUP ===== */
.android-setup-info {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.android-setup-info h4 {
    margin-bottom: 15px;
    color: #856404;
}

.setup-steps {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setup-step {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.step-number {
    width: 30px;
    height: 30px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.setup-step p {
    color: #666;
    font-size: 14px;
    margin-top: 4px;
}

/* ===== КНОПКА ПАРСИНГА ===== */
.btn-parse {
    margin-top: 10px;
    padding: 12px 25px;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-parse:hover {
    background: #138496;
}

/* ===== ДЕРЕВО СКРИНШОТОВ ===== */
#screenshots-tree {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.locale-group {
    margin-bottom: 15px;
}

.locale-header {
    font-weight: 600;
    color: #667eea;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 10px;
}

.resolution-group {
    margin-left: 20px;
    margin-bottom: 10px;
}

.resolution-header {
    font-weight: 500;
    color: #333;
    padding: 5px 0;
}

.screenshot-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: 20px;
    margin-top: 5px;
}

.screenshot-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
    color: #666;
}

.screenshot-item.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* ===== SUMMARY BOX ===== */
.summary-box {
    background: #e8f4fd;
    border: 1px solid #b8daff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

#screenshots-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
}

.summary-label {
    color: #666;
}

.summary-value {
    font-weight: 600;
    color: #333;
}

/* ===== ПРОГРЕСС БАР ===== */
.progress-section {
    margin-top: 20px;
}

.progress-bar {
    background: #e0e0e0;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

#progress-text {
    text-align: center;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.progress-log {
    background: #1e1e1e;
    color: #00ff00;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.progress-log .log-entry {
    margin-bottom: 5px;
}

.progress-log .log-success {
    color: #00ff00;
}

.progress-log .log-error {
    color: #ff6b6b;
}

.progress-log .log-info {
    color: #4dabf7;
}

/* ===== INFO TEXT ===== */
.info-text {
    color: #856404;
    background: #fff3cd;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 15px;
}

/* ===== CODE ===== */
code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

/* ===== PACKAGE SELECTOR ===== */
.package-selector {
    display: flex;
    gap: 10px;
}

.package-selector select {
    flex: 1;
}

.btn-add {
    padding: 12px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}

.btn-add:hover {
    background: #218838;
}

/* ===== CREDENTIALS ROW ===== */
.credentials-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.credentials-status {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.credentials-icon {
    font-size: 20px;
}

#credentials-text {
    color: #666;
    font-size: 14px;
}

.credentials-row.loaded {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.credentials-row.loaded #credentials-text {
    color: #155724;
}

.btn-credentials {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-credentials:hover {
    background: #5568d3;
}

.btn-settings {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-settings:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

/* ===== OTP TAB ===== */
.otp-header { margin-bottom: 15px; }
.otp-status-bar {
    display: flex; justify-content: space-between; align-items: center;
    background: #f8f9fa; border-radius: 8px; padding: 12px 16px; margin-bottom: 12px;
    border: 1px solid #e0e0e0;
}
.otp-status-bar strong { color: #667eea; }
.otp-timer { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #667eea; }
.otp-timer-bar { width: 80px; height: 6px; background: #e0e0e0; border-radius: 3px; overflow: hidden; }
#otp-timer-fill { height: 100%; background: linear-gradient(90deg, #667eea, #764ba2); border-radius: 3px; transition: width 1s linear; }
.otp-toolbar { display: flex; gap: 8px; align-items: center; }
.otp-auto-toggle {
    display: flex; align-items: center; gap: 5px; font-size: 13px; color: #666;
    cursor: pointer; padding: 6px 12px; border: 1px solid #d0d0d0; border-radius: 6px;
    background: #f8f9fa; transition: all 0.2s; white-space: nowrap; user-select: none;
}
.otp-auto-toggle:hover { border-color: #667eea; background: #f0f4ff; }
.otp-auto-toggle input:checked + span { color: #28a745; font-weight: 600; }
.btn-sm { padding: 8px 14px !important; font-size: 13px !important; }

.otp-add-form {
    background: #f0f4ff; border: 1px solid #d0d8f0; border-radius: 8px;
    padding: 16px; margin-bottom: 15px;
}
.otp-add-form h4 { color: #667eea; margin-bottom: 10px; font-size: 15px; }
.otp-form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.otp-form-row input[type="text"],
.otp-form-row input[type="email"] {
    flex: 1; min-width: 160px; padding: 8px 12px;
    border: 1px solid #d0d0d0; border-radius: 6px; font-size: 13px;
}
.otp-form-row input[type="text"]:focus,
.otp-form-row input[type="email"]:focus { border-color: #667eea; outline: none; }
.otp-hidden-toggle { display: flex; align-items: center; gap: 5px; font-size: 13px; color: #666; white-space: nowrap; cursor: pointer; }

.otp-loading { text-align: center; padding: 40px; color: #666; font-size: 15px; }
.otp-error { background: #f8d7da; color: #721c24; padding: 12px 16px; border-radius: 6px; border: 1px solid #f5c6cb; margin-bottom: 15px; }

.otp-table { width: 100%; border-collapse: collapse; border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
.otp-table thead th {
    background: #f0f4ff; padding: 10px 12px; text-align: left;
    font-size: 12px; text-transform: uppercase; color: #667eea; font-weight: 600; letter-spacing: 0.3px;
    border-bottom: 2px solid #d0d8f0;
}
.otp-table td { padding: 10px 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
.otp-table tr:hover td { background: #f8f9ff; }
.otp-row-hidden td { opacity: 0.55; }
.otp-row-hidden:hover td { opacity: 0.85; }
.otp-num { color: #aaa; font-size: 12px; }
.otp-name { font-weight: 500; word-break: break-all; font-size: 13px; }

.otp-code-cell { text-align: center; }
.otp-code {
    display: inline-block; font-family: 'Consolas', 'Monaco', monospace;
    font-size: 20px; font-weight: 700; letter-spacing: 3px; color: #28a745;
    background: #e8f5e9; padding: 4px 14px; border-radius: 6px; cursor: pointer;
    transition: all 0.15s; user-select: all;
}
.otp-code:hover { background: #c8e6c9; transform: scale(1.05); }
.otp-code:active { transform: scale(0.97); }

.otp-badge {
    display: inline-block; padding: 4px 10px; border-radius: 12px; border: none;
    font-size: 11px; font-weight: 600; cursor: pointer; transition: 0.15s;
}
.otp-badge-vis { background: #d4edda; color: #155724; }
.otp-badge-vis:hover { background: #c3e6cb; }
.otp-badge-hid { background: #fff3cd; color: #856404; }
.otp-badge-hid:hover { background: #ffeeba; }

.btn-danger { background: #dc3545; color: #fff; border: none; border-radius: 6px; cursor: pointer; padding: 6px 12px; font-size: 13px; }
.btn-danger:hover { background: #c82333; }

/* ===== FINANCE TABS ===== */
/* Google Connect Bar */
.google-connect-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px; margin-bottom: 12px; border-radius: 8px;
    background: #f8f9fa; border: 1px solid #dee2e6; font-size: 13px;
}
.gc-status { flex: 1; }
.gc-ok { color: #198754; }
.gc-no { color: #dc3545; }
.gc-btn { margin-left: 12px; white-space: nowrap; }

.finance-header { margin-bottom: 15px; }
.finance-header h3 { color: #333; margin: 0; }
.finance-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 15px; }
.finance-status-box {
    background: #f8f9fa; border: 2px solid #e0e0e0; border-radius: 8px;
    padding: 20px; min-height: 60px; display: flex; align-items: center;
    justify-content: center; text-align: center; color: #555; line-height: 1.6;
}
.finance-stats { font-size: 14px; }
.btn-danger-override { background: #dc3545 !important; }
.btn-danger-override:hover { background: #c82333 !important; }

/* Finance Modal List */
.fm-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }
.fm-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; background: #f8f9fa; border-radius: 6px; border: 1px solid #e0e0e0;
}
.fm-item span { flex: 1; }
.fm-item small { color: #888; margin-left: 10px; white-space: nowrap; }
.fm-close-btn {
    background: #e0e0e0; border: none; border-radius: 50%; width: 28px; height: 28px;
    font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: #666; transition: all 0.2s; flex-shrink: 0; padding: 0; line-height: 1;
}
.fm-close-btn:hover { background: #ccc; color: #333; }
.admin-user-perms { display: flex; gap: 10px; flex-wrap: wrap; }
