* {
    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;
}

.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;
}

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;
}

.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: 32px 16px;
    color: #6c757d;
    font-size: 1.05em;
    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-place {
    font-size: 0.88em;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.92;
    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;
}

.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%;
}

.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 6px 0;
    font-size: 11px;
    color: #6B7280;
}

.gp-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 8px;
    font-size: 11px;
}

.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%;
    overflow-x: auto;
}

.gp-chart-svg {
    display: block;
    width: 100%;
    max-width: 340px;
    margin: 0 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: 8px;
    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: 8px 0 0 0;
    font-size: 10px;
    color: #6B7280;
    text-align: center;
}

.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;
}

.link-list {
    list-style: none;
    padding-left: 0;
}

.link-list li {
    margin-bottom: 8px;
}

.link-list a {
    color: #667eea;
    text-decoration: none;
}

.link-list a:hover {
    text-decoration: underline;
}

footer {
    margin-top: 24px;
    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;
}

/* 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;
}

@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;
    }
}
