:root {
  --bg: #0e1116;
  --panel: #171b22;
  --panel-2: #1f242d;
  --line: #2a3038;
  --text: #e6e9ef;
  --muted: #8b94a3;
  --accent: #46d6db;
  --accent-2: #5484ed;
  --high: #2ecc71;
  --low: #f5b942;
  --na: #3a4049;
  --err: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, rgba(70,214,219,0.08), transparent), var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* Header */
.fm-header {
  text-align: center;
  padding: 32px 20px 20px;
  position: relative;
}
.back-link {
  position: absolute; left: 20px; top: 24px;
  color: var(--muted); text-decoration: none; font-size: 14px;
  transition: color .15s;
}
.back-link:hover { color: var(--accent); }
.brand { display: flex; align-items: center; justify-content: center; gap: 12px; }
.brand-mark {
  font-size: 30px; color: var(--accent);
  transform: rotate(-20deg); display: inline-block;
}
.fm-header h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; }
.tagline { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* Main */
.fm-main { max-width: 1080px; margin: 0 auto; padding: 0 20px 60px; }

/* Search panel */
.search-panel {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 22px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.field input, .field select {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 10px 12px; font-size: 14px; font-family: inherit;
  min-width: 92px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }
#origin, #dest { text-transform: uppercase; font-weight: 600; width: 84px; }
.swap {
  cursor: pointer; align-self: flex-end; margin-bottom: 9px;
  font-size: 18px; color: var(--accent); user-select: none;
  padding: 6px; transition: transform .2s;
}
.swap:hover { transform: rotate(180deg); }
.search-btn {
  margin-left: auto; align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06141b; font-weight: 600; font-size: 15px; font-family: inherit;
  border: none; border-radius: 9px; padding: 11px 26px; cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.search-btn:hover { opacity: .92; }
.search-btn:active { transform: translateY(1px); }
.search-btn:disabled { opacity: .55; cursor: default; }

/* Summary */
.summary {
  display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; position: relative;
}
.sum-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 20px; min-width: 130px; flex: 1;
}
.sum-card.highlight { border-color: var(--accent); background: linear-gradient(180deg, rgba(70,214,219,0.08), var(--panel)); }
.sum-num { font-size: 28px; font-weight: 700; }
.sum-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.s-h-text { color: var(--high); }
.s-l-text { color: var(--low); }
.sum-updated { position: absolute; right: 2px; bottom: -18px; font-size: 11px; color: var(--muted); }

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.legend-item { display: flex; align-items: center; gap: 7px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.swatch.s-h { background: var(--high); }
.swatch.s-l { background: var(--low); }
.swatch.s-na { background: var(--na); }
.swatch.s-out { background: transparent; border: 1px dashed var(--line); }

/* Results — month cards */
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.month-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.month-title { font-size: 17px; font-weight: 600; margin-bottom: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 4px; }
.cal-cell {
  aspect-ratio: 1 / 1; border-radius: 8px; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 13px; background: var(--panel-2); border: 1px solid transparent;
}
.cal-cell.blank { background: transparent; }
.cell-day { font-weight: 600; }
.cell-tag { font-size: 9px; text-transform: uppercase; letter-spacing: 0.3px; opacity: 0.85; }
.cal-cell.s-h { background: rgba(46,204,113,0.18); border-color: var(--high); color: #b6f0cd; }
.cal-cell.s-l { background: rgba(245,185,66,0.16); border-color: var(--low); color: #f7dca0; }
.cal-cell.s-na { background: var(--panel-2); color: var(--muted); }
.cal-cell.s-na .cell-tag { opacity: 0.4; }
.cal-cell.s-out { background: transparent; color: #4a515c; border: 1px dashed var(--line); }
.cal-cell.s-h:hover, .cal-cell.s-l:hover { filter: brightness(1.15); cursor: default; }

/* Status */
.status { text-align: center; padding: 40px 20px; color: var(--muted); }
.status .muted { font-size: 13px; margin-top: 6px; display: block; }
.loading { color: var(--accent); }
.err { color: var(--err); }
.muted { color: var(--muted); }

/* Footer */
.fm-footer { text-align: center; padding: 24px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .search-panel { gap: 10px; }
  .search-btn { margin-left: 0; width: 100%; }
  .results { grid-template-columns: 1fr; }
}
