* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
}

body.modal-open {
    overflow: hidden;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 24px;
}

.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.portal-header-text {
    flex: 1;
    text-align: center;
}

.portal-header h1 {
    font-size: 1.8em;
    color: #2c3e50;
    margin-bottom: 0;
}

.portal-title {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 10px;
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: 1.2;
}

.portal-title-prefix {
    flex: 0 0 auto;
    font-size: 0.75em;
    font-weight: 600;
    color: #4b5563;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.portal-title-logo-track {
    display: block;
    position: relative;
    flex: 0 1 auto;
    width: auto;
    max-width: min(100%, 580px);
    overflow: hidden;
    padding: 4px 8px 4px 0;
}

.portal-title-logo-track::after {
    content: "";
    position: absolute;
    inset: -10% -20%;
    background: linear-gradient(
        105deg,
        transparent 42%,
        rgba(255, 255, 255, 0.15) 47%,
        rgba(255, 248, 200, 0.85) 50%,
        rgba(255, 255, 255, 0.15) 53%,
        transparent 58%
    );
    transform: translateX(-130%) skewX(-18deg);
    animation: portal-title-logo-shimmer 4.8s ease-in-out infinite;
    pointer-events: none;
}

.portal-title-logo {
    display: block;
    width: auto;
    height: 72px;
    max-width: min(100%, 560px);
    margin: 0;
    animation: portal-title-logo-sparkle 4.8s ease-in-out infinite;
    will-change: filter;
}

.portal-title-prefix.hidden + .portal-title-logo-track .portal-title-logo {
    height: 80px;
    max-width: min(100%, 600px);
}

.portal-brand-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 8px;
    margin: 6px 0 0;
    font-size: 0.92rem;
    color: #4b5563;
    line-height: 1.4;
}

.portal-brand-message {
    font-weight: 500;
}

.portal-brand-info-anchor {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.portal-brand-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    padding: 0;
    border: 1px solid #9ca3af;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 11px;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1;
    cursor: help;
}

.portal-brand-info-btn:hover,
.portal-brand-info-btn:focus-visible {
    color: #1e40af;
    border-color: #667eea;
    background: #eef2ff;
}

.portal-brand-info-popover {
    display: none;
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    z-index: 30;
    width: max-content;
    max-width: min(340px, 88vw);
    padding: 12px 14px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #d1d5db;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    font-size: 11px;
    line-height: 1.6;
    color: #374151;
    text-align: left;
    transform: translateX(-50%);
}

.portal-brand-info-anchor.is-open .portal-brand-info-popover {
    display: block;
}

@media (hover: hover) and (pointer: fine) {
    .portal-brand-info-anchor:hover .portal-brand-info-popover,
    .portal-brand-info-anchor:focus-within .portal-brand-info-popover {
        display: block;
    }

    .portal-brand-info-anchor.is-open .portal-brand-info-popover {
        display: block;
    }
}

@keyframes portal-title-logo-shimmer {
    0%,
    62%,
    100% {
        transform: translateX(-130%) skewX(-18deg);
        opacity: 0;
    }

    68% {
        opacity: 1;
    }

    78% {
        transform: translateX(130%) skewX(-18deg);
        opacity: 0;
    }
}

@keyframes portal-title-logo-sparkle {
    0%,
    62%,
    100% {
        filter: brightness(1) drop-shadow(0 0 0 transparent);
    }

    70% {
        filter: brightness(1.14) drop-shadow(0 0 5px rgba(255, 236, 140, 0.75));
    }

    76% {
        filter: brightness(1.04) drop-shadow(0 0 2px rgba(255, 248, 210, 0.45));
    }
}

@media (prefers-reduced-motion: reduce) {
    .portal-title-logo-track::after,
    .portal-title-logo {
        animation: none;
    }
}

.settings-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.settings-btn:hover {
    opacity: 0.9;
}

.ai-advisor-section {
    margin-bottom: 16px;
}

.ai-advisor-chat {
    width: 100%;
    max-width: none;
    margin: 0;
}

.ai-advisor-messages {
    overflow-y: auto;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #f9f9f9;
    transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.25s ease;
}

.ai-advisor-messages.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    overflow: hidden;
}

.ai-advisor-messages.expanded {
    max-height: min(420px, 50vh);
    opacity: 1;
}

