* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Yu Gothic UI", "Meiryo", sans-serif;
    background: #f5f6f8;
    color: #222;
}
.container {
    max-width: 1200px;
    margin: 40px auto;
    background: white;
    padding: 28px;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}
.form-container {
    max-width: 760px;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}
h1 { margin-top: 0; }
p { color: #666; }
.btn {
    display: inline-block;
    padding: 9px 15px;
    border: 1px solid #bbb;
    border-radius: 7px;
    background: #fff;
    color: #222;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
}
.btn.primary {
    background: #222;
    color: white;
    border-color: #222;
}
.btn.danger {
    background: #fff;
    color: #b00020;
    border-color: #d99;
}
.message {
    padding: 12px 14px;
    background: #eef7ee;
    border: 1px solid #b8d8b8;
    border-radius: 7px;
    margin-bottom: 18px;
}
.empty {
    padding: 30px;
    text-align: center;
    color: #777;
    border: 1px dashed #ccc;
    border-radius: 8px;
}
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    border-bottom: 1px solid #e5e5e5;
    padding: 10px 8px;
    text-align: left;
    white-space: nowrap;
}
th {
    background: #fafafa;
}
.actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.actions form { margin: 0; }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field input,
.field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #bbb;
    border-radius: 6px;
    font-size: 15px;
}
.field.checkbox {
    justify-content: flex-end;
}
.field.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
}
.field.checkbox input {
    width: auto;
}
.form-actions {
    margin-top: 26px;
    display: flex;
    gap: 10px;
}
.validation {
    color: #b00020;
    font-size: 13px;
}
@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
    .page-header { align-items: flex-start; flex-direction: column; }
}

.readonly {
    background: #f0f1f3;
    color: #555;
}
small {
    color: #777;
    line-height: 1.4;
}

.full-row { grid-column: 1 / -1; }

