/* Agent lotniczy — strona ustawień. Kolory jak w mailu z alertem. */
:root {
  --navy: #0b3d6b; --navy-2: #0b2540; --bg: #eef2f6; --card: #fff; --line: #dde3ea;
  --text: #1c2430; --muted: #5f6b7a; --blue: #1a73e8; --blue-d: #1557b0;
  --green-bg: #e6f4ea; --green: #137333; --amber-bg: #fef7e0; --amber: #8a5300;
  --red-bg: #fce8e6; --red: #b3261e; --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* Nagłówek */
.top { background: var(--navy); color: #fff; }
.top-in { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 12px; }
.brand { background: none; border: 0; color: #fff; font-weight: 700; font-size: 18px; padding: 0; cursor: pointer; }
.link { background: none; border: 0; color: #d6e4f5; cursor: pointer; padding: 8px 6px; }
.link:hover { color: #fff; text-decoration: underline; }

main.wrap { padding-top: 18px; padding-bottom: 48px; }
h1 { font-size: 20px; margin: 0; color: var(--navy-2); }
h2 { font-size: 17px; margin: 0; color: var(--navy-2); }
h3 { font-size: 15px; margin: 0 0 10px; color: var(--navy-2); }

/* Przyciski */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.btn:hover { border-color: #b9c4d0; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--blue-d); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .55; cursor: default; }

/* Pasek stanu */
.status { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }
.status b { color: var(--navy-2); }
.status.warn { border-color: #f1c27d; background: var(--amber-bg); }

.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

/* Karty kierunków */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; }
.card.off { opacity: .6; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.route { color: var(--muted); font-size: 14px; margin-top: 2px; }
.when { font-weight: 600; margin: 10px 0 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: inline-block; font-size: 13px; padding: 3px 10px; border-radius: 12px;
  background: #edf1f6; color: var(--navy-2); }
.chip.good { background: var(--green-bg); color: var(--green); font-weight: 600; }
.chip.warn { background: var(--amber-bg); color: var(--amber); }
.card-actions { display: flex; gap: 8px; margin-top: 12px; }
.empty { text-align: center; padding: 32px 16px; }

/* Przełącznik włącz/wyłącz */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 13px; color: var(--muted); white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 42px; height: 24px; border-radius: 12px; background: #c5ced8; position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { left: 21px; }
.switch input:focus-visible + .track { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Okno (formularz, ustawienia, potwierdzenia) */
.modal { position: fixed; inset: 0; background: rgba(11, 37, 64, .45); display: flex;
  align-items: flex-start; justify-content: center; overflow-y: auto; padding: 24px 12px; z-index: 10; }
.modal-box { background: var(--card); border-radius: 12px; width: 100%; max-width: 640px;
  padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.modal-box.narrow { max-width: 420px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.close { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* Formularz */
fieldset { border: 0; border-top: 1px solid var(--line); margin: 14px 0 0; padding: 14px 0 0; }
legend { font-weight: 700; color: var(--navy-2); padding: 0 8px 0 0; }
.field { margin-bottom: 12px; }
.field > label, .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--navy-2); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #c5ced8; border-radius: 8px; background: #fff; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.range { display: flex; align-items: center; gap: 8px; }
.range input { flex: 1; min-width: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid #c5ced8;
  border-radius: 8px; cursor: pointer; background: #fff; }
.check input { margin: 0; }
.check:has(input:checked) { border-color: var(--blue); background: #e8f0fe; }
.seg { display: inline-flex; border: 1px solid #c5ced8; border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.seg label { padding: 8px 14px; cursor: pointer; border-right: 1px solid #c5ced8; }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:checked) { background: var(--navy); color: #fff; }
.day-hours { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.preview { margin-top: 16px; padding: 12px 14px; border-radius: 8px; background: #edf1f6; font-size: 14px; }
.preview.bad, .errors { background: var(--red-bg); color: var(--red); }
.errors { padding: 10px 14px; border-radius: 8px; margin-top: 12px; }
.errors ul, .preview ul { margin: 0; padding-left: 18px; }

/* Logowanie */
.login { max-width: 380px; margin: 40px auto; }
.login .card { padding: 22px; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: #edf1f6;
  padding: 8px 10px; border-radius: 6px; word-break: break-all; }

/* Komunikat */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--navy-2);
  color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 20; max-width: calc(100% - 32px); }
.toast.bad { background: var(--red); }

/* Pole „Dokąd lecisz” z listą podpowiedzi */
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: 70px; z-index: 5; margin: 0; padding: 4px 0;
  list-style: none; background: #fff; border: 1px solid #c5ced8; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(11, 37, 64, .18); max-height: 320px; overflow-y: auto; }
.combo-item { padding: 8px 12px; cursor: pointer; line-height: 1.35; }
.combo-item.active, .combo-item:hover { background: #e8f0fe; }
.combo-item .code { display: inline-block; font-size: 12px; font-weight: 700; color: var(--navy);
  background: #edf1f6; border-radius: 4px; padding: 0 5px; margin-left: 4px; }
.combo-city { padding: 8px 12px 2px; font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; }
.combo-empty { padding: 10px 12px; color: var(--muted); font-size: 14px; }

.combo-item.group { background: #f6f8fb; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.combo-item.group.active, .combo-item.group:hover { background: #e8f0fe; }
.dest-codes { margin-top: 8px; padding: 10px; border: 1px dashed #c5ced8; border-radius: 8px; }
.dest-codes .code { font-size: 12px; font-weight: 700; color: var(--navy); background: #edf1f6; border-radius: 4px; padding: 0 5px; margin-left: 2px; }

.codes-head { width: 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.codes-head .label { margin: 0; }
.link-btn { background: none; border: 0; padding: 2px 0; color: var(--blue); cursor: pointer; font-size: 13px; text-decoration: underline; }
