:root {
    --background: #0b131b;
    --surface: #101a24;
    --text: #f1f4f7;
    --muted: #a3afbd;
    --border: #304453;
    --accent: #d7f47a;
    --gutter: clamp(24px, 4vw, 64px);
    --radius: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; background: var(--background); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.site-header { min-height: 100px; padding: 0 var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 23px; white-space: nowrap; }
.brand-mark { width: 43px; height: 43px; position: relative; color: var(--accent); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; inset: 7px; border: 1.5px solid currentColor; border-radius: 50%; }
.brand-mark::after { inset: 0; border: 0; border-radius: 0; background: linear-gradient(currentColor, currentColor) center/100% 1.5px no-repeat, linear-gradient(currentColor, currentColor) center/1.5px 100% no-repeat; }
.brand-name { font-size: 29px; font-weight: 750; letter-spacing: -1px; }
.brand-detail { color: #c5cdd7; font-size: 14px; letter-spacing: 4.5px; margin-left: -3px; }
.account { display: flex; align-items: center; gap: 38px; }
.account-name { color: var(--muted); font-size: 17px; }
.account form { margin: 0; }
.button { border-radius: 8px; border: 1px solid transparent; min-height: 46px; transition: background-color .16s, border-color .16s, transform .16s; }
.button:active { transform: translateY(1px); }
.button-outline { padding: 0 28px; border-color: #51677a; background: transparent; color: #c5cdd7; font-size: 14px; }
.button-outline:hover { background: #172430; border-color: var(--muted); }
main { flex: 1; }
.site-footer { padding: 38px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 12px; letter-spacing: 1.7px; color: var(--muted); }
.dashboard-page main { padding: 54px var(--gutter) 64px; }
.page-heading { font-size: 36px; font-weight: 650; letter-spacing: .01em; margin: 0 0 30px; line-height: 1.4; }
.clock-panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 20px 28px; margin-bottom: 24px; display: flex; align-items: center; gap: 36px; min-height: 112px; }
.clock-panel-header { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; flex-shrink: 0; }
.clock-panel-header h2 { font-size: 17px; font-weight: 600; margin: 0; line-height: 1.5; }
.clock-zone { font-size: 12px; color: var(--muted); }
.clock-display { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.clock-date { margin: 0; font-size: 22px; font-weight: 500; line-height: 1.4; white-space: nowrap; }
.clock-time { display: block; font-family: "Liberation Sans", Arial, sans-serif; font-weight: 600; font-size: clamp(46px, 4.5vw, 64px); letter-spacing: -1px; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock-weekday { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 5px 0 0; }
.login-page main { display: flex; align-items: center; justify-content: center; padding: 60px var(--gutter) 70px; }
.login-panel { width: 532px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 48px 44px 38px; }
.login-panel h1 { margin: 0 0 8px; font-size: 36px; font-weight: 650; letter-spacing: .02em; line-height: 1.4; }
.login-welcome { color: var(--muted); margin: 0 0 32px; font-size: 17px; line-height: 1.6; }
.form-field { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.form-field label { font-weight: 600; font-size: 17px; }
.form-field input { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 0 20px; height: 57px; background: var(--background); color: var(--text); font-size: 18px; transition: border-color .16s, box-shadow .16s; }
.form-field input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgb(215 244 122 / 10%); }
.form-field input[aria-invalid="true"] { border-color: #e7a0a0; }
.button-primary { width: 100%; min-height: 58px; margin-top: 6px; background: var(--accent); color: #152007; font-size: 19px; font-weight: 700; }
.button-primary:hover { background: #e1fa99; }
.login-note { margin: 25px 0 0; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.7; }
.form-error { border: 1px solid #8e515a; border-radius: 8px; padding: 12px 14px; margin-bottom: 24px; color: #f3b9be; background: #2a1921; font-size: 14px; line-height: 1.65; }
@media (min-width: 1500px) { .brand-mark { width: 48px; height: 48px; } .brand-name { font-size: 32px; } .brand-detail { font-size: 15px; } .page-heading { font-size: 38px; margin-bottom: 27px; } .site-footer { font-size: 14px; } .account-name { font-size: 18px; } .account { gap: 42px; } .button-outline { min-height: 50px; font-size: 16px; } .site-header { min-height: 110px; } .dashboard-page main { padding-top: 61px; } .login-panel { width: 586px; padding: 53px 49px 40px; } .login-panel h1 { font-size: 40px; } .login-welcome { font-size: 19px; margin-bottom: 36px; } .form-field input { height: 64px; } .button-primary { min-height: 64px; } .form-field { margin-bottom: 26px; } .login-note { margin-top: 28px; font-size: 16px; } }
@media (max-width: 700px) {
    .site-header { min-height: 88px; gap: 12px; }
    .brand { gap: 12px; }
    .brand-mark { width: 31px; height: 31px; }
    .brand-mark::before { inset: 5px; }
    .brand-name { font-size: 23px; }
    .brand-detail { font-size: 10px; letter-spacing: 2px; margin-left: 0; }
    .account { gap: 14px; }
    .account-name { display: none; }
    .button-outline { padding: 0 14px; min-height: 40px; font-size: 12px; }
    .dashboard-page main { padding-top: 30px; padding-bottom: 36px; }
    .page-heading { font-size: 27px; margin-bottom: 24px; }
    .clock-panel { min-height: 0; padding: 16px 20px; flex-direction: column; align-items: stretch; gap: 14px; }
    .clock-panel-header { align-items: center; flex-direction: row; justify-content: space-between; gap: 12px; }
    .clock-panel-header h2 { font-size: 15px; }
    .clock-zone { font-size: 10px; }
    .clock-display { gap: 12px; }
    .clock-date { font-size: clamp(13px, 3.8vw, 18px); }
    .clock-time { font-size: clamp(32px, 9.5vw, 48px); }
    .clock-weekday { font-size: 12px; margin-top: 3px; }
    .site-footer { padding-top: 25px; padding-bottom: 25px; font-size: 10px; }
    .login-page main { padding-top: 24px; padding-bottom: 42px; }
    .login-panel { width: 100%; max-width: 440px; padding: 30px 24px; }
    .login-panel h1 { font-size: 29px; }
    .login-welcome { font-size: 14px; margin-bottom: 28px; }
    .form-field label { font-size: 14px; }
    .form-field input { height: 50px; font-size: 16px; padding: 0 14px; }
    .button-primary { font-size: 16px; min-height: 50px; }
    .login-note { font-size: 12px; }
}
@media (max-width: 370px) { :root { --gutter: 18px; } .brand-detail { letter-spacing: 1px; font-size: 9px; } .brand { gap: 9px; } .button-outline { padding: 0 10px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

[hidden] { display: none !important; }
.dashboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 30px; }
.dashboard-heading .page-heading { margin: 0; }
.settings-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; flex-shrink: 0; }
dialog { color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; box-shadow: 0 30px 100px rgb(0 0 0 / 45%); }
dialog::backdrop { background: rgb(3 8 13 / 76%); backdrop-filter: blur(5px); }
body:has(dialog[open]) { overflow: hidden; }
.settings-dialog { width: min(800px, calc(100vw - 32px)); max-height: min(90svh, 950px); }
.settings-dialog[open] { display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 26px 30px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-eyebrow { color: var(--accent); font-size: 11px; font-weight: 650; letter-spacing: 2px; }
.modal-header h2 { font-size: 25px; margin: 6px 0 0; font-weight: 650; }
.modal-close { color: var(--muted); background: transparent; min-width: 44px; font-size: 30px; line-height: 1; }
.modal-close:hover { background: #20303c; color: var(--text); }
.modal-body { padding: 26px 30px 30px; overflow-y: auto; overscroll-behavior: contain; }
.modal-intro { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 0 0 24px; }
.modal-body h3 { font-size: 17px; margin: 0 0 20px; }
.key-create-section { padding: 22px; border: 1px solid var(--border); border-radius: 12px; background: var(--background); }
.key-create-section .form-field { margin-bottom: 18px; gap: 8px; }
.key-create-section .form-field label { font-size: 14px; }
.key-create-section input { height: 48px; font-size: 15px; padding: 0 14px; }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.8; }
.key-issue-button { padding: 0 22px; color: #152007; background: var(--accent); font-size: 14px; font-weight: 700; }
.key-issue-button:hover { background: #e1fa99; }
.button:disabled { opacity: .5; cursor: wait; }
.key-message { margin-top: 20px; padding: 12px 16px; border: 1px solid #54733d; border-radius: 8px; color: var(--accent); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.key-message[data-error="true"] { color: #ffc0c4; border-color: #8e515a; background: #2a1921; }
.issued-key { margin-top: 20px; padding: 22px; background: #16241e; border: 1px solid #54733d; border-radius: 12px; }
.issued-key h3 { color: var(--accent); margin-bottom: 6px; }
#issued-key-label { overflow-wrap: anywhere; font-size: 14px; margin: 0 0 16px; }
#issued-key-secret { width: 100%; resize: none; margin: 6px 0 14px; padding: 12px; border: 1px solid #54733d; border-radius: 8px; background: var(--background); color: var(--text); font: 13px/1.7 monospace; overflow-wrap: anywhere; }
#issued-key-secret:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.key-list-section { margin-top: 30px; }
.key-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.key-list-heading h3 { margin: 0; }
.key-count { color: var(--accent); font-size: 12px; background: #243326; padding: 3px 8px; border-radius: 5px; margin-left: 6px; }
.key-list-heading .button { min-height: 36px; padding: 0 14px; font-size: 12px; }
.key-list-help { margin: 14px 0 18px; }
.empty-keys { color: var(--muted); padding: 28px 18px; text-align: center; border: 1px dashed var(--border); border-radius: 10px; font-size: 14px; }
.api-key-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.api-key-row { padding: 20px; border: 1px solid var(--border); border-radius: 12px; }
.key-row-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.key-label { font-size: 16px; font-weight: 650; overflow-wrap: anywhere; min-width: 0; margin: 0; }
.key-purpose { flex-shrink: 0; color: var(--accent); font-size: 10px; letter-spacing: .5px; border: 1px solid #54733d; border-radius: 4px; padding: 4px 7px; }
.key-dates { color: var(--muted); font-size: 12px; line-height: 1.9; margin: 0 0 16px; }
.key-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.key-actions .button { min-height: 37px; padding: 0 13px; font-size: 12px; }
.key-actions .key-delete { color: #efafb5; border-color: #73464e; margin-left: auto; }
.confirmation-dialog { width: min(480px, calc(100vw - 32px)); max-height: 90svh; padding: 30px; }
.confirmation-dialog h2 { font-size: 22px; margin: 10px 0 22px; }
.confirmation-question { overflow-wrap: anywhere; font-size: 17px; line-height: 1.8; margin: 0 0 14px; }
.confirmation-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 26px; }
.button-danger { background: #a93d4d; color: #fff; padding: 0 24px; font-size: 14px; }
.button-danger:hover { background: #bf4c5d; }
@media (max-width: 700px) {
    .dashboard-heading { margin-bottom: 24px; }
    .dashboard-heading .page-heading { font-size: 24px; }
    .settings-dialog { max-height: 92svh; }
    .modal-header { padding: 18px 20px; }
    .modal-header h2 { font-size: 22px; }
    .modal-body { padding: 20px; }
    .key-create-section, .issued-key, .api-key-row { padding: 16px; }
    .key-label { font-size: 14px; }
    .key-row-heading { gap: 10px; }
    .key-actions .key-delete { margin-left: 0; }
    .confirmation-dialog { padding: 24px; }
    .confirmation-actions .button { padding: 0 18px; }
}

.reception-panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 24px; overflow: hidden; }
.reception-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 25px 30px 0; }
.reception-header h2 { margin: 7px 0 0; font-size: 22px; font-weight: 600; }
.reception-demo { color: #f1ca82; border: 1px solid #6b5737; border-radius: 6px; padding: 6px 10px; font-size: 12px; }
.reception-content { display: grid; grid-template-columns: 360px 1fr; align-items: center; gap: clamp(24px, 4vw, 64px); padding: 5px 40px 26px 28px; }
.receiver-gauge-wrap { width: 100%; height: 252px; position: relative; }
.receiver-gauge { width: 100%; height: 100%; }
.gauge-readout { position: absolute; top: 54%; left: 50%; transform: translateX(-50%); text-align: center; white-space: nowrap; pointer-events: none; }
.receiver-count { font-size: 62px; font-weight: 700; color: var(--accent); margin: 0; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -2px; }
.receiver-count span { font-size: 26px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.gauge-unit { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.reception-health { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--accent); }
.reception-health::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.reception-health[data-state="partial"] { color: #f1ca82; }
.reception-health[data-state="empty"] { color: var(--muted); }
.reception-time-label { margin: 19px 0 8px; font-size: 13px; color: var(--muted); }
.reception-time-label span { margin-left: 7px; font-size: 10px; }
.latest-received-at { display: block; font-size: clamp(22px, 2.3vw, 34px); font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; }
.reception-freshness { margin: 9px 0 18px; font-size: 12px; color: var(--muted); }
.reception-freshness[data-stale="true"] { color: #f1ca82; }
.reception-metadata { border-top: 1px solid var(--border); margin: 0; padding-top: 14px; font-size: 12px; }
.reception-metadata div { display: flex; gap: 18px; line-height: 1.8; margin-top: 5px; }
.reception-metadata dt { width: 86px; color: var(--muted); flex-shrink: 0; }
.reception-metadata dd { margin: 0; font-variant-numeric: tabular-nums; }
.reception-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--border); margin: 0 30px; padding: 14px 0; font-size: 12px; color: var(--muted); }
.reception-footer .button { min-height: 38px; padding: 0 18px; font-size: 12px; }
@media (max-width: 850px) {
    .reception-content { grid-template-columns: 280px 1fr; gap: 20px; padding-left: 18px; padding-right: 24px; }
    .latest-received-at { font-size: 22px; }
}
@media (max-width: 650px) {
    .reception-header { padding: 22px 20px 0; }
    .reception-header h2 { font-size: 20px; }
    .reception-demo { padding: 5px 7px; font-size: 10px; }
    .reception-content { grid-template-columns: 1fr; gap: 0; padding: 0 22px 22px; }
    .receiver-gauge-wrap { height: 230px; max-width: 350px; justify-self: center; }
    .receiver-count { font-size: 54px; }
    .reception-details { border-top: 1px solid var(--border); padding-top: 18px; }
    .reception-time-label { margin-top: 15px; }
    .latest-received-at { font-size: 23px; }
    .reception-footer { margin: 0 22px; }
}

.dashboard-status-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-bottom: 24px; }
.dashboard-status-grid .reception-panel { margin-bottom: 0; display: flex; flex-direction: column; min-width: 0; }
.dashboard-status-grid .reception-content { grid-template-columns: 1fr; gap: 0; padding: 0 30px 22px; flex: 1; }
.dashboard-status-grid .receiver-gauge-wrap { height: 210px; max-width: 360px; justify-self: center; }
.dashboard-status-grid .receiver-count { font-size: 54px; }
.dashboard-status-grid .reception-details { border-top: 1px solid var(--border); padding-top: 16px; }
.dashboard-status-grid .latest-received-at { font-size: 26px; }
.dashboard-status-grid .reception-time-label { margin-top: 14px; }
.map-panel { min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.map-panel .reception-header { padding-bottom: 22px; }
.map-fit-button { min-height: 38px; padding: 0 14px; font-size: 12px; flex-shrink: 0; }
.receiver-map { flex: 1; min-height: 315px; margin: 0 24px; border: 1px solid var(--border); border-radius: 10px; background: #dce3e5; isolation: isolate; z-index: 0; color-scheme: light; }
.map-description { display: flex; justify-content: space-between; gap: 12px; margin: 14px 24px 10px; color: var(--muted); font-size: 12px; }
.map-description > :last-child { font-size: 10px; letter-spacing: 1px; }
.receiver-map-legend { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0 24px; }
.receiver-select { min-height: 34px; padding: 4px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--background); font-size: 12px; font-variant-numeric: tabular-nums; }
.receiver-select::before { content: ''; display: inline-block; width: 7px; height: 7px; background: var(--receiver-color); border-radius: 50%; margin-right: 5px; }
.receiver-select[aria-pressed="true"] { border-color: var(--accent); background: #243326; }
.receiver-select:disabled { color: #6f7e8b; cursor: default; }
.receiver-select:disabled::before { background: #6f7e8b; }
.map-help { font-size: 11px; color: var(--muted); margin: 12px 24px 20px; }
.receiver-map .leaflet-control-attribution { font-size: 10px; background: rgb(255 255 255 / 90%); color: #34444c; }
.receiver-map .leaflet-control-attribution a { color: #1760a0; }
.receiver-map .leaflet-popup-content-wrapper, .receiver-map .leaflet-popup-tip { background: #101a24; color: var(--text); }
.receiver-map .leaflet-popup-content { margin: 16px 22px; line-height: 1.8; font-family: inherit; font-variant-numeric: tabular-nums; }
.receiver-popup strong { display: block; color: var(--accent); font-size: 17px; margin-bottom: 5px; }
.receiver-map .leaflet-popup-close-button { color: var(--muted); }
.readings-panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.readings-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 26px 30px 20px; }
.readings-header h2 { margin: 7px 0 0; font-size: 22px; font-weight: 600; }
.readings-header p { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.readings-header .button { font-size: 13px; min-height: 42px; padding: 0 18px; flex-shrink: 0; }
.readings-table-scroll { overflow-x: auto; }
.readings-table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.readings-table { border-collapse: collapse; width: 100%; text-align: left; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.readings-table thead { background: #14212d; color: var(--muted); font-size: 11px; }
.readings-table th, .readings-table td { padding: 16px 18px; border-bottom: 1px solid #233542; font-weight: 400; }
.readings-table th:first-child { padding-left: 30px; }
.readings-table th[scope="row"] { font-weight: 650; }
.readings-table tbody tr:hover { background: #162531; }
.readings-table td:nth-child(n+5), .readings-table thead th:nth-child(n+5) { text-align: right; }
.readings-table tbody tr:last-child > * { border-bottom: 0; }
.reading-demo { display: inline-block; color: #f1ca82; font-size: 9px; margin-left: 7px; font-weight: 400; }
.quality-fixed { color: var(--accent); }
.quality-invalid { color: #f1ca82; }
.readings-help { padding: 16px 30px; border-top: 1px solid var(--border); margin: 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.download-dialog { width: min(620px, calc(100vw - 32px)); }
.download-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.download-dates .form-field { margin-bottom: 0; }
.download-dates input { padding: 0 14px; font-size: 16px; min-width: 0; }
.download-actions { display: flex; gap: 12px; margin-top: 22px; }
.download-progress-panel { margin-top: 24px; padding: 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--background); font-size: 14px; }
.download-progress-panel label { display: block; line-height: 1.7; margin-bottom: 12px; }
.download-progress-panel progress { display: block; width: 100%; height: 8px; accent-color: var(--accent); }
.download-progress-panel p { color: var(--muted); font-size: 12px; margin: 12px 0 0; line-height: 1.7; }
@media (max-width: 1000px) {
    .dashboard-status-grid { grid-template-columns: minmax(0, 1fr); }
    .receiver-map { flex: none; height: 360px; }
}
@media (max-width: 700px) {
    .dashboard-status-grid .reception-content { padding: 0 20px 20px; }
    .dashboard-status-grid .latest-received-at { font-size: 22px; }
    .map-panel .reception-header { padding: 22px 20px 18px; }
    .receiver-map { margin: 0 16px; height: 330px; min-height: 0; }
    .receiver-map-legend { margin: 0 16px; gap: 5px; }
    .receiver-select { font-size: 10px; min-height: 36px; }
    .receiver-select::before { width: 5px; height: 5px; margin-right: 4px; }
    .map-description, .map-help { margin-left: 16px; margin-right: 16px; }
    .readings-header { padding: 22px 20px 18px; flex-wrap: wrap; }
    .readings-header h2 { font-size: 20px; }
    .readings-table th:first-child { padding-left: 20px; }
    .readings-help { padding: 16px 20px; }
    .download-dates { grid-template-columns: 1fr; gap: 20px; }
}
