:root {
    --bg-color: #F5F5F7;
    --nav-bg: rgba(255, 255, 255, 0.8);
    --accent: #0071E3;
    --text: #1D1D1F;
    --border: rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.tank-vertical {
    height: 90%;
    width: 50%;
    background: #F5F5F7;
    border-radius: 10px;
    overflow: hidden;

}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text);
    overflow-x: hidden;
    /* Prevents horizontal scroll bleed; vertical handled by iframe */
    /* height: 100vh; */
    /* width: 100vw; */
}

/* ===============================
   Vertical Tank – Apple Style
================================ */

.tank-visual {
    height: 7.5em;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tank-shell {
    position: relative;
    width: 40px;
    height: 100%;
    background: #F5F5F7;
    border-radius: 20px;
    overflow: hidden;

    /* Apple inset depth */
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.08),
        inset 0 -2px 6px rgba(255, 255, 255, 0.8);
}

.tank-liquid {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0%;
    border-radius: 20px;
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);

    /* Liquid glow */
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.4),
        0 0 8px rgba(0, 0, 0, 0.05);

    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.tank-percent {
    margin-top: 6px;
    font-size: 1em;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}


.tank-division {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
}

.division {
    display: flex;
    flex-direction: column;
    align-content: center;
    align-items: center;
    justify-content: center;
}

/* Container Layout Adjustment */
.app-container {
    display: flex;
    /* Aligns iframe and sidebar side-by-side */
    height: calc(100vh - 60px);
    width: 100%;
    position: relative;
}

iframe {
    flex-grow: 1;
    border: none;
    width: 100%;
    height: 100%;
    /* Vital for iOS/Android iframe scrolling */
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    display: block;
}

/* ////////////////////////////////////////////////////// Sidebar Styling */
.side-nav {
    width: 100px;
    /* Desktop width */
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    gap: 20px;
    z-index: 0;
}

.side-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    width: 100%;
    transition: all 0.2s ease;
    opacity: 0.8;
}

.side-nav a:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.side-icon {
    font-size: 20px;
    margin-bottom: 4px;
    background: #f0f0f2;
    padding: 10px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
}

.app-content-wrapper {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    /* This ensures content isn't cut off by the mobile nav */
    padding-bottom: 100px;
}

.side-label {
    font-size: 11px;
    font-weight: 500;
    color: #86868B;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .side-nav {
        width: 60px;
        /* Slimmer for mobile */
        padding-top: 35px;
        gap: 75px;
    }

    .side-label {
        display: none;
        /* Hide text on mobile as requested */
    }

    .app-container {
        height: calc(100vh - 80px);
        /* Adjust for bottom mobile nav */
    }

    .side-icon {
        background: transparent;
        font-size: 24px;
    }
}

.side-icon svg {
    width: 20px;
    height: 20px;
    display: block;
    color: #424245;
    /* Darker Apple grey */
}

/* If the parent 'a' tag has an active class, change the SVG color */
.side-nav a.active .side-icon svg {
    color: #ffffff;
    stroke: #ffffff;
}

/* Mobile tweak for SVG size */
@media (max-width: 768px) {
    .side-icon svg {
        width: 24px;
        height: 24px;
    }
}


/* ////////////////////////////////////////////////////// Loader Styles */
.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.apple-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Navigation Logic */
.nav-desktop {
    height: 60px;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 40px;
}

.nav-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-desktop .links a {
    text-decoration: none;
    color: var(--text);
    margin-left: 25px;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.nav-desktop .links a:hover {
    opacity: 0.6;
}

.nav-mobile {
    display: none;
}

/* Mobile Adaptations */
@media (max-width: 768px) {
    .nav-desktop {
        display: none;
    }

    .app-container {
        /* vh fallback for old browsers */
        height: calc(100vh - 80px);
        /* dvh = dynamic viewport height — excludes browser chrome on real mobile */
        height: calc(100dvh - 80px);
    }

    .nav-mobile {
        display: flex;
        position: fixed;
        bottom: 0;
        width: 100%;
        /* Base height + safe area for iPhone home indicator */
        height: calc(80px + env(safe-area-inset-bottom, 20px));
        background: var(--nav-bg);
        backdrop-filter: blur(20px);
        border-top: 1px solid var(--border);
        justify-content: space-around;
        align-items: flex-start;
        padding-top: 8px;
        padding-bottom: env(safe-area-inset-bottom, 20px);
        z-index: 1000;
    }

    .mobile-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #86868B;
        font-size: 10px;
        padding-top: 10px;
    }

    .mobile-item .icon {
        font-size: 24px;
        margin-bottom: 4px;
    }
}


