html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: #f3f6f9;
    color: #263445;
}

* {
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

.emsa-layout {
    display: flex;
    min-height: 100vh;
    background: #f3f6f9;
}

.emsa-sidebar {
    width: 265px;
    min-width: 265px;
    height: 100vh;
    background: #162231;
    box-shadow: 4px 0 18px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    align-self: flex-start;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.emsa-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.emsa-topbar {
    min-height: 76px;
    padding: 12px 28px;
    background: #ffffff;
    border-bottom: 1px solid #e3e8ee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-title {
    color: #172333;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.2;
}

.topbar-subtitle {
    color: #7a8797;
    font-size: 0.82rem;
    margin-top: 3px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-icon {
    width: 42px;
    height: 42px;
    border: 1px solid #dde4eb;
    border-radius: 12px;
    background: #ffffff;
    font-size: 1.05rem;
    cursor: pointer;
}

    .topbar-icon:hover {
        background: #f4f7fa;
    }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #f0a500;
    color: #172333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

    .user-info strong {
        color: #263445;
        font-size: 0.9rem;
    }

    .user-info span {
        color: #8491a0;
        font-size: 0.75rem;
        margin-top: 3px;
    }

.emsa-content {
    width: 100%;
    padding: 28px;
}

.nav-header {
    height: 76px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
}

    .brand-link:hover {
        color: #ffffff;
    }

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #f0a500;
    color: #172333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 900;
}

.brand-logo-img {
    background: #ffffff;
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    width: 100%;
}

    .brand-logo-img img {
        max-width: 100%;
        height: auto;
        display: block;
    }

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

    .brand-text strong {
        color: #ffffff;
        font-size: 1.15rem;
        letter-spacing: 0.08rem;
    }

    .brand-text span {
        margin-top: 4px;
        color: #9eabba;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.08rem;
    }

.nav-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 12px 24px;
}

.nav-section-title {
    margin: 18px 12px 8px;
    color: #78889a;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.09rem;
}

.nav-item {
    min-height: 45px;
    padding: 10px 13px;
    margin-bottom: 4px;
    border-radius: 10px;
    color: #c7d0da;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    font-weight: 600;
}

    .nav-item:hover {
        background: rgba(255, 255, 255, 0.07);
        color: #ffffff;
    }

    .nav-item.active {
        background: #f0a500;
        color: #172333;
        box-shadow: 0 5px 14px rgba(240, 165, 0, 0.25);
    }

.nav-icon {
    width: 23px;
    min-width: 23px;
    text-align: center;
    font-size: 1rem;
}

.nav-footer {
    padding: 16px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d1d8df;
}

.status-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
    background: #3bc774;
    box-shadow: 0 0 8px rgba(59, 199, 116, 0.7);
}

.footer-status div {
    display: flex;
    flex-direction: column;
}

.footer-status strong {
    font-size: 0.76rem;
}

.footer-status span {
    margin-top: 3px;
    color: #7f8d9d;
    font-size: 0.68rem;
}

#blazor-error-ui {
    background: #fff3cd;
    bottom: 0;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.8rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.45rem;
        border: 0;
        background: transparent;
        font-size: 1.4rem;
    }

@media (max-width: 900px) {
    .emsa-layout {
        display: block;
    }

    .emsa-sidebar {
        width: 100%;
        min-width: 100%;
        min-height: auto;
        position: relative;
    }

    .nav-header {
        height: 64px;
    }

    .nav-container {
        display: flex;
        overflow-x: auto;
        gap: 5px;
        padding: 10px;
    }

    .nav-section-title,
    .nav-footer {
        display: none;
    }

    .nav-item {
        min-width: max-content;
        margin: 0;
    }

    .emsa-topbar {
        position: relative;
        padding: 12px 16px;
    }

    .emsa-content {
        padding: 18px 14px;
    }

    .topbar-subtitle,
    .user-info {
        display: none;
    }
}