.ai-advisor-message {
    margin-bottom: 12px;
    animation: advisorFadeIn 0.3s ease;
}

@keyframes advisorFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-advisor-message-content {
    padding: 10px 14px;
    border-radius: 10px;
    max-width: 88%;
    line-height: 1.6;
    word-wrap: break-word;
    font-size: 14px;
}

.ai-advisor-message-content :first-child {
    margin-top: 0;
}

.ai-advisor-message-content :last-child {
    margin-bottom: 0;
}

.ai-advisor-message-content p {
    margin: 0.6em 0;
}

.ai-advisor-message-content ul,
.ai-advisor-message-content ol {
    margin: 0.6em 0;
    padding-left: 1.4em;
}

.ai-advisor-message-content code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.92em;
}

.ai-advisor-message-content pre {
    background: rgba(0, 0, 0, 0.06);
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
}

.ai-advisor-user .ai-advisor-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
}

.ai-advisor-bot .ai-advisor-message-content {
    background: #e9ecef;
    color: #333;
}

.ai-advisor-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
    width: 100%;
}

.ai-advisor-input-wrap {
    min-width: 0;
}

#ai-advisor-input {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 42px;
    max-height: 120px;
}

#ai-advisor-input:focus {
    outline: none;
    border-color: #667eea;
}

.ai-advisor-send-btn {
    align-self: stretch;
    white-space: nowrap;
}

.ai-advisor-notice-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 6px 0 0;
    font-size: 11px;
    color: #6B7280;
    line-height: 1.4;
}

.ai-advisor-notice-anchor {
    position: relative;
    display: inline-flex;
}

