:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #202733;
    --muted: #727b89;
    --line: #e4e8ef;
    --line-strong: #d7dce5;

    --navy-950: #101a2d;
    --navy-900: #17243b;
    --navy-800: #203454;
    --primary: #315f98;
    --primary-dark: #244b7a;
    --primary-soft: #eaf2fb;

    --life: #2967b1;
    --life-soft: #e9f2ff;
    --michiko: #771f35;
    --michiko-soft: #f8e9ee;

    --green: #25734d;
    --green-soft: #eaf7ef;
    --amber: #98630b;
    --amber-soft: #fff4d8;
    --red: #a33942;
    --red-soft: #fdecee;
    --purple: #6e4da1;
    --purple-soft: #f1ecfa;
    --gray-soft: #f0f2f5;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow: 0 8px 28px rgba(30, 43, 63, 0.08);
    --shadow-soft: 0 3px 14px rgba(30, 43, 63, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    font-family: "Leelawadee UI", Tahoma, Arial, sans-serif;
    background:
        radial-gradient(circle at 92% 0%, rgba(49, 95, 152, 0.08), transparent 28%),
        var(--bg);
    color: var(--text);
    line-height: 1.5;
}

button,
input,
select {
    font: inherit;
}

button {
    min-height: 40px;
    padding: 9px 16px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #3d73ae);
    color: #fff;
    font-weight: 650;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(49, 95, 152, 0.14);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(49, 95, 152, 0.20);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button.secondary {
    background: #eef1f5;
    color: #4b5563;
    box-shadow: none;
    border: 1px solid #dfe4eb;
}

button.secondary:hover:not(:disabled) {
    background: #e5e9ef;
    box-shadow: none;
}

button:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.deleteEmployee,
.deleteLeave,
.deleteOT {
    background: var(--red-soft) !important;
    color: var(--red) !important;
    border: 1px solid #f2cdd1 !important;
    box-shadow: none !important;
}

input,
select {
    min-height: 40px;
    padding: 8px 11px;
    border: 1px solid #cfd6e0;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input:hover,
select:hover {
    border-color: #aeb9c8;
}

input:focus,
select:focus {
    outline: none;
    border-color: #6e96c5;
    box-shadow: 0 0 0 3px rgba(49, 95, 152, 0.12);
}

input::placeholder {
    color: #a2a9b3;
}

label {
    color: #4f5866;
    font-size: 13px;
    font-weight: 650;
}

hr {
    height: 1px;
    margin: 20px 0;
    border: 0;
    background: var(--line);
}

.app {
    display: flex;
    min-height: 100vh;
}

/* =====================================================
   SIDEBAR
===================================================== */

.sidebar {
    position: sticky;
    top: 0;
    width: 252px;
    height: 100vh;
    flex: 0 0 252px;
    padding: 24px 16px 20px;
    background:
        radial-gradient(circle at 15% 8%, rgba(95, 139, 196, .28), transparent 28%),
        linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
    color: #f7f9fc;
    overflow-y: auto;
    box-shadow: 8px 0 30px rgba(16, 26, 45, 0.10);
    z-index: 5;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 4px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6b9ad0, #345f97);
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: .4px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 7px 16px rgba(0,0,0,.18);
}

.brand-copy {
    min-width: 0;
}

.sidebar h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: .1px;
}

.sidebar p {
    margin: 2px 0 3px;
    color: #b8c3d5;
    font-size: 11px;
    white-space: nowrap;
}

.app-version {
    display: inline-flex;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: #d8e1ee;
    font-size: 10px;
}

.sidebar nav {
    display: grid;
    gap: 7px;
    margin-top: 22px;
}

.sidebar .menu {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 45px;
    padding: 10px 12px;
    text-align: left;
    background: transparent;
    color: #dce4f0;
    border: 1px solid transparent;
    border-radius: 11px;
    box-shadow: none;
    font-weight: 600;
}

.sidebar .menu:hover:not(:disabled) {
    transform: none;
    background: rgba(255, 255, 255, .07);
    border-color: rgba(255, 255, 255, .06);
    box-shadow: none;
}

.sidebar .menu.active {
    background: linear-gradient(90deg, rgba(83, 130, 185, .36), rgba(83, 130, 185, .16));
    color: #fff;
    border-color: rgba(159, 195, 235, .18);
    box-shadow: inset 3px 0 0 #84afe0;
}

.menu-icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    font-size: 16px;
}

