/* リセットと基本スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: manipulation;
}

html {
    font-size: 18px;
    touch-action: manipulation;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -ms-touch-action: manipulation;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ヘッダー */
.header {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    color: white;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.logo:active {
    transform: scale(0.95);
    opacity: 0.8;
}

.logo-icon {
    flex-shrink: 0;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 0.9rem;
}

#clock {
    font-size: 1rem;
}

.day-sat {
    color: #64B5F6;
}

.day-sun {
    color: #EF5350;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sync-status::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #4CAF50;
}

.sync-status.offline::before {
    background-color: #FF9800;
}

.sync-status.syncing::before {
    background-color: #2196F3;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 画面共通 */
.screen {
    display: none;
    flex: 1;
    padding: 20px;
}

.screen.active {
    display: flex;
    flex-direction: column;
    position: relative;
}

.screen-title {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 24px;
    color: #333;
}

/* メイン画面：職員リスト */
.staff-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    flex: 1;
}

.staff-btn {
    background: #E3F2FD;
    border: none;
    border-radius: 16px;
    padding: 24px 16px;
    font-size: 1.4rem;
    font-weight: bold;
    color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s, background 0.3s;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.staff-btn.clocked-in {
    background: #FFF3E0;
    border: 3px solid #FF9800;
    opacity: 1;
}

.staff-btn.clocked-out,
.staff-btn.not-clocked {
    background: #E3F2FD;
    border: 3px solid #5C6BC0;
    opacity: 0.55;
}

.staff-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.no-staff-message {
    text-align: center;
    color: #666;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-top: 40px;
}

.btn-admin-link {
    margin-top: auto;
    padding: 12px 24px;
    background: #9E9E9E;
    color: white;
    font-size: 1rem;
    align-self: center;
}

.pin-action-label {
    text-align: center;
    font-size: 1.3rem;
    color: #1976D2;
    margin-bottom: 20px;
    font-weight: bold;
}

/* PIN入力画面 */
#screen-pin, #screen-action {
    justify-content: center;
}

.pin-display {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.pin-dot, .admin-pin-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid #1976D2;
    background: transparent;
    transition: background 0.15s;
}

.pin-dot.filled, .admin-pin-dot.filled {
    background: #1976D2;
}

.pin-error {
    color: #F44336;
    text-align: center;
    font-size: 0.9rem;
    min-height: 1.2rem;
    margin-bottom: 8px;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 260px;
    margin: 0 auto 16px;
}

.key, .admin-key {
    background: white;
    border: none;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    font-size: 1.6rem;
    font-weight: bold;
    color: #333;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.1s, background 0.1s;
    justify-self: center;
}

.key:active, .admin-key:active {
    transform: scale(0.92);
    background: #e0e0e0;
}

.key-clear {
    background: #f0f0f0;
    color: #666;
}

.key-empty {
    visibility: hidden;
}

/* PIN入力セクション（横向き対応用） */
.pin-input-section,
.keypad-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* PIN画面の戻るボタン（左上配置） */
.btn-back-top {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #1976D2;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-back-top:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 1);
}

body.dark-mode .btn-back-top {
    background: rgba(45, 55, 72, 0.95);
    color: #5b8def;
}

/* PIN画面・出勤退勤画面の職員名（大きく表示） */
.pin-staff-name,
.action-staff-name {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

/* PIN画面・出勤退勤画面：スクロール無効・画面内に収める */
#screen-pin,
#screen-action {
    position: relative;
    justify-content: center;
    overflow: hidden;
    height: calc(100vh - 100px);
    max-height: calc(100vh - 100px);
}