/* Login Specific Styles */
.login-body {
    background: linear-gradient(135deg, #e0e0e0 0%, #ffffff 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 100%;
    max-width: 380px;
    text-align: center;
    transition: transform 0.3s ease;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-header p {
    color: #86868B;
    font-size: 14px;
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 15px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #D2D2D7;
    background: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: #0071E3;
}

#login-btn {
    width: 100%;
    padding: 14px;
    background: #0071E3;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#login-btn:hover {
    background: #0077ED;
}

.error-message {
    color: #FF3B30;
    font-size: 13px;
    margin-top: 15px;
    display: none;
}

/* Shake Animation */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

.shake {
    animation: shake 0.4s ease-in-out 0s 2;
}

.btn-loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ///////////////////////////////////// tank level styling */

.tank-card {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease;
}

.tank-card:hover {
    transform: translateY(-2px);
}


.tank-card:active {
    transform: translateY(-4px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}


.tank-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.tank-name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #1D1D1F;
}

.tank-status {
    display: block;
    font-size: 11px;
    color: #86868B;
    margin-top: 2px;
}

.tank-stats {
    margin-bottom: 15px;
}

.current-liters {
    font-size: 20px;
    font-weight: 700;
    color: #1D1D1F;
}

.full-liters {
    font-size: 14px;
    color: #86868B;
    margin-left: 4px;
}

/* Flat Progress Bar */
.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar-bg {
    flex-grow: 1;
    height: 6px;
    background: #F5F5F7;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.percentage-label {
    font-size: 12px;
    font-weight: 600;
    color: #1D1D1F;
    min-width: 30px;
}


/* The percentage text */
.progress-label {
    font-size: 10px;
    color: white;
    font-weight: 700;
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.tank-wrapper {
    position: relative;
}

/* Local Loader Hidden by default */
.tank-local-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(2px);
    z-index: 5;
    display: none;
    /* Shown via JS */
    justify-content: center;
    align-items: center;
    border-radius: 16px;
}

.tank-wrapper.is-loading .tank-local-loader {
    display: flex;
}

/* Smaller spinner for inside cards */
.apple-spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: #0071E3;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.signal-bars-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
}

.signal-bars-wrapper .bar {
    width: 3px;
    background-color: #D2D2D7;
    /* Inactive color */
    border-radius: 1px;
}

.signal-bars-wrapper .bar.active {
    background-color: #34C759;
    /* Apple System Green */
}

/* If signal is critical (1 bar), make it red */
.signal-bars-wrapper .bar.active:nth-child(1):nth-last-child(4) {
    background-color: #FF3B30;
    /* Only if it's the only bar */
}

/* Center Header */
.app-content-wrapper h2.main-title {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
    color: #1d1d1f;
    margin: 40px 0;
    text-transform: uppercase;
}

/* Collapsible Group Container */
.tank-group {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Group Header/Toggle */
.group-header {
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #ffffff;
    user-select: none;
}

.group-header:hover {
    background: #fbfbfd;
}

.group-title {
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
}

.group-chevron {
    transition: transform 0.3s ease;
    color: #86868b;
}

/* Grid inside the group */
.group-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 24px;
    transition: max-height 0.3s ease-out, opacity 0.3s ease;
}

/* Closed State */
.tank-group.collapsed .group-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    pointer-events: none;
}

.tank-group.collapsed .group-chevron {
    transform: rotate(-90deg);
}

.off-grey-header {
    background-color: #919192;

}


/*///////////////////////////////////////////////////////// Table Layout */
.table-container {
    background: white;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);

    /* FIX: This allows the table to scroll horizontally without breaking the layout */
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling for iOS */
}


.table-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 15px;
}

.search-wrapper {
    position: relative;
    flex-grow: 1;
    max-width: 400px;
}

.search-wrapper svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #86868B;
}

