/* 身份到期时间线计算器 —— 仅作用于本工具页，沿用 assets/style.css 的品牌变量 */
:root {
  --risk-red: #c8401f;
  --risk-red-bg: #FDECEF;
  --risk-yellow: #B7791F;
  --risk-yellow-bg: #FFF7E0;
  --risk-green: #1F7A4D;
  --risk-green-bg: #E8F6EE;
}

.tl-sub { margin: 12px 0 0; color: #C6D2E4; font-size: 15px; line-height: 1.7; }
.tl-section { padding: 36px 0 56px; background: var(--bg-tint); }

.tl-disclaimer {
  border: 2px solid var(--red);
  background: var(--surface);
  border-left-width: 6px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink);
}
.tl-disclaimer strong { color: var(--red-ink); }
.tl-disclaimer.small { font-size: 14px; margin-top: 18px; }
.tl-privacy { margin: 10px 0 22px; font-size: 14px; color: var(--ink-soft); }

.tl-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 22px 22px; }
.tl-form fieldset { border: 0; border-bottom: 1px dashed var(--line); margin: 0; padding: 18px 0; }
.tl-form legend { font-weight: 800; color: var(--heading); font-size: 17px; padding: 0; margin-bottom: 10px; }
.tl-form label { display: block; font-size: 15px; color: var(--ink); }
.tl-form small { display: block; color: var(--ink-mute); font-size: 13px; line-height: 1.5; }
.tl-form input[type=date], .tl-form select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  font: inherit; font-size: 16px; border: 1px solid #cbbfa6; border-radius: 8px; background: var(--surface); color: var(--ink);
  min-height: 46px;
}
.tl-form input:focus, .tl-form select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.tl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; margin: 8px 0; }
.req { color: var(--red-ink); }

.tl-types { display: flex; flex-wrap: wrap; gap: 10px; }
.tl-types label { position: relative; }
.tl-types input { position: absolute; opacity: 0; inset: 0; }
.tl-types span {
  display: inline-block; padding: 10px 16px; border: 1px solid #cbbfa6; border-radius: 999px;
  font-size: 15px; cursor: pointer; background: var(--surface); min-height: 44px; line-height: 22px;
}
.tl-types input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); box-shadow: inset 0 -3px 0 var(--gold); }
.tl-types input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.tl-check { display: flex !important; gap: 10px; align-items: flex-start; margin: 10px 0; line-height: 1.6; cursor: pointer; }
.tl-check input { width: 20px; height: 20px; margin-top: 3px; flex-shrink: 0; accent-color: var(--navy); }

.tl-actions { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end; padding-top: 20px; }
.tl-actions .btn { border: 0; cursor: pointer; font: inherit; font-weight: 700; }
.tl-today { font-size: 13px !important; color: var(--ink-mute) !important; }
.tl-today input { max-width: 200px; min-height: 40px !important; font-size: 14px !important; }
.tl-errors { margin-top: 14px; padding: 12px 16px; background: var(--risk-red-bg); color: var(--risk-red); border-radius: 8px; font-size: 15px; }

.tl-result { margin-top: 30px; }
.tl-h2 { font-size: 22px; color: var(--heading); margin: 30px 0 12px; font-weight: 800; }

