/* ROBERIN jetlag-helper (시차 적응 도우미) - The New workspace (20260715a)
 * Scope: .tn-jlh-* only. New IA: input-left (route/schedule/method) + summary-right
 * (시차·방향·심각도 meter·적응 설명), full-width plan below (dependency-free 24h sleep timeline + day cards).
 * Gates: input-left (#3), realtime no Generate button (#17), container gap owns spacing (#22/#37),
 * uniform 1px borders / no decorative rail (#11/#30), field label separation 5px (#34/#4),
 * flipped dark tokens with text-fill on every surface (#8/#14), full skeleton on load no void (#10),
 * native select+checkbox custom appearance (#2/#33), element reset limited to li/ul/ol/dd (#37). */

.tn-jlh-page {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  color: #1a1208;
  -webkit-text-fill-color: currentColor;
}
.tn-jlh-page,
.tn-jlh-page * { box-sizing: border-box; }

.tn-jlh-tool {
  --jlh-ink: #1a1208;
  --jlh-muted: #5a4a30;
  --jlh-line: #b8a888;
  --jlh-soft: #cbb692;
  --jlh-paper: #fffdf8;
  --jlh-wash: #f6eddc;
  --jlh-surface: #fffdf8;
  --jlh-card: #fbf4e6;
  --jlh-band-bg: #f9f1e2;
  --jlh-track: #e7dcc4;
  --jlh-accent: #4a5c9c;
  --jlh-accent-soft: #e0e2f0;
  --jlh-accent-ink: #fffdf8;
  --jlh-btn-sec-bg: #f2e7d3;
  --jlh-btn-sec-hover: #e7d8bd;
  --jlh-btn-sec-text: #3a2c18;
  --jlh-sleep: #4a5c9c;
  --jlh-sleep-bg: #dcdff0;
  --jlh-low: #2f7a44;
  --jlh-low-bg: #e4efe0;
  --jlh-mid: #96690f;
  --jlh-mid-bg: #f2e9d3;
  --jlh-high: #a5402a;
  --jlh-high-bg: #f2ded6;
  color: var(--jlh-ink);
  -webkit-text-fill-color: var(--jlh-ink);
  font-family: inherit;
  display: grid;
  gap: 16px;
}

.tn-jlh-tool ul,
.tn-jlh-tool ol,
.tn-jlh-tool li,
.tn-jlh-tool dd { margin: 0; padding: 0; list-style: none; }

/* ---- workspace split ---- */
.tn-jlh-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--jlh-line);
  background: var(--jlh-surface);
}
.tn-jlh-input,
.tn-jlh-summary {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
  min-width: 0;
}
.tn-jlh-input {
  border-right: 1px solid var(--jlh-line);
  background: var(--jlh-wash);
}
.tn-jlh-pane-label {
  margin: 0;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--jlh-muted);
  -webkit-text-fill-color: var(--jlh-muted);
}
.tn-jlh-band-label {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  font: 700 11px/1.3 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--jlh-muted);
  -webkit-text-fill-color: var(--jlh-muted);
}
.tn-jlh-band-label small {
  font: 500 11px/1.3 inherit;
  letter-spacing: 0;
  text-transform: none;
  color: var(--jlh-muted);
  -webkit-text-fill-color: var(--jlh-muted);
}

/* ---- input fields ---- */
.tn-jlh-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.tn-jlh-field {
  display: grid;
  gap: 5px;
  align-content: start;
  min-width: 0;
}
.tn-jlh-field--full { grid-column: 1 / -1; }
.tn-jlh-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--jlh-muted);
  -webkit-text-fill-color: var(--jlh-muted);
}
.tn-jlh-hint {
  font-size: 11px;
  line-height: 1.4;
  min-height: 15.4px;
  color: var(--jlh-muted);
  -webkit-text-fill-color: var(--jlh-muted);
}
.tn-jlh-control {
  display: flex;
  align-items: stretch;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--jlh-line);
  background: var(--jlh-paper);
}
.tn-jlh-control input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--jlh-ink);
  -webkit-text-fill-color: var(--jlh-ink);
  font: 600 14px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.tn-jlh-control input::placeholder { color: var(--jlh-muted); -webkit-text-fill-color: var(--jlh-muted); opacity: 0.55; }