/* =====================================================
   CONTENT / PAGE HEADER
===================================================== */

.content {
    flex: 1;
    min-width: 0;
    padding: 34px 38px 48px;
}

.page {
    max-width: 1520px;
    margin: 0 auto;
}

.page-header {
    position: relative;
    margin-bottom: 24px;
    padding-left: 15px;
}

.page-header::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 4px;
    border-radius: 99px;
    background: linear-gradient(180deg, #3e73ae, #8a3750);
}

.page-header h1 {
    margin: 0 0 3px;
    color: #1d2735;
    font-size: 27px;
    line-height: 1.25;
}

.page-header p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

/* =====================================================
   DASHBOARD
===================================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(220px, 310px) minmax(0, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.summary-card,
.workflow-card,
.main-card {
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(222, 227, 235, .95);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 122px;
    padding: 20px;
}

.summary-card-primary {
    color: #fff;
    background:
        radial-gradient(circle at 90% 10%, rgba(255,255,255,.18), transparent 35%),
        linear-gradient(135deg, #315f98, #1f426f);
    border: 0;
    box-shadow: 0 12px 28px rgba(37, 76, 125, .22);
}

.summary-icon {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    border-radius: 15px;
    background: rgba(255,255,255,.15);
    font-size: 23px;
}

.summary-card p {
    margin: 0 0 3px;
    opacity: .84;
    font-size: 12px;
}

.summary-number {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.summary-number h2 {
    margin: 0;
    font-size: 34px;
    line-height: 1;
}

.summary-number span {
    font-size: 13px;
    opacity: .8;
}

.workflow-card {
    padding: 20px 22px;
}

.workflow-title {
    margin-bottom: 12px;
    color: #364252;
    font-size: 13px;
    font-weight: 750;
}

.workflow-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.workflow-steps span {
    padding: 7px 10px;
    border-radius: 999px;
    background: #f0f4f9;
    color: #566579;
    border: 1px solid #e1e7ef;
    font-size: 11px;
    font-weight: 650;
}

/* =====================================================
   CARDS / FORMS
===================================================== */

.main-card {
    position: relative;
    margin-bottom: 22px;
    padding: 22px 24px;
    transition: box-shadow .18s ease, border-color .18s ease;
}

.main-card:hover {
    border-color: #d8dee7;
    box-shadow: var(--shadow);
}

.main-card h2,
.main-card h3 {
    color: #303a49;
}

.main-card h2 {
    margin: 0 0 6px;
    font-size: 18px;
}

.main-card h3 {
    margin-top: 0;
    font-size: 14px;
}

.main-card > p:first-of-type {
    color: var(--muted);
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: center;
}

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

.form-grid label,
.form-section label {
    display: grid;
    gap: 7px;
}

.form-grid label input,
.form-grid label select {
    width: 100%;
}

.form-section {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 16px;
    border: 1px solid #dde4ed;
    border-radius: 12px;
    background: linear-gradient(180deg, #fbfcfe, #f7f9fc);
}

.form-section small {
    grid-column: 1 / -1;
    color: var(--muted);
}

.span-2 {
    grid-column: 1 / -1;
}

.form-actions,
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.card-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 14px;
}

.card-toolbar h2 {
    margin: 0;
}

.bulk-schedule {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 13px 14px;
    margin-bottom: 14px;
    background: linear-gradient(180deg, #f7f9fc, #f2f6fa);
    border: 1px solid #dfe6ef;
    border-radius: 12px;
}

.info-box {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #d8e4f2;
    border-radius: 10px;
    background: var(--primary-soft);
    color: #35587f;
}

.muted {
    color: var(--muted);
}

.warning-text {
    padding: 10px 12px;
    border-radius: 9px;
    background: var(--amber-soft);
    color: #805410;
    border: 1px solid #f1dea7;
}

/* =====================================================
   TABLES
===================================================== */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}

