:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --navy: #142b3a;
  --navy-deep: #102432;
  --sidebar-text: #d0dce3;
  --background: #f4f7f9;
  --surface: #fff;
  --text: #1b3040;
  --subtle: #576d7b;
  --border: #dbe4e9;
  --teal: #126e61;
  --teal-dark: #0a5147;
  --teal-tint: #e2f3ef;
  --focus: #188476;
  --danger: #9d3236;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; color: var(--text); background: var(--background); font-size: 15px; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { touch-action: manipulation; }
h1, h2, h3, p, dl, dd { margin: 0; }
button { cursor: pointer; }
button:disabled { opacity: .58; cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.subtle { color: var(--subtle); font-size: .88rem; line-height: 1.55; }
.skip-link { position: absolute; left: 12px; top: 12px; z-index: 10; display: block; color: var(--navy); background: #fff; padding: 10px 14px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.brand { display: flex; align-items: center; gap: 12px; color: #f3fafc; font-size: 1.08rem; font-weight: 780; white-space: nowrap; }
.brand-mark {
  display: inline-block;
  position: relative;
  flex: 0 0 31px;
  height: 31px;
  border: 2px solid #88dfce;
  border-radius: 50%;
}
.brand-mark::before, .brand-mark::after {
  position: absolute;
  top: 50%;
  left: 50%;
  content: "";
  width: 2px;
  height: 8px;
  background: #88dfce;
  border-radius: 2px;
  transform: translate(-50%, -100%);
  transform-origin: 50% 100%;
}
.brand-mark::after { height: 8px; transform: translate(-50%, -100%) rotate(119deg); }

.panel { padding: 23px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 15px; }
.panel h2 { font-size: 1.05rem; line-height: 1.35; }
.stack { display: grid; gap: 15px; }
.field { display: grid; min-width: 0; gap: 6px; color: var(--text); font-size: .86rem; font-weight: 650; }
input, select, textarea {
  width: 100%;
  max-width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid #cbd8e0;
  background: #fff;
  color: var(--text);
  border-radius: 7px;
  font-weight: 400;
}
textarea { min-height: 72px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #627784; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 41px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: .85rem;
  line-height: 1.3;
  font-weight: 730;
  white-space: nowrap;
}
.button.primary { background: var(--teal); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--teal-dark); }
.button.secondary { border-color: #a9c8c3; color: var(--teal-dark); }
.button.secondary:hover:not(:disabled) { background: var(--teal-tint); }
.button.quiet { background: transparent; color: var(--subtle); }
.button.quiet:hover:not(:disabled) { background: #eaf0f4; color: var(--text); }
.button.danger { border-color: #e7b8ba; color: var(--danger); }
.button.danger:hover:not(:disabled) { background: #fcebec; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 8px; white-space: nowrap; color: #254153; background: #edf2f6; font-size: .76rem; font-weight: 750; }
.status-pill.active, .status-pill.approved { color: var(--teal-dark); background: var(--teal-tint); }
.status-pill.pending { color: #74510d; background: #fbf0d7; }
.status-pill.rejected { color: #833036; background: #f9e5e7; }
.form-error { color: var(--danger); background: #fbebe9; border: 1px solid #ecc6c4; border-radius: 7px; padding: 9px 11px; line-height: 1.5; font-size: .86rem; overflow-wrap: anywhere; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(235px, 280px) minmax(280px, 370px);
  justify-content: center;
  align-content: center;
  gap: 0;
  padding: 22px;
  background: radial-gradient(ellipse at 36% 20%, #e1f0ee 0%, transparent 49%), var(--background);
}
.auth-brand { position: relative; isolation: isolate; overflow: hidden; padding: 35px 27px; background: linear-gradient(155deg, #184457, var(--navy-deep)); border-radius: 15px 0 0 15px; color: var(--sidebar-text); }
.auth-brand::after {
  position: absolute;
  z-index: -1;
  right: -68px;
  bottom: -78px;
  content: "";
  width: 276px;
  height: 276px;
  border-radius: 50%;
  border: 1px solid #75c7c15c;
  box-shadow: 0 0 0 25px #5fadab14, 0 0 0 51px #5fadab10, 0 0 0 77px #5fadab09;
}
.auth-brand p { margin-top: 21px; font-size: .9rem; line-height: 1.55; color: #c2d9dc; }
.auth-panel { padding: 33px; border-radius: 0 15px 15px 0; box-shadow: 0 20px 50px #17394310; }
.auth-panel h1 { margin-bottom: 7px; font-size: clamp(1.45rem, 3vw, 1.9rem); letter-spacing: -.03em; }
.auth-panel .stack { margin-top: 22px; }
.auth-panel .form-error { margin-top: 14px; }

.dashboard { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  height: 100vh;
  max-height: 100vh;
  overflow: auto;
  background: linear-gradient(153deg, var(--navy), var(--navy-deep));
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 26px 15px 16px;
}
.sidebar .brand { margin: 0 8px 36px; }
.main-nav { display: grid; gap: 5px; }
.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 43px;
  padding: 10px 11px;
  color: var(--sidebar-text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 660;
  text-align: left;
  white-space: nowrap;
}
.nav-button[aria-current="page"] { background: #1e464a; border-color: #376366; color: #e8fffa; }
.nav-button:hover { background: #254551; color: #fff; }
.sidebar :focus-visible { outline-color: #84e3d0; }
.nav-icon { display: block; position: relative; width: 15px; height: 15px; border: 1.4px solid currentColor; border-radius: 4px; flex: 0 0 15px; opacity: .86; }
.icon-clock, .icon-profile { border-radius: 50%; }
.nav-icon::after { content: ""; position: absolute; display: block; }
.icon-clock::after { width: 5px; height: 5px; border-left: 1px solid currentColor; border-bottom: 1px solid currentColor; left: 6px; top: 2px; }
.icon-calendar::after { border-top: 1px solid currentColor; inset: 4px 0 auto; }
.icon-profile::after { width: 5px; height: 5px; top: 2px; left: 4px; border-radius: 50%; background: currentColor; box-shadow: 0 5px 0 1px currentColor; }
.icon-admin::after { inset: 3px; background: currentColor; clip-path: polygon(0 100%, 0 42%, 25% 42%, 25% 100%, 40% 100%, 40% 0, 64% 0, 64% 100%, 77% 100%, 77% 23%, 100% 23%, 100% 100%); }
.sidebar-account { margin-top: auto; border-top: 1px solid #314a58; padding-top: 13px; display: flex; align-items: center; gap: 9px; }
.account-avatar { display: grid; place-items: center; flex: 0 0 32px; height: 32px; border-radius: 50%; color: #cbf8ea; background: #27565a; font-size: .72rem; font-weight: 780; }
.account-identity { display: grid; gap: 2px; min-width: 0; }
.account-identity strong { color: #f1fafb; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .85rem; }
.account-identity span { color: #b0c3cf; font-size: .72rem; white-space: nowrap; }
.button.logout { margin-left: auto; color: #d8e7eb; padding: 5px 6px; min-height: 36px; }
.button.logout:hover:not(:disabled) { color: #fff; background: #294958; }

.workspace { padding: clamp(22px, 4vw, 50px); width: 100%; margin: 0 auto; max-width: 1560px; min-width: 0; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.page-header h1 { color: var(--navy); font-size: clamp(1.57rem, 2.7vw, 2.28rem); letter-spacing: -.035em; margin-bottom: 4px; }
.page-meta { display: grid; gap: 2px; text-align: right; font-variant-numeric: tabular-nums; }
.page-meta strong { font-size: .91rem; }
.page-meta span { font-size: .73rem; overflow-wrap: anywhere; }
#employee-error { margin-bottom: 14px; }
.summary-grid { display: grid; grid-template-columns: minmax(0, 1.28fr) minmax(0, .82fr); gap: 15px; }
.clock-card {
  border-color: #bcd9d6;
  background: linear-gradient(137deg, #f8fdfc, #e9f5f4);
}
.clock-timer { margin-top: 14px; color: var(--navy); font-size: clamp(2.2rem, 4.7vw, 4.3rem); line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.05em; font-weight: 750; }
.clock-detail { margin-top: 5px; min-height: 2.8em; }
.clock-action { margin-top: 13px; min-width: 132px; }
.overview-card { display: flex; gap: 8px; align-items: flex-start; flex-direction: column; }
.overview-card .panel-heading { margin-bottom: 2px; }
.metric-value { color: var(--navy); font-size: clamp(1.22rem, 2.85vw, 2.21rem); line-height: 1.25; font-weight: 770; font-variant-numeric: tabular-nums; letter-spacing: -.04em; overflow-wrap: anywhere; }
.overview-card .button { margin-top: auto; }
.records-panel { margin-top: 15px; }
.records-panel .panel-heading { margin-bottom: 6px; }
.table-wrap { width: 100%; min-width: 0; overflow-x: auto; }
.data-table { border-collapse: collapse; text-align: left; width: 100%; font-variant-numeric: tabular-nums; font-size: .87rem; }
.data-table th { border-bottom: 1px solid var(--border); color: var(--subtle); font-weight: 670; font-size: .78rem; }
.data-table td { border-bottom: 1px solid #e9eef2; vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table th, .data-table td { padding: 12px 9px; }
.data-table td:first-child, .data-table th:first-child { padding-left: 2px; }
.data-table .nowrap { white-space: nowrap; }
.data-table .note-cell { min-width: 7em; overflow-wrap: anywhere; white-space: pre-wrap; }
.empty-message { color: var(--subtle); padding-block: 12px; font-size: .9rem; line-height: 1.5; }
.balance-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-bottom: 15px; }
.metric { padding: 16px 15px; }
.metric h2 { color: var(--subtle); font-size: .86rem; margin-bottom: 7px; }
.balance-primary { background: var(--teal-tint); border-color: #b9dbd5; }
.balance-primary h2, .balance-primary .metric-value { color: var(--teal-dark); }
.pto-grid { display: grid; grid-template-columns: minmax(210px, .8fr) minmax(0, 1.25fr); gap: 15px; align-items: start; }
.settings-panel { width: min(440px, 100%); }
.settings-panel .button { justify-self: start; }
.notice {
  position: fixed;
  z-index: 9;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  max-width: min(430px, calc(100% - 32px));
  padding: 11px 13px;
  border: 1px solid #9fc5bb;
  border-radius: 8px;
  color: #0a4a40;
  background: #e6f5f1;
  box-shadow: 0 5px 20px #18384722;
  font-size: .89rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.notice.error { color: var(--danger); border-color: #dfb3b6; background: #fff0ef; }

@media (max-width: 1050px) {
  .dashboard { grid-template-columns: 190px minmax(0, 1fr); }
  .workspace { padding: 27px; }
  .sidebar { padding-inline: 11px; }
  .panel { padding: 17px; }
}
@media (max-width: 820px) {
  .balance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pto-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .dashboard { display: block; }
  .sidebar { position: static; display: grid; min-height: 0; height: auto; max-height: none; padding: 11px 12px 7px; overflow: visible; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
  .sidebar .brand { margin: 0; font-size: .94rem; gap: 7px; }
  .brand-mark { flex-basis: 25px; height: 25px; }
  .sidebar-account { grid-column: 2; grid-row: 1; margin: 0; padding: 0; border: 0; max-width: 170px; }
  .account-avatar { display: none; }
  .account-identity span { display: none; }
  .main-nav { grid-column: 1 / -1; display: flex; gap: 2px; overflow-x: auto; padding-bottom: 2px; }
  .nav-button { min-height: 39px; padding: 7px 8px; font-size: .82rem; gap: 5px; }
  .nav-icon { width: 13px; height: 13px; flex-basis: 13px; }
  .workspace { padding: 18px 12px 32px; }
  .page-header { margin-bottom: 14px; align-items: flex-start; }
  .page-meta { text-align: left; }
  .summary-grid, .pto-grid { gap: 10px; }
  .panel { padding: 14px; }
  .records-panel { margin-top: 10px; }
  .auth-screen { grid-template-columns: minmax(0, 380px); gap: 10px; align-content: start; padding-top: clamp(20px, 10vh, 78px); }
  .auth-brand, .auth-panel { border-radius: 12px; padding: 24px; }
  .auth-brand p { margin-top: 11px; }
}
@media (max-width: 430px) {
  .summary-grid { grid-template-columns: 1fr; }
  .nav-icon { display: none; }
  .page-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; }
  .overview-card { gap: 6px; }
  .overview-card .button { margin-top: 3px; }
  .clock-detail { min-height: 0; }
}