.tn-jlh-control input:focus-visible { outline: 2px solid var(--jlh-accent); outline-offset: -2px; }
.tn-jlh-control input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.6; }
.tn-jlh-control--suffix { padding-right: 8px; align-items: center; }
.tn-jlh-control--suffix b { font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-style: normal; color: var(--jlh-muted); -webkit-text-fill-color: var(--jlh-muted); white-space: nowrap; }
.tn-jlh-control--select select {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 32px 0 10px;
  border: 0;
  background: transparent;
  color: var(--jlh-ink);
  -webkit-text-fill-color: var(--jlh-ink);
  font: 600 13px/1 inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%235a4a30' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.tn-jlh-control--select select:focus-visible { outline: 2px solid var(--jlh-accent); outline-offset: -2px; }

/* ---- adaptation method segmented control ---- */
.tn-jlh-methods {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.tn-jlh-method {
  display: grid;
  gap: 2px;
  justify-items: start;
  padding: 8px 10px;
  border: 1px solid var(--jlh-line);
  background: var(--jlh-paper);
  cursor: pointer;
  text-align: left;
}
.tn-jlh-method b { font: 700 13px/1.1 inherit; font-style: normal; color: var(--jlh-ink); -webkit-text-fill-color: var(--jlh-ink); }
.tn-jlh-method span { font-size: 11px; line-height: 1.3; color: var(--jlh-muted); -webkit-text-fill-color: var(--jlh-muted); }
.tn-jlh-method:hover { border-color: var(--jlh-accent); background: var(--jlh-accent-soft); }
.tn-jlh-method:focus-visible { outline: 2px solid var(--jlh-accent); outline-offset: 2px; }
.tn-jlh-method.is-selected { border-color: var(--jlh-accent); background: var(--jlh-accent-soft); }
.tn-jlh-method.is-selected b { color: var(--jlh-accent); -webkit-text-fill-color: var(--jlh-accent); }

/* ---- prepare toggle (custom checkbox) ---- */
.tn-jlh-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  line-height: 20px;
}
.tn-jlh-toggle input {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1px solid var(--jlh-line);
  background: var(--jlh-paper);
  cursor: pointer;
  position: relative;
  flex: 0 0 auto;
}
.tn-jlh-toggle input:checked { border-color: var(--jlh-accent); background: var(--jlh-accent); }
.tn-jlh-toggle input:checked::before {
  content: "";
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid var(--jlh-accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.tn-jlh-toggle input:focus-visible { outline: 2px solid var(--jlh-accent); outline-offset: 2px; }
.tn-jlh-toggle span { font-size: 13px; font-weight: 600; color: var(--jlh-ink); -webkit-text-fill-color: var(--jlh-ink); line-height: 20px; }

.tn-jlh-methods-wrap { display: grid; gap: 8px; }
.tn-jlh-prepare { display: grid; gap: 10px; }

/* ---- command / actions ---- */
.tn-jlh-command { display: grid; gap: 8px; }
.tn-jlh-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.tn-jlh-secondary {
  height: 38px;
  border: 1px solid var(--jlh-line);
  background: var(--jlh-btn-sec-bg);
  color: var(--jlh-btn-sec-text);
  -webkit-text-fill-color: var(--jlh-btn-sec-text);
  font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.tn-jlh-secondary:hover { background: var(--jlh-btn-sec-hover); }
.tn-jlh-secondary:focus-visible { outline: 2px solid var(--jlh-accent); outline-offset: 2px; }
.tn-jlh-status {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--jlh-soft);
  background: var(--jlh-band-bg);
  font-size: 12px;
  line-height: 1.5;
  color: var(--jlh-muted);
  -webkit-text-fill-color: var(--jlh-muted);
}

/* ---- summary (right) ---- */
.tn-jlh-diff {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--jlh-line);
  background: var(--jlh-card);
}
.tn-jlh-diff > span { font-size: 12px; font-weight: 600; color: var(--jlh-muted); -webkit-text-fill-color: var(--jlh-muted); }
.tn-jlh-diff strong {
  font: 800 clamp(24px, 4.6vw, 32px)/1.12 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--jlh-ink);
  -webkit-text-fill-color: var(--jlh-ink);
}
.tn-jlh-diff em {
  font-size: 12px; font-style: normal; line-height: 1.4;
  color: var(--jlh-muted); -webkit-text-fill-color: var(--jlh-muted);
}
.tn-jlh-dir {
  justify-self: start;
  margin-top: 2px;
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 4px 8px;
  border: 1px solid var(--jlh-accent);
  color: var(--jlh-accent);
  -webkit-text-fill-color: var(--jlh-accent);
}

.tn-jlh-severity {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--jlh-soft);
  background: var(--jlh-band-bg);
}
.tn-jlh-severity-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.tn-jlh-severity-head span { font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; letter-spacing: 0.03em; text-transform: uppercase; color: var(--jlh-muted); -webkit-text-fill-color: var(--jlh-muted); }
.tn-jlh-severity-head strong { font-size: 14px; font-weight: 700; color: var(--jlh-ink); -webkit-text-fill-color: var(--jlh-ink); }
.tn-jlh-severity-track {
  height: 12px;
  border: 1px solid var(--jlh-line);
  background: var(--jlh-paper);
  overflow: hidden;
}
.tn-jlh-severity-bar {
  height: 100%;
  width: 0;
  background: var(--jlh-low);
  transition: width 0.2s ease;
}
.tn-jlh-severity-bar.is-mid { background: var(--jlh-mid); }
.tn-jlh-severity-bar.is-high { background: var(--jlh-high); }

