:root {
    --background: #f4f6f9;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #dfe4ea;
    --text: #1e293b;
    --text-soft: #64748b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar: #172033;
    --sidebar-hover: #243047;
    --sidebar-text: #dbe4f0;
    --success: #15803d;
    --danger: #b91c1c;
    --danger-background: #fef2f2;
    --shadow: 0 10px 30px rgb(15 23 42 / 8%);
    --header-height: 64px;
    --sidebar-width: 240px;

    --scene: #303030;
    --person: #D3D3D3;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Hiragino Kaku Gothic ProN",
        "Yu Gothic",
        sans-serif;
    color: var(--text);
    background: var(--background);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.flex-wrap {
    display: flex;
    flex-wrap: wrap;
}

.flex-media {
    display: flex;
}

.flex-wrap.middle,
.flex-media.middle {
    align-items: center;
}

.hide-media {
    display: contents;
}
.hide-non-media {
    display: none;
}

.text {
    font-size: 1em;
}

select.text {
    padding: 0.2em 0.5em;
}

.title {
    font-size: 1.5em;
    font-weight: bold;
}

input.text {
    font-size: 1em;
    padding: 0.2em 0.5em;
}

input.title {
    font-size: 1.5em;
    font-weight: bold;
}

.label {
    white-space: nowrap;
}



/* ログイン画面 */

.login-body {
    background:
        radial-gradient(
            circle at top left,
            #dbeafe,
            transparent 38%
        ),
        linear-gradient(135deg, #eef2ff, #f8fafc);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(100%, 440px);
    padding: 36px;
    background: rgb(255 255 255 / 94%);
    border: 1px solid rgb(255 255 255 / 80%);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgb(30 41 59 / 14%);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
}

.brand-mark,
.header-brand-mark {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    color: #ffffff;
    background: var(--primary);
    font-weight: 700;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 22px;
}

.login-brand h1 {
    margin: 0;
    font-size: 21px;
}

.login-brand p {
    margin: 3px 0 0;
    color: var(--text-soft);
    font-size: 13px;
}

.login-description h2 {
    margin: 0;
    font-size: 28px;
}

.login-description p {
    margin: 8px 0 26px;
    color: var(--text-soft);
    line-height: 1.7;
}

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

.form-field {
    display: grid;
    gap: 8px;
}

.form-field label {
    font-size: 14px;
    font-weight: 600;
}

.form-field input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: #ffffff;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

.form-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgb(37 99 235 / 12%);
}

.primary-button {
    min-height: 48px;
    border: 0;
    border-radius: 10px;
    color: #ffffff;
    background: var(--primary);
    font-weight: 700;
}

.primary-button:hover {
    background: var(--primary-dark);
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.button-indicator {
    margin-left: 8px;
    font-size: 12px;
}

.login-result:empty {
    display: none;
}

.alert {
    padding: 12px 14px;
    border-radius: 9px;
    font-size: 14px;
    line-height: 1.5;
}

.alert-error {
    color: var(--danger);
    border: 1px solid #fecaca;
    background: var(--danger-background);
}

.login-note {
    margin: 24px 0 0;
    color: var(--text-soft);
    text-align: center;
    font-size: 12px;
}

/* Admin-table */

.adm-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 4px;
}
.adm-table th, .adm-table td {
    padding: 8px;
    border: 1px solid #ddd;
    text-align: left;
}
.adm-table th {
    background-color: #f2f2f2;
}









/* 共通レイアウト */

.app-header {
    position: fixed;
    z-index: 50;
    top: 0;
    right: 0;
    left: 0;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    color: #ffffff;
    background: #111827;
    box-shadow: 0 2px 10px rgb(15 23 42 / 18%);
}

.header-left,
.header-brand,
.header-user {
    display: flex;
    align-items: center;
}

.header-left {
    gap: 16px;
}

.header-brand-div {
    display: flex;
    flex-direction: column;
}

.header-brand {
    gap: 10px;
    font-weight: 700;
}

.header-brand-server-name {
    display: block;
    color: #aebacc;
    font-size: 12px;
    font-weight: 500;
}

.header-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
}