th,
td {
    padding: 10px 11px;
    border: 0;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    text-align: left;
    font-size: 12px;
}

th + th,
td + td {
    border-left: 1px solid #eef1f5;
}

th {
    background: #f6f8fb;
    color: #4a5565;
    font-weight: 750;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:nth-child(even) td {
    background: #fcfdfe;
}

tbody tr:hover td {
    background: #f7faff;
}

td button {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 11px;
}

.worktime-table-wrap {
    max-height: 68vh;
    overflow: auto;
}

.worktime-table {
    min-width: 1320px;
}

.worktime-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #eef3f8;
    box-shadow: inset 0 -1px 0 #dbe2eb;
}

.worktime-table input[type="text"] {
    min-width: 78px;
    background: #fff;
}

.worktime-table .workNote {
    min-width: 165px;
}

.worktime-table td:nth-child(2) {
    white-space: nowrap;
    font-weight: 650;
    color: #515c6d;
}

.worktime-table td:nth-child(9),
.worktime-table td:nth-child(10) {
    min-width: 125px;
}

.result-normal,
.result-late,
.result-bad,
.result-error,
.result-leave,
.result-off {
    font-weight: 700;
}

.result-normal {
    background: var(--green-soft) !important;
    color: var(--green);
}

.result-late {
    background: var(--amber-soft) !important;
    color: var(--amber);
}

.result-bad,
.result-error {
    background: var(--red-soft) !important;
    color: var(--red);
}

.result-leave {
    background: var(--primary-soft) !important;
    color: var(--life);
}

.result-off {
    background: var(--gray-soft) !important;
    color: #6c7480;
}

/* Modern Edge: tint the whole row gently by attendance result */
.worktime-table tbody tr:has(.result-normal) td:first-child {
    box-shadow: inset 3px 0 0 #65a981;
}

.worktime-table tbody tr:has(.result-late) td:first-child {
    box-shadow: inset 3px 0 0 #d5a139;
}

.worktime-table tbody tr:has(.result-bad) td:first-child,
.worktime-table tbody tr:has(.result-error) td:first-child {
    box-shadow: inset 3px 0 0 #d46c73;
}

.worktime-table tbody tr:has(.result-leave) td:first-child {
    box-shadow: inset 3px 0 0 #5f8fc8;
}

.worktime-table tbody tr:has(.result-off) td:first-child {
    box-shadow: inset 3px 0 0 #a0a7b1;
}

/* =====================================================
   COMPANY / STATUS BADGES
===================================================== */

.company-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 750;
    line-height: 1.25;
    white-space: nowrap;
}

.company-badge {
    background: #f0f2f5;
    color: #5e6672;
    border: 1px solid #e0e4e9;
}

.company-life {
    background: var(--life-soft);
    color: var(--life);
    border-color: #cfe0f5;
}

.company-michiko {
    background: var(--michiko-soft);
    color: var(--michiko);
    border-color: #ecd0d8;
}

.status-success {
    background: var(--green-soft);
    color: var(--green);
    border: 1px solid #cfe8d9;
}

.status-danger {
    background: var(--red-soft);
    color: var(--red);
    border: 1px solid #f2ced2;
}

/* =====================================================
   CHECKBOX LISTS / REPORT PICKER
===================================================== */

.employee-check-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px;
}

.employee-check-list label,
.report-employee-option {
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.employee-check-list label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-weight: 500;
}

.employee-check-list label:hover,
.report-employee-option:hover {
    border-color: #b9c9dc;
    background: #f6f9fd;
}

.employee-check-list input[type="checkbox"],
.report-employee-option input[type="checkbox"],
.daySelector {
    accent-color: var(--primary);
}

#reportEmployeePicker {
    margin: 15px 0;
}

.report-picker-group {
    margin-bottom: 13px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f9fbfd;
}

.report-picker-group h4 {
    margin: 0 0 9px;
    color: #4b5667;
}

