html {
    height: 100%;
    font-family: sans-serif;
    line-height: 1.4;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
    margin: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    color: #182026;
    background: #eef2f1;
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", "メイリオ", Meiryo, sans-serif;
    font-size: 1rem;
    font-weight: 600;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #eef2f1;
}

.login-shell {
    width: min(100%, 460px);
    padding: 24px;
}

.login-panel {
    padding: 28px;
    border: 1px solid #d8dfdc;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 42px rgba(28, 40, 36, 0.12);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    color: #15201b;
    font-weight: 800;
}

.login-panel h1 {
    margin: 0 0 20px;
    color: #182026;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0;
}

.login-alert {
    margin-bottom: 18px;
    font-weight: 700;
}

.login-form {
    display: grid;
    gap: 16px;
}

.login-field label {
    display: block;
    margin-bottom: 8px;
    color: #27362f;
    font-size: 0.95rem;
    font-weight: 800;
}

.login-submit {
    width: 100%;
    margin-top: 4px;
}

.ptz-warning {
    position: fixed;
    top: 78px;
    left: 50%;
    z-index: 1200;
    width: min(calc(100% - 32px), 520px);
    margin: 0;
    transform: translateX(-50%);
    box-shadow: 0 12px 28px rgba(31, 44, 39, 0.18);
    opacity: 1;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ptz-warning-hide {
    transform: translate(-50%, -8px);
    opacity: 0;
}

a {
    text-decoration: none;
}

.app-nav {
    position: sticky;
    top: 0;
    z-index: 900;
    padding: 0;
    background: #ffffff;
    border-bottom: 1px solid #d8dfdc;
    box-shadow: 0 8px 24px rgba(31, 44, 39, 0.08);
}

.app-nav-inner {
    max-width: 1800px;
    min-height: 64px;
    padding: 0 24px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: #15201b;
    font-weight: 800;
}

.app-brand:hover,
.app-brand:focus {
    color: #15201b;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 8px;
    color: #ffffff;
    background: #0f6f60;
    letter-spacing: 0;
}

.brand-office,
.brand-system {
    display: block;
    line-height: 1.15;
}

.brand-office {
    font-size: 0.9rem;
}

.brand-system {
    margin-top: 2px;
    font-size: 1.1rem;
}

.navbar-toggler {
    border-color: #cbd6d1;
}

.navbar-toggler-icon {
    filter: invert(20%);
}

.app-menu {
    gap: 8px;
}

.app-menu .nav-link {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 8px;
    color: #4d5c55;
    font-size: 0.95rem;
}

.app-menu .nav-link:hover,
.app-menu .nav-link.active {
    color: #0d4f45;
    background: #e4f1ee;
}

.app-shell {
    width: min(100%, 1800px);
    margin: 0 auto;
    flex: 1;
    padding: 24px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 4px 0 20px;
}

.page-head h1,
.site-header h2,
.camera-toolbar h3 {
    margin: 0;
    letter-spacing: 0;
}

.page-head h1 {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.25;
}

.eyebrow {
    margin: 0 0 6px;
    color: #6f7f78;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.head-badges {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid #cbd8d3;
    border-radius: 8px;
    color: #0d4f45;
    background: #ffffff;
    font-size: 0.9rem;
    white-space: nowrap;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #18a57f;
    box-shadow: 0 0 0 4px rgba(24, 165, 127, 0.16);
}

.status-section,
.site-section {
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid #d8dfdc;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 34px rgba(28, 40, 36, 0.07);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    color: #27362f;
    font-size: 1.05rem;
    font-weight: 800;
}

.status-table-wrap {
    overflow-x: auto;
}

.status-overview {
    min-height: 92px;
    border: 1px solid #e1e8e5;
    border-radius: 8px;
    background: #f8faf9;
}

.status-empty {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 92px;
    padding: 18px;
    color: #52625b;
}

.status-empty-dot {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    border-radius: 999px;
    background: #20a47c;
    box-shadow: 0 0 0 6px rgba(32, 164, 124, 0.13);
}

.status-empty p {
    margin: 0 0 4px;
    color: #26332e;
    font-size: 1rem;
    font-weight: 800;
}

.status-alert-list {
    display: grid;
    gap: 10px;
    padding: 12px;
}

.status-alert-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid #f0b6a7;
    border-radius: 8px;
    color: #4c1c10;
    background: #fff5f2;
}

.status-alert-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: #ffffff;
    background: #c23b22;
    font-size: 1rem;
    font-weight: 900;
}

.status-alert-main {
    min-width: 0;
}

.status-alert-title {
    margin: 0 0 5px;
    color: #3b180f;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.25;
}

.status-alert-meta {
    margin: 0;
    color: #814230;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.35;
}

