/* Shared look for the public calculation tools (Phase 2 onward).
   Mobile first: every grid collapses to one column at phone width. */

.tl-section { background: #f8fafc; padding: clamp(32px, 6vw, 64px) 0; }
/* width: 100% inputs must include their padding, or they overflow at phone width */
.tl-section *, .tl-section *::before, .tl-section *::after { box-sizing: border-box; }
.tl-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 20px; padding: clamp(16px, 4vw, 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .05); }
.tl-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.tl-head-text { flex: 1 1 220px; min-width: 0; }
.tl-icon { background: var(--hm-navy); color: var(--hm-lime); width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.tl-head h2 { font-size: clamp(1.2rem, 3.5vw, 1.6rem); font-weight: 800; color: var(--hm-navy); margin: 0; }
.tl-head p { font-size: .9rem; color: #64748b; margin: 3px 0 0; }

.tl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 18px; }
.tl-field { min-width: 0; }
.tl-field label { display: block; font-size: .85rem; font-weight: 700; color: #334155; margin-bottom: 6px; }
.tl-field input, .tl-field select { width: 100%; padding: 11px 14px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 1rem; font-weight: 600; color: var(--hm-navy); background: #fff; }
.tl-field small { display: block; margin-top: 5px; font-size: .78rem; color: #64748b; }
.tl-inline { display: flex; gap: 8px; }
.tl-inline > * { min-width: 0; }

.tl-toggle { display: inline-flex; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 10px; padding: 4px; gap: 4px; }
.tl-toggle button { border: 0; background: transparent; padding: 7px 14px; border-radius: 7px; font-weight: 700; font-size: .85rem; color: #475569; cursor: pointer; }
.tl-toggle button[aria-pressed="true"] { background: var(--hm-navy); color: #fff; }

.tl-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.tl-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #cbd5e1; background: #fff; color: var(--hm-navy); font-weight: 700; font-size: .88rem; padding: 9px 16px; border-radius: 10px; cursor: pointer; }
.tl-btn:hover { border-color: var(--hm-navy); }
.tl-btn-primary { background: var(--hm-navy); color: #fff; border-color: var(--hm-navy); }
.tl-btn:disabled { opacity: .5; cursor: not-allowed; }

.tl-results { margin-top: 26px; background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 14px; padding: clamp(14px, 3vw, 24px); }
.tl-results h3 { font-size: 1.1rem; font-weight: 800; color: var(--hm-navy); margin: 0 0 14px; }
.tl-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 14px; }
/* Exactly four result boxes: 2×2 instead of a lone fourth box under three. */
.tl-stats:has(> .tl-stat:nth-child(4):last-child) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.tl-stat { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px; min-width: 0; }
.tl-stat .k { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #047857; }
.tl-stat .v { font-size: 1.15rem; font-weight: 800; color: var(--hm-navy); margin-top: 6px; overflow-wrap: anywhere; }
.tl-stat .s { font-size: .78rem; color: #64748b; margin-top: 4px; }
.tl-stat.is-key { background: #ecfdf5; border: 2px solid #34d399; }
.tl-stat.is-key .v { color: #047857; font-size: 1.3rem; }

.tl-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tl-step { display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: 4px 16px; background: #fff; border: 1px solid #e2e8f0; border-left: 4px solid #0284c7; border-radius: 10px; padding: 12px 14px; }
.tl-step.is-ai { border-left-color: #16a34a; background: #f0fdf4; }
.tl-step.is-watch { border-left-color: #d97706; background: #fffbeb; }
.tl-step .when { font-weight: 800; color: var(--hm-navy); font-size: .92rem; }
.tl-step .day { display: block; font-size: .75rem; font-weight: 600; color: #64748b; }
.tl-step .what { font-weight: 700; color: #0f172a; }
.tl-step .note, .tl-step .dose { display: block; font-size: .82rem; color: #475569; margin-top: 2px; }
@media (max-width: 520px) { .tl-step { grid-template-columns: 1fr; } }

.tl-alert { border-radius: 12px; padding: 12px 16px; font-size: .88rem; line-height: 1.6; margin-top: 16px; }
.tl-alert-warn { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }
.tl-alert-danger { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.tl-alert-info { background: #f0f9ff; border: 1px solid #bae6fd; color: #075985; }
.tl-big { font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 900; color: var(--hm-navy); }

.tl-guide { background: #fff; padding: clamp(36px, 6vw, 64px) 0; }
.tl-guide .wrap, .tl-section .wrap { max-width: 980px; }
.tl-faq { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.tl-faq > div { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 18px 20px; }
.tl-faq h3 { font-size: 1.05rem; font-weight: 800; color: var(--hm-navy); margin: 0 0 6px; }
.tl-faq p, .tl-prose p, .tl-prose li { font-size: .92rem; line-height: 1.7; color: #475569; }
.tl-faq p { margin: 0; }
.tl-prose > h3 + .tl-faq { margin-top: 12px; }
.tl-guide .sec-head { margin-bottom: 24px; }
.tl-guide .sec-head h2 { font-weight: 800; font-size: clamp(24px, 3vw, 38px); line-height: 1.1; letter-spacing: -.02em; color: var(--hm-navy); margin: 0; }
.tl-guide .sec-head > p { margin: 12px 0 0; font-size: 1rem; }
.tl-refs { font-size: .82rem; color: #64748b; line-height: 1.7; padding-left: 18px; }

@media print {
    body * { visibility: hidden !important; }
    .tl-print, .tl-print * { visibility: visible !important; }
    .tl-print { position: absolute; inset: 0 auto auto 0; width: 100%; box-shadow: none; border: 0; }
    .tl-no-print { display: none !important; }
}