.report-employee-option {
    display: block;
    margin: 4px 0;
    padding: 8px 9px;
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 500;
}

.report-employee-option input {
    min-height: auto;
    margin-right: 7px;
}

.report-zone-row td {
    background: linear-gradient(90deg, #eaf0f7, #f5f8fb) !important;
    color: #41536a;
    font-weight: 800;
    text-align: left !important;
    letter-spacing: .1px;
}

/* =====================================================
   SETTINGS / LOCK
===================================================== */

#settingsPage .main-card:nth-of-type(1) {
    border-left: 4px solid #8a3750;
}

#settingsPage .main-card:nth-of-type(2) {
    border-left: 4px solid #315f98;
}

#settingsPage .main-card:nth-of-type(3) {
    border-left: 4px solid #b17a25;
}

#workMonthLockNotice {
    padding: 11px 13px;
    margin-bottom: 13px;
    border-radius: 10px;
    background: #f2f3f5;
    color: #5f6671;
    border: 1px solid #dfe3e8;
    font-weight: 700;
}

#workScheduleSection input:disabled,
#workScheduleSection select:disabled {
    background: #e9edf2;
    color: #808793;
    border-color: #d5dbe3;
    box-shadow: none;
    cursor: not-allowed;
}

#workScheduleSection input[type="checkbox"]:disabled {
    opacity: .45;
}

/* =====================================================
   REPORT SCREEN
===================================================== */

#reportPrintArea {
    max-width: none;
    width: 100%;
    background: #fff;
}

.report-header {
    position: relative;
    margin-bottom: 18px;
    padding: 19px 18px 17px;
    text-align: center;
    border-radius: 12px;
    background:
        linear-gradient(90deg, rgba(41,103,177,.08), rgba(119,31,53,.06)),
        #fbfcfe;
    border: 1px solid var(--line);
}

.report-header::before {
    content: "";
    position: absolute;
    left: 18%;
    right: 18%;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, var(--life), var(--michiko));
    border-radius: 999px;
}

.report-header h2,
.report-header h3,
.report-header p {
    margin: 0 0 5px;
}

.report-header h2 {
    color: #27384d;
}

.report-header h3,
.report-header p {
    color: #697485;
}

#reportTable th,
#reportTable td {
    font-size: 10.8px;
    line-height: 1.35;
    text-align: center;
}

#reportTable td:nth-child(2),
#reportTable td:nth-child(3),
#reportTable td:nth-child(4),
#reportTable td:nth-child(14) {
    text-align: left;
}

/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 1050px) {
    .sidebar {
        width: 220px;
        flex-basis: 220px;
    }

    .content {
        padding: 28px 24px 40px;
    }

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

@media (max-width: 820px) {
    .app {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 16px;
    }

    .sidebar-brand {
        padding-bottom: 14px;
    }

    .sidebar nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 14px;
    }

    .content {
        padding: 20px 14px 34px;
    }

    .form-grid,
    .form-section {
        grid-template-columns: 1fr;
    }

    .span-2,
    .form-section small {
        grid-column: auto;
    }

    .card-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .main-card {
        padding: 18px;
    }
}

/* =====================================================
   PRINT / PDF
===================================================== */