.search-wrapper input {
    width: 100%;
    padding: 10px 10px 10px 40px;
    border-radius: 10px;
    border: 1px solid #D2D2D7;
    background: #F5F5F7;
    outline: none;
}

/* Table Styling */
.apple-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    /* Forces scroll instead of squashing columns on mobile */
}


.apple-table th {
    text-align: left;
    padding: 12px 15px;
    font-size: 13px;
    color: #86868B;
    font-weight: 500;
    border-bottom: 1px solid #F5F5F7;
}

.apple-table td {
    padding: 15px;
    font-size: 14px;
    border-bottom: 1px solid #F5F5F7;
}

/* Remove the min-width to prevent horizontal scroll */
.apple-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 0;
    /* Changed from 600px */
}

@media (max-width: 768px) {

    /* Hide the original table header */
    .apple-table thead {
        display: none;
    }

    /* Make every row look like a card */
    .apple-table tr {
        display: block;
        background: #ffffff;
        border: 1px solid #F5F5F7;
        border-radius: 15px;
        margin-bottom: 15px;
        padding: 10px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    }

    /* Make every cell a full-width block */
    .apple-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 10px 5px;
        border-bottom: 1px solid #f9f9fb;
        font-size: 10px;
    }

    /* Remove border from the last cell (Actions) */
    .apple-table td:last-child {
        border-bottom: none;
    }

    /* Insert the column label from the data-label attribute */
    .apple-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #86868B;
        text-align: left;
        font-size: 12px;
        text-transform: uppercase;
    }

    /* Special styling for Client Name to make it the "Header" of the card */
    .apple-table td.client-name {
        background: #fbfbfd;
        margin: -10px -10px 10px -10px;
        padding: 15px;
        border-radius: 15px 15px 0 0;
        justify-content: center;
        font-size: 16px;
        text-align: center;
    }

    .apple-table td.client-name::before {
        display: none;
        /* Don't show "Client Name" label since it's obvious */
    }

    /* Ensure progress bar takes up enough space in the split row */
    .progress-col .progress-container {
        width: 150px;
        /* Give it a fixed width on mobile so it doesn't vanish */
    }
}

.client-name {
    font-weight: 600;
    color: #1D1D1F;
}

/* Buttons */
.btn-edit {
    background: #F5F5F7;
    color: #0071E3;
    border: none;
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit:hover {
    background: #0071E3;
    color: white;
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success {
    background: #E8F5E9;
    color: #2E7D32;
}


/* //////////////////////////////// Button Styling */
.btn-primary {
    background-color: #0071E3;
    /* Apple Blue */
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.2);
    white-space: nowrap;
    /* Prevents text wrapping on small screens */
}

.btn-primary:hover {
    background-color: #0077ED;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 113, 227, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    background-color: #0062C4;
}

.btn-primary span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-danger {
    background: #FFF2F2;
    color: #FF3B30;
    /* Apple Red */
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #FF3B30;
    color: white;
}

/* Ensure the container keeps them aligned on desktop */
.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
}

@media (max-width: 768px) {
    .table-actions {
        flex-direction: column;
        /* Stack search and button */
        align-items: stretch;
    }

    .btn-primary {
        width: 100%;
        /* Full width on mobile for easier tapping */
        height: 44px;
        /* Apple's recommended minimum touch target height */
    }
}


/* //////////////////////////////////////////////////////////// Modal Overlay */
/* Fix the background overlay to handle scrolling correctly */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    /* Centers the card on desktop */
    padding: 15px;
    /* Prevents the card from touching screen edges */
    z-index: 2000;
}

/* Fix the card structure */
.modal-card {
    background: #fff;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    /* Prevents the modal from exceeding the screen height */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    /* Stacks Header, Body, Footer */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    /* Clips children to the border-radius */
}

/* Ensure the body doesn't swallow the scroll */
.modal-body {
    padding: 20px;
    overflow-y: auto;
    /* This makes the middle section scrollable */
    flex-grow: 1;
    /* Takes up available space */
}

/* Optional: Make the tank list scrollable internally 
   so the whole modal doesn't get TOO long */
.tank-checkbox-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 10px;
    background: #f9f9f9;
}

/* Keep the Header at the top */
.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    /* Prevents header from squishing */
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #86868B;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    /* Prevents footer from squishing */
}