.ai-advisor-notice-btn {
    padding: 0;
    border: none;
    background: none;
    color: #6B7280;
    font-size: 11px;
    cursor: help;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ai-advisor-notice-btn:hover,
.ai-advisor-notice-btn:focus-visible {
    color: #1E40AF;
}

.ai-advisor-notice-popover {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    z-index: 20;
    width: max-content;
    max-width: min(320px, 90vw);
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #D1D5DB;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    font-size: 11px;
    line-height: 1.55;
    color: #374151;
    text-align: left;
}

.ai-advisor-notice-popover strong {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    color: #1F2937;
}

.ai-advisor-notice-anchor:hover .ai-advisor-notice-popover,
.ai-advisor-notice-anchor:focus-within .ai-advisor-notice-popover {
    display: block;
}

.ai-advisor-notice-brief {
    flex: 1 1 auto;
    min-width: 0;
}

.ai-advisor-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

section {
    margin-bottom: 24px;
}

section h2 {
    color: #2c3e50;
    font-size: 1.2em;
    margin-bottom: 12px;
}

.weather-section {
    position: relative;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.weather-more-link {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.72em;
    font-weight: 600;
    color: #667eea;
    background: white;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: background-color 0.15s, color 0.15s;
}

.weather-more-link:hover {
    color: white;
    background: #667eea;
    border-color: #667eea;
}

.weather-placeholder {
    text-align: center;
    padding: 24px 16px;
    color: #6c757d;
    font-size: 0.9em;
    line-height: 1.5;
    background: white;
    border-radius: 10px;
}

.weather-widget {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.weather-scroll {
    display: flex;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 8px;
}

.weather-scroll::-webkit-scrollbar {
    height: 8px;
}

.weather-scroll::-webkit-scrollbar-track {
    background: #eef1f5;
    border-radius: 4px;
}

.weather-scroll::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.weather-day-block {
    flex: 0 0 auto;
    border-right: 2px solid #e9ecef;
    scroll-snap-align: start;
}

.weather-day-block:last-child {
    border-right: none;
}

.weather-day-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-width: 280px;
}

.weather-day-main {
    flex-shrink: 0;
}

.weather-day-date {
    font-size: 1.05em;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
}

.weather-day-icon {
    font-size: 2.2em;
    line-height: 1;
}

.weather-day-stats {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    font-size: 0.82em;
    opacity: 0.95;
}

.weather-day-stat {
    white-space: nowrap;
}

.weather-hour-row {
    display: flex;
    min-height: 150px;
}

.weather-hour-cell {
    flex: 0 0 72px;
    padding: 10px 6px;
    text-align: center;
    border-right: 1px solid #eee;
    background: white;
}

.weather-hour-cell:last-child {
    border-right: none;
}

.weather-hour-time {
    font-size: 0.82em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

.weather-hour-icon {
    font-size: 1.6em;
    line-height: 1;
    margin-bottom: 6px;
}

.weather-hour-temp {
    font-size: 1.05em;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}

.weather-hour-meta {
    font-size: 0.75em;
    color: #6c757d;
    line-height: 1.35;
}

.weather-hour-precip {
    font-size: 0.72em;
    color: #667eea;
    margin-top: 4px;
}

.disease-risk-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
}

.portal-insights-row {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.portal-insights-col {
    flex: 1;
    min-width: 0;
    overflow: visible;
}

.portal-gp-row {
    margin-top: 16px;
}

.portal-gp-rac-row {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.portal-gp-col,
.portal-rac-search-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.portal-gp-col > #gp-chart-area,
.portal-rac-search-col > .portal-rac-search-panel {
    flex: 1;
}

.portal-rac-search-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 12px;
    height: 100%;
}

.portal-rac-search-title {
    margin: 0 0 4px 0;
    color: #1E40AF;
    font-size: 1.05em;
    font-weight: bold;
    border-bottom: 2px solid #E5E7EB;
    padding-bottom: 6px;
}

.portal-rac-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.92em;
    font-family: inherit;
}

.portal-rac-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.portal-rac-and-label {
    margin: 0;
    text-align: center;
    font-size: 0.85em;
    color: #6c757d;
}

.portal-rac-search-desc {
    margin: 8px 0 0 0;
    font-size: 10px;
    color: #6B7280;
    text-align: center;
    line-height: 1.5;
}

.portal-rac-search-error {
    margin: 0;
    padding: 8px 10px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    border-radius: 6px;
    font-size: 0.85em;
    text-align: center;
}

.gdd-panel {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 12px;
    height: 100%;
    overflow: visible;
}

.gdd-block {
    margin-bottom: 10px;
    overflow: visible;
}

.gdd-title {
    margin: 0 0 4px 0;
    color: #1E40AF;
    font-size: 1.05em;
    font-weight: bold;
    border-bottom: 2px solid #E5E7EB;
    padding-bottom: 6px;
}

.gdd-subtitle {
    margin: 0 0 10px 0;
    font-size: 11px;
    color: #6B7280;
}

.gdd-block:last-child {
    margin-bottom: 0;
}

.gdd-section-divider {
    border-top: 1px solid #E5E7EB;
    margin: 12px 0 10px;
}

.gdd-section-title {
    margin: 0 0 4px 0;
    font-size: 12px;
    font-weight: bold;
    color: #374151;
}

.gdd-subtitle--germination {
    margin-bottom: 8px;
}

.gdd-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: bold;
    color: #374151;
    margin-bottom: 4px;
    line-height: 1.3;
}

.gdd-info-anchor {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.gdd-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    padding: 0;
    border: 1px solid #9ca3af;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 10px;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1;
    cursor: help;
}

.gdd-info-btn:hover,
.gdd-info-btn:focus-visible {
    color: #1e40af;
    border-color: #667eea;
    background: #eef2ff;
}

.gdd-info-popover {
    display: none;
    position: absolute;
    left: auto;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    width: min(360px, calc(100vw - 48px));
    max-width: min(360px, calc(100vw - 48px));
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #d1d5db;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    font-size: 11px;
    font-weight: normal;
    line-height: 1.55;
    color: #374151;
    text-align: left;
    box-sizing: border-box;
}

.gdd-info-lead {
    margin: 0 0 8px;
}

.gdd-info-foot {
    margin: 8px 0 0;
}

.gdd-info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}

.gdd-info-table th,
.gdd-info-table td {
    padding: 4px 6px;
    border: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

.gdd-info-table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #1f2937;
}

.gdd-info-anchor.is-open .gdd-info-popover {
    display: block;
}

@media (hover: hover) and (pointer: fine) {
    .gdd-info-anchor:hover .gdd-info-popover,
    .gdd-info-anchor:focus-within .gdd-info-popover {
        display: block;
    }

    .gdd-info-anchor.is-open .gdd-info-popover {
        display: block;
    }
}

.gdd-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.gdd-date-label {
    font-size: 11px;
    font-weight: bold;
    color: #4B5563;
    white-space: nowrap;
}

.gdd-controls input[type="date"] {
    width: 130px;
    padding: 4px 6px;
    font-size: 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
}