@media print {
    @page {
        size: A4 landscape;
        margin: 8mm;
    }

    html,
    body {
        margin: 0;
        padding: 0;
        background: #fff;
    }

    .sidebar,
    #reportControls,
    #reportPage > .page-header {
        display: none !important;
    }

    .content {
        padding: 0 !important;
    }

    .page {
        display: none !important;
    }

    #reportPage {
        display: block !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #reportPrintArea {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    #reportPrintArea .table-wrap {
        overflow: visible !important;
        border: 0 !important;
    }

    .report-header {
        margin-bottom: 10px;
        padding: 0 0 8px;
        border: 0;
        border-radius: 0;
        background: #fff;
    }

    .report-header::before {
        display: none;
    }

    .report-header h2 {
        font-size: 18px;
    }

    .report-header h3 {
        font-size: 14px;
    }

    .report-header p {
        font-size: 10px;
    }

    #reportTable {
        width: 100% !important;
        table-layout: fixed;
        border-collapse: collapse;
    }

    #reportTable th,
    #reportTable td {
        border: 1px solid #000 !important;
        padding: 4px 3px;
        background: #fff !important;
        color: #000 !important;
        font-size: 8.3px;
        line-height: 1.22;
        vertical-align: middle;
        white-space: normal;
        overflow-wrap: break-word;
    }

    .company-badge,
    .status-badge {
        padding: 0;
        border: 0;
        background: transparent !important;
        color: #000 !important;
        font-size: inherit;
        font-weight: inherit;
    }

    #reportTable th:nth-child(1),
    #reportTable td:nth-child(1) { width: 4%; }
    #reportTable th:nth-child(2),
    #reportTable td:nth-child(2) { width: 13%; }
    #reportTable th:nth-child(3),
    #reportTable td:nth-child(3) { width: 7%; }
    #reportTable th:nth-child(4),
    #reportTable td:nth-child(4) { width: 9%; }
    #reportTable th:nth-child(5),
    #reportTable td:nth-child(5) { width: 4%; }
    #reportTable th:nth-child(6),
    #reportTable td:nth-child(6) { width: 6%; }
    #reportTable th:nth-child(7),
    #reportTable td:nth-child(7) { width: 6%; }
    #reportTable th:nth-child(8),
    #reportTable td:nth-child(8) { width: 8%; }
    #reportTable th:nth-child(9),
    #reportTable td:nth-child(9) { width: 6%; }
    #reportTable th:nth-child(10),
    #reportTable td:nth-child(10) { width: 6%; }
    #reportTable th:nth-child(11),
    #reportTable td:nth-child(11) { width: 5%; }
    #reportTable th:nth-child(12),
    #reportTable td:nth-child(12) { width: 10%; }
    #reportTable th:nth-child(13),
    #reportTable td:nth-child(13) { width: 6%; }
    #reportTable th:nth-child(14),
    #reportTable td:nth-child(14) { width: 10%; }

    #reportTable thead {
        display: table-header-group;
    }

    #reportTable tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* =====================================================
   VERSION 1.2 - MULTI COMPANY
===================================================== */

body[data-company="life"] {
    --primary: #373aa6;
    --primary-dark: #292c83;
    --primary-soft: #eef0ff;
    --company-accent: #373aa6;
    --company-accent-soft: #eef0ff;
    --company-accent-rgb: 55, 58, 166;
    --sidebar-top: #292c83;
    --sidebar-bottom: #17194f;
}

body[data-company="michiko"] {
    --primary: #86252d;
    --primary-dark: #681a21;
    --primary-soft: #faecee;
    --company-accent: #86252d;
    --company-accent-soft: #faecee;
    --company-accent-rgb: 134, 37, 45;
    --sidebar-top: #741d25;
    --sidebar-bottom: #451016;
}

body[data-company="life"],
body[data-company="michiko"] {
    background:
        radial-gradient(circle at 92% 0%, rgba(var(--company-accent-rgb), 0.08), transparent 28%),
        var(--bg);
}

body[data-company="life"] .sidebar,
body[data-company="michiko"] .sidebar {
    background:
        radial-gradient(circle at 15% 8%, rgba(255, 255, 255, .13), transparent 28%),
        linear-gradient(180deg, var(--sidebar-top) 0%, var(--sidebar-bottom) 100%);
}

body[data-company="life"] .sidebar .menu.active,
body[data-company="michiko"] .sidebar .menu.active {
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .12);
    box-shadow: inset 3px 0 0 rgba(255,255,255,.78);
}

body[data-company="life"] .page-header::before,
body[data-company="michiko"] .page-header::before {
    background: var(--company-accent);
}

