/* 8558 calculator: page layout and the stay calendar (calendar.js).
   Layout only — every input, button and calculation is the page's own, unchanged. */

#app-main { max-width: 1280px; overflow: clip; }

/* ── Top: what 8558 means, beside your live stay ── */
.s8-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 28px;
}
.s8-intro { display: flex; flex-direction: column; min-width: 0; }
.s8-intro > .about-content { flex: 1; margin-bottom: 0; }
.s8-dash { min-width: 0; }
.s8-dash > .rolling-period { height: 100%; margin: 0; }

/* ── Middle: visa, past trips and future trips side by side ── */
.s8-plan {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
  margin-bottom: 28px;
}
.s8-plan > * { margin-top: 0 !important; min-width: 0; }
.s8-plan > .about-content { margin-bottom: 0; }

/* compact trip cards: name on its own line, entry and exit side by side */
.s8-plan .trip-entry {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
  padding: 1rem 1.1rem;
}
.s8-plan .trip-entry > .trip-header,
.s8-plan .trip-entry > .trip-header + .form-group,
.s8-plan .trip-entry > .trip-controls { grid-column: 1 / -1; }
.s8-plan .trip-entry .form-group { margin-bottom: .4rem; }
.s8-plan .trip-entry .form-group input { min-width: 0; width: 100%; }
.s8-plan .trip-entry .trip-controls { display: flex; gap: 8px; margin-top: 4px; }
.s8-plan .trip-entry .trip-controls .btn { flex: 1; }

/* the progress text sits across both the filled and the empty part of the bar */
.progress-text { color: #0f172a !important; text-shadow: 0 0 3px rgba(255, 255, 255, .9), 0 0 1px #fff; }
[data-theme="dark"] .progress-text { color: #ffffff !important; text-shadow: 0 1px 3px rgba(0, 0, 0, .85), 0 0 1px #000; }

@media (max-width: 1180px) {
  .s8-plan { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .s8-plan > .future-trips { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .s8-hero, .s8-plan { grid-template-columns: 1fr; gap: 20px; }
  .s8-plan > .future-trips { grid-column: auto; }
}
@media (max-width: 420px) {
  .s8-plan .trip-entry { grid-template-columns: 1fr; }
}

/* ── The stay calendar ── */
.vsc { margin: 6px 0 4px; }
.vsc-stage { width: 100%; max-width: 560px; margin: 0 auto; }
.vsc-stage svg { overflow: visible; }
.vsc-label { text-align: center; font-size: 14px; color: var(--text-color, #1a1a1a); min-height: 1.5em; margin-top: 2px; }
.vsc-label strong { font-size: 20px; font-weight: 800; color: var(--primary-color, #1c3461); }
.vsc-label.is-over strong { color: #e11d48; }
.vsc-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; list-style: none; padding: 0; margin: 6px 0 10px; font-size: 12.5px; color: var(--text-color, #1a1a1a); opacity: .85; }
.vsc-legend li { display: inline-flex; align-items: center; gap: 6px; }
.vsc-key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.vsc-key-stay { background: #fbbf24; border: 1px solid #b7791f; }
.vsc-key-over { background: #f43f5e; border: 1px solid #9f1239; }
.vsc-key-now { background: transparent; border: 2px solid #0ea5e9; }

.vsc-stage {
  --vsc-pad: #f3f6fb; --vsc-pad-side: #d5dde8; --vsc-edge: #b7c3d4; --vsc-binding: #1c3461; --vsc-ring: #94a3b8;
  --vsc-tile: #ffffff; --vsc-tile-side: #e3e9f1;
  --vsc-stay: #fbbf24; --vsc-stay-side: #d48a06; --vsc-stay-edge: #9a6404;
  --vsc-over: #f43f5e; --vsc-over-side: #be123c; --vsc-over-edge: #881337;
  --vsc-on: #0ea5e9; --vsc-shadow: rgba(15, 23, 42, .2); --vsc-text: #475569; --vsc-days: #422006;
}
[data-theme="dark"] .vsc-stage {
  --vsc-pad: #111a2e; --vsc-pad-side: #0a1222; --vsc-edge: #2a3a58; --vsc-binding: #4d7fc4; --vsc-ring: #64748b;
  --vsc-tile: #1a2640; --vsc-tile-side: #121c31;
  --vsc-shadow: rgba(0, 0, 0, .55); --vsc-text: #a5b4cc;
}

.vsc-stage svg path { fill: none; stroke: var(--vsc-edge); stroke-width: 1; }
.vsc-stage .vsc-shadow { fill: var(--vsc-shadow); stroke: none; }
.vsc-stage .vsc-pad-side { fill: var(--vsc-pad-side); }
.vsc-stage .vsc-pad-top { fill: var(--vsc-pad); }
.vsc-stage .vsc-binding { fill: var(--vsc-binding); stroke: none; }
.vsc-stage .vsc-ring { fill: none; stroke: var(--vsc-ring); stroke-width: 1.6; }
.vsc-stage .vsc-side { fill: var(--vsc-tile-side); }
.vsc-stage .vsc-top { fill: var(--vsc-tile); }
.vsc-stage .vsc-edge { stroke: var(--vsc-tile); stroke-width: .6; }
.vsc-stage .is-stay .vsc-side { fill: var(--vsc-stay-side); stroke: var(--vsc-stay-edge); }
.vsc-stage .is-stay .vsc-top { fill: var(--vsc-stay); stroke: var(--vsc-stay-edge); }
.vsc-stage .is-stay .vsc-edge { stroke: #fde68a; }
.vsc-stage .is-over .vsc-side { fill: var(--vsc-over-side); stroke: var(--vsc-over-edge); }
.vsc-stage .is-over .vsc-top { fill: var(--vsc-over); stroke: var(--vsc-over-edge); }
.vsc-stage .is-over .vsc-edge { stroke: #fecdd3; }
.vsc-stage .is-now .vsc-top { stroke: var(--vsc-on); stroke-width: 2; }
.vsc-stage .is-on .vsc-top { stroke: var(--vsc-on); stroke-width: 2.4; }

.vsc-stage text { font-family: Inter, system-ui, -apple-system, sans-serif; pointer-events: none; }
.vsc-stage .vsc-month { font-size: 7.2px; font-weight: 600; fill: var(--vsc-text); }
.vsc-stage .is-now .vsc-month { fill: var(--vsc-on); font-weight: 800; }
.vsc-stage .vsc-days { font-size: 9.5px; font-weight: 800; fill: var(--vsc-days); }
.vsc-stage .is-stay .vsc-month { fill: #6b4106; }
.vsc-stage .is-over .vsc-month, .vsc-stage .is-over .vsc-days { fill: #ffffff; }