.tl-summary { border-radius: var(--radius); padding: 18px 20px; color: #fff; background: var(--navy); }
.tl-summary .big { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.tl-summary ul { margin: 6px 0 0; padding-left: 18px; font-size: 15px; color: #e0d7c5; }
.tl-summary.lv-red { box-shadow: inset 6px 0 0 var(--risk-red); }
.tl-summary.lv-yellow { box-shadow: inset 6px 0 0 #E8B931; }
.tl-summary.lv-green { box-shadow: inset 6px 0 0 #3BB273; }

/* 横向分段条 */
.tl-bar { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 14px 34px; }
.tl-track { position: relative; height: 26px; background: #EEF2F7; border-radius: 6px; margin: 6px 0; }
.tl-seg { position: absolute; top: 0; bottom: 0; border-radius: 6px; font-size: 12px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; line-height: 26px; }
.tl-seg.valid { background: #2F8F5B; }
.tl-seg.maintained { background: #D9A21B; }
.tl-seg.maintained.open { background: repeating-linear-gradient(45deg, #D9A21B 0 10px, #E7B940 10px 20px); }
.tl-seg.restore { background: var(--risk-red); }
.tl-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--navy); }
.tl-mark.today { background: var(--gold); width: 3px; }
.tl-mark span { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 4px; font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
.tl-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-mute); margin-top: 22px; }
.tl-keys { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-soft); margin-top: 8px; }
.tl-keys i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }

/* 纵向事件列表 */
.tl-events { list-style: none; margin: 16px 0 0; padding: 0 0 0 4px; border-left: 3px solid var(--line); }
.tl-events li { position: relative; padding: 6px 0 12px 22px; font-size: 15px; line-height: 1.6; }
.tl-events li::before { content: ""; position: absolute; left: -9px; top: 12px; width: 13px; height: 13px; border-radius: 50%; background: var(--navy-soft); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.tl-events li b { display: inline-block; min-width: 98px; font-family: var(--font-en); color: var(--heading); }
.tl-events li.k-expiry::before, .tl-events li.k-lost::before, .tl-events li.k-refused::before { background: var(--risk-red); }
.tl-events li.k-deadline::before { background: #D9A21B; }
.tl-events li.k-apply::before, .tl-events li.k-ok::before { background: #2F8F5B; }
.tl-events li.k-today::before { background: var(--gold); }
.tl-events li.k-today { font-weight: 700; }
.tl-events li.past { color: var(--ink-mute); }

.tl-legend { font-size: 14px; color: var(--ink-soft); margin: 0 0 10px; }
.lv { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 1px 8px; border-radius: 4px; margin-left: 6px; }
.lv-red { background: var(--risk-red-bg); color: var(--risk-red); }
.lv-yellow { background: var(--risk-yellow-bg); color: var(--risk-yellow); }
.lv-green { background: var(--risk-green-bg); color: var(--risk-green); }

.tl-findings { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.tl-card { min-width: 0; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid; border-radius: 10px; padding: 14px 16px; }
.tl-card.red { border-left-color: var(--risk-red); }
.tl-card.yellow { border-left-color: #E8B931; }
.tl-card.green { border-left-color: #3BB273; }
.tl-card h3 { margin: 0 0 6px; font-size: 16.5px; color: var(--heading); line-height: 1.5; }
.tl-card h3 .lv { margin: 0 8px 0 0; }
.tl-card p { margin: 0; font-size: 15px; line-height: 1.8; color: var(--ink-soft); }
.tl-card .src { margin-top: 8px; font-size: 13px; line-height: 1.6; }
.tl-card .src a { color: var(--link); border-bottom: 1px solid rgba(30,58,112,.3); word-break: break-word; }
.tl-card .tl-todo { margin-top: 8px; font-size: 13px; color: var(--risk-yellow); background: var(--risk-yellow-bg); padding: 6px 10px; border-radius: 6px; }

.tl-reminders { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.tl-reminders li { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-size: 15px; line-height: 1.6; }
.tl-reminders li b { font-family: var(--font-en); color: var(--heading); margin-right: 8px; }
.tl-reminders li.past { color: var(--ink-mute); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.tl-reminders li.next { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.tl-note { font-size: 13px; color: var(--ink-mute); margin-top: 18px; }

.tl-cta { margin-top: 24px; display: flex; gap: 18px; align-items: center; background: var(--navy); color: #fff; padding: 20px; border-radius: var(--radius); border-top: 3px solid var(--gold); }
.tl-cta img { width: 120px; height: 120px; background: #fff; border-radius: 6px; flex-shrink: 0; }
.tl-cta h3 { margin: 0 0 6px; color: var(--gold); font-size: 18px; }
.tl-cta p { margin: 0 0 6px; font-size: 14.5px; color: #e0d7c5; }
.tl-cta a:not(.btn) { color: #fff; border-bottom: 1px solid rgba(212,175,55,.6); }
.tl-cta .btn { margin-top: 8px; display: inline-block; }

[hidden] { display: none !important; }

@media (max-width: 560px) {
  .tl-form { padding: 4px 16px 18px; }
  .tl-cta { flex-direction: column; align-items: flex-start; }
  .tl-events li b { display: block; }
  .tl-section .wrap { padding: 0 16px; }
}

/* 暗色模式（变量在 assets/style.css 末尾） */
@media screen and (prefers-color-scheme: dark) {
  :root {
    --risk-red-bg: rgba(200, 16, 46, 0.16);
    --risk-yellow-bg: rgba(217, 162, 27, 0.14);
    --risk-green-bg: rgba(47, 143, 91, 0.18);
  }
  .tl-errors, .lv-red { color: #FF9AA9; }
  .lv-yellow, .tl-card .tl-todo { color: #E8B931; }
  .lv-green { color: #7DDBA8; }
  .tl-form input[type=date], .tl-form select, .tl-types span { border-color: var(--line); }
  .tl-types input:checked + span { background: var(--navy-soft); border-color: var(--gold); }
  .tl-track { background: #22324D; }
  .tl-mark { background: #B7C3D5; }
  .tl-events li::before { border-color: var(--surface); }
  .tl-summary, .tl-cta { border: 1px solid var(--line); }
}