.status-alert-update {
    color: #6f3526;
    font-size: 0.86rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-raw-table {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.status-table {
    min-width: 620px;
    margin: 0;
    border: 1px solid #e1e7e4;
    border-radius: 8px;
    overflow: hidden;
    vertical-align: middle;
}

.status-table > :not(caption) > * > * {
    padding: 14px 16px;
    border-bottom-color: #e4ebe8;
}

.status-table thead th {
    color: #65736d;
    background: #f5f8f7;
    font-size: 0.85rem;
    font-weight: 800;
}

.status-table tbody th {
    color: #26332e;
    background: #fbfcfc;
    font-weight: 800;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.site-header h2 {
    font-size: 1.35rem;
    font-weight: 800;
}

.site-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.6fr) minmax(520px, 1.4fr);
    gap: 16px;
    align-items: stretch;
}

.location-panel,
.camera-card,
.map2 {
    border: 1px solid #dde5e1;
    border-radius: 8px;
    background: #f8faf9;
    overflow: hidden;
}

.location-panel {
    min-height: 520px;
}

.map {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 520px;
}

.camera-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.camera-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 14px;
    background: #ffffff;
}

.camera-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.camera-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.camera-kicker {
    margin: 0 0 4px;
    color: #6a7972;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.camera-toolbar h3 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.25;
}

.ptz-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.btn.command-btn,
.btn.ptz-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border-radius: 8px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.btn.command-btn {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.btn.ptz-btn {
    min-width: 76px;
    padding: 7px 10px;
    border: 1px solid #ccd8d2;
    color: #26352f;
    background: #f4f7f6;
    font-size: 0.85rem;
}

.btn.ptz-btn:hover,
.btn.ptz-btn:focus {
    border-color: #0f6f60;
    color: #0b5146;
    background: #e5f3f0;
}

.warning-command {
    border: 1px solid #d7a400;
    color: #3d3102;
    background: #ffd766;
}

.warning-command:hover,
.warning-command:focus {
    border-color: #b68900;
    color: #2a2100;
    background: #f3c84f;
}

.direct-command {
    border: 1px solid #9fc1d7;
    color: #174156;
    background: #dceff9;
}

.direct-command:hover,
.direct-command:focus {
    border-color: #5d9ec1;
    color: #10364a;
    background: #cae6f5;
}

.breaker-command {
    border: 1px solid #cf9b55;
    color: #5a3305;
    background: #fff0d7;
}

.breaker-command:hover,
.breaker-command:focus {
    border-color: #b97d2f;
    color: #452701;
    background: #ffe2b4;
}

.camera-video,
.video-js {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #101416;
}

.video-js.vjs-fluid {
    padding-top: 56.25%;
}

.camera-video-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #101416;
}

.camera-video-wrap .video-js {
    position: absolute;
    inset: 0;
}

.camera-still {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #101416;
}

.camera-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #101416;
}

.camera-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #101416;
}

.camera-image-status {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    place-items: center;
    color: #dce6e1;
    background: rgba(16, 20, 22, 0.82);
    font-weight: 800;
    letter-spacing: 0;
}

.camera-image-error .camera-image-status {
    display: grid;
}

.map2 {
    position: relative;
    width: 100%;
    min-height: 220px;
}

.camera-view-map {
    margin-top: 12px;
    flex: 1 1 auto;
    min-height: 220px;
}

.airstr {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    color: #9c2700;
    background: #fff0e7;
    font-size: 0.78rem;
    font-weight: 800;
}

.str_icon,
.str_icons {
    padding: 2px 5px;
    border: 1px solid rgba(255, 255, 255, 0.86);
    border-radius: 4px;
    color: #3e1703;
    background: rgba(255, 246, 226, 0.92);
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 2px 7px rgba(48, 33, 16, 0.18);
}

.str_icon {
    font-size: 13px;
}

.str_icons {
    font-size: 11px;
}

.str_icon2 {
    color: #d02a16;
    background: transparent;
    font-size: 25px;
    font-weight: 800;
}

.blinking {
    animation: flash 1s ease-in-out infinite alternate;
}

@keyframes flash {
    0% {
        opacity: 0.25;
    }
    100% {
        opacity: 1;
    }
}

#loading_box {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.82);
}

#loading_box img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    transform: translate(-50%, -50%);
}

.app-footer {
    margin-top: auto;
    padding: 14px 24px;
    border-top: 1px solid #d8dfdc;
    color: #65736d;
    background: #ffffff;
    text-align: center;
    font-size: 0.9rem;
}

.history-shell {
    max-width: 1200px;
}

.history-filter {
    display: flex;
    align-items: end;
    gap: 12px;
    max-width: 360px;
}

.history-label {
    display: flex;
    align-items: center;
    min-height: 38px;
    margin: 0;
    color: #6a7972;
    font-size: 0.86rem;
    font-weight: 800;
    white-space: nowrap;
}

.history-month-input {
    min-height: 38px;
    border-color: #ccd8d2;
    border-radius: 8px;
    color: #26352f;
    background: #f8faf9;
    font-weight: 800;
}

.history-result {
    min-height: 260px;
}

.history-note {
    margin: 0;
    color: #708078;
    font-size: 0.9rem;
}