.gdd-gauge-wrap {
    flex: 1 1 140px;
    min-width: 120px;
}

.gdd-gauge-track {
    position: relative;
    height: 16px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: visible;
}

.gdd-gauge-seg {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 3px;
}

.gdd-seg-normal {
    background: #81c784;
    z-index: 1;
}

.gdd-seg-window {
    background: #ffeb3b;
    z-index: 2;
}

.gdd-seg-over {
    background: #e53935;
    z-index: 3;
}

.gdd-gauge-mark {
    position: absolute;
    top: -2px;
    width: 2px;
    height: 20px;
    background: rgba(255, 255, 255, 0.9);
    z-index: 4;
    transform: translateX(-1px);
}

.gdd-gauge-scale {
    position: relative;
    height: 14px;
    font-size: 9px;
    color: #6B7280;
    margin-top: 2px;
}

.gdd-gauge-scale span {
    position: absolute;
    white-space: nowrap;
    transform: translateX(-50%);
}

.gdd-gauge-scale span.scale-start {
    transform: translateX(0);
}

.gdd-gauge-scale span.scale-end {
    transform: translateX(-100%);
}

.disease-risk-panel {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 12px;
    height: 100%;
}

.disease-risk-panel--combined {
    max-width: none;
    margin: 0;
}

.gp-chart-panel {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 12px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.gp-chart-title {
    margin: 0 0 4px 0;
    color: #1E40AF;
    font-size: 1.05em;
    font-weight: bold;
    border-bottom: 2px solid #E5E7EB;
    padding-bottom: 6px;
}

.gp-chart-subtitle {
    margin: 0 0 4px 0;
    font-size: 11px;
    color: #6B7280;
}

.gp-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 4px;
    font-size: 10px;
}

.gp-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gp-legend-item::before {
    content: "";
    width: 18px;
    height: 3px;
    border-radius: 2px;
}

.gp-legend-warm::before {
    background: #EA580C;
}

.gp-legend-cool::before {
    background: #2563EB;
}

.gp-legend-warm-default::before {
    background: repeating-linear-gradient(
        90deg,
        #FB923C 0,
        #FB923C 4px,
        transparent 4px,
        transparent 7px
    );
}

.gp-legend-cool-default::before {
    background: repeating-linear-gradient(
        90deg,
        #60A5FA 0,
        #60A5FA 4px,
        transparent 4px,
        transparent 7px
    );
}

.gp-chart-body {
    width: 100%;
    flex: 0 0 auto;
}

.gp-chart-svg {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
}

.gp-grid-line {
    stroke: #E5E7EB;
    stroke-width: 1;
}

.gp-axis-label,
.gp-month-label {
    fill: #6B7280;
    font-size: 10px;
}

.gp-today-line {
    stroke: #DC2626;
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
}

.gp-today-label-bg {
    fill: #FEE2E2;
    stroke: #DC2626;
    stroke-width: 1;
}

.gp-today-label {
    fill: #B91C1C;
    font-size: 9px;
    font-weight: bold;
}

.gp-line {
    fill: none;
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.gp-line-warm {
    stroke: #EA580C;
}

.gp-line-cool {
    stroke: #2563EB;
}

.gp-line-warm-default {
    stroke: #FB923C;
    stroke-dasharray: 6 4;
    stroke-width: 2;
}

.gp-line-cool-default {
    stroke: #60A5FA;
    stroke-dasharray: 6 4;
    stroke-width: 2;
}

.gp-point-warm {
    fill: #EA580C;
    stroke: #FFFFFF;
    stroke-width: 1.5;
}

.gp-point-cool {
    fill: #2563EB;
    stroke: #FFFFFF;
    stroke-width: 1.5;
}

.gp-chart-details {
    margin-top: 4px;
    font-size: 11px;
    color: #374151;
}

.gp-chart-details summary {
    cursor: pointer;
    color: #1E40AF;
    user-select: none;
}

.gp-chart-table {
    width: 100%;
    margin-top: 6px;
    border-collapse: collapse;
    font-size: 10px;
}

.gp-chart-table th,
.gp-chart-table td {
    border: 1px solid #E5E7EB;
    padding: 3px 6px;
    text-align: center;
}

.gp-chart-table th {
    background: #F3F4F6;
    color: #374151;
}

.gp-chart-footer {
    margin: 4px 0 0 0;
    font-size: 10px;
    color: #6B7280;
    text-align: center;
}

#gp-chart-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#gp-chart-area .gp-chart-panel {
    flex: 1;
}

