:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --ink: #1d2433;
  --muted: #6b7280;
  --line: #e4ded1;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #d7efe9;
  --warn: #b45309;
  --price: #0f766e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 36, 51, .06), 0 6px 20px rgba(29, 36, 51, .05);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; letter-spacing: -.01em; }
small, .muted { color: var(--muted); }
.hidden { display: none !important; }

/* Felső sáv */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .75rem 1.5rem;
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.2rem; }
.brand svg { width: 26px; height: 26px; color: #5eead4; }
.tabs { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.tab {
  background: none; border: 0; color: #cbd5e1; font: inherit; cursor: pointer;
  padding: .5rem .9rem; border-radius: 999px;
}
.tab:hover { color: #fff; }
.tab.active { background: #fff; color: var(--ink); font-weight: 600; }
.user-chip { font-size: .9rem; color: #cbd5e1; white-space: nowrap; }
.badge {
  display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 999px;
  background: #f59e0b; color: #111; font-size: .75rem; font-weight: 700; text-align: center;
}

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.panel { display: grid; gap: 1.25rem; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem 1.4rem; box-shadow: var(--shadow);
}

/* Űrlapok */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.2rem; }
.form-grid h2, .span2 { grid-column: 1 / -1; }
label, .field { display: grid; gap: .3rem; font-size: .88rem; font-weight: 600; }
label.check { display: flex; align-items: center; gap: .5rem; align-self: end; font-weight: 500; }
input, select {
  font: inherit; font-weight: 400; padding: .55rem .7rem; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset.modes { border: 1px dashed var(--line); border-radius: 10px; display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; padding: .6rem .9rem; }
fieldset.modes legend { font-size: .85rem; font-weight: 600; padding: 0 .3rem; }
fieldset.modes label { display: flex; align-items: center; gap: .35rem; font-weight: 500; }

.row { display: flex; gap: .5rem; align-items: center; }
.row.between { justify-content: space-between; }
.row select { flex: 1; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; min-height: 1.6rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; background: var(--accent-soft);
  color: var(--accent); border-radius: 999px; padding: .2rem .4rem .2rem .7rem; font-size: .85rem; font-weight: 600;
}
.chip button { border: 0; background: none; cursor: pointer; color: inherit; font-size: 1rem; line-height: 1; }
.chip .ord { opacity: .6; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; padding: .6rem 1.1rem;
  border: 1px solid transparent;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: #f1ede4; }
.btn.small { padding: .3rem .7rem; font-size: .85rem; }
.btn.danger { color: #b91c1c; }
.btn:disabled { opacity: .5; cursor: progress; }

/* Találatok */
.results { display: grid; gap: .9rem; }
.results .summary { color: var(--muted); font-size: .9rem; }
.trip {
  display: grid; grid-template-columns: 1fr auto; gap: .6rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem;
  box-shadow: var(--shadow);
}
.trip.best { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.trip h3 { margin: 0; font-size: 1.05rem; }
.trip .meta { color: var(--muted); font-size: .88rem; }
.price { font-size: 1.5rem; font-weight: 800; color: var(--price); text-align: right; white-space: nowrap; }
.price small { display: block; font-size: .75rem; font-weight: 500; color: var(--muted); }
.legs { grid-column: 1 / -1; display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.leg {
  display: grid; grid-template-columns: 1.8rem 6.5rem 1fr auto; gap: .6rem; align-items: center;
  font-size: .9rem; padding: .4rem .6rem; border-radius: 8px; background: #f8f6f0;
}
.leg .mode { font-size: 1.1rem; text-align: center; }
.leg .when { font-variant-numeric: tabular-nums; color: var(--muted); }
.leg .lp { font-weight: 700; font-variant-numeric: tabular-nums; }

.empty, .error { padding: 1rem 1.2rem; border-radius: var(--radius); }
.empty { background: var(--surface); border: 1px dashed var(--line); color: var(--muted); }
.error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* Figyelések */
.watch {
  display: grid; grid-template-columns: 1fr 180px auto; gap: .8rem 1.2rem; align-items: center;
  border-top: 1px solid var(--line); padding: .9rem 0;
}
.watch:first-child { border-top: 0; }
.watch h3 { margin: 0 0 .2rem; font-size: 1rem; }
.watch .status { font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; margin-left: .4rem; }
.status.on { background: var(--accent-soft); color: var(--accent); }
.status.off { background: #eee; color: #666; }
.spark { width: 180px; height: 44px; }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 2; }
.spark path.area { fill: var(--accent-soft); opacity: .7; }
.watch .detail { grid-column: 1 / -1; }
.watch .btns { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }

.notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; max-height: 240px; overflow: auto; }
.notif-list li { padding: .5rem .7rem; border-radius: 8px; background: #f8f6f0; font-size: .9rem; }
.notif-list li.unread { background: #fff7e6; border-left: 3px solid #f59e0b; }
.notif-list time { color: var(--muted); font-size: .8rem; margin-right: .5rem; }

/* Fiók */
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; }
.tier { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; display: grid; gap: .5rem; align-content: start; }
.tier.current { border-color: var(--accent); background: #f3fbf9; }
.tier h3 { margin: 0; }
.tier ul { margin: 0; padding-left: 1.1rem; font-size: .88rem; color: #374151; }
.keybox { font-family: ui-monospace, Consolas, monospace; background: #f1ede4; padding: .4rem .6rem; border-radius: 8px; word-break: break-all; }

dialog { border: 0; border-radius: var(--radius); padding: 1.4rem; max-width: 520px; width: 92vw; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }

.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow); z-index: 50;
}

.spinner { display: inline-block; width: 1rem; height: 1rem; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: .4rem; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: .6rem; padding: .7rem 1rem; justify-content: space-between; }
  .tabs { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; }
  .tab { white-space: nowrap; padding: .4rem .75rem; }
  main { padding: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .tiers { grid-template-columns: 1fr; }
  .watch { grid-template-columns: 1fr; }
  .leg { grid-template-columns: 1.6rem 1fr auto; }
  .leg .when { grid-column: 2 / -1; grid-row: 2; }
}
