* {
    box-sizing: border-box;
}

:root {
    --sidebar-width: 280px;
    --bg: #f3f6fb;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --nav-bg: #081531;
    --nav-item: rgba(255,255,255,0.05);
    --nav-hover: #2453e6;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #081531 0%, #0b1736 100%);
    color: #fff;
    padding: 22px 18px;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
}

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

.brand {
    font-size: 28px;
    font-weight: 800;
}

.sidebar-close {
    display: none;
    border: 0;
    background: #2f66f3;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 22px;
    cursor: pointer;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.side-nav a {
    display: block;
    padding: 15px 16px;
    border-radius: 14px;
    background: var(--nav-item);
    color: #e2e8f0;
    font-size: 17px;
    transition: 0.2s ease;
}

.side-nav a:hover,
.side-nav a.active {
    background: var(--nav-hover);
    color: #fff;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
}

.mobile-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    border: 0;
    background: #2f66f3;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 22px;
    cursor: pointer;
}

.mobile-title {
    font-size: 18px;
    font-weight: 700;
}

.page-content {
    padding: 28px;
}

.page-header {
    margin-bottom: 22px;
}

.page-header h1,
.topbar h1 {
    margin: 0;
    font-size: 28px;
    color: #0f172a;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 18px;
}

.wms-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: #fff;
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border-left: 8px solid #cbd5e1;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.wms-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12);
}

.card-icon {
    width: 40px;
    flex-shrink: 0;
    text-align: center;
    font-size: 30px;
    line-height: 1;
}

.card-body h2 {
    margin: 0 0 8px 0;
    font-size: 18px;
}

.card-body p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.card-alerts { border-left-color: #94a3b8; }
.card-safety { border-left-color: #ef4444; }
.card-mandatory { border-left-color: #f59e0b; }
.card-engine { border-left-color: #2563eb; }
.card-systems { border-left-color: #22c55e; }


.page-content,
.panel,
.layout-2,
.content-grid,
.form-grid,
.form-grid > *,
label {
    min-width: 0;
}

.panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.layout-2,
.content-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
    max-width: 100%;
}

input,
select,
textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

@media (max-width: 960px) {
    .layout-2,
    .content-grid {
        grid-template-columns: 1fr;
    }
}

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



label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: #334155;
    font-weight: 600;
}

input,
select,
textarea,
button,
.btn-secondary {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #cfd6e0;
    font: inherit;
}

textarea {
    resize: vertical;
}

button,
.btn-secondary {
    display: inline-block;
    width: auto;
    text-decoration: none;
    background: #1f5eff;
    color: #fff;
    border: 0;
    cursor: pointer;
    padding: 10px 16px;
    font-weight: 600;
}

.btn-secondary {
    background: #64748b;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    background: #f8fafc;
    color: #334155;
    font-weight: 700;
}

tr.ok td { background: #eefbf1; }
tr.warning td { background: #fff8e6; }
tr.danger td { background: #fdecec; }
tr.neutral td { background: #f3f4f6; }

.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.badge-ok { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-neutral { background: #e5e7eb; color: #374151; }

.sidebar-backdrop {
    display: none;
}

@media (max-width: 960px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        width: min(86vw, 320px);
    }

    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-topbar {
        display: flex;
    }

    .page-content {
        padding: 18px;
    }

    .layout-2 {
        grid-template-columns: 1fr;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 999;
    }
}

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

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .page-header h1,
    .topbar h1 {
        font-size: 24px;
    }
}