/* Company-specific dashboard summary card */
body[data-company="life"] .summary-card-primary {
    background:
        radial-gradient(circle at 90% 10%, rgba(255,255,255,.18), transparent 35%),
        linear-gradient(135deg, #373aa6, #292c83);
    box-shadow: 0 12px 28px rgba(55, 58, 166, .22);
}

body[data-company="michiko"] .summary-card-primary {
    background:
        radial-gradient(circle at 90% 10%, rgba(255,255,255,.18), transparent 35%),
        linear-gradient(135deg, #86252d, #681a21);
    box-shadow: 0 12px 28px rgba(134, 37, 45, .24);
}

body[data-company="life"] button:not(.secondary):not(.menu):not(.switch-company-button),
body[data-company="michiko"] button:not(.secondary):not(.menu):not(.switch-company-button) {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 3px 10px rgba(var(--company-accent-rgb), .16);
}

body[data-company="life"] input:focus,
body[data-company="life"] select:focus,
body[data-company="michiko"] input:focus,
body[data-company="michiko"] select:focus {
    border-color: var(--company-accent);
    box-shadow: 0 0 0 3px rgba(var(--company-accent-rgb), .12);
}

/* Company gate */
.company-gate {
    min-height: 100vh;
    padding: 54px 24px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 8% 8%, rgba(55,58,166,.12), transparent 28%),
        radial-gradient(circle at 92% 88%, rgba(134,37,45,.11), transparent 30%),
        #f5f6f9;
}

.company-gate-shell {
    width: min(1050px, 100%);
}

.company-gate-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.gate-system-mark {
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    background: #fff;
    color: #21283a;
    font-weight: 850;
    font-size: 21px;
    box-shadow: var(--shadow);
    border: 1px solid #e6e8ee;
}

.company-gate-header .eyebrow {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
    color: #7c8492;
}

.company-gate-header h1 {
    margin: 0 0 6px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.15;
    color: #1e2531;
}

.company-gate-header p:last-child {
    margin: 0;
    color: #737c89;
}

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

.company-choice {
    min-height: 260px;
    padding: 24px;
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    text-align: left;
    background: #fff !important;
    color: #202733 !important;
    border: 1px solid #e2e6ed;
    border-radius: 22px;
    box-shadow: 0 12px 34px rgba(27, 38, 56, .08) !important;
    overflow: hidden;
}

.company-choice:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 18px 44px rgba(27, 38, 56, .13) !important;
}

.company-choice-life:hover {
    border-color: rgba(55,58,166,.38);
}

.company-choice-michiko:hover {
    border-color: rgba(134,37,45,.38);
}

.company-logo-frame {
    width: 150px;
    height: 150px;
    display: grid;
    place-items: center;
    padding: 12px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #eceef2;
    overflow: hidden;
}

.company-logo-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.company-logo-frame-michiko {
    padding: 0;
    background: #86252d;
}

.company-logo-frame-michiko img {
    object-fit: cover;
}

.company-choice-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
}

.company-choice-copy strong {
    font-size: 21px;
    line-height: 1.35;
}

.company-choice-copy small {
    margin-top: 6px;
    color: #808896;
    font-size: 13px;
}

.company-enter {
    margin-top: 26px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 750;
}

