:root {
  --ink: #17231f;
  --muted: #6f7c76;
  --paper: #f7f8f4;
  --card: rgba(255, 255, 255, 0.92);
  --line: #dfe5df;
  --green: #0f6b4f;
  --green-dark: #084c38;
  --green-soft: #e2f1ea;
  --gold: #d9a441;
  --red: #a73d35;
  --shadow: 0 18px 48px rgba(25, 49, 39, 0.1);
  --radius: 22px;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(15, 107, 79, 0.05), transparent 38%),
    var(--paper);
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  pointer-events: none;
}
.ambient-one { top: -160px; right: 4%; background: #5db28b; }
.ambient-two { bottom: -200px; left: -80px; background: #e7c16e; }

[hidden] { display: none !important; }
.app-shell { min-height: 100vh; }
.login-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(360px, 0.9fr) 1.1fr; }

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: clamp(48px, 8vw, 112px);
  color: #fff;
  background:
    linear-gradient(160deg, rgba(6, 55, 40, 0.96), rgba(13, 101, 75, 0.92)),
    #0f6b4f;
}
.brand-panel::after {
  position: absolute;
  right: -90px;
  bottom: -120px;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  box-shadow: 0 0 0 48px rgba(255,255,255,.035), 0 0 0 96px rgba(255,255,255,.025);
  content: "";
}
.line-mark {
  display: grid;
  width: 88px;
  height: 88px;
  margin-bottom: 40px;
  place-items: center;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 50%;
  box-shadow: inset 0 0 0 7px rgba(255,255,255,.08);
}
.line-mark span { font-family: Georgia, serif; font-size: 38px; }
.eyebrow { margin: 0 0 12px; color: rgba(255,255,255,.7); font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.eyebrow.dark { color: var(--green); }
.brand-panel h1 { margin: 0; font-family: "STSong", "SimSun", serif; font-size: clamp(48px, 6vw, 76px); font-weight: 600; line-height: 1.08; letter-spacing: .04em; }
.brand-copy { max-width: 420px; margin: 32px 0 0; color: rgba(255,255,255,.82); font-size: 17px; line-height: 1.85; }
.brand-rule { width: 56px; height: 3px; margin: 42px 0 18px; background: var(--gold); }
.brand-footnote { margin: 0; color: rgba(255,255,255,.58); font-size: 13px; letter-spacing: .12em; }

.login-card-wrap { display: grid; padding: 42px; place-items: center; }
.login-card { display: grid; width: min(440px, 100%); gap: 24px; padding: clamp(30px, 5vw, 54px); border: 1px solid rgba(255,255,255,.78); border-radius: 28px; background: rgba(255,255,255,.82); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-card h2 { margin: 0 0 8px; font-family: "STSong", "SimSun", serif; font-size: 34px; }
.muted { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
label > span, .month-field > span { display: block; margin-bottom: 9px; color: #4d5c55; font-size: 13px; font-weight: 700; }
input, textarea {
  width: 100%;
  border: 1px solid #cfd9d2;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input { height: 48px; padding: 0 14px; }
textarea { min-height: 126px; padding: 13px 14px; line-height: 1.65; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15,107,79,.12); }
.form-error { min-height: 20px; margin: -10px 0 0; color: var(--red); font-size: 13px; }

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .14s, box-shadow .14s, background .14s;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button.primary { color: #fff; background: var(--green); box-shadow: 0 8px 18px rgba(15,107,79,.18); }
.button.primary:hover:not(:disabled) { background: var(--green-dark); }
.button.secondary { border-color: #cad7cf; color: var(--green-dark); background: #fff; }
.button.danger { color: #fff; background: var(--red); }
.button.ghost { border-color: rgba(23,35,31,.12); color: var(--ink); background: transparent; }
.button.compact { min-height: 36px; padding: 0 13px; font-size: 13px; }
.button.wide { width: 100%; }

.workspace { min-height: 100vh; }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(213,222,216,.9);
  background: rgba(247,248,244,.88);
  backdrop-filter: blur(16px);
}
.topbar-brand, .topbar-user { display: flex; align-items: center; gap: 13px; }
.topbar-brand p, .topbar-user small { display: block; margin: 0 0 2px; color: var(--muted); font-size: 11px; }
.topbar-brand strong { font-family: "STSong", "SimSun", serif; font-size: 18px; }
.mini-line-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: #fff; background: var(--green); font-family: Georgia, serif; font-size: 16px; }
.role-pill, .status-pill { display: inline-flex; align-items: center; border-radius: 999px; font-size: 12px; font-weight: 800; }
.role-pill { padding: 6px 10px; color: var(--green-dark); background: var(--green-soft); }
.workspace-body { width: min(1540px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 60px; }

.month-hero {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: clamp(26px, 4vw, 46px);
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(118deg, #0b5e45, #167a5b 72%, #2b8e6d);
  box-shadow: 0 18px 46px rgba(9,84,61,.18);
}
.month-hero .eyebrow { margin-bottom: 8px; color: rgba(255,255,255,.65); }
.month-hero .muted { color: rgba(255,255,255,.72); }
.month-line { display: flex; align-items: center; gap: 14px; }
.month-line h2 { margin: 0 0 8px; font-family: "STSong", "SimSun", serif; font-size: clamp(34px, 4vw, 52px); font-weight: 600; }
.status-pill { padding: 7px 11px; color: #fff; background: rgba(255,255,255,.16); }
.status-pill.locked { color: #ffe6dd; background: rgba(121,31,24,.42); }
.progress-ring { display: grid; width: 105px; height: 105px; place-content: center; border: 8px solid rgba(255,255,255,.16); border-top-color: #eac268; border-radius: 50%; text-align: center; }
.progress-ring strong { font-size: 23px; }
.progress-ring span { color: rgba(255,255,255,.65); font-size: 11px; }

.notice { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 14px 17px; border-radius: 12px; font-size: 14px; }
.notice.locked { color: #713028; background: #f7e4df; }
.section-card { margin-bottom: 22px; padding: clamp(20px, 3vw, 32px); border: 1px solid rgba(218,226,220,.92); border-radius: var(--radius); background: var(--card); box-shadow: 0 10px 32px rgba(31,49,41,.055); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.section-heading h3 { margin: 0 0 6px; font-family: "STSong", "SimSun", serif; font-size: 25px; }
.heading-actions { display: flex; align-items: center; gap: 12px; }
.unsaved-label { color: #9a6d12; font-size: 12px; font-weight: 700; }

.table-scroll { max-height: 66vh; overflow: auto; border: 1px solid var(--line); border-radius: 14px; outline: none; }
.frequency-table { min-width: 2200px; width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.frequency-table th, .frequency-table td { min-width: 70px; padding: 9px 7px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; text-align: center; }
.frequency-table th { position: sticky; z-index: 5; top: 0; color: #425149; background: #edf3ee; font-weight: 800; }
.frequency-table th:first-child, .frequency-table td:first-child { position: sticky; z-index: 7; left: 0; min-width: 330px; max-width: 330px; text-align: left; }
.frequency-table th:nth-child(2), .frequency-table td:nth-child(2) { position: sticky; z-index: 6; left: 330px; min-width: 70px; }
.frequency-table th:first-child, .frequency-table th:nth-child(2) { z-index: 9; background: #e7efe9; }
.frequency-table td:first-child, .frequency-table td:nth-child(2) { background: #fbfcfa; }
.frequency-table td:first-child { line-height: 1.55; }
.frequency-table select { width: 58px; height: 34px; padding: 0 5px; border: 1px solid #ccd7cf; border-radius: 8px; color: var(--ink); background: #fff; outline: none; }
.frequency-table select.filled { border-color: var(--green); color: var(--green-dark); background: var(--green-soft); font-weight: 800; }
.frequency-table tr:last-child td { border-bottom: 0; }
.frequency-table th:last-child, .frequency-table td:last-child { border-right: 0; }
.remark-cell { min-width: 170px !important; color: var(--muted); text-align: left !important; }
.textarea-label span { color: var(--muted); }

.admin-grid { display: grid; grid-template-columns: minmax(280px, .72fr) minmax(480px, 1.28fr); gap: 22px; }
.control-card .button + .button { margin-top: 10px; }
.divider { height: 1px; margin: 22px 0; background: var(--line); }
.helper { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.staff-progress-list { display: grid; gap: 16px; }
.staff-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.staff-row:last-child { border-bottom: 0; }
.staff-row strong { font-size: 14px; }
.staff-row small { color: var(--muted); text-align: right; }
.staff-row small b { color: var(--green-dark); font-size: 18px; }
.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.export-item { display: grid; min-height: 104px; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: #fff; text-decoration: none; transition: border-color .15s, transform .15s; }
.export-item:not(.disabled):not(.pending):hover { transform: translateY(-2px); border-color: var(--green); }
.export-item.disabled { pointer-events: none; opacity: .48; }
.export-item.pending { color: var(--muted); background: #fafbf9; }
.export-item strong, .export-item small { display: block; }
.export-item small { margin-top: 4px; color: var(--muted); }
.file-badge { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 12px; color: #fff; background: var(--green); font-size: 10px; font-weight: 900; letter-spacing: .06em; }
.file-badge.word { background: #3f63a3; }
.download-mark { color: var(--green); font-size: 26px; }
.pending-mark { font-size: 12px; font-weight: 800; }
.toast { position: fixed; z-index: 50; right: 24px; bottom: 24px; max-width: 360px; padding: 14px 18px; border-radius: 12px; color: #fff; background: #163c30; box-shadow: var(--shadow); font-size: 14px; }
.toast.error { background: #87372f; }

.password-dialog {
  width: min(520px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: var(--ink);
  background: transparent;
  box-shadow: 0 28px 80px rgba(10, 35, 26, .28);
}
.password-dialog::backdrop { background: rgba(8, 26, 20, .58); backdrop-filter: blur(4px); }
.dialog-card { display: grid; gap: 19px; padding: clamp(26px, 5vw, 40px); background: #fff; }
.dialog-card h2 { margin: 0 0 8px; font-family: "STSong", "SimSun", serif; font-size: 30px; }
.dialog-card .form-error { margin: -4px 0 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; }
  .brand-panel { min-height: 42vh; padding: 44px 28px; }
  .line-mark { width: 60px; height: 60px; margin-bottom: 22px; }
  .line-mark span { font-size: 28px; }
  .brand-panel h1 { font-size: 44px; }
  .brand-copy, .brand-rule, .brand-footnote { display: none; }
  .login-card-wrap { padding: 24px 18px 42px; }
  .login-card { margin-top: -54px; }
  .topbar { padding: 0 16px; }
  .role-pill, .topbar-user small { display: none; }
  .workspace-body { width: min(100% - 24px, 1540px); padding-top: 18px; }
  .month-hero { min-height: 150px; }
  .progress-ring { width: 82px; height: 82px; border-width: 6px; }
  .admin-grid, .export-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar-brand > div:nth-child(2), .topbar-user div { display: none; }
  .topbar-user { gap: 7px; }
  .topbar-user .button.compact { padding: 0 10px; }
  .month-hero { align-items: flex-start; padding: 24px; }
  .month-line { display: block; }
  .progress-ring { width: 70px; height: 70px; }
  .progress-ring strong { font-size: 17px; }
  .section-heading { display: grid; }
  .heading-actions { justify-content: space-between; }
  .frequency-table th:first-child, .frequency-table td:first-child { min-width: 250px; max-width: 250px; }
  .frequency-table th:nth-child(2), .frequency-table td:nth-child(2) { left: 250px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