.header-user {
    gap: 12px;
    padding: 5px 8px;
    border: 0;
    border-radius: 10px;
    color: inherit;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.header-user:hover,
.header-user-menu[open] .header-user {
    background: rgb(255 255 255 / 9%);
}

.header-user-menu {
    position: relative;
}

.header-user::-webkit-details-marker {
    display: none;
}

.header-user::marker {
    content: "";
}

.user-summary {
    display: grid;
    text-align: right;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
}

.user-role {
    color: #aebacc;
    font-size: 11px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #172033;
    background: #dbeafe;
    font-weight: 700;
}

.user-menu-chevron {
    color: #aebacc;
    font-size: 15px;
    transition: transform 160ms ease;
}

.header-user-menu[open] .user-menu-chevron {
    transform: rotate(180deg);
}

.user-menu {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    width: 230px;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    color: #172033;
    background: #ffffff;
    box-shadow: 0 14px 35px rgb(15 23 42 / 22%);
}

.user-menu-label {
    padding: 7px 10px 6px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.user-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    color: #334155;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.user-menu-item:hover {
    background: #f1f5f9;
}

.user-menu-item.active {
    color: #1d4ed8;
    background: #eff6ff;
    font-weight: 700;
}

.user-menu-divider {
    height: 1px;
    margin: 8px 2px;
    background: #e5e7eb;
}

.user-menu-logout {
    color: #dc2626;
}

.user-menu-logout:hover {
    background: #fef2f2;
}

.app-layout {
    min-height: 100vh;
    padding-top: var(--header-height);
}

.sidebar {
    position: fixed;
    z-index: 40;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--sidebar);
}

.sidebar-nav {
    padding: 18px 12px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 15px;
    margin-bottom: 5px;
    border: 0;
    border-radius: 9px;
    color: var(--sidebar-text);
    background: transparent;
    text-align: left;
}

.nav-item:hover,
.nav-item.active {
    color: #ffffff;
    background: var(--sidebar-hover);
}

.nav-item.active {
    box-shadow:
        inset 3px 0 0 var(--primary),
        0 6px 16px rgb(0 0 0 / 10%);
}

.nav-icon {
    width: 22px;
    text-align: center;
    font-size: 17px;
}

.sidebar-footer {
    padding: 18px;
    border-top: 1px solid rgb(255 255 255 / 8%);
}

.logout-button {
    width: 100%;
    padding: 11px;
    border: 1px solid rgb(255 255 255 / 15%);
    border-radius: 8px;
    color: var(--sidebar-text);
    background: transparent;
}

.logout-button:hover {
    color: #ffffff;
    background: rgb(255 255 255 / 8%);
}

