:root {
  color-scheme: light;
  --ink: #1e2925;
  --muted: #75827a;
  --line: #e5eae5;
  --paper: #fff;
  --bg: #f3f5f1;
  --green: #287456;
  --green-dark: #153f31;
  --green-soft: #e9f3ed;
  --amber: #e2ae67;
  --red: #b44b4b;
  --shadow: 0 15px 42px rgba(25, 49, 37, .055);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 8% 0%, rgba(220, 234, 222, .55), transparent 32rem),
    var(--bg);
  font: 14px/1.6 Inter, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.shell { width: min(1320px, 100%); margin: 0 auto; padding: 0 42px; }
.hidden { display: none !important; }

/* Shared header */
.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(218, 226, 218, .9);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: .035em; }
.brand-icon {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 14px; color: transparent; font-size: 0;
  background: linear-gradient(145deg, #286b50, #153e30);
  box-shadow: 0 6px 14px rgba(25, 78, 55, .18);
}
.brand-icon::after { content: "S"; color: #fff; font-size: 19px; font-weight: 700; letter-spacing: -.04em; }
.brand small { display: block; color: #89938c; font-size: 10px; font-weight: 500; letter-spacing: .1em; }
.userbar { display: flex; align-items: center; gap: 14px; color: #6f7b73; font-size: 12px; }
.userbar #user-label { padding: 7px 12px; border: 1px solid #e2e8e2; border-radius: 30px; background: rgba(255,255,255,.6); }
.link-button { border: 0; padding: 9px 11px; color: var(--green); background: transparent; font: inherit; font-weight: 600; cursor: pointer; }
.link-button:hover { color: var(--green-dark); }

/* Login */
.login-layout { min-height: calc(100vh - 146px); display: grid; grid-template-columns: 1.1fr .9fr; gap: 8%; align-items: center; max-width: 1080px; margin: 0 auto; }
.welcome { position: relative; min-height: 480px; display: flex; flex-direction: column; justify-content: center; padding: 38px 0 190px; }
.eyebrow { color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
.welcome h1 { margin: 19px 0 13px; color: #20372d; font-size: clamp(38px, 4.1vw, 52px); line-height: 1.34; letter-spacing: -.055em; }
.welcome > p, .page-heading p { margin: 0; color: var(--muted); }
.welcome > p { max-width: 395px; font-size: 14px; line-height: 1.9; }
.welcome-art { position: absolute; right: 5px; bottom: 2px; width: 335px; height: 160px; overflow: hidden; border: 1px solid #d6e4d9; border-radius: 24px; background: linear-gradient(125deg, #e5efe6, #d8e9dc); }
.welcome-art::before, .welcome-art::after { position: absolute; content: ""; border-radius: 50%; background: rgba(255,255,255,.48); }
.welcome-art::before { width: 210px; height: 210px; right: -49px; top: 31px; }
.welcome-art::after { width: 110px; height: 110px; right: 104px; top: -61px; background: rgba(255,255,255,.38); }
.watch-face { position: absolute; z-index: 1; top: 27px; left: 56px; width: 82px; height: 107px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 8px solid #315d48; border-radius: 27px; color: var(--green-dark); background: #f6f8f0; box-shadow: 0 13px 24px rgba(34,71,49,.17); }
.watch-face::before, .watch-face::after { position: absolute; z-index: -1; left: 17px; width: 32px; height: 20px; content: ""; background: #315d48; }
.watch-face::before { top: -26px; border-radius: 8px 8px 0 0; }
.watch-face::after { bottom: -26px; border-radius: 0 0 8px 8px; }
.watch-face span { font-size: 17px; font-weight: 700; letter-spacing: -.04em; }
.watch-face small { font-size: 7px; letter-spacing: .1em; }
.art-note { position: absolute; z-index: 2; top: 48px; left: 170px; color: #667d6d; font-size: 12px; line-height: 1.9; }
.art-note strong { color: #285641; font-size: 16px; }
.login-card, .panel, .stat-card { border: 1px solid rgba(226,232,226,.9); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.login-card { padding: 39px; }
.login-card h2 { margin: 7px 0 3px; font-size: 26px; letter-spacing: -.04em; }
.muted { margin: 0 0 25px; color: var(--muted); font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 17px; }
.stack label, .filters label { display: flex; flex-direction: column; gap: 7px; color: #46554c; font-size: 12px; font-weight: 600; }
.optional { color: #98a29a; font-size: 10px; font-weight: 400; }
.stack input, .stack select, .stack textarea, .filters input, .filters select {
  width: 100%; min-width: 0; min-height: 45px; padding: 10px 13px;
  border: 1px solid #dfe6df; border-radius: 10px; outline: none;
  color: var(--ink); background: #fcfdfb; font: inherit; transition: border-color .18s, box-shadow .18s, background .18s;
}
.stack textarea { min-height: 82px; resize: vertical; }
.stack label small { color: #849087; font-size: 11px; font-weight: 400; }
.stack input::placeholder, .stack textarea::placeholder { color: #aab3ac; }
.stack input:focus, .stack select:focus, .stack textarea:focus, .filters input:focus, .filters select:focus { border-color: #76a48c; background: #fff; box-shadow: 0 0 0 3px rgba(40,116,86,.10); }
.primary, .secondary { min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 10px; font-family: inherit; font-size: 13px; font-weight: 650; cursor: pointer; transition: transform .16s, background .16s, box-shadow .16s; }
.primary { color: white; background: linear-gradient(135deg, #2b805d, #206448); box-shadow: 0 5px 12px rgba(35,113,79,.16); }
.primary:hover { background: linear-gradient(135deg, #246e50, #174b38); box-shadow: 0 8px 17px rgba(35,113,79,.22); transform: translateY(-1px); }
.primary:active, .secondary:active { transform: translateY(0); }
.primary span { float: right; font-size: 17px; line-height: 18px; }
.full { width: 100%; min-height: 48px; margin-top: 3px; padding: 13px 16px; }
.secondary { border-color: #e1e8e1; color: #42604e; background: #f6f8f5; }
.secondary:hover { border-color: #d5e2d7; background: #edf4ee; }
.danger-action { color: var(--red); }
.secure-note { margin-top: 24px; padding-top: 17px; border-top: 1px solid #edf0ed; color: #89958d; font-size: 11px; }
.secure-note span { margin-right: 7px; color: #4f9a6e; }
.setup-tip { padding: 11px 12px; border: 1px solid #e3eee5; border-radius: 9px; color: #647c6a; background: #f4f8f4; font-size: 11px; }
.error { margin-top: 12px; color: var(--red); font-size: 12px; }

/* Page headings, employee workspace and admin metrics */
.page-heading { display: flex; align-items: end; justify-content: space-between; padding: 37px 0 23px; }
.page-heading h1 { margin: 5px 0 2px; color: #21362c; font-size: 29px; letter-spacing: -.045em; }
.page-heading p { font-size: 12px; }
#employee-view .page-heading { position: relative; min-height: 136px; overflow: hidden; align-items: center; padding: 25px 30px; border: 1px solid #e0e9e0; border-radius: 18px; background: linear-gradient(105deg, #edf5ee, #f8faf6 76%); }
#employee-view .page-heading::after { position: absolute; right: 128px; width: 135px; height: 135px; content: ""; border: 1px solid rgba(63,131,91,.12); border-radius: 50%; box-shadow: 0 0 0 17px rgba(63,131,91,.035), 0 0 0 34px rgba(63,131,91,.025); }
#employee-view .page-heading > * { position: relative; z-index: 1; }
.date-pill { padding: 8px 13px; border: 1px solid #dce9de; border-radius: 30px; color: #347452; background: rgba(255,255,255,.8); font-size: 11px; font-weight: 600; }
.employee-grid { display: grid; grid-template-columns: .86fr 1.14fr; gap: 20px; align-items: start; margin-top: 19px; }
.panel { margin-bottom: 19px; padding: 23px; }
.entry-panel { padding: 25px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0 0 3px; font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.step-badge { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid #dcebe0; border-radius: 11px; color: var(--green); background: #eff6f0; font-size: 20px; }
.icon-button { width: 37px; height: 37px; border: 1px solid #e2e8e2; border-radius: 10px; color: var(--green); background: #fff; font-size: 20px; cursor: pointer; transition: background .15s, transform .25s; }
.icon-button:hover { background: #f1f6f1; transform: rotate(35deg); }
.message { padding: 10px 12px; border: 1px solid #d9ebdc; border-radius: 9px; color: #34724c; background: #f0f8f1; font-size: 12px; }
.setup-warning { margin: 0 0 17px; padding: 12px 14px; border: 1px solid #f0dfbf; border-radius: 11px; color: #815e2c; background: #fff9ee; font-size: 12px; }
.setup-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 18px; padding: 15px 18px; border: 1px solid #e8dfc8; border-radius: 14px; background: linear-gradient(105deg, #fffaf0, #fff 85%); }
.setup-banner strong { color: #594421; font-size: 12px; }
.setup-banner p { margin: 3px 0 0; color: #8b7956; font-size: 11px; }
.setup-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.record-list { display: flex; flex-direction: column; }
.record { padding: 14px 0; border-top: 1px solid #eef1ed; }
.record:first-child { padding-top: 0; border-top: 0; }
.record-top, .record-meta, .product-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.record strong { font-size: 12px; }
.record time, .record-meta { color: #87928a; font-size: 10px; }
.record-meta { justify-content: flex-start; gap: 16px; margin-top: 6px; }
.record-meta b { color: #364b3d; }
.product-row { align-items: center; }
.product-row > div { min-width: 0; }
.product-row .record-meta { flex-wrap: wrap; }
.employee-actions { display: flex; flex: 0 0 auto; gap: 6px; }
#my-records .record-meta { flex-wrap: wrap; line-height: 1.5; }
#my-records .employee-actions { justify-content: flex-end; margin-top: 9px; }
.status { padding: 3px 8px; border-radius: 20px; font-size: 9px; font-weight: 600; }
.status.on { color: #31704d; background: #eaf5ec; }
.status.off { color: #818a83; background: #f0f2ef; }
.role-tag { padding: 3px 8px; border: 1px solid #e2e9e2; border-radius: 20px; color: #67786a; background: #f7f9f6; font-size: 9px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { position: relative; min-height: 127px; overflow: hidden; padding: 18px 21px; }
.stat-card::after { position: absolute; right: -27px; bottom: -49px; width: 115px; height: 115px; content: ""; border: 1px solid rgba(47,115,78,.09); border-radius: 50%; box-shadow: 0 0 0 12px rgba(47,115,78,.025), 0 0 0 24px rgba(47,115,78,.02); }
.stat-card:first-child { border-color: #d9e7da; background: linear-gradient(120deg, #eff6ef, #fff 84%); }
.stat-card span, .stat-card small { position: relative; z-index: 1; display: block; color: #78857c; font-size: 10px; }
.stat-card strong { position: relative; z-index: 1; display: block; margin: 5px 0 1px; color: #21392e; font-size: 25px; font-weight: 700; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.stat-card:first-child strong { color: #246b49; }

/* Tabs, filters, tables */
.tabs { display: flex; gap: 5px; overflow-x: auto; margin: 0 0 15px; border-bottom: 1px solid #e2e8e2; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; flex: 0 0 auto; padding: 12px 16px; border: 0; color: #7b887f; background: transparent; font: inherit; font-size: 12px; cursor: pointer; }
.tab::after { position: absolute; right: 13px; bottom: -1px; left: 13px; height: 2px; content: ""; border-radius: 3px; background: transparent; }
.tab:hover { color: #38684c; }
.tab.active { color: #286b49; font-weight: 700; }
.tab.active::after { background: #3a8a5d; }
.filters { display: flex; align-items: end; gap: 11px; flex-wrap: wrap; padding: 15px 17px; }
.filters label { min-width: 130px; flex: 1; gap: 5px; color: #738077; font-size: 10px; }
.filters input, .filters select { min-height: 39px; padding: 8px 10px; font-size: 11px; }
.filters .secondary { min-height: 39px; }
.table-panel { overflow: hidden; padding: 19px 0 0; }
.table-panel > .panel-heading { padding: 0 20px; }
.table-wrap { width: 100%; overflow: auto; scrollbar-color: #cad7cc transparent; scrollbar-width: thin; }
table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; white-space: nowrap; font-size: 11px; }
th { position: sticky; top: 0; z-index: 1; color: #758279; background: #f6f8f5; font-size: 10px; font-weight: 650; }
td, th { padding: 11px 13px; border-top: 1px solid #edf0ec; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #f8faf7; }
td { color: #526057; }
td strong { color: #276847; font-variant-numeric: tabular-nums; }
.empty, .empty-cell { padding: 27px; color: #929d94; text-align: center; font-size: 12px; }
.split { display: grid; grid-template-columns: .8fr 1.2fr; gap: 19px; align-items: start; }
.checkline { flex-direction: row !important; align-items: center; gap: 9px !important; }
.checkline input { width: 16px; min-height: 16px; accent-color: var(--green); }
.button-row { display: flex; gap: 9px; }
.small { min-height: 32px; padding: 5px 10px; white-space: nowrap; font-size: 10px; }

/* Dialog, footer, motion */
dialog { width: min(440px, calc(100% - 30px)); padding: 27px; border: 1px solid #e0e8e0; border-radius: 18px; color: var(--ink); background: #fff; box-shadow: 0 24px 80px rgba(15,39,25,.25); }
dialog::backdrop { background: rgba(21,41,31,.48); backdrop-filter: blur(3px); }
dialog h2 { margin: 7px 0; font-size: 20px; }
dialog .muted { margin: 0 0 4px; }
footer { display: flex; justify-content: space-between; padding: 23px 0 20px; color: #a0aaa2; font-size: 9px; }
footer span { letter-spacing: .08em; }
.toast { position: fixed; z-index: 5; bottom: max(22px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); padding: 11px 18px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; color: #fff; background: #203a2d; box-shadow: 0 12px 32px rgba(18,44,29,.2); font-size: 12px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }

@media (max-width: 800px) {
  .shell { padding: 0 23px; }
  .login-layout { min-height: auto; grid-template-columns: 1fr; align-content: start; gap: 8px; padding: 17px 0; }
  .welcome { min-height: auto; padding: 10px 0 12px; }
  .welcome h1 { margin: 7px 0 4px; font-size: 30px; }
  .welcome > p { max-width: 380px; font-size: 11px; }
  .welcome-art { display: none; }
  .login-card { margin-bottom: 20px; padding: 24px; }
  .employee-grid, .split { grid-template-columns: 1fr; gap: 0; }
  .page-heading { padding: 27px 0 17px; }
  #employee-view .page-heading { min-height: 120px; padding: 21px 23px; }
  .page-heading h1 { font-size: 26px; }
  .panel { padding: 19px; }
  .entry-panel { padding: 22px; }
  .employee-grid { margin-top: 14px; }
  .stat-grid { gap: 9px; }
  .stat-card { min-height: 112px; padding: 15px; }
  .stat-card strong { font-size: 21px; }
  .stat-card small { font-size: 9px; }
  .table-panel { padding: 17px 0 0; }
  .table-panel > .panel-heading { padding: 0 17px; }
  .topbar { height: 68px; }
  .brand-icon { width: 38px; height: 38px; }
  /* 16px prevents iOS Safari from zooming the whole page when a field is focused. */
  .stack input, .stack select, .stack textarea, .filters input, .filters select { min-height: 52px; font-size: 16px; }
  .stack textarea { min-height: 100px; }
  .stack label { font-size: 13px; }
  .primary, .secondary { min-height: 48px; }
  .primary.full { min-height: 56px; }
  .small { min-height: 40px; padding: 8px 11px; }
  .tab { min-height: 46px; }
  .setup-banner { align-items: stretch; flex-direction: column; }
  .setup-actions { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .shell { padding: 0 15px; }
  .topbar { height: 62px; }
  .brand { gap: 9px; font-size: 13px; }
  .brand small { font-size: 9px; }
  .brand-icon { width: 35px; height: 35px; border-radius: 11px; }
  .userbar { gap: 5px; font-size: 10px; }
  .userbar #user-label { padding: 6px 9px; }
  .welcome { min-height: auto; padding-bottom: 0; }
  .welcome h1 { font-size: 28px; }
  .login-card { padding: 23px; }
  .page-heading { gap: 10px; }
  .page-heading p { max-width: 250px; font-size: 10px; }
  #employee-view .page-heading { min-height: 108px; padding: 16px; }
  #employee-view .page-heading::after { right: 79px; }
  .date-pill { padding: 7px 9px; font-size: 9px; white-space: nowrap; }
  .page-heading h1 { font-size: 24px; }
  #admin-view > .page-heading .secondary { min-height: 36px; padding: 8px 10px; font-size: 10px; white-space: nowrap; }
  .stat-grid { gap: 7px; }
  .stat-card { min-height: 105px; padding: 12px 10px; border-radius: 14px; }
  .stat-card span { font-size: 9px; }
  .stat-card strong { font-size: 18px; }
  .stat-card small { line-height: 1.35; }
  .tab { padding: 11px 12px; font-size: 11px; }
  .filters { gap: 9px; padding: 13px; }
  .filters label { min-width: calc(50% - 6px); }
  .filters > button { flex: 1; }
  .employee-actions { gap: 5px; }
  footer { padding: 19px 0; font-size: 8px; }
  dialog { padding: 22px; }
}

.choice-group { min-width:0; margin:0; padding:12px; border:1px solid #e4e9e3; border-radius:12px; }
.choice-group legend { padding:0 5px; font-size:12px; font-weight:650; }
.choice-group small { display:block; margin-top:8px; color:#849087; font-size:11px; }
.choice-list { display:flex; flex-wrap:wrap; gap:8px; }
.choice { display:flex; align-items:center; gap:8px; min-height:42px; padding:8px 12px; border:1px solid #e3e9e2; border-radius:10px; background:#f8faf7; cursor:pointer; }
.choice input { width:18px; height:18px; accent-color:#3f835b; }
.choice span { font-size:13px; }
#tab-options .record-list { margin-top:16px; }
#tab-options .split { gap:18px; }
@media(max-width:800px){.choice { min-height:48px; } #tab-options .split { gap:12px; }}
