:root {
    --bg-top: #f2f7fc;
    --bg-bottom: #dce7f3;
    --surface: #ffffff;
    --surface-alt: #f7fbff;
    --text-main: #162336;
    --text-muted: #52657f;
    --border: #c9d8e8;
    --brand: #005f8f;
    --brand-hover: #004e75;
    --brand-soft: #2f98c3;
    --accent: #f2a23a;
    --focus-ring: rgba(0, 95, 143, 0.24);
    --shadow-soft: 0 14px 30px rgba(8, 29, 51, 0.14);
    --radius-lg: 18px;
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 10px;
    font-family: "Manrope", "Segoe UI", "Helvetica Neue", sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at 8% 8%, rgba(0, 95, 143, 0.14), transparent 40%),
        radial-gradient(circle at 88% 14%, rgba(242, 162, 58, 0.14), transparent 45%),
        linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

#main {
    width: min(100%, 1040px);
    margin: 0 auto;
    padding: 24px 20px;
    font-size: clamp(18px, 4.8vw, 22px);
    line-height: 1.5;
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.oil-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.oil-page-header h1 {
    margin: 0;
    text-align: left;
    font-size: clamp(28px, 3.2vw, 40px);
    line-height: 1.1;
}

.oil-page-logo {
    display: block;
    width: auto;
    max-height: 72px;
    object-fit: contain;
}

#main .oil-report-table th,
#main .oil-report-table td,
#main .oil-report-table td:first-child {
    font-weight: 400;
    font-size: inherit;
}

#main .oil-report-table {
    width: 100%;
    margin-top: 12px;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 12px 24px rgba(8, 29, 51, 0.08);
}

#main .oil-report-table thead th {
    padding: 14px 12px;
    font-size: 0.92em;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-main);
    background: linear-gradient(180deg, #eff5fb, #e2edf7);
}

#main .oil-report-table tbody tr {
    transition: background-color 0.18s ease;
}

#main .oil-report-table tbody tr:nth-child(odd) td {
    background: #f9fcff;
}

#main .oil-report-table tbody tr:nth-child(even) td {
    background: #eef5fb;
}

#main .oil-report-table tbody tr:hover td {
    background: #e4f0f8;
}

#main .oil-report-table td {
    padding: 12px 12px;
    vertical-align: middle;
}

#main .oil-report-table tfoot td {
    padding: 14px 12px;
    color: var(--text-main);
    background: linear-gradient(180deg, #edf4fa, #e2ebf4);
}

#main .oil-report-table td:first-child {
    width: 34%;
    font-size: inherit;
    font-weight: 400;
    color: inherit;
    line-height: inherit;
}

.oil-report-delete-button {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 100%;
    padding: 12px 14px;
    border: 1px solid #e8a9a9;
    border-radius: 10px;
    color: #b33a3a;
    background: linear-gradient(180deg, #fff7f7, #ffecec);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(179, 58, 58, 0.10);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
    font: 700 18px/1.1 "Manrope", "Segoe UI", sans-serif;
    box-sizing: border-box;
}

.oil-report-delete-button:hover {
    color: #8f2727;
    background: #ffe8e8;
    box-shadow: 0 10px 18px rgba(179, 58, 58, 0.20);
    transform: translateY(-1px);
}

.oil-report-delete-button:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(179, 58, 58, 0.18);
}

.oil-report-delete-cell {
    padding: 0 !important;
    width: 12%;
    background: inherit;
}

.oil-report-delete-form {
    margin: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.oil-report-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.oil-report-filter-group {
    min-width: 0;
}

.oil-edit-auth-actions {
    display: block;
}

.oil-report-add-actions {
    display: flex;
    align-items: flex-end;
}

.oil-edit-auth-submit {
    width: 100%;
    min-height: 58px !important;
    margin-top: 0 !important;
}

#main .oil-report-add-button {
    width: 100%;
    min-height: 58px;
    margin: 6px 0 14px;
}

.oil-entry-label {
    font-size: clamp(16px, 3vw, 19px);
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
    margin-bottom: 4px;
}

#main .oil-report-filter select[name='aircraft'] {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 6px 0 14px;
}

#main .oil-report-filter input[type='date'],
#main .oil-report-filter input[type='datetime-local'],
#main .oil-report-filter input[type='password'] {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 6px 0 14px;
}

#main input[type='text'],
#main input[type='number'],
#main input[type='date'],
#main input[type='datetime-local'],
#main input[type='password'],
#main form select[name='aircraft'] {
    width: 100%;
    max-width: none;
    min-height: 58px;
    padding: 10px 12px;
    margin: 2px 0 8px;
    font: inherit;
    font-size: clamp(20px, 5vw, 24px);
    color: var(--text-main);
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

#main form td {
    padding: 3px 0;
}

#main form td:first-child {
    width: 30%;
    margin-top: 8px;
    font-size: clamp(20px, 5.2vw, 26px);
    line-height: 1.25;
    text-align: left;
}

#main input[type='text']:focus,
#main input[type='number']:focus,
#main input[type='date']:focus,
#main input[type='datetime-local']:focus,
#main input[type='password']:focus,
#main form select[name='aircraft']:focus,
#main input[type='submit']:focus,
#main input[type='range']:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