.disease-risk-title {
    margin: 0 0 10px 0;
    color: #1E40AF;
    font-size: 1.05em;
    font-weight: bold;
    border-bottom: 2px solid #E5E7EB;
    padding-bottom: 6px;
}

.disease-risk-table-header {
    display: grid;
    grid-template-columns: 1fr 56px 56px;
    gap: 8px;
    align-items: end;
    margin-bottom: 4px;
    padding: 0 8px;
}

.disease-risk-table-col {
    font-size: 11px;
    font-weight: bold;
    color: #1E40AF;
    text-align: center;
    line-height: 1.2;
}

.disease-risk-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.disease-risk-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background-color: #F9FAFB;
    border-radius: 6px;
    border: 2px solid #E5E7EB;
}

.disease-risk-item-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
    font-weight: bold;
    font-size: 13px;
    color: #1F2937;
    line-height: 1.2;
}

.disease-risk-item-label {
    flex-shrink: 0;
}

.disease-logic-btn {
    padding: 1px 6px;
    font-size: 9px;
    font-weight: 600;
    color: #1E40AF;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1.4;
}

.disease-logic-btn:hover {
    background: #DBEAFE;
}

.disease-logic-panel {
    width: min(420px, 100%);
}

.disease-logic-content {
    font-size: 12px;
    color: #374151;
    line-height: 1.45;
}

.disease-logic-subtitle {
    margin: 0 0 8px 0;
    font-size: 11px;
    color: #6B7280;
}

.disease-logic-description {
    margin: 0 0 10px 0;
}

.disease-logic-formula {
    margin-bottom: 12px;
    padding: 8px;
    background: #F3F4F6;
    border-radius: 6px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    word-break: break-word;
}

.disease-logic-section {
    margin-bottom: 12px;
}

.disease-logic-section h3 {
    margin: 0 0 6px 0;
    font-size: 12px;
    color: #1E40AF;
}

.disease-logic-list {
    margin: 0;
    padding-left: 18px;
}

.disease-logic-list li {
    margin-bottom: 4px;
}

.disease-logic-calculation {
    padding: 10px;
    background: #FEF3C7;
    border: 1px solid #FCD34D;
    border-radius: 6px;
}

.disease-logic-calc-block {
    font-size: 11px;
    line-height: 1.45;
}

.disease-logic-calc-gap {
    margin-top: 6px;
}

.disease-logic-note {
    margin: 4px 0 0 0;
    font-size: 10px;
    color: #6B7280;
    text-align: center;
}

.disease-risk-item-values {
    display: grid;
    grid-template-columns: 56px 56px;
    gap: 8px;
}

.disease-risk-item-value {
    width: 56px;
    height: 32px;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.disease-risk-footer {
    margin-top: 8px;
    font-size: 10px;
    color: #6B7280;
    text-align: center;
    padding-top: 8px;
    border-top: 1px solid #E5E7EB;
}

.loading {
    text-align: center;
    padding: 24px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #f5c6cb;
}

.hidden {
    display: none;
}

.app-list {
    list-style: none;
    display: grid;
    gap: 12px;
}

.app-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 16px;
    border-left: 4px solid #667eea;
}

.app-card h3 {
    color: #2c3e50;
    margin-bottom: 6px;
}

.app-card p {
    color: #555;
    margin-bottom: 12px;
    font-size: 0.95em;
}

.app-link {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
}

.app-link:hover {
    opacity: 0.92;
}

/* 芝しごとシリーズ — カテゴリ非表示: .series-section--no-category .series-card-category { display: none; } */
.series-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.series-section-title {
    margin: 0 0 12px 0;
    color: #1E40AF;
    font-size: 1.05em;
    font-weight: bold;
    border-bottom: 2px solid #E5E7EB;
    padding-bottom: 6px;
}

.series-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.series-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 64px;
    padding: 12px 36px 12px 14px;
    background: white;
    border: 2px solid transparent;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: #2c3e50;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.series-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.18);
}

.series-card:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.series-card-category {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #667eea;
    line-height: 1.2;
}

.series-card-name-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.series-card-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.series-info-anchor {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    z-index: 3;
}

