/* ======================================================
   GLOBAL RESET
====================================================== */

* {
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #0f141a;
    color: #ffffff;

    display: flex;
    flex-direction: column;

    min-height: 100dvh; /* dynamic viewport fix */
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ======================================================
   BUTTON LINK
====================================================== */

.link {
    display: inline-block;
    padding: 12px 20px;
    background: #ff6a00;
    color: #ffffff;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    transition: 0.2s ease;
}

.link:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.link:active {
    transform: translateY(0);
}

/* ======================================================
   LAYOUT STRUCTURE
====================================================== */

.layout {
    display: flex;
    flex: 1;
    min-height: 100%;
}

.content {
    flex: 1;
    padding: 16px;
    padding-bottom: 85px; /* space for mobile nav */
}

/* ======================================================
   SIDEBAR (DESKTOP ONLY)
====================================================== */

.sidebar {
    width: 220px;
    background: #151c24;
    padding: 20px;
    display: none;
}

.sidebar h2 {
    font-size: 18px;
    margin-bottom: 20px;
}

.sidebar a {
    display: block;
    padding: 10px 0;
    opacity: 0.8;
}

.sidebar a:hover {
    opacity: 1;
}

/* ======================================================
   SUMMARY STRIP
====================================================== */

.summary-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.stat-card {
    background: #151c24;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    font-size: 9px;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.stat-value {
    font-size: 15px;
    font-weight: bold;
    margin-top: 3px;
}

/* ======================================================
   FORMS
====================================================== */

.ro-form input,
.ro-form select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: none;
    background: #1d2630;
    color: #fff;
    font-size: 14px;
}

.ro-form button {
    width: 100%;
    padding: 12px;
    background: #ff6a00;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

/* ======================================================
   REPAIR ORDER CARDS
====================================================== */

.ro-card {
    background: #151c24;
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.ro-main {
    display: block;
    padding: 14px;
}

.ro-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ro-number {
    font-size: 14px;
}

.badge {
    display: inline-block;
    min-width: 70px;
    text-align: center;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 10px;
    letter-spacing: 0.5px;
}

.badge.cpay {
    background: #1e3a5f;
}

.badge.warranty {
    background: #5f1e1e;
}

.ro-desc {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 5px;
}

.ro-hours {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 12px;
}

.ro-hours .label {
    display: block;
    opacity: 0.6;
}

.efficiency {
    font-weight: bold;
}

/* ======================================================
   ANALYTICS
====================================================== */

.analytics-hero {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    text-align: center;
}

.hero-label {
    font-size: 11px;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.hero-value {
    font-size: 22px;
    font-weight: bold;
    margin-top: 4px;
}

.analytics-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.analytics-card {
    background: #151c24;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    min-width: 0;
}

.small-label {
    font-size: 9px;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.big-value {
    font-size: 14px;
    font-weight: bold;
    margin-top: 2px;
}

.sub-text {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 3px;
}

.analytics-row-item {
    display: grid;
    grid-template-columns: 1fr 1.3fr 1fr 0.8fr;
    align-items: center;
    background: #151c24;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 11px;
    gap: 6px;
}

.analytics-row-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ======================================================
   COLOR STATES
====================================================== */

.green { background: #1e3f2a !important; }
.yellow { background: #4a3e1e !important; }
.red { background: #4a1e1e !important; }
.neutral { background: #151c24 !important; }

/* ======================================================
   MOBILE NAVIGATION BAR
====================================================== */

.mobile-nav {
    position: fixed;
    left: 0;
    width: 100%;
    height: 65px;
    background: #121820;
    border-top: 1px solid #ff6a00;

    display: flex;
    justify-content: space-around;
    align-items: center;

    padding-bottom: env(safe-area-inset-bottom);
    z-index: 1000;

    backdrop-filter: blur(8px);

    bottom: 0; /* default fallback */
}

.mobile-nav .nav-item {
    font-size: 16px;
    opacity: 0.85;
}

.mobile-nav .nav-item:hover {
    opacity: 1;
}

.ro-card-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
}

.ro-main {
    flex: 1;
    padding: 14px;
}

.ro-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    gap: 8px;
}

.close-btn {
    font-size: 12px;
    color: #ff6a00;
}

.ro-checkbox {
    width: 18px;
    height: 18px;
}

.bulk-row {
    margin-top: 15px;
    text-align: right;
}

.bulk-btn {
    background: #ff6a00;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
}

/* ======================================================
   DESKTOP ADJUSTMENTS
====================================================== */

@media (min-width: 768px) {

    .sidebar {
        display: block;
    }

    .mobile-nav {
        display: none;
    }

    .summary-strip {
        display: flex;
        gap: 12px;
    }

    .analytics-row {
        display: flex;
        gap: 12px;
    }

    .analytics-card {
        flex: 1;
        padding: 14px;
    }

    .hero-value {
        font-size: 38px;
    }

    .big-value {
        font-size: 18px;
    }

    .analytics-row-item {
        font-size: 13px;
    }
}