.company-choice-life .company-enter { color: #373aa6; }
.company-choice-michiko .company-enter { color: #86252d; }

.company-gate-note {
    margin-top: 20px;
    padding: 12px 16px;
    text-align: center;
    color: #7b8390;
    font-size: 12px;
}

/* Sidebar company identity */
.company-sidebar-brand {
    align-items: flex-start;
}

.sidebar-company-logo {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    display: grid;
    place-items: center;
    padding: 5px;
    border-radius: 13px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 7px 18px rgba(0,0,0,.18);
}

.sidebar-company-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

body[data-company="michiko"] .sidebar-company-logo {
    padding: 0;
    background: #86252d;
}

body[data-company="michiko"] .sidebar-company-logo img {
    object-fit: cover;
}

.sidebar-kicker {
    margin: 0 0 2px !important;
    font-size: 9px !important;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.58) !important;
}

.company-sidebar-brand .brand-copy h2 {
    max-width: 150px;
    font-size: 13px;
    line-height: 1.35;
}

.switch-company-button {
    width: 100%;
    min-height: 38px;
    margin-top: 12px;
    background: rgba(255,255,255,.08) !important;
    color: rgba(255,255,255,.88) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    box-shadow: none !important;
    font-size: 12px;
}

.switch-company-button:hover:not(:disabled) {
    transform: none;
    background: rgba(255,255,255,.14) !important;
    box-shadow: none !important;
}

.company-readonly,
.company-context-chip {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--company-accent-soft, #f1f3f6);
    color: var(--company-accent, #4d5867);
    border: 1px solid rgba(var(--company-accent-rgb, 80, 90, 100), .16);
    font-weight: 700;
    font-size: 12px;
}

.company-readonly {
    width: 100%;
    margin-top: 6px;
}

.company-settings-banner {
    margin-bottom: 18px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-radius: 14px;
    background: var(--company-accent-soft, #f6f7f9);
    border: 1px solid rgba(var(--company-accent-rgb, 80, 90, 100), .14);
}

.company-settings-banner span,
.company-settings-banner small {
    color: var(--muted);
}

.company-settings-banner strong {
    color: var(--company-accent, var(--text));
}

.company-settings-banner small {
    margin-left: auto;
}

.report-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.report-company-logo {
    width: 68px;
    height: 68px;
    object-fit: contain;
    border-radius: 10px;
}

body[data-company="michiko"] .report-company-logo {
    object-fit: cover;
    background: #86252d;
}

@media (max-width: 850px) {
    .company-choice-grid {
        grid-template-columns: 1fr;
    }

    .company-choice {
        grid-template-columns: 120px minmax(0, 1fr);
        min-height: 210px;
    }

    .company-logo-frame {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 560px) {
    .company-gate {
        padding: 28px 14px;
    }

    .company-gate-header {
        align-items: flex-start;
    }

    .gate-system-mark {
        width: 52px;
        height: 52px;
        flex-basis: 52px;
        border-radius: 16px;
    }

    .company-choice {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 18px;
    }

    .company-logo-frame {
        width: 100%;
        height: 140px;
    }
}

@media print {
    .report-company-logo {
        width: 50px !important;
        height: 50px !important;
    }

    .report-header {
        display: flex !important;
        gap: 10px !important;
    }
}

/* =====================================================
   VERSION 2.0 CLOUD / LOGIN / SHARED SCHEDULE
===================================================== */

.access-gate {
    min-height: 100vh;
    padding: 36px 20px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 12% 12%, rgba(49,95,152,.12), transparent 30%),
        radial-gradient(circle at 90% 88%, rgba(119,31,53,.10), transparent 30%),
        #f4f6fa;
}

.access-card {
    width: min(680px, 100%);
    padding: 30px;
    border: 1px solid #e1e6ed;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(30,43,63,.10);
}

.access-mark {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), #3d73ae);
    color: #fff;
    font-size: 20px;
    font-weight: 850;
}

.access-heading .eyebrow {
    margin: 0 0 4px;
    color: #7c8492;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .14em;
}

.access-heading h1 {
    margin: 0 0 6px;
    font-size: clamp(26px, 4vw, 36px);
    line-height: 1.2;
}

.access-heading p:last-child {
    margin: 0;
    color: var(--muted);
}

.access-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    margin-top: 24px;
}

.access-form label {
    display: grid;
    gap: 6px;
}

.access-login-status {
    margin-top: 16px;
    padding: 10px 12px;
    border: 1px solid #e1e6ed;
    border-radius: 10px;
    background: #f8fafc;
    color: #667085;
    font-size: 12px;
}

.access-login-status.is-working {
    color: #7d590d;
    background: var(--amber-soft);
    border-color: #ecdca7;
}

.access-login-status.is-success {
    color: var(--green);
    background: var(--green-soft);
    border-color: #cbe7d6;
}

.access-login-status.is-error {
    color: var(--red);
    background: var(--red-soft);
    border-color: #f0cfd3;
}

.access-note {
    margin: 10px 0 0;
    color: #8a919d;
    font-size: 11px;
}

.sidebar-session {
    margin: 12px 0 6px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 11px;
    background: rgba(255,255,255,.055);
}

.session-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    color: rgba(255,255,255,.70);
    font-size: 10px;
}

