@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+TC:wght@400;500;600;700&display=swap');

:root {
    --primary: #1476ff;
    --deep-blue: #0e47c9;
    --action: #0866e8;
    --teal: #18d5c2;
    --light-blue: #eaf4ff;
    --background: #f7fafc;
    --success: #22c55e;
    --text: #1f2a44;
    --heading: #102956;
    --muted: #64748b;
    --border: #e3edf7;
    --shadow: 0 4px 16px rgb(20 118 255 / 6%);
    font-family: Inter, "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--background);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--deep-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
h1, h2, h3 { color: var(--heading); line-height: 1.4; }
h1 { margin: 0 0 24px; font-size: 32px; font-weight: 700; letter-spacing: -.035em; }
h2 { margin: 32px 0 16px; font-size: 24px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0 0 16px; }
.icon { width: 22px; height: 22px; flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); font-size: 14px; }
.inline { display: inline; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; z-index: 10; top: 12px; left: 12px; padding: 12px 20px; background: #fff; border-radius: 8px; box-shadow: var(--shadow); }

/* Shared navigation and work area. */
.brand { display: flex; gap: 12px; align-items: center; color: var(--heading); }
.brand:hover { text-decoration: none; }
.brand img { display: block; border-radius: 14px; flex-shrink: 0; }
.brand strong { display: block; font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.brand small { display: block; margin-top: 2px; font-size: 9px; font-weight: 500; letter-spacing: .17em; opacity: .7; }
.brand--inverse { color: #fff; padding: 0 4px 28px; }
.brand--inverse img { width: 40px; height: 40px; border-radius: 12px; }
.brand--inverse strong { font-size: 16px; }
.brand--inverse small { font-size: 8px; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 3; width: 240px; display: flex; flex-direction: column; padding: 28px 16px 20px; overflow-y: auto; background: linear-gradient(168deg, #0870ee 0%, #1168ef 38%, #0e47c9 100%); color: #fff; }
.sidebar-label { padding: 0 16px 12px; color: #d5e8ff; font-size: 12px; letter-spacing: .12em; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 48px; color: #fff; border-radius: 10px; font-size: 14px; font-weight: 500; transition: background .15s; }
.nav a:hover { background: rgb(255 255 255 / 12%); text-decoration: none; }
.nav a.is-active { background: #fff; color: var(--deep-blue); font-weight: 700; box-shadow: 0 4px 12px rgb(0 45 144 / 12%); }
.nav a:focus-visible { outline-color: #fff; outline-offset: 2px; }
.nav a.is-active:focus-visible { outline-color: var(--teal); }
.nav .icon { width: 20px; height: 20px; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; padding: 24px 12px 0; margin-top: auto; color: #d5e8ff; font-size: 12px; }
.sidebar-footer .icon { width: 18px; height: 18px; }
.workspace { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { min-height: 80px; padding: 16px 32px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.breadcrumb { display: flex; gap: 12px; align-items: center; font-size: 14px; color: var(--muted); }
.breadcrumb strong { color: var(--text); font-weight: 500; }
.account { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { width: 36px; height: 36px; background: var(--light-blue); color: var(--primary); border-radius: 50%; display: grid; place-items: center; }
.account-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.container { width: 100%; max-width: 1560px; padding: 32px; margin: 0 auto; flex: 1; min-width: 0; }
.workspace-footer { display: flex; justify-content: space-between; gap: 16px; margin: 8px 32px 24px; color: var(--muted); font-size: 12px; }
.workspace-footer span { letter-spacing: .12em; font-size: 10px; }

/* Cards, real metrics, and section headings. */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.card { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-heading h1 { margin-bottom: 4px; }
.page-heading p { margin: 0; }
.page-heading--actions h1 { margin: 0; }
.page-heading--actions > .button { flex-shrink: 0; white-space: nowrap; }
.date-label { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; color: var(--deep-blue); font-size: 14px; border: 1px solid var(--border); border-radius: 8px; white-space: nowrap; }
.date-label .icon { width: 18px; height: 18px; }
.metric-card { display: flex; align-items: center; gap: 18px; }
.metric-icon, .auth-card-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--light-blue); color: var(--primary); flex-shrink: 0; }
.metric-icon .icon { width: 26px; height: 26px; }
.metric-icon--warning { background: #fff3e5; color: #ad5708; }
.metric-icon--danger { background: #fff0f2; color: #cc304c; }
.metric { margin: 2px 0; font-size: 32px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; color: var(--heading); }
.metric small { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.metric-caption { font-size: 12px; color: var(--muted); }
.section-card { margin-top: 24px; padding: 0; overflow: hidden; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; }
.section-heading h2 { font-size: 18px; margin: 0 0 4px; }
.section-heading p { margin: 0; }
.section-heading > a { font-size: 14px; font-weight: 600; white-space: nowrap; }

/* Tables scroll within the content area at narrow widths. */
.table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: #fff; margin: 20px 0; box-shadow: var(--shadow); }
.section-card .table-scroll { border-width: 1px 0 0; border-radius: 0; margin: 0; box-shadow: none; }
table { width: 100%; min-width: 640px; border-collapse: collapse; background: #fff; font-size: 14px; }
th, td { padding: 16px; border-bottom: 1px solid #edf2f8; text-align: left; vertical-align: middle; }
th { background: #eff5fc; color: #455879; font-size: 13px; font-weight: 600; white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f6faff; }
tr.weekend-row td { background: #fff9ee; }
tr.holiday-row td { background: #f0fbf6; }
.empty-state { padding: 40px 24px; text-align: center; color: var(--muted); }
.status-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; color: #08694b; background: #e0f8ee; }
.status-badge:not(:empty)::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-badge:empty { display: none; }
.status-badge--problem { background: #ffe9ee; color: #b62341; }
.status-badge--warning { background: #fff1de; color: #995006; }
.status-badge--info { background: #e5f2ff; color: #0e55bf; }
.status-badge--neutral { background: #eef2f7; color: #52627b; }
.system-event-badge { display: inline-flex; align-items: center; min-height: 24px; margin-left: 6px; padding: 2px 8px; border-radius: 6px; background: #eef4fa; color: #52627b; font-size: 12px; line-height: 1.4; }

/* Form controls and actions. */
label { font-size: 14px; font-weight: 500; }
input, select, textarea { width: 100%; max-width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; background: #fff; border: 1px solid #cddced; border-radius: 8px; color: var(--text); font-size: 16px; line-height: 1.5; }
label > input:not([type="checkbox"]):not([type="hidden"]), label > select, label > textarea { display: block; margin-top: 6px; }
input::placeholder, textarea::placeholder { color: #74859d; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 3px solid rgb(20 118 255 / 13%); outline-offset: 0; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; margin: 0 6px 0 0; accent-color: var(--primary); vertical-align: middle; }
input[type="hidden"] { display: none; }
input.compact, select.compact { width: auto; min-width: 150px; max-width: 100%; }
textarea { resize: vertical; min-height: 96px; }
button, .button { border: 1px solid transparent; border-radius: 8px; background: var(--action); color: #fff; padding: 10px 18px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; justify-content: center; min-height: 44px; font-weight: 600; line-height: 1.4; text-align: center; transition: background .15s, box-shadow .15s; }
button:hover, .button:hover { background: var(--deep-blue); color: #fff; text-decoration: none; }
button:active, .button:active { box-shadow: inset 0 2px 4px rgb(0 0 0 / 12%); }
.button.secondary { color: var(--deep-blue); border-color: #cddff8; background: var(--light-blue); }
.button.secondary:hover { background: #dcecff; border-color: #98bfff; }
button:disabled, .button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.inline button { min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--deep-blue); font-size: inherit; font-weight: 500; }
.inline button:hover { text-decoration: underline; }
.logout-button { background: transparent; color: var(--muted); padding: 8px; font-size: 13px; min-height: 40px; }
.logout-button:hover { background: var(--light-blue); color: var(--deep-blue); }
.logout-button .icon { width: 18px; height: 18px; }
.form-grid { display: flex; gap: 20px 16px; align-items: flex-end; flex-wrap: wrap; }
.form-grid > label { flex: 1 1 220px; min-width: 0; }
.form-grid > .filter-date-field { flex: 0 1 auto; }
.filter-form, .action-panel { margin-bottom: 20px; }
.line-audit-filters { display: grid; gap: 20px; }
.import-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.action-form { display: inline-flex; }
.import-form input[type="file"] { width: auto; max-width: 320px; padding: 6px; font-size: 14px; }
input::file-selector-button { border: 0; border-radius: 4px; color: var(--deep-blue); background: var(--light-blue); padding: 6px 10px; margin-right: 8px; cursor: pointer; }
.filter-actions { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.action-panel .muted { margin-top: 12px; }
.employee-controls { display: flex; flex-direction: column; gap: 16px; padding: 16px 24px; }
.employee-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.employee-import-help { flex: 1 1 260px; font-size: 12px; }
.employee-controls .form-grid { gap: 12px 16px; }
form.card > p:first-of-type { margin-top: 20px; }
.card > p:last-child { margin-bottom: 0; }
.notice, .error { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; border-radius: 10px; margin-bottom: 20px; border: 1px solid #b7ecd4; background: #e9fbf2; color: #146447; font-size: 14px; }
.error { background: #fff0f3; color: #a9203e; border-color: #ffd0da; }
.notice .icon, .error .icon { width: 20px; height: 20px; margin-top: 1px; }
.pagination { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; list-style: none; padding: 0; margin: 24px 0 0; }
.page-link { display: inline-flex; min-width: 40px; min-height: 40px; align-items: center; justify-content: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--deep-blue); font-size: 14px; line-height: 1; }
a.page-link:hover { background: var(--light-blue); text-decoration: none; }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-item.disabled .page-link { color: #738399; background: #eff4f9; cursor: not-allowed; }

/* The same brand identity carries through login and password recovery. */
.guest-page { background: radial-gradient(ellipse at 15% 50%, #e4f4ff 0, transparent 50%), radial-gradient(ellipse at 94% 4%, #e4faf6 0, transparent 38%), var(--background); }
.guest-shell { min-height: 100vh; max-width: 1360px; margin: 0 auto; padding: 32px 56px 24px; display: flex; flex-direction: column; }
.guest-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.guest-header-note { color: var(--muted); font-size: 13px; letter-spacing: .1em; }
.auth-layout { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 96px; width: 100%; padding: 56px 32px 64px; flex: 1; }
.auth-intro { padding: 0 8px; }
.brand-art { position: relative; width: 220px; margin-bottom: 32px; }
.brand-art img { display: block; width: 100%; height: auto; border-radius: 48px; box-shadow: 0 16px 40px rgb(20 118 255 / 16%); }
.eyebrow { color: var(--deep-blue); font-size: 11px; font-weight: 600; letter-spacing: .2em; margin-bottom: 12px; }
.auth-intro h2 { margin: 0 0 20px; font-size: clamp(32px, 3.5vw, 44px); line-height: 1.45; letter-spacing: -.035em; }
.intro-description { font-size: 16px; line-height: 1.9; color: #536985; margin-bottom: 28px; }
.feature-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.feature-chips span { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: #315b93; }
.feature-chips .icon { width: 16px; height: 16px; color: var(--primary); }
.auth-content { width: 100%; max-width: 440px; justify-self: end; }
.auth-card { padding: 36px; border-radius: 20px; box-shadow: 0 12px 48px rgb(20 70 130 / 7%); }
.auth-card-icon { margin-bottom: 24px; }
.auth-card h1 { margin-bottom: 8px; font-size: 28px; }
.auth-description { color: var(--muted); font-size: 14px; margin-bottom: 32px; line-height: 1.8; }
.auth-form > label { display: block; margin: 20px 0 8px; }
.input-with-icon { position: relative; }
.input-with-icon > .icon { position: absolute; left: 14px; top: 15px; width: 18px; height: 18px; color: #7d96b7; pointer-events: none; }
.input-with-icon input { padding: 12px 12px 12px 42px; min-height: 48px; }
.auth-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 28px; font-size: 13px; }
.checkbox-label { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; color: #536985; cursor: pointer; }
.auth-submit { width: 100%; min-height: 48px; background: linear-gradient(110deg, var(--action), #0862ed); box-shadow: 0 4px 12px rgb(20 118 255 / 16%); }
.auth-submit:hover { background: var(--deep-blue); }
.auth-form > .auth-submit { margin-top: 24px; }
.auth-options + .auth-submit { margin-top: 0; }
.auth-submit .icon { width: 18px; height: 18px; }
.auth-card-footer { border-top: 1px solid var(--border); margin: 28px 0 0; padding-top: 20px; text-align: center; color: var(--muted); font-size: 12px; }
.auth-card-footer .icon { width: 15px; height: 15px; margin-right: 4px; color: #129b91; }
.auth-back { display: block; margin-top: 24px; text-align: center; font-size: 14px; }
.guest-footer { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 12px; }

@media (min-width: 1600px) {
    .container { padding: 40px; }
}
@media (max-width: 1100px) {
    .sidebar { width: 216px; padding-left: 12px; padding-right: 12px; }
    .brand--inverse { gap: 8px; }
    .brand--inverse strong { font-size: 14px; }
    .workspace { margin-left: 216px; }
    .container, .topbar { padding: 24px; }
    .metric-card { gap: 12px; padding: 20px; }
    .metric-icon { width: 44px; height: 44px; border-radius: 12px; }
    .guest-shell { padding: 28px 40px 24px; }
    .auth-layout { gap: 48px; padding-left: 0; padding-right: 0; }
    .auth-card { padding: 28px; }
}
@media (max-width: 800px) {
    .sidebar { position: static; width: 100%; padding: 16px 20px 12px; overflow: visible; }
    .brand--inverse { padding: 0 0 16px; gap: 10px; }
    .brand--inverse strong { font-size: 16px; }
    .sidebar-label, .sidebar-footer { display: none; }
    .nav { flex-direction: row; overflow-x: auto; padding: 2px 2px 8px; gap: 6px; scrollbar-width: thin; scrollbar-color: #8ec3ff transparent; }
    .nav a { flex-shrink: 0; gap: 8px; padding: 10px 14px; min-height: 44px; }
    .nav .icon { width: 18px; height: 18px; }
    .workspace { margin-left: 0; min-height: calc(100vh - 140px); }
    .topbar { min-height: 64px; padding: 12px 20px; }
    .container { padding: 24px 20px; }
    .workspace-footer { margin-left: 20px; margin-right: 20px; }
    .guest-shell { padding: 24px; }
    .auth-layout { gap: 28px; }
    .brand-art { width: 170px; }
    .auth-intro { padding: 0; }
    .feature-chips { flex-direction: column; gap: 8px; }
    .auth-card { padding: 24px; }
}
@media (max-width: 600px) {
    h1 { font-size: 26px; }
    h2 { font-size: 20px; }
    .breadcrumb > span { display: none; }
    .account { gap: 8px; }
    .account-name { max-width: 100px; }
    .avatar { width: 30px; height: 30px; }
    .logout-button .icon { display: none; }
    .grid { grid-template-columns: 1fr; gap: 12px; }
    .metric-card { padding: 18px 20px; }
    .metric-caption { display: inline; }
    .metric { display: inline-block; margin-right: 12px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .page-heading--actions { align-items: center; flex-direction: row; gap: 12px; }
    .date-label { font-size: 12px; }
    .card { padding: 20px; }
    .employee-controls { padding: 16px; }
    .section-card { padding: 0; }
    .section-heading { padding: 16px; align-items: flex-start; }
    .section-heading h2 { font-size: 16px; }
    .section-heading > a { font-size: 12px; }
    .form-grid > label, .form-grid > .filter-date-field { flex: 1 1 100%; }
    .filter-date-field input { width: 100%; }
    .filter-actions { width: 100%; }
    .filter-actions > button, .filter-actions > .button { flex: 1 1 auto; }
    .import-form, .import-form input[type="file"] { width: 100%; max-width: 100%; }
    th, td { padding: 14px 12px; }
    .workspace-footer span { display: none; }
    .guest-header .brand img { width: 40px; height: 40px; border-radius: 12px; }
    .guest-header .brand strong { font-size: 16px; }
    .guest-header-note { display: none; }
    .auth-layout { grid-template-columns: 1fr; padding: 32px 0; gap: 24px; }
    .auth-intro { text-align: center; }
    .brand-art { display: none; }
    .eyebrow { font-size: 10px; margin-bottom: 8px; }
    .auth-intro h2 { font-size: 26px; margin: 0; }
    .auth-intro h2 br { display: none; }
    .intro-description, .feature-chips { display: none; }
    .auth-content { justify-self: center; }
    .auth-card { padding: 28px 24px; }
    .auth-card h1 { font-size: 26px; }
    .auth-card-icon { width: 44px; height: 44px; margin-bottom: 16px; border-radius: 12px; }
    .auth-description { margin-bottom: 24px; }
    .guest-footer { justify-content: center; font-size: 11px; }
    .guest-footer > span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
