:root {
  --navy: #102a43;
  --navy-2: #183b56;
  --cream: #f4f1ea;
  --paper: #fffdf8;
  --gold: #f4b860;
  --gold-soft: #fff0d5;
  --green: #17866b;
  --green-soft: #e5f5ef;
  --orange: #d86f3d;
  --orange-soft: #fff0e7;
  --red: #b74242;
  --ink: #172b3a;
  --muted: #6b7c88;
  --line: #e5e0d6;
  --shadow: 0 18px 45px rgba(16, 42, 67, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
html { background: var(--cream); color: var(--ink); font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% -10%, rgba(244,184,96,.20), transparent 34%), var(--cream); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.topbar { height: 80px; padding: 0 max(24px, calc((100vw - 1240px)/2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(16,42,67,.09); background: rgba(244,241,234,.88); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; gap: 11px; align-items: center; text-decoration: none; color: var(--navy); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: var(--navy); background: var(--gold); border-radius: 13px; font: 800 21px/1 serif; }
.header-logo { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; background: white; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: .12em; }
.brand small { color: var(--muted); font-size: 10px; margin-top: 1px; letter-spacing: .18em; }
.role-switch { display: flex; padding: 4px; border-radius: 13px; background: rgba(16,42,67,.08); }
.role-switch button { border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 700; }
.role-switch button.active { color: white; background: var(--navy); box-shadow: 0 5px 12px rgba(16,42,67,.2); }
.role-switch .logout-button { color: var(--red); }
.auth-screen { min-height: 100vh; padding: 30px 18px; display: grid; place-items: center; background: radial-gradient(circle at 75% 0, rgba(244,184,96,.26), transparent 38%), var(--cream); }
.auth-card { width: min(100%, 430px); padding: 30px; border: 1px solid rgba(16,42,67,.08); border-radius: 25px; background: var(--paper); box-shadow: 0 28px 70px rgba(16,42,67,.14); }
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 27px; }
.auth-logo { width: 86px; height: 78px; object-fit: contain; }
.auth-brand strong, .auth-brand small { display: block; }
.auth-brand strong { color: var(--navy); font: 700 20px/1.2 Georgia, "Songti SC", serif; }
.auth-brand small { color: var(--muted); font-size: 10px; margin-top: 4px; letter-spacing: .12em; }
.auth-card h1 { margin: 0 0 8px; color: var(--navy); font: 700 27px/1.2 Georgia, "Songti SC", serif; }
.auth-card > div > p, .auth-loading { color: var(--muted); font-size: 12px; line-height: 1.65; }
.auth-form { display: grid; gap: 13px; margin-top: 20px; }
.auth-error { padding: 10px; border-radius: 10px; color: var(--red); background: #fdecec; font-size: 11px; }
main { max-width: 1240px; margin: 0 auto; padding: 42px 24px 80px; }
.view { display: none; animation: enter .35s ease both; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } }

.hero-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 22px; }
.hero-card { min-height: 390px; position: relative; overflow: hidden; padding: 34px; border-radius: 28px; color: white; background: var(--navy); box-shadow: 0 22px 55px rgba(16,42,67,.18); }
.hero-card::after { content: ""; position: absolute; width: 290px; height: 290px; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; top: -110px; right: -70px; box-shadow: 0 0 0 45px rgba(255,255,255,.025), 0 0 0 90px rgba(255,255,255,.018); }
.eyebrow, .kicker { text-transform: uppercase; letter-spacing: .13em; font-size: 11px; font-weight: 800; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: #c9d5df; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #65d6a9; box-shadow: 0 0 0 5px rgba(101,214,169,.1); }
.hero-card h1 { margin: 26px 0 5px; font: 700 31px/1.25 Georgia, "Songti SC", serif; }
.hero-card > p { margin: 0; color: #b8c6d1; font-size: 14px; }
.clock { margin: 25px 0 21px; font: 600 48px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .035em; font-variant-numeric: tabular-nums; }
.primary-action { width: min(100%, 440px); border: 0; color: var(--navy); background: var(--gold); padding: 15px 18px; border-radius: 16px; display: flex; align-items: center; justify-content: center; gap: 12px; box-shadow: 0 12px 30px rgba(244,184,96,.20); transition: transform .18s, box-shadow .18s; }
.primary-action:hover { transform: translateY(-2px); box-shadow: 0 15px 35px rgba(244,184,96,.28); }
.primary-action:disabled { opacity: .58; cursor: not-allowed; transform: none; }
.primary-action strong, .primary-action small { display: block; text-align: left; }
.primary-action strong { font-size: 16px; }
.primary-action small { font-size: 10px; opacity: .75; margin-top: 2px; }
.action-icon { font-size: 27px; transform: rotate(-15deg); }
.trust-row { display: flex; gap: 8px; margin-top: 15px; flex-wrap: wrap; }
.status-pill, .badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 6px 10px; }
.status-pill { color: #c7f5e3; background: rgba(101,214,169,.12); }
.status-pill.muted { color: #c1ccd5; background: rgba(255,255,255,.08); }
.status-pill.blocked { color: #ffd1ca; background: rgba(255,105,85,.14); }

.card { background: rgba(255,253,248,.94); border: 1px solid rgba(16,42,67,.07); border-radius: var(--radius); box-shadow: var(--shadow); padding: 25px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.section-heading h2 { margin: 4px 0 0; color: var(--navy); font: 700 21px/1.2 Georgia, "Songti SC", serif; }
.kicker { color: #8a7a61; }
.badge { padding: 5px 9px; }
.badge.neutral { background: #edf0f2; color: #687985; }
.badge.good { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--orange-soft); color: var(--orange); }
.day-card { display: flex; flex-direction: column; }
.timeline { flex: 1; display: grid; align-content: center; gap: 0; min-height: 270px; }
.timeline-item { display: grid; grid-template-columns: 31px 1fr auto; gap: 10px; min-height: 65px; position: relative; }
.timeline-item:not(:last-child)::after { content: ""; width: 1px; background: var(--line); position: absolute; left: 14px; top: 28px; bottom: -2px; }
.timeline-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; background: #edf0f2; color: #84909a; font-size: 11px; z-index: 1; }
.timeline-item.done .timeline-icon { color: white; background: var(--green); }
.timeline-main strong, .timeline-main small { display: block; }
.timeline-main strong { color: var(--navy); font-size: 13px; margin-top: 3px; }
.timeline-main small, .timeline-time small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.timeline-time { text-align: right; font: 700 14px/1.2 ui-monospace, monospace; color: var(--navy); padding-top: 4px; }
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.stats-grid { display: grid; }
.employee-stats { grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.stat { min-height: 103px; padding: 17px; background: var(--paper); border-right: 1px solid var(--line); }
.stat:last-child { border: 0; }
.stat span, .stat small { display: block; color: var(--muted); font-size: 11px; }
.stat strong { display: inline-block; color: var(--navy); font: 700 30px/1.2 Georgia, serif; margin: 9px 3px 0 0; }
.stat.warning strong { color: var(--orange); }
.stat.soft { background: #faf8f2; }
.text-button, .small-primary, .secondary-button, .primary-button { border-radius: 11px; font-size: 12px; font-weight: 750; padding: 9px 13px; }
.text-button { border: 0; color: var(--navy); background: transparent; }
.small-primary, .primary-button { border: 0; color: white; background: var(--navy); }
.secondary-button { border: 1px solid #d4d9dc; color: var(--navy); background: white; }
.leave-list, .approval-list { display: grid; gap: 10px; }
.security-card, .early-leave-card { grid-column: 1 / -1; }
.security-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.security-item { display: grid; grid-template-columns: 43px 1fr auto; gap: 12px; align-items: center; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #fbfaf6; }
.security-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; color: var(--navy); background: var(--gold-soft); font-size: 21px; font-weight: 800; }
.security-item strong { color: var(--navy); font-size: 13px; }
.security-item p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.benefit-intro { margin: -8px 0 16px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.location-cell { display: flex; align-items: center; gap: 7px; }
.map-link { color: var(--navy); font-size: 10px; font-weight: 750; text-decoration: none; border-bottom: 1px solid #aeb9c1; }
.location-summary { padding: 13px; border-radius: 13px; background: var(--green-soft); color: var(--green); font-size: 11px; line-height: 1.55; }
.location-summary.unset { color: var(--orange); background: var(--orange-soft); }
.leave-item { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; }
.leave-date { text-align: center; padding: 6px 4px; border-radius: 9px; color: var(--navy); background: var(--cream); font-weight: 800; font-size: 14px; }
.leave-date small { display: block; font-size: 8px; color: var(--muted); margin-top: 2px; }
.leave-copy strong, .leave-copy small { display: block; }
.leave-copy strong { font-size: 12px; color: var(--navy); }
.leave-copy small { color: var(--muted); font-size: 10px; margin-top: 3px; }

.admin-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.admin-heading h1 { margin: 7px 0; color: var(--navy); font: 700 34px/1.15 Georgia, "Songti SC", serif; }
.admin-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.admin-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.notification-enabled { color: var(--green) !important; border-color: rgba(25,137,104,.35) !important; background: var(--green-soft) !important; }
.admin-stats { grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 22px; }
#office-summary { margin: -12px 0 20px; }
.metric { padding: 21px; border: 1px solid rgba(16,42,67,.07); border-radius: 17px; background: rgba(255,253,248,.8); }
.metric span, .metric small { display: block; color: var(--muted); font-size: 11px; }
.metric strong { display: block; color: var(--navy); font: 700 32px/1.2 Georgia, serif; margin: 7px 0 2px; }
.metric strong.green { color: var(--green); }.metric strong.orange { color: var(--orange); }.metric strong.navy { color: var(--navy); }
.admin-grid { display: grid; grid-template-columns: 1.55fr .75fr; gap: 22px; }
.search-wrap input, .month-select input { border: 1px solid var(--line); background: #faf9f5; border-radius: 10px; padding: 9px 11px; color: var(--ink); outline: none; font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; padding: 11px 10px; color: var(--muted); background: #f7f5ef; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
th:first-child { border-radius: 9px 0 0 9px; } th:last-child { border-radius: 0 9px 9px 0; }
td { padding: 14px 10px; border-bottom: 1px solid var(--line); color: #526572; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.person { display: flex; align-items: center; gap: 9px; color: var(--navy); font-weight: 700; }
.employee-link { padding: 0; border: 0; background: none; color: var(--navy); font: inherit; text-decoration: underline; text-decoration-color: rgba(16,42,67,.25); text-underline-offset: 3px; cursor: pointer; }
.employee-link:hover { color: var(--green); text-decoration-color: currentColor; }
.avatar { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--gold-soft); color: #9a6419; font-size: 11px; font-weight: 800; }
.approval { padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.approval-top { display: flex; justify-content: space-between; gap: 8px; }
.approval strong { color: var(--navy); font-size: 13px; }
.approval p { color: var(--muted); font-size: 11px; line-height: 1.55; margin: 10px 0 12px; }
.approval-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.approval-actions button { padding: 8px; border-radius: 9px; font-size: 11px; font-weight: 700; }
.approve { border: 0; color: white; background: var(--green); }
.reject { border: 1px solid var(--line); color: var(--red); background: white; }
.empty-state { padding: 30px 10px; text-align: center; color: var(--muted); font-size: 12px; }
.monthly-card { margin-top: 22px; }
.month-select { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }

.modal { display: none; position: fixed; inset: 0; z-index: 100; padding: 20px; align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8,25,39,.58); backdrop-filter: blur(4px); }
.modal-panel { position: relative; width: min(100%, 500px); max-height: calc(100vh - 40px); overflow-y: auto; padding: 28px; border-radius: 22px; background: var(--paper); box-shadow: 0 30px 80px rgba(0,0,0,.25); animation: modalIn .25s ease both; }
.modal-panel.detail-panel { width: min(100%, 860px); }
@keyframes modalIn { from { opacity:0; transform: translateY(12px) scale(.98); } }
.modal-close { position: absolute; right: 16px; top: 14px; width: 31px; height: 31px; border: 0; border-radius: 50%; background: #f0eee8; color: var(--muted); font-size: 20px; }
.modal h2 { margin: 4px 35px 7px 0; color: var(--navy); font: 700 24px/1.2 Georgia, "Songti SC", serif; }
.modal-intro { margin: 0 0 20px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.employee-detail-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.employee-detail-heading button { margin: -8px 0 14px; }
.personal-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.personal-stats article { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fbfaf6; }
.personal-stats span { display: block; color: var(--muted); font-size: 10px; }
.personal-stats strong { display: block; margin-top: 6px; color: var(--navy); font: 700 27px/1.1 Georgia, serif; }
.personal-stats strong.green { color: var(--green); }
.personal-stats strong.orange { color: var(--orange); }
.delete-note { padding: 10px 12px; border-radius: 10px; background: var(--orange-soft); color: var(--orange); font-size: 10px; line-height: 1.5; }
.attendance-days { display: grid; gap: 12px; margin-top: 14px; }
.attendance-day { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.attendance-day-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); color: var(--navy); }
.personal-record { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.personal-record:last-child { padding-bottom: 0; border-bottom: 0; }
.personal-record strong, .personal-record span { display: block; }
.personal-record strong { color: var(--navy); font-size: 12px; }
.personal-record span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.record-actions { display: flex; align-items: center; gap: 8px; }
.danger-button { padding: 7px 10px; border: 1px solid #efc3bd; border-radius: 8px; background: white; color: var(--red); font-size: 10px; font-weight: 700; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--navy); font-size: 11px; font-weight: 750; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: #fbfaf6; padding: 11px; color: var(--ink); outline: none; }
.field textarea { resize: vertical; min-height: 82px; }
.form-submit { width: 100%; border: 0; border-radius: 12px; color: white; background: var(--navy); padding: 12px; font-weight: 750; margin-top: 17px; }
.capture-box { aspect-ratio: 4/3; overflow: hidden; position: relative; display: grid; place-items: center; border-radius: 16px; background: #112333; color: white; }
.capture-box video, .capture-box canvas { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.capture-guide { pointer-events: none; position: absolute; width: 45%; aspect-ratio: .76; border: 2px dashed rgba(255,255,255,.75); border-radius: 50%; }
.capture-note { margin: 10px 0; text-align: center; color: var(--muted); font-size: 11px; }
.verification-result { margin: 11px 0; padding: 11px; border-radius: 11px; color: var(--green); background: var(--green-soft); font-size: 11px; line-height: 1.5; }
.computer-proof-step { margin-top: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfaf6; }
.computer-proof-step h3 { margin: 0 0 5px; color: var(--navy); font-size: 13px; }
.computer-proof-step p { margin: 0 0 10px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.photo-input { display: block; width: 100%; padding: 10px; border: 1px dashed #b8c1c8; border-radius: 10px; background: white; font-size: 11px; }
.proof-preview { width: 100%; max-height: 210px; object-fit: contain; margin-top: 10px; border-radius: 10px; background: var(--navy); }
.proof-button { border: 0; color: var(--navy); background: var(--gold); border-radius: 10px; padding: 8px 10px; font-size: 10px; font-weight: 750; }
.proof-image { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 14px; background: var(--navy); }
.capture-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.capture-actions button { padding: 10px; border-radius: 11px; font-size: 12px; font-weight: 750; }
.capture-primary { border: 0; color: var(--navy); background: var(--gold); }
.capture-secondary { border: 1px solid var(--line); color: var(--navy); background: white; }
.location-confirm { padding: 12px; margin: 12px 0; border-radius: 12px; color: var(--green); background: var(--green-soft); font-size: 11px; line-height: 1.55; }
.toast { position: fixed; left: 50%; bottom: 25px; z-index: 200; transform: translate(-50%, 20px); padding: 11px 17px; border-radius: 12px; color: white; background: var(--navy); box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .hero-grid, .content-grid, .admin-grid { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .day-card { min-height: 350px; }
}
@media (max-width: 600px) {
  .topbar { height: 68px; padding: 0 15px; }
  .brand small { display: none; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .role-switch button { padding: 7px 9px; font-size: 11px; }
  main { padding: 20px 14px 88px; }
  .hero-card { padding: 25px 20px; min-height: 370px; border-radius: 22px; }
  .hero-card h1 { font-size: 26px; margin-top: 24px; }
  .clock { font-size: 40px; margin-top: 27px; }
  .card { padding: 19px 16px; }
  .employee-stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .admin-heading { align-items: flex-start; flex-direction: column; }
  .admin-heading h1 { font-size: 29px; }
  .admin-actions { width: 100%; }
  .admin-actions button { flex: 1; }
  .admin-stats { gap: 9px; }
  .metric { padding: 16px; }
  .metric strong { font-size: 27px; }
  .form-grid { grid-template-columns: 1fr; }
  .security-grid { grid-template-columns: 1fr; }
  .security-item { grid-template-columns: 40px 1fr; }
  .security-item > :last-child { grid-column: 2; justify-self: start; }
  .field.full { grid-column: auto; }
  .modal { padding: 10px; align-items: flex-end; }
  .modal-panel { width: 100%; max-height: 92vh; border-radius: 22px 22px 12px 12px; }
  .employee-detail-heading { display: block; }
  .employee-detail-heading .month-select { margin: 10px 0 0; }
  .personal-stats { grid-template-columns: 1fr 1fr; }
  .personal-record { align-items: flex-start; flex-direction: column; }
  .record-actions { width: 100%; justify-content: flex-end; }
}