.session-row strong {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    font-size: 11px;
}

.cloud-status {
    margin-top: 7px;
    font-size: 10px;
    font-weight: 750;
}

.cloud-status-idle { color: #c4d0df; }
.cloud-status-saving { color: #ffd67a; }
.cloud-status-saved { color: #8fe0af; }
.cloud-status-error { color: #ffadb4; }
.cloud-status-conflict { color: #ffcb83; }

.cloud-last-update {
    margin-top: 3px;
    color: rgba(255,255,255,.48);
    font-size: 9px;
    line-height: 1.35;
}

.session-action {
    width: 100%;
    min-height: 31px;
    margin-top: 7px;
    padding: 5px 8px;
    background: rgba(255,255,255,.07) !important;
    color: rgba(255,255,255,.82) !important;
    border: 1px solid rgba(255,255,255,.10) !important;
    box-shadow: none !important;
    font-size: 10px;
}

.group-schedule-card {
    border-top: 3px solid var(--company-accent, var(--primary));
}

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

.group-panel {
    min-width: 0;
    padding: 14px;
    border: 1px solid #e2e7ee;
    border-radius: 12px;
    background: #f8fafc;
}

.group-panel-title {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 800;
    color: #394452;
}

.compact-actions button {
    min-height: 31px;
    padding: 5px 9px;
    font-size: 10px;
}

.bulk-employee-picker {
    display: grid;
    gap: 8px;
    max-height: 235px;
    margin-top: 10px;
    overflow: auto;
}

.bulk-zone-block {
    padding: 9px;
    border: 1px solid #e5e9ef;
    border-radius: 9px;
    background: #fff;
}

.bulk-zone-title {
    margin-bottom: 6px;
    color: #596575;
    font-size: 10px;
    font-weight: 800;
}

.bulk-employee-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 8px;
}

.bulk-check-label,
.bulk-day-label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 11px;
    font-weight: 550;
    color: #4d5867;
}

.bulk-check-label input,
.bulk-day-label input {
    min-height: 0;
    width: 15px;
    height: 15px;
    padding: 0;
    flex: 0 0 15px;
}

.bulk-check-label span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bulk-day-picker {
    display: grid;
    grid-template-columns: repeat(7, minmax(42px, 1fr));
    gap: 6px;
    margin-top: 10px;
}

.bulk-day-label {
    justify-content: center;
    padding: 7px 4px;
    border: 1px solid #e0e5ec;
    border-radius: 8px;
    background: #fff;
}

.bulk-rule-form {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #dfe6ef;
    border-radius: 12px;
    background: #fff;
}

.bulk-rule-form label {
    display: grid;
    gap: 5px;
}

.bulk-note-field {
    grid-column: 1 / -1;
}

.bulk-group-footer {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-top: 12px;
}

.work-location {
    min-width: 154px;
}

.worktime-table {
    min-width: 1490px;
}

@media (max-width: 900px) {
    .access-form {
        grid-template-columns: 1fr;
    }

    .group-schedule-grid {
        grid-template-columns: 1fr;
    }

    .bulk-rule-form {
        grid-template-columns: 1fr 1fr;
    }

    .bulk-note-field {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .access-card {
        padding: 22px 16px;
    }

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

    .bulk-day-picker {
        grid-template-columns: repeat(4, minmax(46px, 1fr));
    }

    .bulk-rule-form {
        grid-template-columns: 1fr;
    }

    .bulk-note-field {
        grid-column: auto;
    }

    .bulk-group-footer {
        align-items: stretch;
        flex-direction: column;
    }
}

.group-month-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #dfe6ef;
    border-radius: 10px;
    background: var(--surface-soft);
}

.group-month-row label {
    white-space: nowrap;
}

.group-month-row select {
    min-width: 230px;
}

@media (max-width: 560px) {
    .group-month-row {
        align-items: stretch;
        flex-direction: column;
    }
    .group-month-row select {
        min-width: 0;
        width: 100%;
    }
}

.worktime-table td:nth-child(10),
.worktime-table td:nth-child(11) {
    min-width: 125px;
}