.main-area {
    min-height: calc(100vh - var(--header-height));
    margin-left: var(--sidebar-width);
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.page-title {
    font-size: 28px;
    font-weight: bold;
}

.page-title.clickable {
    cursor: pointer;
}


.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-heading-label,
.eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.page-heading h1 {
    margin: 0;
    font-size: 28px;
}

.loading-text {
    color: var(--text-soft);
    font-size: 13px;
}

.main-content {
    max-width: 1180px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.content-section {
    display: grid;
    gap: 22px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.welcome-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 150px;
    padding: 15px 30px;
    overflow: hidden;
    border-radius: 18px;
    color: #ffffff;
    background:
        radial-gradient(
            circle at 90% 15%,
            rgb(255 255 255 / 24%),
            transparent 30%
        ),
        linear-gradient(135deg, #2563eb, #4338ca);
    box-shadow: var(--shadow);
}

.welcome-card h2 {
    margin: 0 0 10px;
    font-size: 27px;
}

.welcome-card p:not(.eyebrow) {
    margin: 0;
    color: rgb(255 255 255 / 80%);
}

.welcome-card .eyebrow {
    color: #bfdbfe;
}

.welcome-symbol {
    width: 100px;
    height: 100px;
    display: grid;
    place-items: center;
    border: 1px solid rgb(255 255 255 / 20%);
    border-radius: 30px;
    background: rgb(255 255 255 / 12%);
    font-size: 48px;
    font-weight: 800;
    transform: rotate(7deg);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.summary-card,
.panel {
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.summary-card {
    padding: 22px;
    border-radius: 14px;
}

.summary-label {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
}

.summary-value {
    margin: 10px 0 6px;
    font-size: 22px;
    font-weight: 750;
}

.summary-description {
    margin: 0;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.5;
}

.status-active {
    color: var(--success);
}

.panel {
    padding: 25px;
    border-radius: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.panel-header {
    margin-bottom: 20px;
}

.panel-header h2 {
    margin: 0;
    font-size: 20px;
}

.panel-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 92px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    text-align: left;
}

.action-card:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.action-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border-radius: 11px;
    color: var(--primary);
    background: #dbeafe;
    font-weight: 800;
}

.action-card strong,
.action-card small {
    display: block;
}

.action-card small {
    margin-top: 5px;
    color: var(--text-soft);
}

.profile-list {
    margin: 0;
}

.profile-row {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 20px;
    padding: 17px 0;
    border-bottom: 1px solid var(--border);
}

.profile-row:last-child {
    border-bottom: 0;
}

.profile-row dt {
    color: var(--text-soft);
}

.profile-row dd {
    margin: 0;
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    color: var(--success);
    background: #dcfce7;
    font-size: 12px;
}

.setting-list {
    display: grid;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}

.setting-row p {
    margin: 5px 0 0;
    color: var(--text-soft);
    font-size: 13px;
}

.switch {
    position: relative;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    width: 0;
    height: 0;
    opacity: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cbd5e1;
    transition: 0.2s;
}

.switch-slider::before {
    position: absolute;
    bottom: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 5px rgb(0 0 0 / 20%);
    content: "";
    transition: 0.2s;
}

.switch input:checked + .switch-slider {
    background: var(--primary);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.sample-note {
    margin: 20px 0 0;
    color: var(--text-soft);
    font-size: 12px;
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    padding: 9px;
    border: 0;
    border-radius: 8px;
    background: transparent;
}

.menu-toggle:hover {
    background: rgb(255 255 255 / 8%);
}

.menu-toggle span {
    display: block;
    height: 2px;
    margin: 4px 0;
    border-radius: 2px;
    background: #ffffff;
}

.mobile-overlay {
    display: none;
}

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline;
}

.htmx-request.primary-button > span:first-child {
    display: none;
}

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

.scenario-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 92px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    text-align: left;
}

.scenario-card:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.scenario-parameters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
    color: var(--text-soft);
    font-size: 13px;
}

.scenario-memo {
    margin-top: 5px;
    color: var(--text-soft);
    font-size: 13px;
}

.preview-screen {
    border: 10px solid gray;
    background-color: navy;
    border-radius: 10px;
    position: relative;
    margin: 1em;
    box-sizing: content-box;
}
/*
.edit-header {
    display: flex;
　    width: 100%;
    gap: 10px;
    margin-bottom: 10px;
}
*/
/*
.edit-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-height: 92px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    text-align: left;
}
*/

/*
.scene-list {
    width: 100%;
    min-height: 60px;
}

.icon-detail {
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
}

.icon-detail-closed {
    border-left: solid 11px #333333;
    border-top: solid 7px transparent;
    border-bottom: solid 7px transparent;
}

details[open] .icon-detail-closed {
    border-top: solid 11px #333333;
    border-left: solid 7px transparent;
    border-right: solid 7px transparent;
    border-bottom: none;
}

.icon-detail-closed.white {
    border-left: solid 11px #ffffff;
}

details[open] .icon-detail-closed.white {
    border-top: solid 11px #ffffff;
}


.edit-card .zero-scene {
    color: var(--text-soft);
    font-size: 13px;
}

.edit-card.scene {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.edit-card.scene-control {
    justify-content: flex-end;
}

.person-list {
    margin: 8px 0;
}

.person-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-height: 92px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    text-align: left;
    white-space: nowrap;
}
*/

.dummy-qr {
    background-color: gray;
    border: 1px solid black;
}

.talk-balloon {
    position: absolute;
    padding: 5px;
    background-color: white;
    border: 1px solid black;
    font-size: 0.2em;
    border-radius: 6px 6px 6px 0;
}


/* タブレット・スマートフォン */

@media (max-width: 900px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-overlay {
        position: fixed;
        z-index: 35;
        inset: var(--header-height) 0 0;
        display: block;
        pointer-events: none;
        background: rgb(15 23 42 / 45%);
        opacity: 0;
        transition: opacity 0.2s;
    }

    .mobile-overlay.visible {
        pointer-events: auto;
        opacity: 1;
    }

    .main-area {
        margin-left: 0;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }

    .flex-media {
        flex-wrap: wrap;
    }

    .hide-media {
        display: none;
    }
    .hide-non-media {
        display: contents;
    }

}

@media (max-width: 600px) {
    :root {
        --header-height: 58px;
    }

    .app-header {
        padding: 0 14px;
    }

    .header-brand > span:last-child {
        display: none;
    }

    .user-summary {
        display: none;
    }

    .main-area {
        /* padding: 20px 15px; */
        padding: 20px 4px;
    }

    .page-heading {
        align-items: center;
        margin-bottom: 18px;
        padding: 0 15px;
    }

    .page-heading h1 {
        font-size: 22px;
    }

    .welcome-card {
        min-height: 160px;
        padding: 22px;
    }

    .welcome-card h2 {
        font-size: 22px;
    }

    .welcome-symbol {
        display: none;
    }

    .panel {
        padding: 19px 10px;
        width: calc(100vw - 8px);
    }


    .summary-card {
        padding: 19px;
    }

    .profile-row {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .login-page {
        padding: 14px;
    }

    .login-card {
        padding: 25px 20px;
        border-radius: 15px;
    }

    .login-description h2 {
        font-size: 24px;
    }
}
