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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ed 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.5;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 40px;
    max-height: 40px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.logo-badge {
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.user-email {
    font-size: 14px;
    color: var(--gray-600);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
}

.btn-success {
    background: var(--success);
    color: white;
}

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

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

/* Login Form */
.login-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: white;
    box-shadow: 0 8px 16px -4px rgba(37, 99, 235, 0.3);
}

.login-card h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-700) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.login-form-group input {
    width: 100%;
    padding: 16px 18px;
    font-size: 15px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    background: var(--gray-50);
}

.login-form-group input::placeholder {
    color: var(--gray-400);
}

.login-form-group input:hover {
    border-color: var(--gray-300);
    background: white;
}

.login-form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.login-error {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 16px;
    min-height: 20px;
    text-align: center;
}

.btn-login {
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    border: none;
    box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.4);
    transition: all 0.2s ease;
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -2px rgba(37, 99, 235, 0.5);
}

.btn-login:active:not(:disabled) {
    transform: translateY(0);
}

.btn-login svg {
    transition: transform 0.2s ease;
}

.btn-login:hover svg {
    transform: translateX(4px);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

/* Login Section */
.login-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 420px;
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.login-card .subtitle {
    color: var(--gray-500);
    margin-bottom: 32px;
    font-size: 15px;
}

/* Main Content */
.main-content {
    flex: 1;
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select {
    padding: 12px;
    font-size: 15px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-with-addon {
    display: flex;
    align-items: stretch;
}

.input-with-addon .addon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-weight: 500;
    color: var(--gray-600);
    min-width: 40px;
}

.input-with-addon .addon.addon-clickable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, color 0.2s;
}

.input-with-addon .addon.addon-clickable:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.input-with-addon input {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    flex: 1;
}

/* Toggle Group */
.toggle-group {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.toggle-group input {
    display: none;
}

.toggle-btn {
    flex: 1;
    padding: 10px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-group input:checked + .toggle-btn {
    background: white;
    color: var(--gray-900);
    box-shadow: var(--shadow);
}

.toggle-group #sideBuy:checked + .toggle-btn {
    background: var(--success);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.toggle-group #sideSell:checked + .toggle-btn {
    background: var(--danger);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* Quote Display */
.quote-display-card {
    border: 2px solid var(--primary);
}

.quote-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.quote-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--warning);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.quote-timer.expired {
    background: var(--danger);
}

.timer-icon {
    font-size: 16px;
}

.quote-details {
    margin-bottom: 20px;
}

.quote-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}

.quote-row:last-child {
    border-bottom: none;
}

.quote-row.highlight {
    background: var(--gray-50);
    margin: 0 -24px;
    padding: 16px 24px;
    border-bottom: none;
}

.quote-row .label {
    color: var(--gray-500);
    font-size: 14px;
}

.quote-row .value {
    font-weight: 600;
    color: var(--gray-900);
}

.quote-row .value.large {
    font-size: 20px;
}

.quote-row .value.mono {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
}

.sandbox-badge {
    background: var(--warning);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.quote-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Result Card */
.result-card {
    text-align: center;
    padding: 48px 24px;
}

.result-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.result-icon.error {
    background: var(--danger);
}

.result-card h2 {
    margin-bottom: 8px;
}

.result-card p {
    color: var(--gray-500);
    margin-bottom: 24px;
}

.result-details {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 24px;
    text-align: left;
}

.result-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.result-details .detail-row:not(:last-child) {
    border-bottom: 1px solid var(--gray-200);
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px 0;
    color: var(--gray-500);
    font-size: 12px;
    line-height: 1.6;
}

.footer p {
    margin-bottom: 8px;
}

.footer p:last-child {
    margin-bottom: 0;
}

.footer .risk-warning {
    font-weight: 600;
    color: var(--gray-600);
    margin-top: 12px;
}

/* Alert Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    animation: fadeIn 0.2s ease-out;
}

.modal-card {
    background: white;
    border-radius: var(--radius);
    padding: 32px;
    max-width: 360px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--warning);
    color: white;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.modal-message {
    font-size: 15px;
    color: var(--gray-700);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.3s ease-out;
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }

    .login-card {
        padding: 32px 24px;
    }

    .card {
        padding: 20px;
    }

    .quote-row.highlight {
        margin: 0 -20px;
        padding: 12px 20px;
    }
}