/* EMSA Work Order v1 */
.work-order-page{max-width:1180px;margin:0 auto;padding:8px 0 32px}
.work-order-header{display:flex;justify-content:space-between;gap:24px;align-items:flex-start;background:linear-gradient(135deg,#123b66,#0b2744);color:#fff;border-radius:20px;padding:24px 28px;margin-bottom:16px;box-shadow:0 10px 30px rgba(15,23,42,.12)}
.work-order-header h1{margin:3px 0 4px;font-size:30px;font-weight:800}
.eyebrow{font-size:12px;font-weight:800;letter-spacing:.12em;color:#bcd2e8}
.header-summary{display:flex;flex-wrap:wrap;gap:8px;color:#dce8f4;font-size:14px}
.status-pill{background:#fff3cd;color:#765600;border:1px solid #ffe69c;border-radius:999px;padding:8px 12px;font-size:12px;font-weight:800;white-space:nowrap}
.wo-tabs{display:flex;gap:8px;overflow-x:auto;padding:4px 2px 12px}
.wo-tab{border:1px solid #dce4ec;background:#fff;color:#526171;border-radius:12px;padding:10px 14px;font-weight:700;display:flex;align-items:center;gap:7px;white-space:nowrap}
.wo-tab:hover{border-color:#9db9d5;color:#123b66}
.wo-tab.active{background:#123b66;border-color:#123b66;color:#fff}
.tab-count{min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:rgba(255,255,255,.2);display:inline-flex;align-items:center;justify-content:center;font-size:11px}
.wo-card{background:#fff;border:1px solid #dfe6ed;border-radius:18px;padding:24px;min-height:420px;box-shadow:0 6px 22px rgba(15,23,42,.05)}
.section-heading{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:22px}
.section-heading h2{margin:0 0 4px;font-size:22px;font-weight:800;color:#172033}
.section-heading p{margin:0;color:#6b7887}
.selection-summary{background:#e8f0fb;color:#123b66;border-radius:999px;padding:8px 12px;font-weight:800;font-size:13px}
.wo-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.wo-form-grid .span-2{grid-column:1/-1}
.worker-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.worker-card{display:flex;align-items:center;gap:11px;text-align:left;border:1px solid #dce4ec;background:#fff;border-radius:14px;padding:13px;transition:.15s}
.worker-card:hover{border-color:#8aaed1;transform:translateY(-1px)}
.worker-card.selected{background:#eef6ff;border-color:#165dff;box-shadow:0 0 0 2px rgba(22,93,255,.08)}
.worker-card strong,.worker-card small{display:block}
.worker-card small{color:#718096;margin-top:2px}
.worker-check{width:30px;height:30px;border-radius:10px;background:#edf2f7;color:#123b66;display:flex;align-items:center;justify-content:center;font-weight:900;flex:0 0 auto}
.worker-card.selected .worker-check{background:#165dff;color:#fff}
.item-list{display:flex;flex-direction:column;gap:12px}
.simple-item{display:grid;grid-template-columns:44px 1fr 36px;gap:12px;align-items:start;border:1px solid #e0e7ee;border-radius:15px;padding:14px;background:#fbfcfe}
.item-icon{width:42px;height:42px;border-radius:12px;background:#edf4fb;display:flex;align-items:center;justify-content:center}
.item-fields{display:flex;flex-direction:column;gap:9px}
.quantity-row{display:grid;grid-template-columns:1fr 120px 150px;gap:9px}
.icon-button{border:0;border-radius:10px;width:34px;height:34px;font-size:22px;line-height:1}
.icon-button.danger{background:#fff1f2;color:#be123c}
.empty-state{border:1px dashed #cbd5df;border-radius:14px;padding:44px;text-align:center;color:#738091;background:#fbfcfd}
.document-actions{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.document-placeholder{border:1px dashed #b9c7d5;background:#f8fafc;border-radius:14px;padding:28px 14px;font-weight:800;color:#405266}
.journal{border-left:2px solid #d8e2ec;margin-left:8px;padding-left:22px}
.journal-entry{position:relative;display:flex;gap:12px;padding:4px 0}
.journal-dot{position:absolute;left:-29px;top:8px;width:12px;height:12px;background:#165dff;border-radius:50%;box-shadow:0 0 0 4px #eaf2ff}
.journal-entry strong,.journal-entry small{display:block}
.journal-entry small{color:#718096}
.wo-footer{display:flex;justify-content:space-between;align-items:center;margin-top:16px;padding:14px 0}
.footer-actions{display:flex;gap:10px}
@media(max-width:900px){.worker-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.quantity-row{grid-template-columns:1fr 100px}.quantity-row .form-select:last-child{grid-column:1/-1}}
@media(max-width:640px){.work-order-header{padding:20px;flex-direction:column}.wo-card{padding:17px}.wo-form-grid,.worker-grid,.document-actions{grid-template-columns:1fr}.wo-form-grid .span-2{grid-column:auto}.section-heading,.wo-footer{flex-direction:column;align-items:stretch}.footer-actions .btn{width:100%}.quantity-row{grid-template-columns:1fr 90px}}
