:root {
  --ink: #15302d;
  --muted: #687875;
  --line: #dce7e4;
  --surface: #ffffff;
  --surface-soft: #f4f8f7;
  --teal: #0f766e;
  --teal-deep: #115e59;
  --teal-soft: #d9f1ec;
  --amber: #b45309;
  --amber-soft: #fff3d8;
  --red: #b42318;
  --red-soft: #fee9e7;
  --shadow: 0 16px 45px rgba(34, 71, 66, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #edf4f2;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; background: #edf4f2; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 0%, #dff7ef 0, transparent 35%), #edf4f2; }
.login-card { width: min(100%, 430px); display: grid; gap: 18px; }
.login-card h1 { margin: 4px 0 0; font-size: 30px; letter-spacing: -.03em; }

.app-shell { min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(18px, 4vw, 54px);
  color: #f5fffd;
  background: linear-gradient(120deg, #0e4d49, #0f766e 62%, #168477);
}

.brand-lockup, .topbar-actions, .role-switcher, .role-switcher-controls,
.section-title-row, .form-actions, .card-heading, .message-heading,
.member-main, .summary-meta, .nav-button { display: flex; align-items: center; }
.brand-lockup { gap: 11px; }
.brand-mark {
  display: grid; width: 42px; height: 42px; place-items: center;
  border: 1px solid rgba(255,255,255,.32); border-radius: 13px;
  color: #0e4d49; background: #d9f1ec; font-weight: 800; letter-spacing: -1px;
}
.brand-name { font-size: 16px; font-weight: 800; letter-spacing: .02em; }
.brand-subtitle { margin-top: 2px; font-size: 12px; color: rgba(245,255,253,.74); }
.topbar-actions { gap: 12px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(245,255,253,.82); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #95e6ba; }
.avatar-button {
  width: 35px; height: 35px; padding: 0; border: 1px solid rgba(255,255,255,.3);
  border-radius: 50%; color: #f5fffd; background: rgba(255,255,255,.12); font-weight: 700;
}

.main-content { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding: 35px 0 90px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.eyebrow, .section-kicker { margin: 0 0 7px; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.eyebrow { color: #2b8a81; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 42px); line-height: 1.08; letter-spacing: -.045em; }
h2 { margin-bottom: 5px; font-size: 21px; letter-spacing: -.025em; }
h3 { margin-bottom: 4px; font-size: 15px; }
.page-description { max-width: 620px; margin-bottom: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.date-control { display: grid; gap: 6px; min-width: 168px; }
.date-control label, .field-label, .input-label { color: var(--muted); font-size: 12px; font-weight: 700; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--surface);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
input, select { height: 44px; padding: 0 12px; }
textarea { min-height: 105px; padding: 12px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }

.role-switcher {
  justify-content: space-between; gap: 18px; margin-bottom: 25px; padding: 15px 17px;
  border: 1px solid #cfe3df; border-radius: 15px; background: rgba(255,255,255,.7);
}
.role-switcher-copy { display: grid; gap: 4px; }
.role-switcher-copy .section-kicker { margin-bottom: 0; }
.role-switcher-controls { gap: 8px; width: min(430px, 100%); }
.role-switcher-controls select { height: 38px; padding: 0 10px; font-size: 13px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.32fr) minmax(280px, .68fr); gap: 18px; }
.stack { display: grid; gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.panel-pad { padding: 21px; }
.section-title-row { justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-title-row h2 { margin: 0; }
.section-note { margin: 0; color: var(--muted); font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metric-card { min-height: 111px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfdfd; }
.metric-card .metric-label { color: var(--muted); font-size: 12px; }
.metric-card .metric-value { margin: 10px 0 3px; font-size: 25px; font-weight: 800; letter-spacing: -.04em; }
.metric-card .metric-unit { color: var(--muted); font-size: 12px; }
.metric-card.emphasis { border-color: #b7ded8; background: #f0faf7; }
.metric-card.warning { border-color: #f1d7a7; background: #fffaf0; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field { display: grid; gap: 7px; }
.field.span-2 { grid-column: span 2; }
.field input[type="number"] { font-size: 16px; font-weight: 700; }
.form-actions { justify-content: flex-end; gap: 9px; margin-top: 18px; }
.button {
  min-height: 42px; padding: 0 15px; border: 1px solid transparent; border-radius: 11px;
  font-weight: 800; font-size: 13px; transition: transform .16s, background .16s, border-color .16s;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--teal); }
.button-primary:hover { background: var(--teal-deep); }
.button-secondary { border-color: #b9d8d3; color: var(--teal-deep); background: #eff9f6; }
.button-ghost { border-color: var(--line); color: var(--ink); background: #fff; }

.message-box { border: 1px solid #b9ded7; border-radius: 14px; background: #f2fbf8; }
.message-heading { justify-content: space-between; gap: 10px; padding: 13px 15px; border-bottom: 1px solid #d6ebe7; }
.message-heading h3 { margin: 0; }
.message-heading span { color: var(--teal); font-size: 12px; font-weight: 700; }
.message-text { min-height: 82px; padding: 15px; color: #244743; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.message-copy { width: 100%; margin: 0 15px 15px; }

.month-summary { display: grid; gap: 12px; }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-bottom: 12px; border-bottom: 1px solid #edf2f1; }
.summary-row:last-child { padding-bottom: 0; border-bottom: 0; }
.summary-row span { color: var(--muted); font-size: 13px; }
.summary-row strong { font-size: 18px; }
.summary-meta { justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }

.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status-badge.ok { color: #14705c; background: var(--teal-soft); }
.status-badge.pending { color: var(--amber); background: var(--amber-soft); }
.status-badge.missing { color: var(--red); background: var(--red-soft); }
.status-badge .status-dot { width: 6px; height: 6px; background: currentColor; }

.team-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.team-summary .metric-card { min-height: 95px; }
.team-summary .metric-value { margin-top: 8px; font-size: 22px; }
.member-list { display: grid; gap: 10px; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px; border: 1px solid #e4ecea; border-radius: 13px; background: #fcfefe; }
.member-main { gap: 10px; min-width: 0; }
.member-avatar { display: grid; flex: 0 0 auto; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: var(--teal-deep); background: var(--teal-soft); font-size: 13px; font-weight: 800; }
.member-name { margin-bottom: 3px; font-size: 14px; font-weight: 800; }
.member-subtitle { color: var(--muted); font-size: 12px; }
.member-actions { display: flex; align-items: center; gap: 8px; }
.mini-button { min-height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--teal-deep); background: #fff; font-size: 12px; font-weight: 700; }

.manager-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.manager-card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fcfefe; }
.manager-card .card-heading { justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.manager-card .card-heading h3 { margin: 0; }
.manager-card .manager-count { color: var(--muted); font-size: 12px; }
.manager-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.manager-metric { display: grid; gap: 4px; }
.manager-metric span { color: var(--muted); font-size: 11px; }
.manager-metric strong { font-size: 17px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table th, .data-table td { padding: 12px 10px; border-bottom: 1px solid #edf2f1; text-align: left; font-size: 13px; white-space: nowrap; }
.data-table th { color: var(--muted); font-size: 11px; letter-spacing: .03em; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .number { text-align: right; }

.admin-grid { display: grid; grid-template-columns: .78fr 1.22fr; gap: 18px; }
.admin-role-card { display: grid; gap: 10px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fcfefe; }
.admin-role-card strong { font-size: 16px; }
.admin-role-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.admin-role-list { display: grid; gap: 10px; }
.admin-role-card .role-count { color: var(--teal); font-size: 24px; font-weight: 800; }
.config-list { display: grid; gap: 0; }
.config-row { display: grid; grid-template-columns: 1.1fr 1fr .8fr; gap: 10px; padding: 13px 0; border-bottom: 1px solid #edf2f1; font-size: 13px; }
.config-row:first-child { padding-top: 0; color: var(--muted); font-size: 11px; font-weight: 800; }
.config-row:last-child { border-bottom: 0; }
.config-type { color: var(--muted); }

.bottom-nav { display: none; }
.toast { position: fixed; left: 50%; bottom: 25px; z-index: 10; max-width: min(430px, calc(100% - 34px)); padding: 11px 15px; border-radius: 11px; color: #fff; background: #163b37; box-shadow: var(--shadow); font-size: 13px; opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 820px) {
  .main-content { padding-top: 25px; }
  .page-heading { align-items: stretch; flex-direction: column; gap: 18px; }
  .date-control { max-width: 220px; }
  .content-grid, .admin-grid { grid-template-columns: 1fr; }
  .manager-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .topbar { padding: 13px 16px; }
  .brand-subtitle, .status-pill { display: none; }
  .main-content { width: min(100% - 24px, 560px); padding: 23px 0 86px; }
  h1 { font-size: 31px; }
  .role-switcher { align-items: stretch; flex-direction: column; gap: 12px; margin-bottom: 17px; }
  .role-switcher-controls { width: 100%; }
  .role-switcher-controls select { flex: 1; min-width: 0; }
  .panel-pad { padding: 16px; }
  .metric-grid, .team-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .button { width: 100%; }
  .member-row { align-items: flex-start; flex-direction: column; }
  .member-actions { width: 100%; justify-content: space-between; }
  .manager-grid { grid-template-columns: 1fr; }
  .bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 5; display: flex; justify-content: space-around; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
  .nav-button { justify-content: center; flex: 1; min-height: 47px; flex-direction: column; gap: 3px; border: 0; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; }
  .nav-button.active { color: var(--teal); }
  .nav-icon { font-size: 18px; line-height: 1; }
}
