/* CSI_WEATHER_RELEASE_UX_V1 — final layout and text-detail pass. */
:root { --csi-header-height:68px; --csi-panel-gutter:20px; --csi-section-gap:20px; }
#csiWeatherPage { height:100vh; height:100dvh; color:#172338; }
#csiWeatherPage :where(button,input,select,textarea) { font-family:inherit; }
#weatherSidePanel :where(h2,h3,p,label,button,li) { word-break:keep-all; overflow-wrap:anywhere; }
#csiWeatherPage [hidden] { display:none !important; }
#weatherPageHeader {
    display:grid !important;
    grid-template-columns:auto minmax(210px, 1fr) auto;
    align-items:center;
    gap:16px !important;
    height:auto !important;
    min-height:64px !important;
    padding:12px 20px !important;
    flex-shrink:0;
    z-index:1100;
    position:relative;
    background:#fff !important;
}
#weatherPageHeader .csi-brand { font-size:18px !important; line-height:1.4 !important; min-width:0; }
.csi-brand a { display:flex; align-items:center; gap:8px; min-height:44px; color:#312e81; font-weight:800; text-decoration:none; white-space:normal; word-break:keep-all; overflow-wrap:anywhere; }
.csi-brand a > span:first-child { flex-shrink:0; }
.csi-brand a > span:last-child { min-width:0; }
.csi-header-actions { display:flex; align-items:stretch; gap:8px; }
#weatherPageHeader .csi-header-button,
.csi-primary-button, .csi-secondary-button {
    display:inline-flex; align-items:center; justify-content:center; gap:8px;
    min-height:44px !important; height:auto !important; margin:0 !important;
    padding:10px 12px !important; border:1px solid #cbd5e1; border-radius:10px !important;
    background:#fff; color:#334155; font:700 13px/1.4 Pretendard,sans-serif;
    cursor:pointer; box-shadow:none !important; white-space:normal; word-break:keep-all;
}
#weatherPageHeader #btnMyLoc, .csi-primary-button { background:#4338ca; border-color:#4338ca; color:#fff; }
#weatherPageHeader .csi-header-button:hover, .csi-secondary-button:hover { background:#eef2ff; color:#3730a3; }
#weatherPageHeader #btnMyLoc:hover, .csi-primary-button:hover { background:#3730a3; color:#fff; }
#csiWeatherPage button:disabled { cursor:not-allowed; opacity:.55; transform:none !important; box-shadow:none !important; }
#csiWeatherPage button:focus-visible, #csiWeatherPage a:focus-visible,
#csiWeatherPage input:focus-visible, #csiWeatherPage textarea:focus-visible,
#csiWeatherPage select:focus-visible, #csiWeatherPage [tabindex="-1"]:focus-visible {
    outline:3px solid #6366f1 !important; outline-offset:3px;
}
#weatherLocationSearch { position:relative; min-width:0; width:100%; max-width:660px; justify-self:center; }
.csi-search-fields { display:flex; align-items:stretch; gap:8px; }
#weatherLocationSearchBtn { flex:0 0 auto; min-width:56px; }
#weatherLocationQuery { width:100%; min-width:0; min-height:44px; padding:9px 12px; border:1px solid #cbd5e1; border-radius:11px; font-size:14px; line-height:1.5; color:#172338; background:#f8fafc; }
#weatherLocationQuery::placeholder { color:#64748b; opacity:1; }
#weatherLocationResults { position:absolute; top:calc(100% + 8px); left:0; width:100%; min-width:0; box-sizing:border-box; padding:8px; background:#fff; border:1px solid #cbd5e1; border-radius:14px; box-shadow:0 16px 38px #0f172a26; max-height:55vh; overflow-y:auto; }
#weatherLocationSearchStatus { font-size:13px; line-height:1.6; color:#475569; padding:4px 6px 9px; }
#weatherLocationResultList { list-style:none; margin:0; padding:0; }
#weatherLocationResultList button { width:100%; text-align:left; display:flex; flex-direction:column; gap:4px; padding:11px 10px; min-height:52px; border:0; border-radius:9px; background:#fff; cursor:pointer; overflow-wrap:anywhere; }
#weatherLocationResultList button:hover { background:#eef2ff; }
#weatherLocationResultList strong { color:#1e293b; font-size:14px; }
#weatherLocationResultList span { color:#64748b; font-size:12px; }
#csiWeatherWorkspace { min-width:0; min-height:0; }
#csiWeatherPage #map { height:100% !important; }
#csiMapFallback { position:absolute; left:16px; top:16px; z-index:8; width:calc(100% - 32px); max-width:350px; box-sizing:border-box; padding:20px; border:1px solid #cbd5e1; border-radius:16px; background:#fff; box-shadow:0 8px 24px #0f172a18; }
#csiMapFallback h2 { font-size:18px; font-weight:800; }
#csiMapFallback p { margin:8px 0 14px; color:#475569; font-size:14px; line-height:1.6; }
#csiAppNotice { position:fixed; top:calc(var(--csi-header-height) + 10px); left:50%; transform:translateX(-50%); width:calc(100% - 24px); max-width:610px; z-index:1200; display:flex; align-items:flex-start; gap:10px; padding:12px 14px; background:#eff6ff; border:1px solid #93c5fd; border-radius:12px; box-shadow:0 8px 26px #0f172a22; color:#1e3a8a; }
#csiAppNotice[data-level="error"] { background:#fff7ed; border-color:#fdba74; color:#9a3412; }
#csiAppNotice[data-level="success"] { background:#f0fdf4; border-color:#86efac; color:#166534; }
#csiAppNoticeText { flex:1; font-size:14px; line-height:1.6; overflow-wrap:anywhere; }
#csiAppNoticeClose { flex:0 0 44px; width:44px; height:44px; display:grid; place-items:center; margin:-4px -4px -4px 0; font-size:22px; border-radius:8px; }
/* Analysis feedback stays visible outside the independently scrolling work panel. */
#csiWeatherPage #csiAnalysisFeedback {
    position:fixed; right:16px; bottom:calc(16px + env(safe-area-inset-bottom)); z-index:1250;
    display:flex; align-items:flex-start; gap:12px; box-sizing:border-box;
    width:min(460px, calc(100vw - 24px)); max-height:calc(100dvh - 24px); overflow:auto;
    padding:14px; border:1px solid #a5b4fc; border-radius:16px;
    background:#eef2ff; color:#312e81; box-shadow:0 10px 32px #0f172a29;
    font-size:calc(13px * var(--csi-text-scale, 1)); line-height:1.55;
    word-break:keep-all; overflow-wrap:anywhere;
}
#csiAnalysisFeedback[data-status="ready"] { background:#f0fdf4 !important; border-color:#86efac !important; color:#166534 !important; }
#csiAnalysisFeedback[data-status="error"] { background:#fff7ed !important; border-color:#fdba74 !important; color:#9a3412 !important; }
#csiAnalysisFeedback .csi-analysis-feedback-message { flex:1; min-width:0; display:flex; align-items:flex-start; gap:10px; }
#csiAnalysisFeedbackIcon { flex:0 0 24px; width:24px; min-height:24px; display:grid; place-items:center; border-radius:50%; background:#ffffffc9; font-weight:900; }
#csiAnalysisFeedbackTitle { display:block; margin:0; font-size:calc(14px * var(--csi-text-scale, 1)); line-height:1.5; font-weight:800; }
#csiAnalysisFeedbackText { margin:4px 0 0; font-size:inherit; line-height:1.6; }
#csiAnalysisFeedback .csi-analysis-feedback-actions { flex:0 0 auto; display:flex; align-items:flex-start; gap:4px; }
#csiAnalysisFeedback button { min-height:44px; padding:8px 10px; border-radius:9px; font-size:inherit; font-weight:800; line-height:1.5; cursor:pointer; touch-action:manipulation; }
#csiAnalysisFeedbackView { background:#166534; color:#fff; white-space:nowrap; }
#csiAnalysisFeedbackView:hover { background:#14532d; }
#csiAnalysisFeedbackClose { flex:0 0 44px; width:44px; padding:4px !important; font-size:24px !important; background:transparent; color:inherit; }
#csiAnalysisFeedbackClose:hover { background:#ffffffa6; }
#csiWeatherPage #aiResultHeading { display:flex; flex-wrap:wrap; align-items:center; gap:8px; min-width:0; margin:0; scroll-margin-block:16px; color:#1e293b; font-size:calc(16px * var(--csi-text-scale, 1)); font-weight:800; line-height:1.5; }
.csi-analysis-complete-badge { display:inline-flex; align-items:center; padding:4px 8px; border:1px solid #bbf7d0; border-radius:8px; background:#f0fdf4; color:#166534; font-size:calc(12px * var(--csi-text-scale, 1)); font-weight:800; }
@media (max-width:600px) {
    #csiWeatherPage #csiAnalysisFeedback { right:12px; bottom:calc(12px + env(safe-area-inset-bottom)); display:grid; grid-template-columns:minmax(0,1fr) 44px; gap:6px 8px; padding:12px; }
    #csiAnalysisFeedback .csi-analysis-feedback-actions { display:contents; }
    #csiAnalysisFeedbackClose { grid-column:2; grid-row:1; }
    #csiAnalysisFeedbackView { grid-column:1 / -1; justify-self:stretch; }
}
#weatherSidePanel { min-width:0; min-height:0; }
#weatherLocationHeader { padding:12px var(--csi-panel-gutter) 16px !important; }
#csiWeatherPage #locTitle { min-width:0; white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; font-size:19px !important; line-height:1.5 !important; }
#csiWeatherPage #stnInfo { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 8px; min-width:0; white-space:normal; overflow-wrap:anywhere; font-size:12px !important; line-height:1.65; color:#64748b; }
#weatherDataStatus { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:8px; }
#weatherDataStatus span { display:inline-flex; padding:4px 8px; border-radius:6px; background:#f1f5f9; color:#475569; font-size:11px; line-height:1.5; }
#weatherDataStatus [data-status="ready"] { background:#f0fdf4; color:#166534; }
#weatherDataStatus [data-status="loading"] { background:#eef2ff; color:#4338ca; }
#weatherDataStatus [data-status="error"], #weatherDataStatus [data-status="empty"], #weatherDataStatus [data-status="stale"] { background:#fff7ed; color:#9a3412; }
#weatherFreshnessStatus { font-size:12px; line-height:1.6; padding:8px 10px; margin-top:8px; color:#92400e; background:#fffbeb; border:1px solid #fde68a; border-radius:9px; }
#weatherMainTabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); padding-inline:var(--csi-panel-gutter) !important; gap:8px !important; }
#weatherMainTabs .tab-btn { min-width:0; min-height:44px; padding:10px 6px !important; font-size:14px !important; line-height:1.5; white-space:normal; }
#weatherScrollArea { min-width:0; min-height:0; padding:var(--csi-panel-gutter) !important; scroll-behavior:smooth; overscroll-behavior:contain; scrollbar-gutter:stable; }
#weatherScrollArea > [role="tabpanel"] { min-width:0; scroll-margin-top:12px; }
#weatherScrollArea > [role="tabpanel"] > * + :not(.csi-weather-note) { margin-top:var(--csi-section-gap); }
.csi-action-status { margin:0; padding:11px 13px; border:1px solid #c7d2fe; border-radius:11px; background:#eef2ff; color:#3730a3; font-size:13px; line-height:1.65; overflow-wrap:anywhere; }
.csi-action-status[data-status="error"] { border-color:#fdba74; color:#9a3412; background:#fff7ed; }
.csi-action-link { display:inline-flex; align-items:center; gap:8px; padding:10px 0; min-height:44px; line-height:1.6; color:#4338ca; font-size:13px; font-weight:700; text-decoration:underline; text-underline-offset:3px; }
.csi-weather-note { font-size:12px; line-height:1.6; color:#64748b; margin-top:10px; }
#reportInputForm { container-type:inline-size; container-name:csi-report-form; }
.csi-report-fields { display:grid; grid-template-columns:minmax(0,1fr); gap:12px; }
.csi-report-site-field { grid-column:1 / -1; }
@container csi-report-form (min-width:320px) {
    .csi-report-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .csi-report-manager-field { grid-column:1 / -1; }
}
@container csi-report-form (min-width:420px) {
    .csi-report-fields { grid-template-columns:repeat(3,minmax(0,1fr)); }
    .csi-report-manager-field { grid-column:auto; }
}
.csi-report-fields label { display:block; min-width:0; color:#334155; font-size:13px; font-weight:700; }
.csi-report-fields input { display:block; margin-top:6px; box-sizing:border-box; min-width:0; width:100%; color:#0f172a; font-weight:400; min-height:44px; line-height:1.5; }
#btnGenerateReport { min-height:48px; }
.csi-result-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.csi-result-actions > button { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:10px 16px; line-height:1.5; white-space:normal; }
.csi-safety-actions { display:flex; align-items:stretch; gap:8px; flex-wrap:wrap; }
.csi-safety-actions button { flex:1 1 180px; min-width:0; white-space:normal; }
#aiSafetyActions { scroll-margin-top:16px; }
#csiForecastTabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); flex:0 0 auto; gap:4px; }
#csiForecastTabs button { min-height:44px; min-width:56px; padding:8px 12px; font-size:12px; line-height:1.5; }
#dailyList, #weekList { min-height:120px; }
#liveWeatherCard h3 { min-width:0; flex-wrap:wrap; line-height:1.6; }
#liveWeatherCard > div:first-child { gap:8px; align-items:flex-start; flex-wrap:wrap; }
#liveWeatherCard #stnName { min-width:0; max-width:100%; font-size:12px; line-height:1.5; white-space:normal; overflow-wrap:anywhere; }
#nowTime { font-variant-numeric:tabular-nums; line-height:1.6; overflow-wrap:anywhere; }
#csiCopyDialog { width:calc(100% - 28px); max-width:610px; max-height:85dvh; padding:22px; border:1px solid #cbd5e1; border-radius:16px; color:#1e293b; box-shadow:0 16px 48px #0004; }
#csiCopyDialog::backdrop { background:#0f172a80; }
#csiCopyDialog h2 { font-size:18px; font-weight:800; }
#csiCopyDialog p { margin:10px 0; font-size:14px; line-height:1.6; color:#475569; }
#csiCopyText { box-sizing:border-box; width:100%; min-height:180px; margin:0 0 12px; padding:12px; border:1px solid #94a3b8; border-radius:9px; font-size:14px; line-height:1.65; resize:vertical; }
.csi-sr-only { position:absolute !important; width:1px !important; height:1px !important; padding:0 !important; margin:-1px !important; overflow:hidden !important; clip:rect(0,0,0,0) !important; white-space:nowrap !important; border:0 !important; }
#csiPanelToggle { display:none; }
.csi-catalog-field { min-width:0; }
.csi-catalog-field:has(> [data-catalog-controls]) > .csi-catalog-label { display:none; }

/* Common card rhythm and aligned values; text can grow without fixed heights. */
#liveWeatherCard, #forecastCard, #aiInputArea, #reportInputForm { min-width:0; padding:20px !important; }
#forecastCard { min-height:0 !important; }
#forecastCard > div:first-child { display:flex; flex-wrap:wrap; align-items:center; gap:12px; }
#liveWeatherCard .grid.grid-cols-4 { align-items:stretch; gap:8px !important; }
#liveWeatherCard .grid.grid-cols-4 > div { display:flex; flex-direction:column; align-items:center; justify-content:center; min-width:0; min-height:84px; padding:12px 8px !important; }
#liveWeatherCard :is(#val_ta,#val_ws,#val_rn,#val_hm) { max-width:100%; font-variant-numeric:tabular-nums; line-height:1.4; overflow-wrap:normal; word-break:normal; }
#weatherLayerPanel { width:304px !important; max-width:calc(100vw - 32px); word-break:keep-all; overflow-wrap:anywhere; }
#weatherLayerPanel > div:first-child { gap:8px; }
#weatherLayerPanel > div:first-child .text-\[9px\] { font-size:11px; line-height:1.6; }
#weatherLayerPanel > div:first-child > button { min-height:44px; }
#weatherLayerPanel > div:first-child > button:not(:first-child) { width:44px; min-width:44px; height:44px; }
#weatherLayerPanel .weather-layer-toggle { min-height:44px; font-size:12px !important; line-height:1.5; }
#weatherLayerStatus { font-size:12px; line-height:1.65; }
#weatherLayerBody > div:last-child { font-size:11px; line-height:1.6; }
/* Forecast rows share columns so neighbouring dates and values line up. */
#dailyList .csi-hourly-row, #weekList .csi-weekly-row { display:grid; grid-template-columns:56px minmax(0,1fr) max-content; align-items:center; gap:12px; margin-bottom:0; padding:12px; font-variant-numeric:tabular-nums; }
#forecastCard .csi-forecast-time, #forecastCard .csi-forecast-date { width:auto; min-width:0; text-align:center; line-height:1.5; }
#forecastCard .csi-forecast-time { display:flex; flex-direction:column; align-items:center; gap:2px; }
#forecastCard .csi-forecast-condition { display:flex; justify-content:flex-start; align-items:center; gap:10px; min-width:0; padding:0; line-height:1.6; }
#forecastCard .csi-forecast-symbol { flex:0 0 auto; }
#forecastCard .csi-forecast-copy { min-width:0; overflow-wrap:anywhere; }
#forecastCard .csi-forecast-detail { display:block; margin-top:2px; color:#526685; font-size:11px; line-height:1.6; }
#forecastCard .csi-forecast-temperature, #forecastCard .csi-forecast-range { white-space:nowrap; text-align:right; }
#forecastCard .csi-forecast-temperature { font-size:20px; line-height:1.4; }
#forecastCard .csi-forecast-range { font-size:13px; line-height:1.5; }

@media(max-width:1023px) {
    #weatherPageHeader { grid-template-columns:minmax(0,1fr) auto; gap:8px !important; padding:8px 16px !important; }
    #weatherLocationSearch { grid-column:1 / -1; grid-row:2; max-width:none; }
    #weatherPageHeader .csi-brand { font-size:16px !important; }
    #weatherSidePanel { position:absolute !important; bottom:0; left:0; width:100% !important; border-radius:20px 20px 0 0 !important; max-height:calc(100dvh - var(--csi-header-height) - 12px) !important; z-index:999; }
    #dragHandle { display:grid !important; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:12px; padding:4px 12px; min-height:52px; }
    #dragHandle > div { justify-self:center; margin:0; }
    #csiPanelToggle { display:inline-flex; align-items:center; min-height:44px; padding:8px 12px; border:1px solid #e2e8f0; border-radius:8px; color:#475569; background:#fff; font-size:12px; font-weight:700; cursor:pointer; touch-action:manipulation; }
    #weatherSidePanel[data-compact-collapsed="true"] #miniModeView,
    #weatherSidePanel[data-compact-collapsed="true"] #weatherMainTabs,
    #weatherSidePanel[data-compact-collapsed="true"] #weatherScrollArea,
    #weatherSidePanel[data-compact-collapsed="true"] #weatherDataStatus,
    #weatherSidePanel[data-compact-collapsed="true"] #weatherFreshnessStatus,
    #weatherSidePanel[data-compact-collapsed="true"] #stnInfo { display:none !important; }
    #weatherSidePanel[data-compact-collapsed="true"] #weatherLocationHeader { padding-bottom:calc(10px + env(safe-area-inset-bottom)) !important; }
    #weatherSidePanel[data-compact-collapsed="true"] #locTitle { font-size:15px !important; white-space:normal; overflow:visible; }
    #weatherScrollArea { padding-bottom:calc(24px + env(safe-area-inset-bottom)) !important; }
    #weatherLayerPanel { top:12px !important; left:12px !important; width:272px !important; max-width:calc(100vw - 24px) !important; max-height:calc(100dvh - var(--csi-header-height) - 28px); overflow-y:auto; }
    #weatherLayerPanel.mini-mobile-collapsed { width:240px !important; }
    #weatherLayerPanel.mini-mobile-collapsed > div:first-child { border-bottom:0; }
    #weatherLayerPanel > div:first-child .text-\[9px\] { display:none; }
}
@media(max-width:480px) {
    :root { --csi-panel-gutter:16px; --csi-section-gap:16px; }
    #weatherPageHeader { padding:8px 12px !important; gap:8px !important; }
    #weatherPageHeader .csi-brand { font-size:14px !important; }
    #weatherPageHeader .csi-header-button { width:44px; min-width:44px; min-height:44px !important; padding:8px !important; font-size:18px !important; }
    .csi-header-actions { gap:4px; }
    .csi-compact-label { display:none; }
    #weatherLocationQuery { font-size:16px; }
    #weatherLocationHeader { padding:8px var(--csi-panel-gutter) 12px !important; }
    #csiWeatherPage #locTitle { font-size:16px !important; }
    #weatherDataStatus span { font-size:11px; padding:4px 6px; }
    #weatherMainTabs { padding-inline:12px !important; gap:4px !important; }
    #weatherMainTabs .tab-btn { font-size:12px !important; }
    #liveWeatherCard .grid-cols-4 { grid-template-columns:repeat(2,minmax(0,1fr)); }
    #liveWeatherCard, #forecastCard, #aiInputArea, #reportInputForm { padding:16px !important; }
    .csi-report-fields { gap:12px; }
    .csi-report-fields input { font-size:16px; }
    .csi-result-actions > button { flex:0 0 auto; }
    #csiCopyDialog { padding:16px; }
    #csiCopyText { font-size:16px; }
}

@media(max-width:560px) {
    #dailyList .csi-hourly-row { grid-template-columns:48px minmax(0,1fr) max-content; gap:8px; padding:12px 8px; }
    #weekList .csi-weekly-row { grid-template-columns:48px minmax(0,1fr); gap:4px 8px; padding:12px; }
    #weekList .csi-forecast-date { grid-row:1 / span 2; }
    #weekList .csi-forecast-range { grid-column:2; text-align:left; }
    #forecastCard .csi-forecast-condition { gap:8px; }
    #dailyList .csi-forecast-condition { flex-direction:column; align-items:flex-start; gap:4px; }
    #dailyList .csi-forecast-symbol { font-size:20px; }
    #forecastCard .csi-forecast-temperature { font-size:18px; }
}
@media(max-width:360px) {
    #weatherPageHeader .csi-brand { font-size:13px !important; }
    #weatherMainTabs .tab-btn { font-size:12px !important; padding-inline:4px !important; }
}

@media(prefers-reduced-motion:reduce) {
    #csiWeatherPage *, #csiWeatherPage *::before, #csiWeatherPage *::after { scroll-behavior:auto !important; transition:none !important; animation:none !important; }
}
@media(max-width:1023px) and (max-height:480px) {
    #weatherSidePanel { display:block !important; overflow-y:auto; overscroll-behavior:contain; }
    #weatherSidePanel #miniModeView, #weatherSidePanel #weatherScrollArea { height:auto; overflow:visible !important; flex:none; }
}
@media print { #weatherPageHeader, #csiAppNotice, #csiCopyDialog, #csiAnalysisFeedback, .csi-analysis-complete-badge { display:none !important; } }
