.flight-calculator {
    width: min(1080px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 32px);
    box-sizing: border-box; padding: 16px; border: 1px solid #8495a5; border-radius: 8px;
    background: #f5f7fa; color: #202d39; font: 13px Arial, sans-serif; letter-spacing: 0;
}
.flight-calculator::backdrop { background: #17212b80; }
.flight-calculator header, .flight-calculator footer, .calculator-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flight-calculator header { justify-content: space-between; margin-bottom: 14px; }
.flight-calculator h2 { font-size: 16px; margin: 0; }
.flight-calculator label { font: inherit; color: inherit; margin: 0; }
.flight-calculator button { display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-height: 30px;
    padding: 5px 9px; border: 1px solid #a5b2bf; border-radius: 4px; background: #fff; color: inherit; font: inherit; cursor: pointer; }
.flight-calculator button:hover { background: #e1eaf2; }
.flight-calculator button:disabled { opacity: .45; cursor: default; }
.flight-calculator :focus-visible { outline: 2px solid #078575; outline-offset: 1px; }
.calculator-settings { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.calculator-settings label { display: grid; gap: 5px; flex: 0 1 175px; min-width: 130px; }
.flight-calculator input[type=number] { box-sizing: border-box; width: 100%; min-width: 0; height: 30px; padding: 4px 7px;
    background: #fff; color: inherit; border: 1px solid #a5b2bf; border-radius: 3px; font: inherit; text-align: right; }
.calculator-actions { margin-bottom: 12px; }
.calculator-actions label { display: flex; align-items: center; gap: 5px; margin-right: auto; }
.calculator-actions label span { white-space: nowrap; }
.flight-calculator input[type=checkbox] { width: 16px; height: 16px; flex: 0 0 16px; margin: 0 4px 0 0; }
.calculator-sheet { max-height: calc(100dvh - 310px); overflow: auto; border: 1px solid #acb8c2; }
.calculator-sheet table { border-collapse: separate; border-spacing: 0; min-width: 100%; table-layout: fixed; }
.calculator-sheet th, .calculator-sheet td { border-right: 1px solid #cbd3db; border-bottom: 1px solid #cbd3db; padding: 5px 8px; height: 34px; box-sizing: border-box; }
.calculator-sheet thead th { position: sticky; top: 0; background: #dce5ed; z-index: 2; min-width: 180px; white-space: nowrap; text-align: left; }
.calculator-sheet tbody th { position: sticky; left: 0; z-index: 1; background: #edf1f5; text-align: left; font-weight: 400; min-width: 176px; max-width: 190px; }
.calculator-sheet thead th:first-child { left: 0; z-index: 3; }
.calculator-sheet thead th button { margin-right: 7px; }
.calculator-sheet td { text-align: right; background: #fff; }
.calculator-cell { display: grid; grid-template-columns: 28px minmax(100px,1fr); align-items: center; gap: 5px; }
.calculator-cell select { width:100%; min-width:0; padding:4px 7px; font:inherit; color:inherit; background:var(--field,#fff); border:1px solid #a5b2bf; border-radius:3px; }
.flight-calculator button[data-lock] { width: 26px; height: 26px; min-height: 26px; padding: 3px; border-color: transparent; }
.flight-calculator button[data-lock][aria-pressed=true] { color: #a55c00; background: #fff0d6; }
.flight-calculator input[readonly] { background: #edf0f3; border-color: transparent; }
.calculator-feedback { min-height: 20px; padding: 9px 0; color: #86520a; }
.calculator-feedback[data-error=true] { color: #b02d35; }
.flight-calculator footer output { margin-right: auto; font-variant-numeric: tabular-nums; }
.flight-calculator footer { justify-content: flex-end; }
.flight-calculator button[data-calculator-action=apply] { background: #087c6c; color: #fff; border-color: #087c6c; }
#flightCalculatorButton { width: 28px; height: 28px; padding: 3px; flex: 0 0 28px; border: 1px solid #269f90; border-radius: 5px; background: transparent; color: inherit; display: grid; place-items: center; }
#flightCalculatorButton[hidden] { display: none; }
body[data-theme=night] .flight-calculator { background: #23272d; color: #e7edf2; }
body[data-theme=night] .flight-calculator button, body[data-theme=night] .flight-calculator input[type=number], body[data-theme=night] .calculator-sheet td { background: #30363f; color: #e7edf2; border-color: #58616e; }
body[data-theme=night] .calculator-sheet th { background: #3b434f; color: #f0f4f7; }
body[data-theme=night] .flight-calculator button[data-lock][aria-pressed=true] { color: #ffc576; background: #503f27; }
body[data-theme=night] .calculator-feedback[data-error=true] { color: #ff989c; }
body[data-theme=night] .flight-calculator input[readonly] { background: #242a31; }
@media(max-width:600px) {
    .flight-calculator { padding: 10px; }
    .calculator-settings { gap: 8px; }
    .calculator-settings label { flex: 1 1 120px; }
    .calculator-sheet { max-height: calc(100dvh - 350px); }
    .calculator-sheet thead th:first-child, .calculator-sheet tbody th { min-width: 140px; max-width: 140px; width: 140px; }
    .flight-calculator footer output { flex-basis: 100%; }
}