.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.top-nav {
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #dcdfe4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.top-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 64px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.top-nav-brand {
    font-size: 20px;
    font-weight: 700;
    color: #222;
    text-decoration: none;
    white-space: nowrap;
}
.top-nav-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.top-nav-btn {
    display: inline-block;
    padding: 10px 16px;
    border: 1px solid #bbb;
    border-radius: 7px;
    background: #f8f9fa;
    color: #222;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}
.top-nav-btn:hover {
    background: #eceff2;
}
@media (max-width: 700px) {
    .top-nav-inner {
        align-items: flex-start;
        flex-direction: column;
    }
}

.top-nav-title {
    font-size: 20px;
    font-weight: 700;
    color: #222;
    white-space: nowrap;
}
.nav-master-btn {
    min-width: 130px;
    text-align: center;
    padding: 11px 18px;
    font-size: 15px;
}

.master-toolbar {
    width: 100%;
    background: #eeeeee;
    border-bottom: 1px solid #cfcfcf;
    padding: 12px 0;
}
.master-toolbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.master-toolbar-title {
    font-size: 20px;
    font-weight: 700;
    min-width: 180px;
}
.master-toolbar-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}
.master-toolbar-buttons form {
    margin: 0;
}
.master-button {
    min-width: 150px;
    height: 42px;
    font-size: 15px;
    font-weight: 700;
}
@media (max-width: 700px) {
    .master-toolbar-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    .master-toolbar-buttons {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* v0.9 master navigation */
.master-toolbar {
    width: 100%;
    background: #f4f5f7;
    border-bottom: 1px solid #d8dbe0;
    padding: 8px 0;
}
.master-toolbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 28px;
    min-height: 46px;
    display: flex;
    align-items: center;
}
.master-toolbar-title {
    font-size: 18px;
    font-weight: 700;
    color: #222;
    white-space: nowrap;
}
.master-toolbar-buttons {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.master-toolbar-buttons form {
    margin: 0;
}
.master-button {
    min-width: 0;
    width: auto;
    height: 34px;
    padding: 5px 13px;
    border: 0;
    border-radius: 6px;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.employee-master-button {
    background: #2563a6;
}
.employee-master-button:hover {
    background: #1d4f86;
}
.department-master-button {
    background: #3f7d4b;
}
.department-master-button:hover {
    background: #32643c;
}
@media (max-width: 700px) {
    .master-toolbar-inner {
        padding: 0 14px;
        gap: 10px;
    }
    .master-toolbar-title {
        font-size: 16px;
    }
    .master-toolbar-buttons {
        gap: 6px;
    }
    .master-button {
        height: 32px;
        padding: 4px 9px;
        font-size: 12px;
    }
}

/* v1.0 navigation width/position adjustment */
.master-toolbar-inner {
    justify-content: flex-start;
}
.master-toolbar-buttons {
    margin-left: 70px;
}
.master-button {
    width: 125px;
    min-width: 125px;
    height: 34px;
    padding-left: 8px;
    padding-right: 8px;
}
@media (max-width: 700px) {
    .master-toolbar-buttons {
        margin-left: auto;
    }
    .master-button {
        width: 112px;
        min-width: 112px;
    }
}

/* v1.3 additional master buttons */
.master-toolbar-buttons { margin-left: 36px; gap: 7px; }
.worklocation-master-button { background: #9a6700; }
.worklocation-master-button:hover { background: #7a5200; }
.employment-master-button { background: #7c3f98; }
.employment-master-button:hover { background: #64327b; }
.workpattern-master-button { background: #b45309; }
.workpattern-master-button:hover { background: #92400e; }
@media (max-width: 900px) {
    .master-toolbar-inner { align-items: flex-start; }
    .master-toolbar-buttons { flex-wrap: wrap; margin-left: 24px; }
}
@media (max-width: 700px) {
    .master-toolbar-inner { flex-direction: column; }
    .master-toolbar-buttons { margin-left: 0; margin-top: 8px; }
}

/* v1.4 master color coordination
   Each navigation button has its own color, and each master title uses the same color. */
.employee-master-button { background: #2563a6; }
.employee-master-button:hover { background: #1d4f86; }

.department-master-button { background: #3f7d4b; }
.department-master-button:hover { background: #32643c; }

.worklocation-master-button { background: #0f766e; }
.worklocation-master-button:hover { background: #0b5f59; }

.employment-master-button { background: #7c3f98; }
.employment-master-button:hover { background: #64327b; }

.workpattern-master-button { background: #b45309; }
.workpattern-master-button:hover { background: #92400e; }

.employee-master-title { color: #2563a6; }
.department-master-title { color: #3f7d4b; }
.worklocation-master-title { color: #0f766e; }
.employment-master-title { color: #7c3f98; }
.workpattern-master-title { color: #b45309; }

/* v1.5 - forced master color scheme */
.employee-master-button { background-color:#2563A6 !important; color:#fff !important; }
.department-master-button { background-color:#3F7D4B !important; color:#fff !important; }
.worklocation-master-button { background-color:#0F766E !important; color:#fff !important; }
.employment-master-button { background-color:#7C3F98 !important; color:#fff !important; }
.workpattern-master-button { background-color:#B45309 !important; color:#fff !important; }

.employee-master-title { color:#2563A6 !important; }
.department-master-title { color:#3F7D4B !important; }
.worklocation-master-title { color:#0F766E !important; }
.employment-master-title { color:#7C3F98 !important; }
.workpattern-master-title { color:#B45309 !important; }


/* v1.6 打刻画面 */
.attendance-nav-button {
    background-color: #334155 !important;
}
.attendance-nav-button:hover {
    background-color: #1f2937 !important;
}

.attendance-container {
    max-width: 1000px;
}

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

.attendance-title {
    color: #334155;
    margin-bottom: 6px;
}

.attendance-clock-box {
    min-width: 250px;
    padding: 14px 20px;
    background: #f8fafc;
    border: 1px solid #d9e0e7;
    border-radius: 10px;
    text-align: center;
}

.attendance-current-date {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 2px;
}

.attendance-current-time {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #1e293b;
    font-variant-numeric: tabular-nums;
}

.attendance-error {
    padding: 12px 14px;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
    border-radius: 7px;
    margin-bottom: 18px;
}

.attendance-selector-card,
.attendance-history-card {
    border: 1px solid #e1e5ea;
    border-radius: 10px;
    padding: 20px;
    background: #fff;
}

.attendance-select-form {
    display: grid;
    grid-template-columns: 110px minmax(250px, 1fr);
    align-items: center;
    gap: 12px;
}

.attendance-select-form label {
    font-weight: 700;
}

.attendance-select-form select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #aeb7c2;
    border-radius: 7px;
    font-size: 16px;
    background: #fff;
}

.attendance-employee-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding-top: 18px;
    margin-top: 18px;
    border-top: 1px solid #e6e8eb;
}

.attendance-employee-summary > div {
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 7px;
}

.summary-label {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 3px;
}

.attendance-status {
    color: #0f172a;
    font-size: 18px;
}

.attendance-punch-form {
    margin: 22px 0;
}

.attendance-punch-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.attendance-punch-button {
    min-height: 118px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.13);
    transition: transform .08s ease, opacity .08s ease;
}

.attendance-punch-button:not(:disabled):active {
    transform: translateY(1px);
}

.attendance-punch-button:disabled {
    opacity: .28;
    cursor: not-allowed;
    box-shadow: none;
}

.punch-in {
    background: #15803d;
}

.punch-out {
    background: #b91c1c;
}

.punch-goout {
    background: #b45309;
}

.punch-return {
    background: #2563eb;
}

.punch-label {
    display: block;
    font-size: 27px;
    font-weight: 800;
    margin-bottom: 7px;
}

.punch-help {
    display: block;
    font-size: 13px;
    opacity: .9;
}

.attendance-history-card h2 {
    margin: 0 0 14px;
    font-size: 20px;
}

.attendance-no-history {
    color: #7b818a;
    padding: 18px 0 6px;
}

.attendance-history-table {
    max-width: 500px;
}

.attendance-history-table td:first-child {
    width: 190px;
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.punch-type-badge {
    display: inline-block;
    min-width: 72px;
    padding: 5px 10px;
    border-radius: 999px;
    color: #fff;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
}

.punch-type-clockin { background: #15803d; }
.punch-type-clockout { background: #b91c1c; }
.punch-type-goout { background: #b45309; }
.punch-type-return { background: #2563eb; }

@media (max-width: 900px) {
    .master-toolbar-buttons {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .attendance-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .attendance-clock-box {
        width: 100%;
    }

    .attendance-employee-summary {
        grid-template-columns: 1fr 1fr;
    }

    .attendance-punch-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .attendance-select-form {
        grid-template-columns: 1fr;
    }

    .attendance-employee-summary {
        grid-template-columns: 1fr;
    }

    .attendance-punch-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .attendance-punch-button {
        min-height: 95px;
    }

    .punch-label {
        font-size: 23px;
    }
}


/* v2.4 打刻データ管理 */
.attendance-records-nav-button {
    background-color: #475569 !important;
}
.attendance-records-nav-button:hover {
    background-color: #334155 !important;
}
.attendance-records-title {
    color: #475569;
}
.attendance-record-filter {
    display: flex;
    align-items: end;
    gap: 14px;
    flex-wrap: wrap;
    padding: 16px;
    margin: 18px 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
}
.attendance-record-filter > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.attendance-record-filter input,
.attendance-record-filter select {
    min-width: 180px;
    padding: 8px 10px;
    border: 1px solid #aeb7c2;
    border-radius: 6px;
    background: #fff;
}
.attendance-record-filter-buttons {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
}
.attendance-record-actions {
    display: flex;
    gap: 7px;
    align-items: center;
}
.attendance-record-actions form {
    margin: 0;
}
.attendance-record-warning {
    padding: 11px 13px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    border-radius: 7px;
}


/* v2.5 打刻データ 編集・削除ボタンを明示表示 */
.attendance-record-actions {
    min-width: 150px;
    white-space: nowrap;
}
.attendance-record-actions form {
    display: inline-block;
    margin: 0 5px 0 0;
}
.attendance-edit-button,
.attendance-delete-button {
    min-width: 60px;
    height: 34px;
    padding: 5px 12px;
    border: 0;
    border-radius: 6px;
    color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.attendance-edit-button {
    background-color: #2563A6 !important;
}
.attendance-edit-button:hover {
    background-color: #1D4F86 !important;
}
.attendance-delete-button {
    background-color: #B91C1C !important;
}
.attendance-delete-button:hover {
    background-color: #991B1B !important;
}


/* v2.6 管理者ログイン */
.admin-login-button {
    background-color: #111827 !important;
    color: #fff !important;
}
.admin-login-button:hover {
    background-color: #000 !important;
}
.admin-logout-button {
    background-color: #6B7280 !important;
    color: #fff !important;
}
.admin-logout-button:hover {
    background-color: #4B5563 !important;
}
.admin-login-state {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    font-size: 12px;
    color: #475569;
}
.admin-login-state form {
    margin: 0;
}
.admin-login-container {
    max-width: 760px;
    margin-top: 44px;
}
.admin-login-card {
    max-width: 540px;
    margin: 0 auto;
    padding: 28px 32px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 25px rgba(15, 23, 42, .08);
}
.admin-login-title {
    color: #111827;
    margin-top: 0;
}
.admin-login-card .form-group {
    margin: 18px 0;
}
.admin-login-card input {
    box-sizing: border-box;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #aeb7c2;
    border-radius: 7px;
    font-size: 15px;
}
.admin-login-submit {
    min-width: 120px;
}
.admin-setup-note {
    margin: 12px 0 18px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    color: #475569;
}

/* v2.7 work pattern detail */
.workpattern-detail { max-width: 1000px; }
.work-rule-heading { margin: 30px 0 14px; padding: 8px 12px; border-left: 5px solid #B45309; background: #fff8f0; font-size: 18px; }
.work-rule-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 16px 20px; }
.work-rule-grid .field input, .work-rule-grid .field select, .break-row input { width: 100%; box-sizing: border-box; }
.break-table { display: grid; gap: 10px; }
.break-row { display: grid; grid-template-columns: 140px 150px 28px 150px 1fr; align-items: center; gap: 8px; }
.break-row small { color: #666; }
@media (max-width: 760px) { .work-rule-grid { grid-template-columns: 1fr; } .break-row { grid-template-columns: 110px 1fr 20px 1fr; } .break-row small { grid-column: 2 / -1; } }


/* v3.2.1 ICカード打刻画面 実運用向け表示 */
.attendance-recognized-employee {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    padding-top: 18px;
    margin-top: 18px;
    border-top: 1px solid #e6e8eb;
}

.attendance-recognized-main {
    flex: 1;
    padding: 18px 22px;
    background: #f8fafc;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
}

.attendance-recognized-name {
    display: block;
    font-size: 32px;
    line-height: 1.25;
    margin: 3px 0 7px;
    color: #0f172a;
}

.attendance-recognized-number {
    display: block;
    font-size: 17px;
    color: #475569;
    font-weight: 600;
}

.attendance-recognized-side {
    min-width: 270px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.attendance-recognized-side > div {
    padding: 12px 15px;
    background: #f8fafc;
    border-radius: 8px;
}

.attendance-status-large {
    display: block;
    font-size: 24px !important;
    margin-top: 2px;
}

.attendance-punch-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    max-width: 760px;
    margin: 0 auto;
}

.attendance-punch-button {
    min-height: 128px;
}

.punch-label {
    font-size: 31px;
}

.punch-help {
    font-size: 14px;
}

@media (max-width: 760px) {
    .attendance-recognized-employee {
        flex-direction: column;
    }

    .attendance-recognized-side {
        min-width: 0;
    }

    .attendance-recognized-name {
        font-size: 27px;
    }

    .attendance-punch-grid {
        grid-template-columns: 1fr !important;
    }
}


/* =========================================================
   v3.6.14.3 Employee master LIST only: wide / no horizontal scroll
   Other screens keep their previous width.
   ========================================================= */
body:has(.employee-master-title) .container {
    width: calc(100% - 24px) !important;
    max-width: 1900px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Create/Edit screens use form-container and stay at normal readable width */
body:has(.employee-master-title) .container.form-container,
body:has(.employee-master-title) .form-container {
    max-width: 900px !important;
}

/* Employee list only */
body:has(.employee-master-title) .table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: visible !important;
}

body:has(.employee-master-title) .table-wrap table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: auto;
}

body:has(.employee-master-title) .table-wrap th,
body:has(.employee-master-title) .table-wrap td {
    font-size: 12px;
    padding: 6px 4px;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: middle;
}

body:has(.employee-master-title) .table-wrap .btn {
    font-size: 11px;
    padding: 5px 7px;
    white-space: nowrap;
}

body:has(.employee-master-title) .table-wrap td.actions {
    white-space: nowrap;
    width: 1%;
    min-width: 92px;
}

@media screen and (max-width: 1400px) {
    body:has(.employee-master-title) .container {
        width: calc(100% - 12px) !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    body:has(.employee-master-title) .table-wrap th,
    body:has(.employee-master-title) .table-wrap td {
        font-size: 11px;
        padding: 5px 3px;
    }
}

/* v3.6.16 employee edit navigation */
.employee-edit-header {
    display:grid;
    grid-template-columns: 150px 1fr 150px;
    align-items:center;
    gap:16px;
    margin-bottom:16px;
}
.employee-edit-heading { text-align:center; }
.employee-edit-heading h1 { margin:0; }
.employee-position { margin-top:4px; font-size:13px; color:#64748b; }
.employee-nav-btn { text-align:center; white-space:nowrap; }
.employee-nav-btn.disabled {
    pointer-events:none;
    opacity:.35;
}
.employee-count { text-align:right; white-space:nowrap; font-weight:600; }
@media (max-width: 760px) {
    .employee-edit-header { grid-template-columns: 1fr 1fr; }
    .employee-edit-heading { grid-column:1 / -1; grid-row:1; }
}

/* v3.6.16.1 department count positioning */
.department-master-table {
    width: auto !important;
    min-width: 700px;
    max-width: 820px;
    table-layout: fixed;
}
.department-master-table th,
.department-master-table td {
    text-align: left;
}
.department-master-table .employee-count {
    text-align: left;
    padding-left: 12px;
}

/* v3.6.17.4 社員マスター: 左3列固定 + 右側横スクロール */
body:has(.employee-master-title) .container {
    width: calc(100% - 24px) !important;
    max-width: 1900px !important;
}
.employee-list-scroll {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    position: relative;
    border: 1px solid #d7dee7;
}
.employee-list-table {
    width: max-content !important;
    min-width: 1750px !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}
.employee-list-table th,
.employee-list-table td {
    white-space: nowrap !important;
    font-size: 13px !important;
    padding: 7px 8px !important;
    background: #fff;
}
.employee-list-table thead th {
    background: #f8fafc;
}
.employee-list-table .sticky-col {
    position: sticky;
    z-index: 3;
    background: #fff;
}
.employee-list-table thead .sticky-col {
    z-index: 5;
    background: #f1f5f9;
}
.employee-list-table .sticky-col-1 {
    left: 0;
    width: 82px;
    min-width: 82px;
    max-width: 82px;
}
.employee-list-table .sticky-col-2 {
    left: 82px;
    width: 94px;
    min-width: 94px;
    max-width: 94px;
}
.employee-list-table .sticky-col-3 {
    left: 176px;
    width: 118px;
    min-width: 118px;
    max-width: 118px;
    border-right: 2px solid #94a3b8 !important;
    box-shadow: 5px 0 7px -7px rgba(15,23,42,.7);
}
.employee-list-table tbody tr:hover td {
    background: #f8fafc;
}
.employee-list-table tbody tr:hover .sticky-col {
    background: #f8fafc;
}

/* v3.6.17.5 社員一覧の外枠は他マスターと同じ幅へ戻す。
   表だけ横スクロールし、社員番号・登録日・氏名を固定する。 */
body:has(.employee-master-title) .container {
    width: min(1180px, calc(100% - 40px)) !important;
    max-width: 1180px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}
.employee-list-scroll {
    width: 100% !important;
    overflow-x: auto !important;
}

/* v3.6.17.6 社員マスター: 他マスターと同じ外枠、表だけ確実に横スクロール */
body:has(.employee-master-title) .container {
    width: min(1180px, calc(100% - 40px)) !important;
    max-width: 1180px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}
body:has(.employee-master-title) .employee-list-scroll {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    box-sizing: border-box !important;
}
body:has(.employee-master-title) .employee-list-table {
    width: 1750px !important;
    min-width: 1750px !important;
    max-width: none !important;
    table-layout: fixed !important;
}
.employee-update-details {
    margin: 8px 0 16px;
    padding: 12px 16px;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e3a5f;
    line-height: 1.65;
    font-size: 14px;
}
.validation-summary-errors, .warning-box {
    margin: 8px 0 16px;
    padding: 12px 16px;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    background: #fffbeb;
    color: #92400e;
}

/* v3.6.18 */
.master-toolbar-brand {
    display:flex;
    flex-direction:column;
    justify-content:center;
    min-width:165px;
}
.system-version {
    margin-top:3px;
    font-size:11px;
    font-weight:500;
    color:#64748b;
    letter-spacing:.2px;
}
.employee-list-table .sticky-col-1 {
    left:0 !important;
    width:82px !important;
    min-width:82px !important;
    max-width:82px !important;
}
.employee-list-table .sticky-col-2 {
    left:82px !important;
    width:120px !important;
    min-width:120px !important;
    max-width:120px !important;
    border-right:2px solid #94a3b8 !important;
    box-shadow:5px 0 7px -7px rgba(15,23,42,.7);
}
.employee-list-table .sticky-col-3 {
    position:static !important;
    left:auto !important;
    border-right:0 !important;
    box-shadow:none !important;
}


/* =========================================================
   Version 4.0 - 5-group dropdown navigation
   ========================================================= */
.v4-toolbar-inner {
    max-width: 1580px !important;
    width: calc(100% - 32px) !important;
    padding-left: 28px !important;
    padding-right: 28px !important;
    overflow: visible !important;
}
.v4-menu-area {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 18px !important;
    flex: 1 1 auto !important;
    overflow: visible !important;
}
.v4-menu-groups {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 1 auto;
    overflow: visible;
}
.v4-menu-group {
    position: relative;
    flex: 0 0 auto;
}
.v4-parent-button {
    width: 142px;
    height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #1e293b;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15,23,42,.08);
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.v4-parent-button:hover,
.v4-menu-group.open .v4-parent-button {
    background: #eaf1f8;
    border-color: #94a3b8;
    box-shadow: 0 3px 8px rgba(15,23,42,.12);
}
.v4-chevron {
    display: inline-block;
    margin-left: 7px;
    font-size: 10px;
    transition: transform .15s ease;
}
.v4-menu-group.open .v4-chevron {
    transform: rotate(180deg);
}
.v4-submenu {
    display: none;
    position: absolute;
    z-index: 5000;
    top: calc(100% + 7px);
    left: 0;
    width: 178px;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15,23,42,.20);
}
.v4-menu-group.open .v4-submenu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.v4-child-button {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 7px 11px;
    border-radius: 7px;
    border-left: 5px solid var(--child-color);
    background: #f8fafc;
    color: #1f2937 !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.v4-child-button:hover {
    background: var(--child-color);
    color: #fff !important;
}
.v4-admin-state {
    flex: 0 0 auto;
    margin-left: auto;
}
.v4-direct-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 125px;
    height: 40px;
    padding: 0 14px;
    border-radius: 7px;
    background: #334155;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 700;
}
.v4-login-button {
    background: #2563A6;
}
@media (max-width: 1180px) {
    .v4-parent-button { width: 125px; font-size: 13px; }
    .v4-menu-groups { gap: 6px; }
    .v4-menu-area { gap: 10px !important; }
}


/* v4.2.0.6 社員マスター: 社員番号・氏名・編集/削除を左固定 */
.employee-list-table .sticky-col-actions {
    left: 176px;
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    z-index: 3;
    border-right: 2px solid #94a3b8 !important;
    box-shadow: 5px 0 7px -7px rgba(15,23,42,.7);
}
.employee-list-table thead .sticky-col-actions {
    z-index: 5;
    background: #f1f5f9;
}
.employee-list-table tbody tr:hover .sticky-col-actions {
    background: #f8fafc;
}
.employee-list-table .sticky-col-actions.actions {
    display: flex;
    align-items: center;
    gap: 6px;
    box-sizing: border-box;
}
.employee-list-table .sticky-col-actions .btn {
    padding: 5px 8px;
    font-size: 12px;
}


/* v4.2.0.7 修正: sticky の td 自体を flex にするとテーブル列が崩れるため、
   td は table-cell のまま、内部要素だけ flex にする。 */
.employee-list-table td.sticky-col-actions {
    display: table-cell !important;
    vertical-align: middle !important;
}
.employee-list-table .sticky-actions-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.employee-list-table .sticky-actions-inner form {
    margin: 0;
}


/* v4.2.0.8 社員マスター固定操作列の仕上げ */
.employee-list-table th.sticky-col-actions,
.employee-list-table td.sticky-col-actions {
    left: 176px !important;
    width: 108px !important;
    min-width: 108px !important;
    max-width: 108px !important;
    padding-left: 3px !important;
    padding-right: 3px !important;
    border-left: none !important;
    border-right: 2px solid #94a3b8 !important;
    box-shadow: 5px 0 7px -7px rgba(15,23,42,.7) !important;
}
.employee-list-table th.sticky-col-2,
.employee-list-table td.sticky-col-2 {
    border-right: none !important;
    box-shadow: none !important;
}
.employee-list-table .sticky-actions-inner {
    gap: 3px !important;
    justify-content: flex-start !important;
}
.employee-list-table .sticky-actions-inner .btn {
    padding: 5px 5px !important;
    font-size: 12px !important;
}


/* v4.2.0.9 社員マスター固定領域を1つの連続した固定ペインとして確定
   colgroupで実列幅とsticky leftを一致させ、操作列が途中で動く現象を防止。 */
.employee-list-table col.employee-col-number { width:82px !important; }
.employee-list-table col.employee-col-name { width:94px !important; }
.employee-list-table col.employee-col-actions { width:96px !important; }

.employee-list-table th.sticky-col-1,
.employee-list-table td.sticky-col-1 {
    left:0 !important;
    width:82px !important;
    min-width:82px !important;
    max-width:82px !important;
    border-left:0 !important;
    border-right:0 !important;
    box-shadow:none !important;
}
.employee-list-table th.sticky-col-2,
.employee-list-table td.sticky-col-2 {
    left:82px !important;
    width:94px !important;
    min-width:94px !important;
    max-width:94px !important;
    border-left:0 !important;
    border-right:0 !important;
    box-shadow:none !important;
}
.employee-list-table th.sticky-col-actions,
.employee-list-table td.sticky-col-actions {
    left:176px !important;
    width:96px !important;
    min-width:96px !important;
    max-width:96px !important;
    padding-left:2px !important;
    padding-right:2px !important;
    border-left:0 !important;
    border-right:2px solid #94a3b8 !important;
    box-shadow:4px 0 6px -6px rgba(15,23,42,.65) !important;
}
.employee-list-table .sticky-actions-inner {
    display:flex !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:2px !important;
    margin:0 !important;
    padding:0 !important;
}
.employee-list-table .sticky-actions-inner .btn {
    padding:4px 4px !important;
    margin:0 !important;
    font-size:12px !important;
}
.employee-list-table .sticky-actions-inner form {
    margin:0 !important;
    padding:0 !important;
}
/* 固定3列の内部に縦罫線を作らない。境界線は操作列の右端1本だけ。 */
.employee-list-table .sticky-col + .sticky-col {
    border-left:0 !important;
}


/* v4.2.0.13 社員在籍状態を常時見える独立パネルにする */
.employee-active-panel {
    margin: 22px 0 4px;
    padding: 16px 18px;
    border: 2px solid #2563a6;
    border-radius: 8px;
    background: #f8fbff;
}
.employee-active-title {
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 16px;
    color: #1e3a5f;
}
.employee-active-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}
.employee-active-toggle input[type="checkbox"] {
    width: 22px !important;
    height: 22px !important;
    margin: 0 !important;
    padding: 0 !important;
    appearance: auto !important;
    -webkit-appearance: checkbox !important;
}
.employee-active-help {
    margin-top: 8px;
    color: #475569;
    font-size: 13px;
}


/* V4.2.0.20 GLOBALオリジナル確認ダイアログ */
.global-confirm-overlay[hidden]{display:none!important}
.global-confirm-overlay{
    position:fixed;inset:0;z-index:100000;
    display:flex;align-items:center;justify-content:center;
    padding:24px;background:rgba(15,23,42,.42);
    backdrop-filter:blur(2px);
}
.global-confirm-dialog{
    width:min(520px,calc(100vw - 40px));
    background:#fff;border:1px solid #dbe3ee;border-radius:14px;
    box-shadow:0 24px 70px rgba(15,23,42,.25);
    padding:24px;
}
.global-confirm-header{display:flex;align-items:center;gap:12px;margin-bottom:16px}
.global-confirm-mark{
    width:34px;height:34px;border-radius:50%;display:flex;align-items:center;justify-content:center;
    background:#fff1f2;color:#b91c1c;font-size:20px;font-weight:900;border:1px solid #fecdd3;
}
.global-confirm-title{font-size:20px;font-weight:800;color:#1e3a5f}
.global-confirm-message{
    white-space:pre-line;line-height:1.75;color:#334155;font-size:15px;
    padding:4px 2px 20px;
}
.global-confirm-actions{display:flex;justify-content:flex-end;gap:10px;border-top:1px solid #e5e7eb;padding-top:16px}
.global-confirm-actions .btn{min-width:100px}
.global-confirm-actions .danger{background:#b91c1c;color:#fff;border-color:#b91c1c}
body.global-confirm-open{overflow:hidden}


/* V4.2.0.24 社員マスター ICカード読取 */
.employee-ic-scan-row{
    display:flex;
    align-items:center;
    gap:8px;
}
.employee-ic-scan-row input{
    flex:1 1 auto;
    min-width:0;
}
.employee-ic-scan-button{
    flex:0 0 auto;
    white-space:nowrap;
}
.employee-ic-scan-status{
    min-height:20px;
    margin-top:5px;
    font-size:12px;
    color:#475569;
}
.employee-ic-scan-status.success{color:#047857;font-weight:700}
.employee-ic-scan-status.error{color:#b91c1c;font-weight:700}


/* V4.2.0.29 バックアップ画面 */
.backup-card{display:flex;gap:22px;align-items:flex-start;margin-top:22px;padding:28px;border:1px solid #dbe3ee;border-radius:12px;background:#fff;box-shadow:0 5px 18px rgba(15,23,42,.06)}
.backup-card-icon{flex:0 0 66px;width:66px;height:66px;border-radius:12px;background:#eef2ff;display:flex;align-items:center;justify-content:center;font-size:34px}
.backup-card-body{flex:1;min-width:0}
.backup-card-body h2{margin:0 0 10px;color:#1e3a5f}
.backup-card-body p{line-height:1.7}
.backup-summary{display:flex;justify-content:space-between;align-items:center;max-width:430px;margin:18px 0;padding:12px 16px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px}
.backup-download-button{min-width:220px;font-size:16px}
.backup-note{margin:14px 0 0;color:#64748b;font-size:13px}
.backup-warning{margin-top:18px;padding:16px 18px;border:1px solid #fde68a;border-radius:9px;background:#fffbeb;color:#92400e;line-height:1.7}

/* 4.2.0.50: terminal UI, using the existing slate/blue navigation palette. */
.terminal-panel { margin: 12px 0 16px; padding: 12px 16px; border: 1px solid #d6dde7; border-radius: 12px; background: #f8fafc; }
.terminal-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.terminal-panel-heading h2 { margin: 5px 0 0; font-size: 22px; color: #0f2747; }
.terminal-eyebrow { color: #64748b; font-size: 13px; font-weight: 700; letter-spacing: .08em; }
.terminal-identity { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding-bottom: 20px; }
.terminal-field-label { display: block; margin-bottom: 8px; color: #64748b; font-size: 13px; font-weight: 700; }
.terminal-name { display: block; color: #0f2747; font-size: 24px; line-height: 1.4; overflow-wrap: anywhere; }
.terminal-id { font-family: Consolas, monospace; font-size: 18px; color: #334155; overflow-wrap: anywhere; }
.terminal-status-grid { display: grid; grid-template-columns: 1fr 1.2fr .9fr 1.4fr; gap: 16px; padding: 18px 0; border-top: 1px solid #d6dde7; border-bottom: 1px solid #d6dde7; }
.terminal-status-cell { min-width: 0; font-size: 15px; line-height: 1.5; }
.terminal-state { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; }
.terminal-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(148,163,184,.12); }
.state-waiting { background: #eab308; }
.state-connected { background: #16a34a; }
.state-disconnected { background: #dc2626; }
.state-unknown { background: #94a3b8; }
.terminal-change-form { display: grid; grid-template-columns: 120px minmax(0,1fr); align-items: center; gap: 16px; margin-top: 20px; }
.terminal-change-form label { font-weight: 700; color: #334155; }
.terminal-change-form select { width: 100%; min-width: 0; min-height: 50px; padding: 12px 16px; border: 1px solid #b6c2d2; border-radius: 8px; background: #fff; font: inherit; font-size: 16px; }
.terminal-help { margin: 10px 0 0; font-size: 13px; color: #64748b; line-height: 1.7; }
.terminal-pair-card { max-width: 660px; padding: 36px 40px; }
.terminal-pair-card h1 { margin: 10px 0 16px; color: #0f2747; font-size: 28px; }
.terminal-pair-description { margin-bottom: 28px; line-height: 1.8; }
.terminal-pair-form { display: grid; gap: 24px; }
.terminal-form-field label { display: block; margin-bottom: 10px; color: #334155; font-size: 16px; font-weight: 700; }
.terminal-form-field input { width: 100%; min-width: 0; height: 52px; padding: 12px 14px; border: 1px solid #b6c2d2; border-radius: 8px; font: inherit; font-size: 16px; background: #fff; }
.terminal-key-input { display: flex; gap: 10px; }
.terminal-key-input input { flex: 1; }
.terminal-key-input .btn { flex: 0 0 76px; }
.terminal-register-button.btn.primary { min-height: 54px; width: 100%; background: #2563a6; border-color: #2563a6; font-size: 17px; font-weight: 700; }
.terminal-pair-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-top: 28px; padding-top: 20px; border-top: 1px solid #e2e8f0; font-size: 13px; color: #64748b; }
.terminal-pair-footer a { color: #2563a6; }
.terminal-form-field input:focus-visible, .terminal-change-form select:focus-visible, .terminal-panel .btn:focus-visible, .terminal-pair-card .btn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.terminal-management-header h1 { margin-bottom: 10px; color: #0f2747; }
.terminal-management-register { min-height: 46px; display: inline-flex; align-items: center; white-space: nowrap; }
.terminal-management-note { padding: 16px 18px; margin-bottom: 22px; background: #f8fafc; border: 1px solid #d6dde7; border-radius: 9px; color: #64748b; font-size: 14px; line-height: 1.7; }
.terminal-management-table { min-width: 880px; }
.terminal-management-table td { padding-top: 18px; padding-bottom: 18px; }
.terminal-table-id { display: block; margin-top: 7px; color: #64748b; font: 13px Consolas, monospace; overflow-wrap: anywhere; }
.terminal-enabled-badge { display: inline-block; padding: 5px 10px; border-radius: 6px; font-size: 13px; font-weight: 700; }
.is-enabled { background: #eef7ee; color: #166534; }
.is-disabled { background: #f1f5f9; color: #64748b; }
@media (max-width: 900px) { .terminal-status-grid { grid-template-columns: 1fr 1fr; gap: 20px; } }
@media (max-width: 600px) {
    .terminal-panel { padding: 18px; }
    .terminal-panel-heading { align-items: flex-start; gap: 12px; }
    .terminal-panel-heading .btn { max-width: 145px; }
    .terminal-identity { grid-template-columns: 1fr; gap: 16px; }
    .terminal-name { font-size: 22px; }
    .terminal-change-form { grid-template-columns: 1fr; gap: 10px; }
    .terminal-pair-card { margin: 24px 12px; padding: 26px 22px; }
    .terminal-pair-card h1 { font-size: 25px; }
    .terminal-management-header { flex-direction: column; align-items: stretch; }
    .terminal-management-register { justify-content: center; white-space: normal; }
}

/* Compact clock screen: keep recognition and punch actions above the fold. */
.attendance-container { margin-top: 18px; padding: 20px 24px; }
.attendance-header { gap: 16px; margin-bottom: 12px; }
.attendance-header p { margin: 4px 0 0; font-size: 14px; }
.attendance-clock-box { padding: 8px 16px; }
.terminal-compact-grid { display: grid; grid-template-columns: minmax(160px, 1.3fr) repeat(4, minmax(0, 1fr)); gap: 14px; align-items: center; }
.terminal-compact-grid .terminal-field-label { margin-bottom: 3px; }
.terminal-compact-grid .terminal-name { font-size: 19px; line-height: 1.3; }
.terminal-compact-name { min-width: 0; }
.terminal-details { margin-top: 8px; }
.terminal-details summary { width: fit-content; padding: 5px 0; color: #2563a6; font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; }
.terminal-details summary::-webkit-details-marker { display: none; }
.terminal-details summary:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; border-radius: 3px; }
.terminal-details-arrow { display: inline-block; font-size: 11px; }
.terminal-details[open] .terminal-details-arrow { transform: rotate(180deg); }
.terminal-details-grid { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 14px; border-top: 1px solid #d6dde7; margin-top: 8px; padding-top: 14px; }
.terminal-details-links { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 14px; }
.attendance-selector-card { padding: 14px 16px; }
.attendance-recognized-employee { padding-top: 12px; margin-top: 12px; gap: 14px; }
.attendance-recognized-main { min-width: 0; padding: 10px 16px; }
.attendance-recognized-name { font-size: 30px; margin: 2px 0 4px; overflow-wrap: anywhere; }
.attendance-recognized-side { grid-template-columns: 1fr 1fr; min-width: 310px; align-items: center; }
.attendance-recognized-side > div { padding: 10px 12px; }
.attendance-container .attendance-punch-form { margin: 14px 0; }
.attendance-container .attendance-punch-button { min-height: 110px; }
@media (max-width: 900px) {
    .terminal-compact-grid { grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
    .attendance-recognized-side { min-width: 250px; }
}
@media (max-width: 760px) {
    .attendance-container { margin: 12px; padding: 16px; }
    .attendance-header { align-items: stretch; }
    .attendance-recognized-side { min-width: 0; }
    .attendance-recognized-name { font-size: 27px; }
    .terminal-details-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
    .attendance-container .terminal-panel { padding: 12px; }
    .terminal-compact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .terminal-compact-name { grid-column: 1 / -1; }
    .terminal-details-grid { grid-template-columns: 1fr; }
    .attendance-recognized-side { grid-template-columns: 1fr 1fr; }
}