.tn-jlh-method-desc {
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--jlh-soft);
  background: var(--jlh-card);
  font-size: 12px;
  line-height: 1.55;
  color: var(--jlh-ink);
  -webkit-text-fill-color: var(--jlh-ink);
}
.tn-jlh-disclaimer {
  margin: 2px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--jlh-track);
  font-size: 11px;
  line-height: 1.5;
  color: var(--jlh-muted);
  -webkit-text-fill-color: var(--jlh-muted);
}

/* ---- plan (full-width): timeline + day cards ---- */
.tn-jlh-plan {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--jlh-line);
  background: var(--jlh-surface);
}
.tn-jlh-plan-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.tn-jlh-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.tn-jlh-legend li { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--jlh-muted); -webkit-text-fill-color: var(--jlh-muted); }
.tn-jlh-legend li::before { content: ""; width: 12px; height: 12px; border: 1px solid currentColor; }
.tn-jlh-legend li.is-sleep::before { background: var(--jlh-sleep-bg); color: var(--jlh-sleep); }
.tn-jlh-legend li.is-today::before { background: var(--jlh-accent-soft); color: var(--jlh-accent); }

.tn-jlh-timeline { display: grid; gap: 4px; }
.tn-jlh-trow {
  display: grid;
  grid-template-columns: var(--jlh-rowlabel, 150px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.tn-jlh-rowlabel {
  display: grid;
  gap: 1px;
  min-width: 0;
  font-size: 12px;
  color: var(--jlh-ink);
  -webkit-text-fill-color: var(--jlh-ink);
}
.tn-jlh-rowlabel b { font-weight: 700; font-style: normal; }
.tn-jlh-rowlabel small { font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; color: var(--jlh-muted); -webkit-text-fill-color: var(--jlh-muted); }
.tn-jlh-trow.is-today .tn-jlh-rowlabel { color: var(--jlh-accent); -webkit-text-fill-color: var(--jlh-accent); }
.tn-jlh-cells {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 1px;
  min-width: 0;
  background: var(--jlh-band-bg);
  border: 1px solid var(--jlh-soft);
}
.tn-jlh-cell { height: 20px; background: var(--jlh-paper); }
.tn-jlh-cell.is-sleep { background: var(--jlh-sleep-bg); }
.tn-jlh-trow.is-today .tn-jlh-cells { border-color: var(--jlh-accent); }
.tn-jlh-textrow {
  font-size: 12px;
  line-height: 1.4;
  padding: 3px 8px;
  border: 1px dashed var(--jlh-soft);
  background: var(--jlh-band-bg);
  color: var(--jlh-muted);
  -webkit-text-fill-color: var(--jlh-muted);
}
.tn-jlh-axis {
  display: grid;
  grid-template-columns: var(--jlh-rowlabel, 150px) minmax(0, 1fr);
  gap: 10px;
}
.tn-jlh-axis-ticks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tn-jlh-axis-ticks span { font: 600 9px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; color: var(--jlh-muted); -webkit-text-fill-color: var(--jlh-muted); }

.tn-jlh-days {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.tn-jlh-day {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 11px 12px;
  border: 1px solid var(--jlh-soft);
  background: var(--jlh-card);
}
.tn-jlh-day.is-today { border-color: var(--jlh-accent); background: var(--jlh-accent-soft); }
.tn-jlh-day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tn-jlh-day-head b { font-size: 13px; font-weight: 700; color: var(--jlh-ink); -webkit-text-fill-color: var(--jlh-ink); }
.tn-jlh-day-head small { font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; color: var(--jlh-muted); -webkit-text-fill-color: var(--jlh-muted); }
.tn-jlh-day-phase {
  justify-self: start;
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 2px 6px;
  border: 1px solid currentColor;
  color: var(--jlh-muted);
  -webkit-text-fill-color: var(--jlh-muted);
}
.tn-jlh-day-times { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.tn-jlh-day-time { display: inline-flex; align-items: baseline; gap: 5px; font-size: 12px; color: var(--jlh-ink); -webkit-text-fill-color: var(--jlh-ink); }
.tn-jlh-day-time b { font: 700 14px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.tn-jlh-day-time span { font-size: 11px; color: var(--jlh-muted); -webkit-text-fill-color: var(--jlh-muted); }
.tn-jlh-day-note { font-size: 12px; line-height: 1.5; color: var(--jlh-muted); -webkit-text-fill-color: var(--jlh-muted); }

/* ---- mobile ---- */
@media (max-width: 720px) {
  .tn-jlh-workspace { grid-template-columns: minmax(0, 1fr); }
  .tn-jlh-input { border-right: 0; border-bottom: 1px solid var(--jlh-line); }
  .tn-jlh-methods { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 440px) {
  .tn-jlh-trow, .tn-jlh-axis { --jlh-rowlabel: 96px; gap: 6px; }
  .tn-jlh-days { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Dark / inverse / auto-dark (#8/#14) ---- */
body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]):not([data-scheme="light"]) .tn-jlh-tool,
html[data-scheme="dark"] body:not([data-scheme="light"]) .tn-jlh-tool,
html[data-scheme="inverse"] body:not([data-scheme="light"]) .tn-jlh-tool {
  --jlh-ink: #efe6d2;
  --jlh-muted: #c3b492;
  --jlh-line: #6f6047;
  --jlh-soft: #574a37;
  --jlh-paper: #241d12;
  --jlh-wash: #221b11;
  --jlh-surface: #1f1810;
  --jlh-card: rgba(58, 48, 32, 0.5);
  --jlh-band-bg: rgba(58, 48, 32, 0.36);
  --jlh-track: rgba(120, 104, 74, 0.3);
  --jlh-accent: #8f9fd6;
  --jlh-accent-soft: rgba(143, 159, 214, 0.22);
  --jlh-accent-ink: #1f1810;
  --jlh-btn-sec-bg: #33291a;
  --jlh-btn-sec-hover: #453720;
  --jlh-btn-sec-text: #efe6d2;
  --jlh-sleep: #8f9fd6;
  --jlh-sleep-bg: rgba(90, 104, 160, 0.34);
  --jlh-low: #8ecb9d;
  --jlh-low-bg: rgba(90, 150, 105, 0.24);
  --jlh-mid: #e0b25a;
  --jlh-mid-bg: rgba(160, 125, 55, 0.26);
  --jlh-high: #e08a72;
  --jlh-high-bg: rgba(165, 80, 55, 0.3);
  color: var(--jlh-ink);
  -webkit-text-fill-color: var(--jlh-ink);
}
body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]):not([data-scheme="light"]) .tn-jlh-method.is-selected b,
html[data-scheme="dark"] body:not([data-scheme="light"]) .tn-jlh-method.is-selected b,
html[data-scheme="inverse"] body:not([data-scheme="light"]) .tn-jlh-method.is-selected b { color: var(--jlh-accent); -webkit-text-fill-color: var(--jlh-accent); }
body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]):not([data-scheme="light"]) .tn-jlh-control--select select,
html[data-scheme="dark"] body:not([data-scheme="light"]) .tn-jlh-control--select select,
html[data-scheme="inverse"] body:not([data-scheme="light"]) .tn-jlh-control--select select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23c3b492' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  body[data-scheme="auto"]:not([data-scheme="light"]) .tn-jlh-tool {
    --jlh-ink: #efe6d2;
    --jlh-muted: #c3b492;
    --jlh-line: #6f6047;
    --jlh-soft: #574a37;
    --jlh-paper: #241d12;
    --jlh-wash: #221b11;
    --jlh-surface: #1f1810;
    --jlh-card: rgba(58, 48, 32, 0.5);
    --jlh-band-bg: rgba(58, 48, 32, 0.36);
    --jlh-track: rgba(120, 104, 74, 0.3);
    --jlh-accent: #8f9fd6;
    --jlh-accent-soft: rgba(143, 159, 214, 0.22);
    --jlh-accent-ink: #1f1810;
    --jlh-btn-sec-bg: #33291a;
    --jlh-btn-sec-hover: #453720;
    --jlh-btn-sec-text: #efe6d2;
    --jlh-sleep: #8f9fd6;
    --jlh-sleep-bg: rgba(90, 104, 160, 0.34);
    --jlh-low: #8ecb9d;
    --jlh-low-bg: rgba(90, 150, 105, 0.24);
    --jlh-mid: #e0b25a;
    --jlh-mid-bg: rgba(160, 125, 55, 0.26);
    --jlh-high: #e08a72;
    --jlh-high-bg: rgba(165, 80, 55, 0.3);
    color: var(--jlh-ink);
    -webkit-text-fill-color: var(--jlh-ink);
  }
  body[data-scheme="auto"]:not([data-scheme="light"]) .tn-jlh-method.is-selected b { color: var(--jlh-accent); -webkit-text-fill-color: var(--jlh-accent); }
  body[data-scheme="auto"]:not([data-scheme="light"]) .tn-jlh-control--select select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23c3b492' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}