/* ボタン共通 */
.btn {
    border: none;
    border-radius: 12px;
    padding: 18px 32px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.1s;
    min-width: 120px;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #1976D2;
    color: white;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-full {
    width: 100%;
    margin-top: 24px;
}

/* 出勤/退勤ボタン */
.action-instruction {
    text-align: center;
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 32px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 32px;
}

.btn-clock-in {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    padding: 32px;
    font-size: 2rem;
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-clock-out {
    background: linear-gradient(135deg, #5C6BC0, #3F51B5);
    color: white;
    padding: 32px;
    font-size: 2rem;
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(63, 81, 181, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-icon {
    font-size: 2.5rem;
}

.btn-clock-in:active, .btn-clock-out:active {
    transform: scale(0.98);
}

/* 完了画面 */
#screen-complete {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.complete-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.complete-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.complete-icon.clock-in {
    background: linear-gradient(135deg, #FF9800, #F57C00);
}

.complete-icon.clock-out {
    background: linear-gradient(135deg, #5C6BC0, #3F51B5);
}

/* チェックマークSVGアニメーション */
.checkmark-svg {
    width: 70px;
    height: 70px;
}

.checkmark-circle {
    stroke: white;
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: checkmark-circle-anim 0.6s ease-in-out forwards;
}

.checkmark-check {
    stroke: white;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: checkmark-check-anim 0.3s ease-in-out 0.4s forwards;
}

@keyframes checkmark-circle-anim {
    0% {
        stroke-dashoffset: 166;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes checkmark-check-anim {
    0% {
        stroke-dashoffset: 48;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.complete-message {
    font-size: 1.8rem;
    margin-bottom: 16px;
    color: #333;
}

.complete-time {
    font-size: 2.5rem;
    font-weight: bold;
    color: #1976D2;
}

.auto-return {
    color: #999;
    font-size: 0.9rem;
}

/* 確認ダイアログ */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.dialog {
    background: white;
    border-radius: 16px;
    padding: 32px 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.dialog-message {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.6;
}

.dialog-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* 管理者パスワード確認ダイアログ */
.admin-pin-dialog {
    text-align: center;
}

.admin-pin-dialog-title {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: #333;
}

.admin-pin-dialog-message {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
    white-space: pre-line;
}

.admin-pin-input {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 8px;
    padding: 16px 20px;
    margin-bottom: 8px;
    -webkit-text-security: disc;
}

/* iOS/Safari用のパスワードマスク */
.admin-pin-input::placeholder {
    letter-spacing: normal;
}

/* 管理画面 */
.admin-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-tab {
    flex: 1;
    min-width: 80px;
    padding: 12px 16px;
    border: none;
    background: #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-tab.active {
    background: #1976D2;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.admin-form {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.admin-form h4 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #333;
}

.help-text {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 12px;
}

.input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1.1rem;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.input:focus {
    outline: none;
    border-color: #1976D2;
}

.form-buttons {
    display: flex;
    gap: 12px;
}

.staff-admin-list ul {
    list-style: none;
}

.staff-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.staff-list-header h4 {
    margin: 0;
}

.btn-reorder {
    background: #9E9E9E;
    color: white;
}

.btn-reorder.active {
    background: #4CAF50;
}

.reorder-hint {
    background: #fff3e0;
    color: #e65100;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 12px;
    text-align: center;
}

body.dark-mode .reorder-hint {
    background: #3a3520;
    color: #ffb74d;
}

.staff-admin-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: default;
    transition: background 0.2s, transform 0.2s;
}

/* 並び替えモードの時 */
.staff-admin-list li.reorder-mode {
    background: #e3f2fd;
    /* touch-action: noneは削除 - スクロールを許可する */
}

.staff-admin-list li.reorder-mode:active {
    cursor: grabbing;
}

.staff-admin-list .staff-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.staff-admin-list .drag-handle {
    color: #1976D2;
    font-size: 1.2rem;
    cursor: grab;
}

.staff-admin-list .staff-name {
    font-size: 1.1rem;
    font-weight: bold;
}

.staff-admin-list .staff-pin {
    font-size: 0.9rem;
    color: #666;
    font-family: monospace;
}

.staff-admin-list .staff-actions {
    display: flex;
    gap: 8px;
}

.btn-show-pin {
    background: #9E9E9E;
    color: white;
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 6px;
}

.btn-edit {
    background: #2196F3;
    color: white;
}

.btn-delete {
    background: #F44336;
    color: white;
}

.status-text {
    font-size: 0.9rem;
    margin-top: 8px;
}

.status-text.success {
    color: #4CAF50;
}

.status-text.error {
    color: #F44336;
}

.data-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

.data-list li {
    padding: 12px;
    background: #f9f9f9;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

/* レスポンシブ */
@media (max-width: 400px) {
    html {
        font-size: 16px;
    }

    .staff-list {
        grid-template-columns: 1fr;
    }

    .key, .admin-key {
        width: 70px;
        height: 70px;
        font-size: 1.5rem;
    }

    .keypad {
        gap: 10px;
    }
}

/* iPad縦向き対応 */
@media (min-width: 768px) and (orientation: portrait) {
    html {
        font-size: 20px;
    }

    #app {
        max-width: 700px;
    }

    .staff-list {
        grid-template-columns: repeat(3, 1fr);
    }

    .key, .admin-key {
        width: 80px;
        height: 80px;
    }

    .keypad {
        max-width: 300px;
    }
}

/* iPad横向き対応 */
@media (min-width: 768px) and (orientation: landscape) {
    html {
        font-size: 18px;
    }

    #app {
        max-width: 900px;
    }

    .screen {
        padding: 12px 20px;
    }

    .screen-title {
        margin-bottom: 12px;
        font-size: 1.3rem;
    }

    .staff-list {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    .staff-btn {
        padding: 16px 12px;
        min-height: 70px;
        font-size: 1.2rem;
    }

    .keypad {
        max-width: 240px;
        gap: 6px;
        margin-bottom: 12px;
    }

    .key, .admin-key {
        width: 60px;
        height: 60px;
        font-size: 1.4rem;
    }

    .pin-display {
        margin-bottom: 8px;
    }

    .action-buttons {
        flex-direction: row;
        gap: 16px;
    }

    .btn-clock-in, .btn-clock-out {
        flex: 1;
        padding: 20px;
        font-size: 1.5rem;
    }

    .btn-icon {
        font-size: 2rem;
    }

    .pin-action-label {
        margin-bottom: 12px;
        font-size: 1.1rem;
    }

    .btn-secondary {
        padding: 12px 24px;
        font-size: 1rem;
    }
}

/* スマホ横向き対応 */
/* スマホ横向き対応（高さが低い） */
@media (orientation: landscape) and (max-height: 500px) {
    .keypad {
        max-width: 220px;
        gap: 4px;
    }

    .key, .admin-key {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .screen-title {
        margin-bottom: 8px;
        font-size: 1.1rem;
    }

    .action-buttons {
        flex-direction: row;
    }

    .btn-clock-in, .btn-clock-out {
        flex: 1;
        padding: 16px;
        font-size: 1.3rem;
    }
}

/* iPad横向き対応（高さが十分ある） */
@media (min-width: 900px) and (orientation: landscape) {
    #app {
        max-width: 1200px;
    }

    /* PIN入力画面を横並びレイアウトに */
    #screen-pin {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 60px;
        padding: 20px 40px;
    }

    /* 左側: PIN表示とボタン */
    #screen-pin .pin-input-section {
        flex: 1;
        max-width: 400px;
    }

    /* 横向き時の職員名を大きく */
    #screen-pin .pin-staff-name {
        font-size: 3rem;
    }

    .keypad {
        max-width: 280px;
        gap: 10px;
    }

    .key, .admin-key {
        width: 80px;
        height: 80px;
        font-size: 1.8rem;
    }

    .pin-display {
        font-size: 3rem;
        letter-spacing: 20px;
        margin-bottom: 20px;
    }

    .pin-dots {
        gap: 16px;
    }

    .pin-dot {
        width: 24px;
        height: 24px;
    }

    .action-buttons {
        flex-direction: row;
        gap: 24px;
        width: 100%;
    }

    .btn-clock-in, .btn-clock-out {
        flex: 1;
        padding: 28px;
        font-size: 1.8rem;
    }

    .btn-icon {
        font-size: 2.5rem;
    }

    /* 職員リスト: 5列表示 */
    .staff-list {
        grid-template-columns: repeat(5, 1fr);
        gap: 16px;
    }

    .staff-btn {
        padding: 20px 16px;
        min-height: 80px;
        font-size: 1.3rem;
    }

    /* 管理画面 */
    .admin-container {
        padding: 20px 40px;
    }

    .admin-section {
        padding: 24px;
    }

    /* タブ */
    .admin-tabs {
        gap: 12px;
    }

    .admin-tab {
        padding: 14px 28px;
        font-size: 1.1rem;
    }

    /* 完了画面 */
    .completion-content {
        transform: scale(1.2);
    }
}

/* 未登録端末画面 */
#screen-unregistered {
    justify-content: center;
    align-items: center;
}

.unregistered-content {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.unregistered-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.unregistered-title {
    font-size: 1.5rem;
    color: #F44336;
    margin-bottom: 16px;
}

.unregistered-description {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.device-register-form {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.device-register-form label {
    display: block;
    font-size: 1rem;
    color: #666;
    margin-bottom: 12px;
}

.device-pin-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid #1976D2;
    background: transparent;
    transition: background 0.15s;
}

.device-pin-dot.filled {
    background: #1976D2;
}

.device-key {
    background: white;
    border: none;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    font-size: 1.6rem;
    font-weight: bold;
    color: #333;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.1s, background 0.1s;
    justify-self: center;
}

.device-key:active {
    transform: scale(0.92);
    background: #e0e0e0;
}

.unregistered-note {
    color: #999;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* 端末管理リスト */
.device-admin-list {
    list-style: none;
}

.device-admin-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 8px;
}

.device-admin-list li.current-device {
    background: #E3F2FD;
    border: 2px solid #1976D2;
}

.device-admin-list .device-info {
    flex: 1;
}

.device-admin-list .device-name {
    font-size: 1.1rem;
    font-weight: bold;
    display: block;
}

.device-admin-list .device-date {
    font-size: 0.85rem;
    color: #666;
}

.device-admin-list .device-current-label {
    font-size: 0.75rem;
    color: #1976D2;
    background: #BBDEFB;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

.device-admin-list .device-actions {
    display: flex;
    gap: 8px;
}

/* 履歴タブ */
.history-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.input-select {
    flex: 1;
    padding: 10px 12px;
    font-size: 1rem;
    cursor: pointer;
}

.history-summary {
    display: flex;
    gap: 16px;
    padding: 12px;
    background: #E3F2FD;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.history-summary span {
    color: #1565C0;
}

.history-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
}

.history-list li {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.history-date-header {
    background: #f0f0f0;
    font-weight: bold;
    font-size: 0.95rem;
    color: #333;
    margin-top: 8px;
}

.history-item {
    background: #fafafa;
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-time {
    font-family: monospace;
    font-size: 1rem;
    color: #666;
    min-width: 50px;
}

.history-name {
    flex: 1;
    font-size: 1rem;
}

.history-type {
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: bold;
}

.history-type.type-in {
    background: #FFF3E0;
    color: #E65100;
}

.history-type.type-out {
    background: #E8EAF6;
    color: #3F51B5;
}

.history-empty, .history-more {
    color: #666;
    text-align: center;
    font-size: 0.9rem;
}

/* ページネーション */
.history-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
}

.history-page-info {
    font-size: 0.9rem;
    color: #666;
    min-width: 60px;
    text-align: center;
}

body.dark-mode .history-pagination {
    background: #1a1d2e;
}

body.dark-mode .history-page-info {
    color: #9ea7c0;
}

/* 折りたたみ */
.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsible-header:hover {
    color: #1976D2;
}

.collapse-icon {
    font-size: 0.8rem;
    color: #999;
}

.collapsible-content {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

/* エクスポートダイアログ */
.export-dialog {
    max-width: 320px;
    max-height: 85vh;
    overflow-y: auto;
}

.export-dialog-title {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 12px;
    color: #333;
}

.export-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.export-option {
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 8px;
    font-size: 0.95rem;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.15s;
}

.export-option:hover {
    background: #e3f2fd;
    border-color: #1976D2;
}

.export-option:active {
    transform: scale(0.96);
}

.export-option-wide {
    grid-column: span 2;
}

.export-option[data-period="custom"] {
    background: #fff3e0;
    border-color: #FF9800;
}

.custom-date-picker {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.date-input-group {
    margin-bottom: 12px;
}

/* 打刻編集ダイアログ */
.edit-record-dialog {
    max-width: 300px;
    max-height: 80vh;
    overflow-y: auto;
}

.edit-dialog-title {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 12px;
    color: #333;
}

.edit-form-group {
    margin-bottom: 10px;
}

.edit-form-group label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 4px;
}

.edit-form-group .required {
    color: #F44336;
    font-size: 0.8rem;
}

.edit-readonly {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    padding: 8px 0;
}

.edit-memo {
    resize: none;
    font-size: 1rem;
}

.edit-history-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.edit-history-section h4 {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 8px;
}

.edit-history-list {
    list-style: none;
    max-height: 90px;
    overflow-y: auto;
}

.edit-history-list li {
    font-size: 0.85rem;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 6px;
}

.edit-history-date {
    color: #666;
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.edit-history-change {
    color: #333;
    font-weight: bold;
}

.edit-history-memo {
    color: #1976D2;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 4px;
}

/* 履歴一覧の編集済みマーク */
.history-item.edited {
    position: relative;
}

.history-item.edited::after {
    content: "✎";
    font-size: 0.75rem;
    color: #FF9800;
    margin-left: 6px;
}

.history-edit-btn {
    background: #e0e0e0;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: 8px;
}

.history-edit-btn:active {
    background: #bdbdbd;
}

.date-input-group label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 4px;
}

.date-input-group .input {
    width: 100%;
}

/* 危険ゾーン（初期化） */
.danger-zone {
    border: 2px solid #F44336;
    background: #FFF5F5;
}

.danger-zone h4 {
    color: #D32F2F;
}

.danger-text {
    color: #D32F2F !important;
}

.btn-danger {
    background: #F44336;
    color: white;
}

.btn-danger:active {
    background: #D32F2F;
}

/* ダークモード切り替えトグル */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle-label {
    font-size: 1rem;
    cursor: pointer;
}

.theme-toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.theme-toggle-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.theme-toggle-switch.dark::after {
    transform: translateX(20px);
}

/* ダークモード - Teamify風スタイリッシュUI */
/* html.dark-modeは早期ロード用、body.dark-modeはJS用 */
html.dark-mode,
body.dark-mode {
    background-color: #1a1d2e;
    color: #e8eaf6;
}

html.dark-mode #app,
body.dark-mode #app {
    background-color: #1a1d2e;
}

body.dark-mode .header {
    background: linear-gradient(135deg, #252a3d, #1e2235);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .screen-title {
    color: #ffffff;
}

body.dark-mode .no-staff-message {
    color: #9ea7c0;
}

body.dark-mode .action-instruction {
    color: #9ea7c0;
}

/* 職員ボタン */
body.dark-mode .staff-btn {
    background: #252a3d;
    color: #ffffff;
    border: 2px solid #363c52;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

body.dark-mode .staff-btn.clocked-in {
    background: linear-gradient(135deg, #5a4020, #4a3518);
    border: 2px solid #ff9800;
    opacity: 1;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

body.dark-mode .staff-btn.clocked-out,
body.dark-mode .staff-btn.not-clocked {
    background: #252a3d;
    border: 2px solid #363c52;
    opacity: 0.7;
}

body.dark-mode .btn-admin-link {
    background: #363c52;
    color: #9ea7c0;
}

/* キーパッド */
body.dark-mode .key,
body.dark-mode .admin-key,
body.dark-mode .device-key {
    background: #252a3d;
    color: #ffffff;
    border: 1px solid #363c52;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

body.dark-mode .key:active,
body.dark-mode .admin-key:active,
body.dark-mode .device-key:active {
    background: #363c52;
}

body.dark-mode .key-clear {
    background: #2a2f42;
    color: #9ea7c0;
}

/* PINドット */
body.dark-mode .pin-dot,
body.dark-mode .admin-pin-dot,
body.dark-mode .device-pin-dot {
    border-color: #5b8def;
}

body.dark-mode .pin-dot.filled,
body.dark-mode .admin-pin-dot.filled,
body.dark-mode .device-pin-dot.filled {
    background: #5b8def;
}

body.dark-mode .pin-action-label {
    color: #5b8def;
}

/* ボタン */
body.dark-mode .btn-primary {
    background: linear-gradient(135deg, #5b8def, #4a7be0);
}

body.dark-mode .btn-secondary {
    background: #363c52;
    color: #e8eaf6;
}

/* 管理画面フォーム */
body.dark-mode .admin-form {
    background: #252a3d;
    color: #e8eaf6;
    border: 1px solid #363c52;
}

body.dark-mode .admin-form h4 {
    color: #ffffff;
}

body.dark-mode .help-text {
    color: #9ea7c0;
}

/* 入力フィールド */
body.dark-mode .input {
    background: #1a1d2e;
    border: 2px solid #363c52;
    color: #ffffff;
}

body.dark-mode .input:focus {
    border-color: #5b8def;
}

body.dark-mode .input::placeholder {
    color: #6b7394;
}

/* リスト */
body.dark-mode .staff-admin-list li,
body.dark-mode .device-admin-list li {
    background: #1a1d2e;
    border: 1px solid #363c52;
    color: #e8eaf6;
}

body.dark-mode .staff-admin-list li.reorder-mode {
    background: #2a3550;
    border: 1px solid #5b8def;
}

body.dark-mode .staff-admin-list .staff-name,
body.dark-mode .device-admin-list .device-name {
    color: #ffffff;
}

body.dark-mode .staff-admin-list .staff-pin,
body.dark-mode .device-admin-list .device-date {
    color: #9ea7c0;
}

body.dark-mode .staff-admin-list .drag-handle {
    color: #5b8def;
}

body.dark-mode .device-admin-list li.current-device {
    background: #2a3a5c;
    border-color: #5b8def;
}

body.dark-mode .device-admin-list .device-current-label {
    background: #5b8def;
    color: #ffffff;
}

/* タブ */
body.dark-mode .admin-tab {
    background: #252a3d;
    color: #9ea7c0;
    border: 1px solid #363c52;
}

body.dark-mode .admin-tab.active {
    background: #5b8def;
    color: #ffffff;
    border-color: #5b8def;
}

/* 履歴 */
body.dark-mode .history-summary {
    background: #252a3d;
    border: 1px solid #363c52;
}

body.dark-mode .history-summary span {
    color: #5b8def;
}

body.dark-mode .history-list li {
    background: #1a1d2e;
}

body.dark-mode .history-date-header {
    background: #252a3d;
    color: #ffffff;
}

body.dark-mode .history-item {
    background: #252a3d;
    border: 1px solid #363c52;
}

body.dark-mode .history-time {
    color: #9ea7c0;
}

body.dark-mode .history-name {
    color: #ffffff;
}

body.dark-mode .history-type.type-in {
    background: rgba(255, 183, 77, 0.2);
    color: #ffb74d;
}

body.dark-mode .history-type.type-out {
    background: rgba(91, 141, 239, 0.2);
    color: #5b8def;
}

body.dark-mode .history-edit-btn {
    background: #363c52;
    color: #9ea7c0;
}

body.dark-mode .history-empty,
body.dark-mode .history-more {
    color: #6b7394;
}

/* ダイアログ */
body.dark-mode .dialog {
    background: #252a3d;
    color: #e8eaf6;
    border: 1px solid #363c52;
}

body.dark-mode .dialog-message {
    color: #ffffff;
}

body.dark-mode .export-dialog-title,
body.dark-mode .edit-dialog-title {
    color: #ffffff;
}

body.dark-mode .export-option {
    background: #1a1d2e;
    border: 2px solid #363c52;
    color: #e8eaf6;
}

body.dark-mode .export-option:hover {
    border-color: #5b8def;
    background: #252a3d;
}

body.dark-mode .export-option[data-period="custom"] {
    background: rgba(255, 183, 77, 0.1);
    border-color: #ffb74d;
}

body.dark-mode .custom-date-picker {
    background: #1a1d2e;
    border: 1px solid #363c52;
}

body.dark-mode .edit-record-dialog,
body.dark-mode .export-dialog {
    background: #252a3d;
}

body.dark-mode .edit-form-group label {
    color: #9ea7c0;
}

body.dark-mode .edit-readonly {
    color: #ffffff;
}

body.dark-mode .edit-history-section {
    border-color: #363c52;
}

body.dark-mode .edit-history-section h4 {
    color: #9ea7c0;
}

body.dark-mode .edit-history-list li {
    background: #1a1d2e;
    border: 1px solid #363c52;
}

body.dark-mode .edit-history-date {
    color: #6b7394;
}

body.dark-mode .edit-history-change {
    color: #ffffff;
}

body.dark-mode .edit-history-memo {
    color: #5b8def;
}

/* 管理者パスワード確認ダイアログ（ダーク）*/
body.dark-mode .admin-pin-dialog-title {
    color: #ffffff;
}

body.dark-mode .admin-pin-dialog-message {
    color: #9ea7c0;
}

body.dark-mode .admin-pin-input {
    background: #1a1d2e;
    border-color: #363c52;
    color: #ffffff;
}

body.dark-mode .admin-pin-input:focus {
    border-color: #5b8def;
}

/* 端末登録画面 */
body.dark-mode .unregistered-title {
    color: #ff6b6b;
}

body.dark-mode .unregistered-description {
    color: #9ea7c0;
}

body.dark-mode .device-register-form {
    background: #252a3d;
    border: 1px solid #363c52;
}

body.dark-mode .device-register-form label {
    color: #9ea7c0;
}

body.dark-mode .unregistered-note {
    color: #6b7394;
}

/* 危険ゾーン */
body.dark-mode .danger-zone {
    background: rgba(255, 107, 107, 0.1);
    border-color: #ff6b6b;
}

body.dark-mode .danger-zone h4 {
    color: #ff6b6b;
}

body.dark-mode .danger-text {
    color: #ff6b6b !important;
}

body.dark-mode .btn-danger {
    background: #ff6b6b;
}

/* 完了画面 */
body.dark-mode .complete-message {
    color: #ffffff;
}

body.dark-mode .complete-time {
    color: #5b8def;
}

body.dark-mode .auto-return {
    color: #6b7394;
}

/* 折りたたみ */
body.dark-mode .collapsible-header:hover {
    color: #5b8def;
}

body.dark-mode .collapse-icon {
    color: #6b7394;
}

body.dark-mode .collapsible-content {
    border-color: #363c52;
}

/* ステータス */
body.dark-mode .status-text.success {
    color: #4ade80;
}

body.dark-mode .status-text.error {
    color: #ff6b6b;
}

/* セレクトボックス */
body.dark-mode .input-select {
    background: #1a1d2e;
    color: #e8eaf6;
}

/* 出勤/退勤ボタン（ダークモード調整） */
body.dark-mode .btn-clock-in {
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.3);
}

body.dark-mode .btn-clock-out {
    box-shadow: 0 6px 20px rgba(91, 141, 239, 0.3);
}

/* ========== 履歴サブタブ ========== */
.history-subtabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: #e0e0e0;
    border-radius: 8px;
    padding: 4px;
}

.history-subtab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.history-subtab.active {
    background: white;
    color: #1976D2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
}

body.dark-mode .history-subtabs {
    background: #1a1d2e;
    gap: 10px;
    padding: 8px;
    border: 1px solid #363c52;
}

body.dark-mode .history-subtab {
    color: #9ea7c0;
    border: 1px solid transparent;
    border-radius: 6px;
}

body.dark-mode .history-subtab.active {
    background: #363c52;
    color: #5b8def;
    border: 1px solid #5b8def;
}

/* ========== 集計セクション ========== */
.summary-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.date-range-picker {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-range-picker input {
    flex: 1;
}

.date-range-picker span {
    color: #666;
}

body.dark-mode .date-range-picker span {
    color: #9ea7c0;
}

.summary-result {
    margin-top: 20px;
}

.summary-card {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    border-radius: 12px;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.summary-item {
    text-align: center;
    color: white;
}

.summary-label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.9;
    margin-bottom: 4px;
}

.summary-value {
    display: block;
    font-size: 1.4rem;
    font-weight: bold;
}

body.dark-mode .summary-card {
    background: linear-gradient(135deg, #3a4a6b, #2d3a5c);
}

.summary-detail {
    margin-top: 16px;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.summary-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.85rem;
}

.summary-detail-item:last-child {
    border-bottom: none;
}

.summary-detail-date {
    color: #666;
}

.summary-detail-hours {
    font-weight: 500;
    color: #1976D2;
}

body.dark-mode .summary-detail {
    background: #1a1d2e;
}

body.dark-mode .summary-detail-item {
    border-bottom-color: #363c52;
}

body.dark-mode .summary-detail-date {
    color: #9ea7c0;
}

body.dark-mode .summary-detail-hours {
    color: #5b8def;
}

/* ========== カレンダーセクション ========== */
.calendar-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.calendar-month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

#calendar-month-label {
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

.attendance-calendar {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #1976D2;
    color: white;
}

.calendar-header-cell {
    padding: 10px 4px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
}

.calendar-header-cell.sun {
    color: #ffcdd2;
}

.calendar-header-cell.sat {
    color: #bbdefb;
}

.calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-cell {
    aspect-ratio: 1;
    padding: 4px;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    min-height: 50px;
}

.calendar-cell.other-month {
    background: #f5f5f5;
    color: #bbb;
}

.calendar-cell.sun .calendar-day {
    color: #e53935;
}

.calendar-cell.sat .calendar-day {
    color: #1976D2;
}

.calendar-day {
    font-weight: 500;
    margin-bottom: 2px;
}

.calendar-status {
    font-size: 0.65rem;
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
}

.calendar-status.worked {
    background: #ff9800;
    color: white;
}

.calendar-status.worked-hours {
    background: #4caf50;
    color: white;
    font-size: 0.6rem;
}

body.dark-mode .attendance-calendar {
    background: #252a3d;
}

body.dark-mode .calendar-header {
    background: linear-gradient(135deg, #3a4a6b, #2d3a5c);
}

body.dark-mode .calendar-cell {
    border-color: #363c52;
}

body.dark-mode .calendar-cell.other-month {
    background: #1a1d2e;
    color: #6b7394;
}

body.dark-mode .calendar-day {
    color: #e8eaf6;
}

body.dark-mode .calendar-cell.sun .calendar-day {
    color: #ff6b6b;
}

body.dark-mode .calendar-cell.sat .calendar-day {
    color: #5b8def;
}

.calendar-summary {
    margin-top: 12px;
    padding: 12px;
    background: #e3f2fd;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
}

.calendar-summary strong {
    color: #1976D2;
}

body.dark-mode .calendar-summary {
    background: #252a3d;
}

body.dark-mode .calendar-summary strong {
    color: #5b8def;
}

.calendar-stats {
    margin-top: 8px;
    padding: 16px;
    background: linear-gradient(135deg, #1976D2, #1565C0);
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.calendar-stat-item {
    text-align: center;
    color: white;
}

.calendar-stat-label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.9;
}

.calendar-stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
}

body.dark-mode .calendar-stats {
    background: linear-gradient(135deg, #3a4a6b, #2d3a5c);
}

/* 集計期間ボタン */
.summary-period-buttons {
    display: flex;
    gap: 8px;
}

.summary-period-buttons .btn {
    flex: 1;
    background: #e0e0e0;
    color: #666;
    transition: all 0.2s;
}

.summary-period-buttons .btn.active {
    background: #1976D2;
    color: white;
}

body.dark-mode .summary-period-buttons .btn {
    background: #363c52;
    color: #9ea7c0;
}

body.dark-mode .summary-period-buttons .btn.active {
    background: #5b8def;
    color: white;
}

/* 履歴カスタム期間 */
.history-custom-dates {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
}

.history-custom-dates input {
    flex: 1;
}

body.dark-mode .history-custom-dates {
    background: #1a1d2e;
}

/* デモモード */
.demo-section {
    border: 2px dashed #9E9E9E;
}

.demo-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.demo-status {
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 4px;
    background: #9E9E9E;
    color: white;
}

.demo-status.active {
    background: #4CAF50;
}

body.demo-mode .header {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}

body.demo-mode .header::after {
    content: '【デモモード】';
    display: block;
    font-size: 0.7rem;
    opacity: 0.9;
}

/* GodMode */
body.god-mode .header {
    background: linear-gradient(135deg, #FFD700, #FFA500);
}

body.god-mode .header::after {
    content: '【GodMode】';
    display: block;
    font-size: 0.7rem;
    color: #8B4513;
    font-weight: bold;
}

body.god-mode.dark-mode .header {
    background: linear-gradient(135deg, #FFD700, #B8860B);
}

body.god-mode .logo,
body.god-mode #clock,
body.god-mode .sync-status {
    color: #333;
}

body.god-mode .day-sat {
    color: #1565C0;
}

body.god-mode .day-sun {
    color: #C62828;
}

/* GodModeセクション */
.godmode-section {
    border: 2px solid #FFD700;
    background: linear-gradient(135deg, #FFF8DC, #FFFACD);
}

.godmode-section h4 {
    color: #B8860B;
}

.godmode-pin-display {
    font-size: 2rem;
    font-weight: bold;
    color: #B8860B;
    text-align: center;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 2px dashed #FFD700;
    font-family: monospace;
    letter-spacing: 4px;
    margin-bottom: 12px;
}

body.dark-mode .godmode-section {
    border-color: #FFD700;
    background: linear-gradient(135deg, #3a3520, #2d2a1a);
}

body.dark-mode .godmode-section h4 {
    color: #FFD700;
}

body.dark-mode .godmode-pin-display {
    background: #1a1d2e;
    color: #FFD700;
    border-color: #B8860B;
}

/* GodMode PIN入力ダイアログ */
.godmode-pin-dialog {
    text-align: center;
    max-width: 320px;
}

.godmode-pin-dialog-title {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: #333;
}

body.dark-mode .godmode-pin-dialog-title {
    color: #ffffff;
}

/* GodMode PIN 伏せ字表示（可変長） */
.godmode-pin-display-mask {
    background: #f5f5f5;
    border: 2px solid #B8860B;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode .godmode-pin-display-mask {
    background: #1a1d2e;
    border-color: #FFD700;
}

.godmode-pin-placeholder {
    color: #999;
    font-size: 1rem;
}

body.dark-mode .godmode-pin-placeholder {
    color: #6b7394;
}

.godmode-pin-asterisks {
    font-size: 1.8rem;
    letter-spacing: 4px;
    color: #B8860B;
}

body.dark-mode .godmode-pin-asterisks {
    color: #FFD700;
}

.godmode-pin-display-mask.shake {
    animation: shake 0.5s ease-in-out;
}

.godmode-pin-display-mask.error {
    border-color: #F44336;
}

.godmode-pin-display-mask.error .godmode-pin-asterisks {
    color: #F44336;
}

body.dark-mode .godmode-pin-display-mask.error {
    border-color: #ff6b6b;
}

body.dark-mode .godmode-pin-display-mask.error .godmode-pin-asterisks {
    color: #ff6b6b;
}

/* GodModeダイアログのボタン */
.godmode-dialog-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.godmode-dialog-buttons .btn {
    flex: 1;
}

.godmode-keypad {
    max-width: 240px;
    margin: 0 auto 16px;
}

.godmode-key {
    background: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.4rem;
    font-weight: bold;
    color: #333;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.1s, background 0.1s;
    justify-self: center;
}

.godmode-key:active {
    transform: scale(0.92);
    background: #e0e0e0;
}

body.dark-mode .godmode-key {
    background: #252a3d;
    color: #ffffff;
    border: 1px solid #363c52;
}

body.dark-mode .godmode-key:active {
    background: #363c52;
}

/* GodModeドット振動アニメーション */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.godmode-pin-display-dots.shake {
    animation: shake 0.5s ease-in-out;
}

.godmode-pin-dot.error {
    border-color: #F44336;
}

body.dark-mode .godmode-pin-dot.error {
    border-color: #ff6b6b;
}

/* テンキー押下フィードバック（強化版） */
.godmode-key.pressed {
    transform: scale(0.88);
    background: linear-gradient(135deg, #1976D2, #1565C0);
    color: white;
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

body.dark-mode .godmode-key.pressed {
    background: linear-gradient(135deg, #5b8def, #4a7be0);
    color: white;
    box-shadow: 0 2px 8px rgba(91, 141, 239, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.2);
    border-color: #5b8def;
}

/* 通常キーパッド押下フィードバック */
.key.pressed,
.admin-key.pressed,
.device-key.pressed {
    transform: scale(0.88);
    background: linear-gradient(135deg, #1976D2, #1565C0);
    color: white;
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

body.dark-mode .key.pressed,
body.dark-mode .admin-key.pressed,
body.dark-mode .device-key.pressed {
    background: linear-gradient(135deg, #5b8def, #4a7be0);
    color: white;
    box-shadow: 0 2px 8px rgba(91, 141, 239, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.2);
    border-color: #5b8def;
}

/* PINドットエラー時 */
.pin-dot.error,
.admin-pin-dot.error,
.device-pin-dot.error {
    border-color: #F44336;
}

body.dark-mode .pin-dot.error,
body.dark-mode .admin-pin-dot.error,
body.dark-mode .device-pin-dot.error {
    border-color: #ff6b6b;
}

/* PIN表示の振動アニメーション */
.pin-display.shake {
    animation: shake 0.5s ease-in-out;
}

/* GodModeダイアログのスマホ対応 */
@media (max-width: 400px) {
    .godmode-pin-dialog {
        max-width: 280px;
        padding: 20px 16px;
    }

    .godmode-pin-display-dots {
        gap: 6px;
    }

    .godmode-pin-dot {
        width: 14px;
        height: 14px;
    }

    .godmode-keypad {
        max-width: 200px;
        gap: 6px;
    }

    .godmode-key {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* 職員並び替えアニメーション */
.staff-admin-list li {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

/* ドラッグ中のアイテム - 浮き上がり効果 */
.staff-admin-list li.dragging {
    opacity: 1 !important;
    transform: scale(1.03) translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35), 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 100;
    background: #e3f2fd;
    border-radius: 8px;
}

body.dark-mode .staff-admin-list li.dragging {
    background: #3d4663;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 4px 8px rgba(91, 141, 239, 0.3);
}

/* ドラッグ中は他のアイテムを薄暗く */
.staff-admin-list.dragging-active li:not(.dragging) {
    opacity: 0.5;
    filter: brightness(0.9);
}

body.dark-mode .staff-admin-list.dragging-active li:not(.dragging) {
    opacity: 0.4;
    filter: brightness(0.8);
}

.staff-admin-list li.drag-over-top {
    border-top: 3px solid #1976D2;
    padding-top: 13px;
    opacity: 0.8 !important;
}

.staff-admin-list li.drag-over-bottom {
    border-bottom: 3px solid #1976D2;
    padding-bottom: 13px;
    opacity: 0.8 !important;
}

body.dark-mode .staff-admin-list li.drag-over-top {
    border-top-color: #5b8def;
}

body.dark-mode .staff-admin-list li.drag-over-bottom {
    border-bottom-color: #5b8def;
}

/* 並び替えモード - 順番表示 */
.reorder-position {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #1976D2;
    color: white;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: bold;
    margin-right: 12px;
    flex-shrink: 0;
}

body.dark-mode .reorder-position {
    background: #5b8def;
}

/* 並び替えボタン */
.reorder-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-left: auto;
}

.btn-reorder-up,
.btn-reorder-down {
    width: 40px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: #e3f2fd;
    color: #1976D2;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-reorder-up:active:not(:disabled),
.btn-reorder-down:active:not(:disabled) {
    background: #1976D2;
    color: white;
    transform: scale(0.95);
}

.btn-reorder-up:disabled,
.btn-reorder-down:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

body.dark-mode .btn-reorder-up,
body.dark-mode .btn-reorder-down {
    background: #3d4663;
    color: #5b8def;
}

body.dark-mode .btn-reorder-up:active:not(:disabled),
body.dark-mode .btn-reorder-down:active:not(:disabled) {
    background: #5b8def;
    color: #1a1a2e;
}

/* 並び替えモード時のリスト */
.staff-admin-list li.reorder-mode {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    transition: background 0.3s ease, transform 0.2s ease;
    border-left: 4px solid transparent;
}

/* 移動後のハイライト - 大胆な色 */
.staff-admin-list li.reorder-mode.just-moved {
    background: #4CAF50 !important;
    border-left-color: #2E7D32;
    color: white;
    animation: highlight-flash 0.3s ease;
}

.staff-admin-list li.reorder-mode.just-moved .reorder-position {
    background: white;
    color: #4CAF50;
}

.staff-admin-list li.reorder-mode.just-moved .staff-name {
    color: white;
}

body.dark-mode .staff-admin-list li.reorder-mode.just-moved {
    background: #66BB6A !important;
    border-left-color: #43A047;
}

@keyframes highlight-flash {
    0% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.staff-admin-list li.reorder-mode .staff-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.staff-admin-list li.reorder-mode .staff-name {
    font-weight: 500;
}
