:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #475569;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    border-bottom: 2px solid var(--border);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.service-status {
    display: flex;
    gap: 0.5rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-badge.online {
    background: var(--success);
    color: white;
}

.status-badge.offline {
    background: var(--error);
    color: white;
}

.status-badge.checking {
    background: var(--warning);
    color: white;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.symbol-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.symbol-count {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-left: auto;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.symbol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: 0.25rem;
}

.symbol-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.symbol-item:hover {
    border-color: var(--primary);
}

.symbol-item.selected {
    background: var(--primary);
    border-color: var(--primary);
}

.symbol-item input[type="checkbox"] {
    margin-right: 0.5rem;
}

.symbol-item label {
    cursor: pointer;
    font-size: 0.875rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.input {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-primary:disabled {
    background: var(--border);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.btn-large {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.jobs-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.job-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    padding: 1rem;
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.job-id {
    font-weight: 600;
    color: var(--primary);
}

.job-status {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.job-status.pending {
    background: var(--warning);
    color: white;
}

.job-status.running {
    background: var(--primary);
    color: white;
}

.job-status.completed {
    background: var(--success);
    color: white;
}

.job-status.failed {
    background: var(--error);
    color: white;
}

.job-progress {
    margin: 0.5rem 0;
}

.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 0.25rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.job-details {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.results-table th,
.results-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.results-table th {
    background: var(--bg-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.results-table td {
    font-size: 0.875rem;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.placeholder {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.error {
    color: var(--error);
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.success-message {
    color: var(--success);
    padding: 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    border-radius: 0.25rem;
    margin-top: 1rem;
}

.success-message p {
    margin-bottom: 0.5rem;
}

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

.backfill-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.backfill-controls input[type="number"] {
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Symbols Table */
.symbols-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.symbols-table th {
    background: var(--bg-primary);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.symbols-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.symbols-table tbody tr {
    transition: background 0.2s;
}

.symbols-table tbody tr:hover {
    background: var(--bg-primary);
}

.symbols-table tbody tr.selected {
    background: rgba(59, 130, 246, 0.1);
}

.symbol-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.symbol-status.complete {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.symbol-status.needs-backfill {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.symbol-status.no-data {
    background: rgba(51, 65, 85, 0.2);
    color: var(--text-secondary);
}

.backfill-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    background: var(--warning);
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.backfill-btn:hover {
    background: #d97706;
}

.backfill-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
}

/* Collapsible Content */
#symbols-table-content {
    transition: all 0.3s ease-in-out;
    overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .symbol-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .symbols-table {
        font-size: 0.75rem;
    }

    .symbols-table th,
    .symbols-table td {
        padding: 0.5rem;
    }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-button:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

/* Tablet and below */
@media (max-width: 1024px) {
    .container {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .card {
        margin-bottom: 1rem;
    }
}

/* Mobile devices */
@media (max-width: 768px) {
    .container {
        padding: 0.75rem;
    }

    h1 {
        font-size: 1.25rem;
    }

    h2 {
        font-size: 1rem;
    }

    /* Tab buttons - scrollable */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-button {
        white-space: nowrap;
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    /* Trading sub-tabs */
    .trading-subtab {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.75rem !important;
        white-space: nowrap;
    }

    /* Hero Performance Card */
    #tab-trading .card:first-of-type > div {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }

    /* Quick Stats Grid */
    #trading-subtab-overview > div:nth-of-type(2) {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    /* Capital Allocation */
    #trading-subtab-overview > div:nth-of-type(3) > div:last-child {
        grid-template-columns: 1fr !important;
    }

    /* Tables */
    table {
        font-size: 0.8rem;
        min-width: 600px;
    }

    table th,
    table td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }

    /* Buttons */
    .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }

    .btn-small {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    /* Signal Flow */
    #flow-timeline-container > div {
        padding: 0.75rem !important;
    }

    #flow-timeline-container > div > div:first-child {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    #flow-timeline-container > div > div:nth-of-type(2) {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Flow nodes */
    #flow-timeline-container > div > div:nth-of-type(2) > div > div > div:first-child {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.25rem !important;
    }

    /* Filter controls */
    #trading-subtab-flow > div > div:nth-of-type(2) {
        flex-direction: column !important;
    }

    #trading-subtab-flow > div > div:nth-of-type(2) select,
    #trading-subtab-flow > div > div:nth-of-type(2) button {
        width: 100%;
    }

    /* Card headers */
    .card-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    /* Form inputs */
    input[type="text"],
    input[type="number"],
    input[type="password"],
    select {
        font-size: 16px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }

    h1 {
        font-size: 1.125rem;
    }

    /* Hero card - single column */
    #tab-trading .card:first-of-type > div {
        grid-template-columns: 1fr !important;
    }

    /* Quick stats - single column */
    #trading-subtab-overview > div:nth-of-type(2) {
        grid-template-columns: 1fr !important;
    }

    .trading-subtab {
        font-size: 0.75rem !important;
        padding: 0.35rem 0.6rem !important;
    }

    table {
        font-size: 0.7rem;
    }
}

/* ============================================================================
   Tooltips for table headers
   ============================================================================ */

th[title] {
    position: relative;
}

th[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: var(--text-primary);
    border: 1px solid var(--primary);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 400;
    white-space: normal;
    width: max-content;
    max-width: 300px;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(59, 130, 246, 0.3);
    line-height: 1.4;
    text-align: left;
}

th[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 2px;
    border: 6px solid transparent;
    border-top-color: var(--primary);
    z-index: 1001;
}

/* Adjust tooltip position for edge columns */
th[title]:first-child:hover::after {
    left: 0;
    transform: translateX(0);
}

th[title]:last-child:hover::after {
    left: auto;
    right: 0;
    transform: translateX(0);
}

th[title]:first-child:hover::before {
    left: 20px;
    transform: translateX(0);
}

th[title]:last-child:hover::before {
    left: auto;
    right: 20px;
    transform: translateX(0);
}

/* Add a subtle help cursor */
th[title] {
    cursor: help !important;
}

/* Tooltip animation */
@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

th[title]:hover::after {
    animation: tooltipFadeIn 0.2s ease-out;
}

/* Mobile - simpler tooltips */
@media (max-width: 768px) {
    th[title]:hover::after {
        max-width: 250px;
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Pulse animation for pending changes */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Draggable row styling */
.draggable-row {
    cursor: move;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.draggable-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.drop-zone {
    transition: all 0.3s ease;
}

.drag-over {
    background: rgba(59, 130, 246, 0.3) !important;
    border-color: var(--primary) !important;
}

/* Drag placeholder */
.drag-placeholder {
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ============================================================================
   Modal Styles
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 2% auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-modal {
    color: var(--text-secondary);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

/* Scrollbar for modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ==================== MOBILE RESPONSIVE STYLES ==================== */

/* Accessibility: Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    button, a, input, select {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Tablet and below (768px) */
@media (max-width: 768px) {
    /* Container and spacing */
    .container {
        padding: 1rem;
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    /* Header responsive */
    header {
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem;
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }

    h1 {
        font-size: 1.5rem;
    }

    .service-status {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    /* Touch targets - minimum 44x44px */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1rem !important;
        font-size: 1rem !important;
    }

    button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove 300ms tap delay */
    a, button, input, select {
        touch-action: manipulation;
    }

    /* Enhanced :active state for touch feedback */
    .btn:active {
        opacity: 0.8;
        transform: scale(0.98);
    }

    /* Input fields - 16px minimum to prevent iOS zoom */
    input[type="text"],
    input[type="number"],
    input[type="password"],
    input[type="email"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
        padding: 1rem !important;
        min-height: 44px !important;
    }

    input:focus,
    select:focus {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

    input::placeholder {
        color: var(--text-secondary);
        opacity: 0.8;
    }

    /* Table horizontal scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--border);
        border-radius: 0.25rem;
        margin: 1rem 0;
    }

    table {
        min-width: 100%;
        width: max-content;
        font-size: 0.875rem;
    }

    table th,
    table td {
        padding: 0.5rem !important;
        white-space: nowrap;
    }

    /* Sticky first column for better UX */
    table tbody td:first-child,
    table thead th:first-child {
        position: sticky;
        left: 0;
        background: var(--bg-secondary);
        z-index: 2;
    }

    table thead th:first-child {
        z-index: 3;
    }

    /* Tab navigation */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 0.25rem;
        padding: 0.25rem;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-button {
        white-space: nowrap;
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
        min-height: 44px;
        flex-shrink: 0;
    }

    /* Modal responsive */
    .modal-content {
        width: 95vw;
        max-width: 95vw;
        max-height: 90vh;
        margin: auto;
    }

    .modal-header {
        position: sticky;
        top: 0;
        z-index: 10;
        padding: 1rem;
    }

    .close-modal {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    /* Symbol grid */
    .symbol-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.5rem;
    }

    .symbol-item {
        padding: 0.75rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .symbol-item input[type="checkbox"] {
        width: 18px;
        height: 18px;
        min-width: 18px;
        margin-right: 0.5rem;
    }

    .symbol-item label {
        font-size: 0.875rem;
    }

    /* Cards and sections */
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .section {
        margin-bottom: 1.5rem;
    }

    /* Form groups */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    /* Responsive grid */
    .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Small mobile (480px) */
@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }

    header {
        padding: 0.5rem;
        padding-left: max(0.5rem, env(safe-area-inset-left));
        padding-right: max(0.5rem, env(safe-area-inset-right));
    }

    h1 {
        font-size: 1.25rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    .tab-button {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .symbol-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .modal-content {
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    table {
        font-size: 0.75rem;
    }

    table th,
    table td {
        padding: 0.375rem !important;
    }

    .btn {
        font-size: 0.875rem !important;
        padding: 0.625rem 0.875rem !important;
    }

    .card {
        padding: 0.75rem;
    }
}