.history-table-wrap {
    overflow-x: auto;
}

.history-table {
    min-width: 620px;
    margin: 0;
    border: 1px solid #e1e7e4;
    border-radius: 8px;
    overflow: hidden;
}

.history-table > :not(caption) > * > * {
    padding: 14px 16px;
    border-bottom-color: #e4ebe8;
    vertical-align: middle;
}

.history-table thead th {
    color: #65736d;
    background: #f5f8f7;
    font-size: 0.85rem;
    font-weight: 800;
}

.history-table tbody td {
    font-weight: 800;
}

.history-place {
    color: #26332e;
}

.history-time {
    color: #4d5c55;
}

.history-status-ok {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    color: #0d6b51;
    background: #e5f4ef;
    font-size: 0.86rem;
    font-weight: 900;
}

.history-status-alert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    color: #9c2700;
    background: #fff0e7;
    font-size: 0.86rem;
    font-weight: 900;
}

.datepicker {
    border-radius: 8px;
    border-color: #d8dfdc;
    box-shadow: 0 12px 34px rgba(28, 40, 36, 0.14);
}

.settings-shell {
    max-width: 1100px;
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 420px);
    gap: 24px;
    align-items: start;
}

.settings-field {
    display: grid;
    gap: 7px;
    margin-bottom: 16px;
}

.settings-field label {
    color: #52615a;
    font-size: 0.86rem;
    font-weight: 800;
}

.settings-position-inputs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.settings-position-inputs .settings-field {
    margin-bottom: 16px;
}

.settings-position {
    margin: 18px 0;
    padding: 12px 14px;
    border: 1px solid #d8dfdc;
    border-radius: 8px;
    color: #1b2a23;
    background: #f7faf8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
}

.settings-actions,
.zoom-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.settings-message {
    min-height: 24px;
    margin-top: 14px;
    color: #52615a;
    font-weight: 700;
}

.settings-message-ok {
    color: #1f6a43;
}

.settings-message-error {
    color: #b12b1f;
}

.settings-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-bottom: 18px;
    border-radius: 8px;
    overflow: hidden;
    background: #101416;
}

.settings-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #101416;
}

.settings-preview-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 16px;
    color: #dce6e1;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 800;
}

.ptz-pad {
    display: grid;
    grid-template-columns: repeat(3, 72px);
    grid-template-rows: repeat(3, 72px);
    gap: 10px;
    justify-content: center;
    margin-bottom: 18px;
}

.ptz-control-btn {
    border: 1px solid #bfcac5;
    border-radius: 8px;
    color: #1b2a23;
    background: #ffffff;
    font-size: 1.6rem;
    font-weight: 900;
}

.ptz-control-btn:hover,
.ptz-control-btn:focus {
    border-color: #6f9381;
    background: #eef6f1;
}

.ptz-control-btn[data-direction="up"] {
    grid-column: 2;
    grid-row: 1;
}

.ptz-control-btn[data-direction="left"] {
    grid-column: 1;
    grid-row: 2;
}

.ptz-control-btn[data-direction="right"] {
    grid-column: 3;
    grid-row: 2;
}

.ptz-control-btn[data-direction="down"] {
    grid-column: 2;
    grid-row: 3;
}

@media screen and (max-width: 1199px) {
    .site-grid {
        grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
    }
}

@media screen and (min-width: 768px) {
    .camera-toolbar {
        min-height: 80px;
    }
}

@media screen and (max-width: 991px) {
    .app-menu {
        padding: 10px 0 14px;
    }

    .site-grid,
    .camera-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .location-panel,
    .map {
        min-height: 360px;
    }

}

@media screen and (max-width: 767px) {
    .app-nav-inner,
    .app-shell {
        padding-left: 14px;
        padding-right: 14px;
    }

    .app-shell {
        padding-top: 18px;
    }

    .page-head,
    .site-header,
    .camera-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .page-head h1 {
        font-size: 1.35rem;
    }

    .site-header h2 {
        font-size: 1.15rem;
    }

    .status-section,
    .site-section {
        padding: 14px;
    }

    .btn.command-btn {
        width: 100%;
    }

    .camera-toolbar .command-btn {
        width: auto;
        align-self: flex-start;
    }

    .camera-actions {
        justify-content: flex-start;
    }

    .location-panel,
    .map {
        min-height: 320px;
    }

    .map2,
    .camera-view-map {
        min-height: 220px;
    }
}

@media screen and (max-width: 480px) {
    .brand-mark {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .brand-office {
        font-size: 0.78rem;
    }

    .brand-system {
        font-size: 0.92rem;
    }

    .ptz-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .btn.ptz-btn {
        min-width: 0;
        padding-left: 6px;
        padding-right: 6px;
        font-size: 0.78rem;
    }
}

.camera-switching {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(12, 18, 16, 0.52);
    font-weight: 800;
    letter-spacing: 0;
    pointer-events: none;
}

.camera-switching.d-none {
    display: none;
}