.series-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    padding: 0;
    border: 1px solid #9ca3af;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 10px;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1;
    cursor: help;
}

.series-info-btn:hover,
.series-info-btn:focus-visible {
    color: #1e40af;
    border-color: #667eea;
    background: #eef2ff;
}

.series-info-popover {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    z-index: 30;
    width: max-content;
    max-width: min(320px, 88vw);
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #d1d5db;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    font-size: 11px;
    font-weight: normal;
    line-height: 1.55;
    color: #374151;
    text-align: left;
}

.series-info-anchor.is-open .series-info-popover {
    display: block;
}

.series-grid .series-card:nth-child(even) .series-info-popover {
    left: auto;
    right: 0;
}

@media (hover: hover) and (pointer: fine) {
    .series-info-anchor:hover .series-info-popover,
    .series-info-anchor:focus-within .series-info-popover {
        display: block;
    }

    .series-info-anchor.is-open .series-info-popover {
        display: block;
    }
}

.series-card-external {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 14px;
    line-height: 1;
    color: #9CA3AF;
    transition: color 0.15s ease;
}

.series-card:hover .series-card-external {
    color: #667eea;
}

.portal-banners {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    max-width: 720px;
    margin: 0 auto 16px;
}

.portal-banner-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 76px;
    padding: 4px;
    line-height: 0;
    border-radius: 8px;
    transition: opacity 0.15s ease;
}

.portal-banner-link:hover {
    opacity: 0.88;
}

.portal-banner-link img {
    display: block;
    width: 100%;
    max-width: 240px;
    height: 76px;
    object-fit: contain;
    vertical-align: bottom;
}

footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid #f0f0f0;
    text-align: center;
    color: #6c757d;
    font-size: 0.85em;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

footer p {
    margin: 4px 0;
}

.footer-gp {
    margin: 8px 0 4px;
}

.footer-gp-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
    text-decoration: none;
    color: #667eea;
}

.footer-gp-link:hover {
    text-decoration: none;
    opacity: 0.88;
}

.footer-gp-link:hover .footer-gp-name {
    text-decoration: underline;
}

.footer-gp-logo {
    display: block;
    height: 56px;
    width: auto;
}

.footer-gp-name {
    font-size: 0.95em;
    font-weight: 600;
}

.footer-version {
    margin-top: 8px;
    font-size: 0.78em;
    color: #9ca3af;
    letter-spacing: 0.04em;
}

/* Settings modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.modal-panel {
    position: relative;
    width: min(520px, 100%);
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 1.2em;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.6em;
    line-height: 1;
    cursor: pointer;
    color: #6c757d;
    padding: 0 4px;
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
}

.setting-group {
    margin-bottom: 18px;
}

.setting-group h3,
.setting-group > label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.setting-group input[type="number"],
.setting-group select {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
}

.setting-group input[type="number"]:focus,
.setting-group select:focus {
    outline: none;
    border-color: #667eea;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.radio-group label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.92em;
}

.help-text {
    font-size: 0.8em;
    color: #6c757d;
    margin: 4px 0 10px;
    line-height: 1.4;
}

.location-status {
    margin-top: 8px;
    font-size: 0.85em;
    color: #28a745;
}

.location-status.error {
    color: #dc3545;
}

.btn-primary,
.btn-secondary {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: default;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover,
.btn-primary:hover:not(:disabled) {
    opacity: 0.92;
}

/* モーダル保存ボタンは全幅、AI質問ボタンは内容幅 */
.ai-advisor-input-row .btn-primary.ai-advisor-send-btn {
    width: auto;
    max-width: none;
    padding: 8px 12px;
    font-size: 13px;
}

.portal-rac-search-panel .btn-primary.portal-rac-search-btn {
    align-self: center;
    width: 25%;
    max-width: none;
    padding: 6px 8px;
    font-size: 0.85em;
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .portal-header {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-btn {
        align-self: flex-end;
    }

    .weather-day-summary {
        min-width: 260px;
        padding: 12px;
        gap: 10px;
    }

    .weather-hour-cell {
        flex-basis: 64px;
    }

    .portal-insights-row {
        flex-direction: column;
    }

    .portal-gp-rac-row {
        flex-direction: column;
    }

    .series-grid {
        grid-template-columns: 1fr;
    }

    .portal-banners {
        grid-template-columns: 1fr;
        max-width: 280px;
    }
}