#main input[type='submit'] {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    min-width: 220px;
    padding: 12px 24px;
    border: none;
    border-radius: 999px;
    font: 700 clamp(20px, 5vw, 24px) "Manrope", "Segoe UI", sans-serif;
    letter-spacing: 0.02em;
    color: #ffffff;
    background: linear-gradient(135deg, var(--brand), var(--brand-soft));
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#main input[type='submit']:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, var(--brand-hover), #257fa8);
    box-shadow: 0 10px 22px rgba(0, 95, 143, 0.26);
}

#main input[type='submit']:active {
    transform: translateY(0);
}

#main input[type='submit']:disabled {
    opacity: 1;
    color: #5f6f7d;
    border: 1px solid #aebcc8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    filter: grayscale(0.25) saturate(0.5);
    background: linear-gradient(135deg, #c7d1d9, #dce4eb);
}

#main input[type='submit']:disabled:hover,
#main input[type='submit']:disabled:active {
    transform: none;
    box-shadow: none;
    background: linear-gradient(135deg, #c7d1d9, #dce4eb);
}

#main input[type='range'] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    max-width: none;
    display: block;
    margin: 6px 0 10px;
    background: transparent;
}

#main input[type='range']::-webkit-slider-runnable-track {
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), var(--brand-soft));
}

#main input[type='range']::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 32px;
    width: 32px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 6px 12px rgba(0, 95, 143, 0.35);
    cursor: pointer;
}

#main input[type='range']::-moz-range-track {
    height: 12px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), var(--brand-soft));
}

#main input[type='range']::-moz-range-thumb {
    height: 32px;
    width: 32px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 6px 12px rgba(0, 95, 143, 0.35);
    cursor: pointer;
}

#main input[type='range']::-ms-track {
    width: 100%;
    height: 12px;
    border-color: transparent;
    border-width: 16px 0;
    color: transparent;
    background: transparent;
}

#main input[type='range']::-ms-fill-lower,
#main input[type='range']::-ms-fill-upper {
    border-radius: 999px;
    background: var(--brand);
}

#main input[type='range']::-ms-thumb {
    height: 32px;
    width: 32px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 6px 12px rgba(0, 95, 143, 0.35);
    cursor: pointer;
}

.oil-chart-panel,
#chart_div {
    width: 100%;
    min-height: 420px;
    margin-top: 18px;
    padding: 12px;
    border: 1px solid rgba(201, 216, 232, 0.45);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(8, 29, 51, 0.06);
    overflow: hidden;
}

.oil-result-status {
    margin-top: 16px;
    padding: 18px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

.oil-result-success {
    color: #0f5f2d;
    background: #e8f7ed;
    border-color: #a9dfb8;
}

.oil-result-failure {
    color: #8a1e1e;
    background: #fdeeee;
    border-color: #efbcbc;
}

@media (max-width: 860px) {
    #main {
        width: 100%;
    }

    #main table,
    #main tbody,
    #main tr,
    #main td {
        display: block;
        width: 100%;
    }

    #main td {
        padding: 3px 0;
    }

    #main td:first-child {
        width: 100%;
        margin-top: 8px;
        font-size: clamp(20px, 5.2vw, 26px);
        line-height: 1.25;
        text-align: left;
    }

    #main form td:first-child {
        width: 100%;
        text-align: left;
    }

    .oil-report-filter {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 18px;
    }

    .oil-entry-label {
        display: block;
        width: 100%;
        margin-top: 8px;
        margin-bottom: 4px;
    }

    .oil-edit-auth-actions {
        align-items: stretch;
    }

    .oil-report-add-actions {
        display: block;
    }

    #main .oil-report-filter select[name='aircraft'],
    #main .oil-report-filter input[type='date'] {
        min-height: 58px;
        padding: 10px 12px;
        margin: 2px 0 8px;
        font-size: clamp(20px, 5vw, 24px);
        border-radius: var(--radius-md);
    }

    #main input[type='submit'] {
        width: 100%;
        min-width: 0;
        margin-top: 4px;
    }

    .oil-page-header {
        margin-bottom: 18px;
    }

    .oil-page-logo {
        max-height: 56px;
    }

    .oil-page-header h1 {
        font-size: clamp(28px, 3.2vw, 40px);
    }

    #main .oil-report-table {
        display: table;
        width: 100%;
    }

    #main .oil-report-table thead {
        display: table-header-group;
    }

    #main .oil-report-table tbody {
        display: table-row-group;
        font-size: clamp(16px, 4vw, 20px);
    }

    #main .oil-report-table tfoot {
        display: table-footer-group;
        font-size: clamp(16px, 4vw, 20px);
    }

    #main .oil-report-table tr {
        display: table-row;
    }

    #main .oil-report-table td,
    #main .oil-report-table th {
        display: table-cell;
        width: auto;
        padding: 8px 10px;
        vertical-align: middle;
    }

    .oil-result-status {
        margin-top: 8px;
        padding: 14px 12px;
        font-size: clamp(20px, 5.2vw, 26px);
    }
}