.btn-secondary {
    background: #F5F5F7;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ///////////////////////////////////////////// Welcome Header */
.sub-text {
    color: #86868B;
    font-size: 14px;
    margin-top: 4px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 30px 0 15px 0;
    color: #1D1D1F;
}

/* Stats Grid Layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon Colors */
.icon-blue {
    background: #E3F2FD;
    color: #0071E3;
}

.icon-green {
    background: #E8F5E9;
    color: #34C759;
}

.icon-orange {
    background: #FFF3E0;
    color: #FF9500;
}

.icon-red {
    background: #FFEBEE;
    color: #FF3B30;
}

.stat-label {
    font-size: 12px;
    color: #86868B;
    display: block;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #1D1D1F;
}

/* Action Buttons */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.action-btn {
    background: white;
    border: 1px solid #D2D2D7;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: #0071E3;
    color: #0071E3;
}

.action-icon {
    font-size: 20px;
}



/* Tab Navigation */
.settings-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: #F5F5F7;
    padding: 5px;
    border-radius: 12px;

    /* FIXES START HERE */
    overflow-x: auto;
    /* Allows horizontal scrolling */
    white-space: nowrap;
    /* Keeps buttons on one line */
    max-width: 100%;
    /* Keeps container within screen bounds */
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iPhone */
    scrollbar-width: none;
    /* Hides scrollbar on Firefox */
}

.settings-tabs {
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    position: relative;
}

/* Scroll hint animation — mobile only */
@media (max-width: 768px) {
    .settings-tabs {
        animation: tabs-hint 1.2s ease-out 0.5s 1 forwards;
    }

    @keyframes tabs-hint {
        0% {
            transform: translateX(0);
        }

        25% {
            transform: translateX(-18px);
        }

        50% {
            transform: translateX(-12px);
        }

        75% {
            transform: translateX(-18px);
        }

        100% {
            transform: translateX(0);
        }
    }

    /* Stronger fade on mobile to reinforce the hint */
    .settings-tabs {
        mask-image: linear-gradient(to right, black 75%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, black 75%, transparent 100%);
    }
}

/* Hide scrollbar for Chrome, Safari and Opera */
.settings-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 8px 20px;
    border: none;
    background: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #86868B;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    /* Prevents buttons from squashing/shrinking */
}

.tab-btn.active {
    background: white;
    color: #1D1D1F;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Tab Logic */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

code {
    background: #F5F5F7;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: #FF3B30;
}


.segmented-control {
    display: flex;
    background: #F5F5F7;
    padding: 4px;
    border-radius: 10px;
    gap: 4px;
}

.seg-btn {
    flex: 1;
    border: none;
    background: none;
    padding: 8px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #86868B;
    cursor: pointer;
    transition: all 0.2s;
}

.seg-btn.active {
    background: white;
    color: #1D1D1F;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}


/* Container for input and label */
.input-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: #86868B;
    margin-left: 4px;
}

/* The actual select element */
.input-group select {
    appearance: none;
    /* Removes default browser arrow */
    -webkit-appearance: none;
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    color: #1D1D1F;
    background-color: #F5F5F7;
    border: 1px solid #D2D2D7;
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;

    /* Custom Apple-style arrow icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2386868b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

/* Interaction States */
.input-group select:hover {
    background-color: #E8E8ED;
    border-color: #86868B;
}

.input-group select:focus {
    background-color: #FFFFFF;
    border-color: #0071E3;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

/* Optional: Styling for the dropdown options */
.input-group select option {
    background: #FFFFFF;
    color: #1D1D1F;
    padding: 10px;
}

.tank-checkbox-list {
    background: #F5F5F7;
    border: 1px solid #D2D2D7;
    border-radius: 12px;
    max-height: 150px;
    overflow-y: auto;
    padding: 10px;
}

.check-item {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    /* Larger padding for mobile taps */
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.check-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

.btn-link {
    background: none;
    border: none;
    color: #0071E3;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.tank-group-header {
    background: #E8E8ED;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #1D1D1F;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 10px;
    border-radius: 6px;
}

.tank-group-header:first-child {
    margin-top: 0;
}

.tank-sub-header {
    padding: 5px 10px 2px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #0071E3;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.check-item {
    padding-left: 15px !important;
    /* Indent tanks under headers */
}