:root {
    --primary: #1a73e8;
    --primary-dark: #1558b0;
    --success: #0d904f;
    --danger: #d93025;
    --bg: #f1f3f4;
    --card-bg: #ffffff;
    --text: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* Header */
.app-header {
    background: var(--primary);
    color: white;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.client-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.client-name {
    font-size: 14px;
    font-weight: 500;
}

.client-id {
    font-size: 11px;
    opacity: 0.8;
}

/* Main */
.app-main {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Balance Card */
.balance-section {}

.balance-card {
    background: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
    color: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.balance-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.85;
    margin-bottom: 8px;
}

.balance-amount {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.balance-currency {
    font-size: 14px;
    opacity: 0.8;
}

.card-info-line {
    margin-top: 12px;
    font-size: 12px;
    opacity: 0.75;
    font-family: monospace;
    letter-spacing: 1px;
}

/* Transfer Section */
.transfer-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.form-group {
    margin-bottom: 16px;
    transition: opacity 0.3s ease;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-select, .form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text);
    background: var(--card-bg);
    transition: border-color 0.2s;
    outline: none;
}

.form-select:focus, .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.transfer-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.transfer-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

.transfer-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.transfer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Result Section */
.result-section {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-card {
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
}

.result-card.success {
    background: #e6f4ea;
    border: 1px solid #ceead6;
}

.result-card.failed {
    background: #fce8e6;
    border: 1px solid #f5c6c0;
}

.result-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.result-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.result-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.result-details {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
    background: rgba(0,0,0,0.05);
    border-radius: 6px;
    padding: 10px;
    text-align: left;
    white-space: pre-line;
}

/* History Section */
.history-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

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

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}

.history-item .hi-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-item .hi-dest {
    font-weight: 500;
    color: var(--text);
}

.history-item .hi-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.history-item .hi-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.history-item .hi-amount {
    font-weight: 600;
    color: var(--danger);
}

.history-item .hi-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.hi-status.success {
    background: #e6f4ea;
    color: var(--success);
}

.hi-status.failed {
    background: #fce8e6;
    color: var(--danger);
}

.refresh-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.refresh-btn:hover {
    background: rgba(26, 115, 232, 0.08);
}

/* Footer */
.app-footer {
    padding: 16px 20px;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-text {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 480px) {
    .app-container {
        max-width: 100%;
    }
    .balance-amount {
        font-size: 28px;
    }
}

/* ═══ SMS-эмулятор ═══ */
#smsWidget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 999;
    font-family: inherit;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
#smsWidget .sms-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    user-select: none;
}
#smsWidget .sms-badge {
    background: #e74c3c;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    margin-left: auto;
    margin-right: 10px;
}
#smsWidget .sms-body {
    padding: 10px;
    overflow-y: auto;
    max-height: 400px;
    display: none;
}
#smsWidget .sms-empty {
    text-align: center;
    color: #aaa;
    font-size: 13px;
    padding: 20px;
}
#smsWidget .sms-item {
    background: #f8f9fc;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-left: 3px solid #667eea;
}
#smsWidget .sms-item.used { opacity: 0.55; border-left-color: #ccc; }
#smsWidget .sms-phone { font-size: 12px; color: #666; }
#smsWidget .sms-code { font-size: 22px; font-weight: 700; font-family: monospace; color: #333; letter-spacing: 4px; margin: 4px 0; }
#smsWidget .sms-meta { display: flex; justify-content: space-between; font-size: 11px; color: #888; }
#smsWidget .sms-status.active { color: #27ae60; font-weight: 600; }
#smsWidget .sms-status.verified { color: #3498db; }
#smsWidget .sms-status.expired { color: #e74c3c; }
#smsWidget .sms-copy {
    margin-top: 6px; width: 100%; padding: 6px; border: none;
    background: #eee; color: #333; border-radius: 6px; cursor: pointer; font-size: 12px;
}
#smsWidget .sms-copy:hover { background: #ddd; }
