:root {
  --ink: #18201d;
  --muted: #68716d;
  --line: #dfe5df;
  --paper: #fbfbf7;
  --panel: #ffffff;
  --accent: #0b8f6a;
  --accent-dark: #06654d;
  --gold: #e4ad38;
  --danger: #c94b3a;
  --shadow: 0 18px 45px rgba(24, 32, 29, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: #f3f5ef;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
input, select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}
button { cursor: pointer; border: 0; }
button:disabled { cursor: not-allowed; opacity: .56; }

.flash-stack {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(520px, calc(100vw - 32px));
}
.flash {
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--accent);
}
.flash.error { border-left-color: var(--danger); }
.flash.success { border-left-color: var(--accent); }

.brand {
  font-weight: 800;
  letter-spacing: 0;
  font-size: 20px;
}
.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--accent-dark);
  font-weight: 800;
  text-transform: uppercase;
}
.muted { color: var(--muted); font-size: 13px; }

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(130deg, rgba(11, 143, 106, .2), transparent 40%),
    linear-gradient(45deg, rgba(228, 173, 56, .22), transparent 45%),
    #f5f3ea;
}
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(980px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 42px;
  align-items: center;
  padding: 56px;
  border-radius: 12px;
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow);
}
.login-panel h1 {
  margin: 0;
  font-size: 48px;
  line-height: 1.1;
}
.login-subtitle {
  margin-top: 18px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}
.login-form {
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.primary-btn, .ghost-btn, .danger-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 800;
}
.primary-btn {
  background: var(--accent);
  color: #fff;
}
.primary-btn:hover { background: var(--accent-dark); }
.ghost-btn {
  background: #edf3ed;
  color: var(--ink);
  border: 1px solid #dbe4dc;
}
.danger-btn {
  background: #f8e5e0;
  color: #8f271f;
  border: 1px solid #efc7bd;
}
.small { min-height: 34px; padding: 0 11px; font-size: 13px; }

.app-shell { min-height: 100vh; }
.employee-body .app-shell { min-height: 0; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  padding: 22px 18px;
  background: #1f2824;
  color: #f6f7f1;
  display: flex;
  flex-direction: column;
}
.side-brand { margin-bottom: 24px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a {
  padding: 11px 12px;
  border-radius: 8px;
  color: rgba(246,247,241,.86);
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.12);
  color: rgba(246,247,241,.7);
  display: grid;
  gap: 6px;
}
.admin-main {
  margin-left: 232px;
  padding: 28px;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}
