* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f3f6f9;
    color: #1f2937;
}

a {
    text-decoration: none;
}

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

.sidebar {
    width: 270px;
    background: #0f2f24;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
}

.sidebar-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 22px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #22c55e;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #052e16;
    font-weight: 800;
}

.sidebar-brand h2 {
    margin: 0;
    font-size: 20px;
}

.sidebar-brand p {
    margin: 3px 0 0;
    font-size: 12px;
    color: #bbf7d0;
}

.sidebar-menu {
    padding: 14px 12px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 13px;
    color: #e5e7eb;
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 14px;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: #1f7a4d;
    color: #ffffff;
}

.sidebar-footer {
    padding: 14px 12px;
    border-top: 1px solid rgba(255,255,255,0.12);
}

.sidebar-footer a {
    display: block;
    color: #ffffff;
    background: rgba(255,255,255,0.08);
    padding: 12px 13px;
    border-radius: 10px;
}

.main-area {
    margin-left: 270px;
    width: calc(100% - 270px);
    min-height: 100vh;
}

.topbar {
    background: #ffffff;
    padding: 18px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
    color: #111827;
}

.topbar p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 13px;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

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

.logout-top {
    white-space: nowrap;
}

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

.user-box strong {
    display: block;
    font-size: 14px;
}

.user-box span {
    display: block;
    font-size: 12px;
    color: #64748b;
}

.content-area {
    padding: 24px;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

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

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.card {
    background: #ffffff;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid #e5e7eb;
}

.card h1,
.card h2,
.card h3 {
    margin-top: 0;
}

.module-card {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
}

.module-card.blue {
    border-left: 6px solid #2563eb;
}

.module-card.orange {
    border-left: 6px solid #ea580c;
}

.module-icon {
    font-size: 42px;
    margin-bottom: 8px;
}

.kpi-card h3 {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}

.kpi-card .kpi {
    font-size: 34px;
    font-weight: 800;
    margin-top: 10px;
    color: #111827;
}

.btn {
    display: inline-block;
    border: none;
    background: #1f7a4d;
    color: #ffffff;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
}

.btn:hover {
    opacity: 0.92;
}

.btn.blue {
    background: #2563eb;
}

.btn.orange {
    background: #ea580c;
}

.btn.red {
    background: #dc2626;
}

.btn.gray {
    background: #475569;
}

.btn.light {
    background: #e5e7eb;
    color: #111827;
}

.alert {
    padding: 11px 13px;
    border-radius: 8px;
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 700;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

input,
select,
textarea {
    width: 100%;
    padding: 11px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    margin: 7px 0 14px;
    background: #ffffff;
    font-size: 14px;
}

label {
    font-size: 14px;
    font-weight: 700;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

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

.table th {
    background: #f8fafc;
    color: #334155;
}

.badge {
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.blue-b {
    background: #dbeafe;
    color: #1d4ed8;
}

.red-b {
    background: #fee2e2;
    color: #b91c1c;
}

.yellow-b {
    background: #fef9c3;
    color: #854d0e;
}

.orange-b {
    background: #ffedd5;
    color: #c2410c;
}

.green-b {
    background: #dcfce7;
    color: #15803d;
}

.status-green {
    color: #15803d;
    font-weight: 800;
}

.status-orange {
    color: #c2410c;
    font-weight: 800;
}

.purple-b {
    background: #ede9fe;
    color: #6d28d9;
}

.map-box {
    height: 420px;
    border-radius: 16px;
    background: linear-gradient(135deg, #dbeafe, #dcfce7);
    border: 1px dashed #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #334155;
    font-weight: 700;
}

.compact-map {
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px;
    overflow: auto;
}

.map-pin {
    display: inline-block;
    padding: 9px 11px;
    border-radius: 8px;
    background: #ffffff;
    color: #111827;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    font-size: 13px;
}

.map-pin.silage_survey {
    border-color: #2563eb;
}

.map-pin.straw_raw {
    border-color: #dc2626;
}

.map-pin.bundle_ready {
    border-color: #ea580c;
}

.map-pin.cleared {
    border-color: #16a34a;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form input,
.inline-form select {
    width: 120px;
    margin: 0;
}

.field-capture-box {
    border: 1px solid #dbe4ee;
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    margin: 8px 0 16px;
}

.field-capture-box h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.point-list {
    margin: 12px 0;
    padding-left: 22px;
    color: #334155;
    font-size: 14px;
}

.help {
    font-size: 13px;
    color: #64748b;
}

.page-title {
    margin-bottom: 18px;
}

.page-title h2 {
    margin: 0;
    font-size: 24px;
}

.page-title p {
    margin: 5px 0 0;
    color: #64748b;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-header h1,
.section-header h2,
.section-header h3 {
    margin: 0;
}

.field-hero {
    background: #14532d;
    color: #ffffff;
    border-radius: 10px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.field-hero h2 {
    margin: 0;
    font-size: 28px;
}

.field-hero p {
    margin: 6px 0 0;
    color: #dcfce7;
}

.field-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}

.field-action {
    min-height: 150px;
    border-radius: 10px;
    padding: 18px;
    color: #111827;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.field-action span {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #ffffff;
    background: #1f7a4d;
}

.field-action strong {
    display: block;
    font-size: 21px;
    margin-top: 14px;
}

.field-action em {
    display: block;
    color: #64748b;
    font-style: normal;
    margin-top: 6px;
    font-size: 14px;
}

.field-action.silage {
    border-left: 6px solid #2563eb;
}

.field-action.straw {
    border-left: 6px solid #ea580c;
}

.field-action.map {
    border-left: 6px solid #16a34a;
}

.field-action.pickup {
    border-left: 6px solid #7c3aed;
}

.step-list {
    display: grid;
    gap: 10px;
}

.step-list div {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.step-list span {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1f7a4d;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex: 0 0 auto;
}

@media(max-width: 900px) {
    .sidebar {
        position: relative;
        width: 100%;
        min-height: auto;
    }

    .app-layout {
        flex-direction: column;
    }

    .main-area {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .two-col {
        grid-template-columns: 1fr;
    }

    .content-area {
        padding: 14px;
    }

    .card {
        padding: 16px;
        border-radius: 10px;
    }

    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .inline-form input {
        width: 100%;
    }

    .field-hero {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px;
    }

    .field-hero h2 {
        font-size: 24px;
    }

    .field-action {
        min-height: 130px;
    }
}