.admin-header h1 {
  margin: 0;
  font-size: 28px;
}
.company-switch select { min-width: 180px; background: #fff; }

.panel, .metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(24, 32, 29, .06);
}
.panel {
  padding: 18px;
  margin-bottom: 18px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-title h2 {
  margin: 0;
  font-size: 19px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metric-card {
  padding: 18px;
}
.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.metric-card strong {
  font-size: 26px;
}
.form-grid, .filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
}
.user-create { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.company-create { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.filter-bar { grid-template-columns: repeat(7, minmax(120px, 1fr)); }

.table-wrap {
  width: 100%;
  overflow-x: auto;
}
.table-wrap.wide table { min-width: 1080px; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}
th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #f7f8f3;
}
.empty-cell, .empty-inline {
  color: var(--muted);
  text-align: center;
  padding: 20px;
}
.empty-inline {
  text-align: left;
  background: #f7f8f3;
  border-radius: 8px;
}
.number-input { max-width: 100px; }
.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inline-form.tight input { max-width: 130px; }
.actions-cell {
  display: flex;
  gap: 8px;
  align-items: center;
}
.time-field {
  position: relative;
}
.time-field input {
  cursor: pointer;
}
.time-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  left: 0;
  width: min(360px, calc(100vw - 36px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
.time-picker-section + .time-picker-section {
  margin-top: 10px;
}
.time-picker-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.time-picker-grid {
  display: grid;
  gap: 6px;
}
.time-picker-grid.hours {
  grid-template-columns: repeat(6, 1fr);
}
.time-picker-grid.minutes {
  grid-template-columns: repeat(6, 1fr);
}
.time-picker-grid button {
  min-height: 34px;
  border-radius: 8px;
  background: #f3f6f1;
  color: var(--ink);
  font-weight: 800;
}
.time-picker-grid button:hover,
.time-picker-grid button.selected {
  background: var(--accent);
  color: #fff;
}
.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: #eef3ee;
}
.status.working { background: #e5f5ef; color: #087453; }
.status.completed { background: #eef0f1; color: #44504b; }
.status.cancelled { background: #f8e5e0; color: #922d23; }

.settlement-preview {
  display: grid;
  grid-template-columns: 220px 220px 1fr;
  gap: 14px;
  align-items: stretch;
  margin: 16px 0;
}
.settle-form {
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 12px;
  align-items: center;
  background: #f7f8f3;
  border-radius: 10px;
  padding: 14px;
}

.topbar {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.employee-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(228, 173, 56, .24), transparent 34%),
    linear-gradient(135deg, #f6f7ed 0%, #eef3ef 48%, #f8efe3 100%);
}
.employee-topbar {
  color: var(--ink);
}
.topbar-user {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--muted);
}
.employee-page {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 96px;
}
.employee-tab-panel { display: none; }
.employee-tab-panel.active { display: block; }
.employee-hero {
  display: grid;
  grid-template-columns: 1fr 430px;
  gap: 20px;
  align-items: end;
  margin: 10px 0 18px;
}
.employee-hero h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.18;
}
.employee-hero p:last-child {
  color: var(--muted);
  font-size: 16px;
}
.employee-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.employee-stats div {
  min-height: 92px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(223,229,223,.9);
}
.employee-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}
.employee-stats strong {
  font-size: 22px;
}
.employee-card {
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(223,229,223,.95);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.live-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: #1f2824;
  color: #fff;
}
.live-card .eyebrow { color: #94d8bd; }
.live-card p { color: rgba(255,255,255,.72); }
.checkout-btn {
  min-width: 230px;
  min-height: 76px;
  border-radius: 12px;
  color: #1f2824;
  background: linear-gradient(135deg, #ffd36a, #f1a84f);
  font-weight: 900;
  font-size: 18px;
  box-shadow: 0 16px 32px rgba(228, 173, 56, .28);
}
.selector-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}
.selector-head h2 {
  margin: 0;
  font-size: 24px;
}
.selector-head.compact { margin-top: 20px; }
.hint-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff3ce;
  color: #8b650d;
  font-weight: 800;
  font-size: 12px;
}
.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.choice-card {
  min-height: 86px;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
.choice-card span {
  display: block;
  font-weight: 900;
  font-size: 17px;
}
.choice-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}
.choice-card.selected {
  border-color: var(--accent);
  background: #edf8f2;
  box-shadow: inset 0 0 0 2px rgba(11,143,106,.18);
}
.sign-btn {
  width: 100%;
  min-height: 98px;
  margin-top: 22px;
  border-radius: 14px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255,255,255,.18), transparent),
    linear-gradient(135deg, #0b8f6a, #075e4a 58%, #1f2824);
  box-shadow: 0 20px 45px rgba(11, 143, 106, .3);
}
.sign-btn span {
  display: block;
  font-size: 30px;
  font-weight: 900;
}
.sign-btn small {
  display: block;
  margin-top: 5px;
  color: rgba(255,255,255,.78);
}
.record-list {
  display: grid;
  gap: 10px;
}
.record-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border-radius: 10px;
  background: #f7f8f3;
}
.record-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.record-money { text-align: right; min-width: 130px; }
.salary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.salary-grid div {
  min-height: 112px;
  padding: 16px;
  border-radius: 10px;
  background: #f7f8f3;
  border: 1px solid var(--line);
}
.salary-grid span,
.salary-grid small,
.profile-list span,
.settlement-row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.salary-grid strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 24px;
}
.salary-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.settlement-list {
  display: grid;
  gap: 10px;
}
.settlement-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 10px;
  background: #f7f8f3;
}
.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.profile-head h2 {
  margin: 0;
  font-size: 24px;
}
.profile-head p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
}
.avatar-badge {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
}
.profile-list {
  display: grid;
  gap: 10px;
}
.profile-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.profile-form {
  display: grid;
  gap: 12px;
}
.logout-link {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  margin-top: 14px;
  border-radius: 8px;
  background: #f8e5e0;
  color: #8f271f;
  font-weight: 800;
}
.employee-bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 45;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 22px));
  min-height: 64px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 7px;
  border: 1px solid rgba(223,229,223,.95);
  border-radius: 18px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 16px 38px rgba(24, 32, 29, .16);
  backdrop-filter: blur(14px);
}
.employee-bottom-nav button {
  min-height: 50px;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}
.employee-bottom-nav button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(11,143,106,.22);
}
.employee-bottom-nav span {
  display: block;
}
.hidden { display: none !important; }
.empty-state {
  display: grid;
  gap: 12px;
  justify-items: start;
}

@media (max-width: 980px) {
  .login-panel, .employee-hero, .settlement-preview {
    grid-template-columns: 1fr;
  }
  .metric-grid, .choice-grid, .salary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid, .filter-bar, .user-create, .company-create {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sidebar {
    position: static;
    width: auto;
  }
  .admin-main {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .topbar {
    height: 56px;
    padding: 0 14px;
  }
  .brand {
    font-size: 18px;
  }
  .topbar-user {
    gap: 10px;
    font-size: 13px;
  }
  .login-panel {
    padding: 24px;
    min-height: auto;
  }
  .login-panel h1, .employee-hero h1 {
    font-size: 27px;
  }
  .employee-stats, .metric-grid, .form-grid, .filter-bar, .user-create, .company-create, .settle-form {
    grid-template-columns: 1fr;
  }
  .choice-grid, .salary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .employee-page {
    width: min(100vw - 20px, 1120px);
    padding-top: 8px;
    padding-bottom: 100px;
  }
  .mobile-hero {
    gap: 12px;
    margin-top: 0;
  }
  .employee-hero p:last-child {
    font-size: 14px;
  }
  .employee-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }
  .employee-stats div {
    min-height: 74px;
    padding: 10px;
  }
  .employee-stats strong {
    font-size: 17px;
  }
  .employee-card {
    padding: 16px;
    border-radius: 10px;
  }
  .live-card, .record-row, .selector-head, .admin-header {
    align-items: stretch;
    flex-direction: column;
  }
  .selector-head h2 {
    font-size: 20px;
  }
  .choice-card {
    min-height: 74px;
    padding: 12px;
  }
  .choice-card span {
    font-size: 15px;
  }
  .sign-btn {
    min-height: 90px;
  }
  .sign-btn span {
    font-size: 26px;
  }
  .checkout-btn {
    width: 100%;
    min-width: 0;
  }
  .salary-grid div {
    min-height: 96px;
    padding: 13px;
  }
  .salary-grid strong {
    font-size: 20px;
  }
  .settlement-row {
    align-items: stretch;
    flex-direction: column;
  }
  .profile-list div {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .record-money { text-align: left; }
}
