:root {
  --brand: #164e49;
  --brand-light: #e6f1ed;
  --ink: #172e2b;
  --muted: #647671;
  --bg: #f3f6f3;
  --line: #dde6e1;
  --warn: #996117;
  --danger: #b24236;
  --radius: 18px;
  font-family: Inter, "PingFang SC", "Microsoft Yahei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button,
.button {
  min-height: 44px;
  padding: 10px 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
button:hover,
.button:hover {
  background: var(--brand-light);
}
button.primary,
.button.primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.danger {
  color: var(--danger);
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #c9d7d0;
  border-radius: 10px;
  min-height: 46px;
  padding: 11px;
  background: #fff;
  color: var(--ink);
}
textarea {
  min-height: 95px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #79afa0;
  outline-offset: 1px;
}
label {
  display: block;
  font-weight: 550;
  line-height: 1.5;
}
label input,
label select,
label textarea {
  margin-top: 7px;
}
label small {
  display: block;
  font-weight: 400;
  color: var(--muted);
}
input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  vertical-align: middle;
  margin-right: 8px;
}
.sidebar {
  width: 226px;
  background: #fff;
  border-right: 1px solid var(--line);
  position: fixed;
  inset: 0 auto 0 0;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  z-index: 10;
}
.brand {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--brand);
}
.brand small {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  margin-top: 5px;
}
.sidebar .caption {
  font-size: 13px;
  margin: 28px 12px 12px;
  color: var(--muted);
}
nav {
  display: grid;
  gap: 5px;
}
nav button {
  justify-content: flex-start;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding-left: 14px;
}
nav button.active {
  color: var(--brand);
  background: var(--brand-light);
  font-weight: 650;
}
.sidebar footer {
  margin-top: auto;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}
.shell {
  margin-left: 226px;
}
.topbar {
  min-height: 88px;
  border-bottom: 1px solid var(--line);
  padding: 18px 36px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: #ffffffb3;
}
.search {
  max-width: 430px;
}
.user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.avatar {
  width: 39px;
  height: 39px;
  border-radius: 50%;
  background: var(--brand-light);
  display: grid;
  place-items: center;
  color: var(--brand);
  font-weight: 650;
}
main {
  max-width: 1460px;
  margin: auto;
  padding: 32px 36px 60px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}
.pagehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
h1 {
  font-size: 30px;
  line-height: 1.3;
  letter-spacing: -0.6px;
  margin: 8px 0 10px;
}
h2 {
  font-size: 19px;
  margin: 0 0 18px;
}
h3 {
  font-size: 17px;
  margin: 0 0 10px;
}
p {
  line-height: 1.7;
  margin: 8px 0;
}
.muted {
  color: var(--muted);
}
.subtle {
  font-size: 14px;
  color: var(--muted);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0;
}
.metric,
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 23px;
}
.metric {
  cursor: pointer;
  text-align: left;
}
.metric .number {
  font-size: 36px;
  font-weight: 650;
  margin: 14px 0 8px;
  letter-spacing: -1px;
}
.metric .label {
  color: var(--muted);
  font-size: 14px;
}
.metric.accent {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
.metric.accent .label {
  color: #c6ded5;
}
.columns {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 22px;
}
.panel + .panel {
  margin-top: 20px;
}
.panelhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panelhead h2 {
  margin: 0;
}
.pill {
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--brand-light);
  color: var(--brand);
  display: inline-block;
  white-space: nowrap;
}
.pill.warn {
  background: #fcf0d9;
  color: var(--warn);
}
.pill.red {
  background: #fbe8e4;
  color: var(--danger);
}
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child {
  border-bottom: 0;
}
.row .grow {
  flex: 1;
  min-width: 0;
}
.row p {
  margin: 4px 0;
  font-size: 14px;
}
.row-title {
  font-weight: 600;
}
.datebox {
  width: 48px;
  min-height: 52px;
  background: var(--bg);
  border-radius: 11px;
  text-align: center;
  font-size: 12px;
  display: grid;
  align-content: center;
  color: var(--muted);
  flex-shrink: 0;
}
.datebox strong {
  font-size: 22px;
  color: var(--brand);
}
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.toolbar > * {
  flex: 1;
  min-width: 145px;
}
.toolbar button,
.toolbar .button {
  flex: 0 0 auto;
}
.tablewrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 15px;
}
th {
  font-weight: 500;
  color: var(--muted);
  padding: 14px 10px;
  background: #f7f9f7;
  white-space: nowrap;
}
td {
  padding: 17px 10px;
  border-bottom: 1px solid var(--line);
  line-height: 1.5;
}
tbody tr:hover {
  background: #f9fbf9;
}
.namecell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cellnote {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-top: 3px;
}
.link {
  background: none;
  border: 0;
  color: var(--brand);
  padding: 4px;
  min-height: 44px;
  text-align: left;
}
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  line-height: 1.8;
}
.empty strong {
  display: block;
  color: var(--ink);
  margin-bottom: 7px;
}
.notice {
  background: #fbf4e5;
  border: 1px solid #e9d7ac;
  padding: 14px 18px;
  border-radius: 12px;
  line-height: 1.7;
  color: #795c2c;
  font-size: 14px;
  margin: 18px 0;
}
.notice.green {
  background: var(--brand-light);
  border-color: #c2d9cf;
  color: var(--brand);
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.actions.end {
  justify-content: flex-end;
}
.bottomnav {
  display: none;
}
.gridform {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.gridform .full {
  grid-column: 1/-1;
}
.sectionlabel {
  grid-column: 1/-1;
  color: var(--brand);
  font-size: 17px;
  font-weight: 650;
  border-bottom: 1px solid var(--line);
  padding: 12px 0 10px;
  margin-top: 10px;
}
.date-selects {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
}
.summary-card,
.fixed-values {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  line-height: 1.7;
}
.summary-card span {
  display: block;
  color: var(--muted);
}
.repeat-row {
  display: grid;
  grid-template-columns: auto repeat(5, minmax(110px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.repeat-row label { min-width: 0; }
.structured {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}
.consent { line-height: 1.7; }
.field-error {
  color: var(--danger);
  font-size: 14px;
}
.errorbox {
  color: var(--danger);
  padding: 12px 0;
  line-height: 1.6;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 22px;
}
.detail-item .key {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.detail-item .val {
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.tabs {
  display: flex;
  gap: 8px;
  margin: 20px 0;
  flex-wrap: wrap;
}
.tabs button.selected {
  background: var(--brand-light);
  border-color: #94b7a8;
  color: var(--brand);
}
dialog {
  width: min(820px, calc(100vw - 26px));
  max-height: 90dvh;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  color: var(--ink);
  box-shadow: 0 25px 100px #163e4933;
}
dialog::backdrop {
  background: #15302c70;
  backdrop-filter: blur(3px);
}
dialog .dialogtop {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 15px;
  margin-bottom: 16px;
}
dialog h2 {
  font-size: 23px;
}
dialog .actions.end {
  position: sticky;
  bottom: -28px;
  background: white;
  padding: 18px 0 8px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
}
.login {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.login-intro {
  background: var(--brand);
  color: white;
  padding: 9vw 7vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-intro .brand {
  color: white;
}
.login-intro h1 {
  font-size: 46px;
  line-height: 1.4;
  margin-top: 60px;
  letter-spacing: 0;
}
.login-intro p {
  color: #c0d9d1;
  max-width: 410px;
}
.login-box {
  max-width: 440px;
  width: 100%;
  padding: 32px;
  margin: auto;
}
.login-box label {
  margin: 20px 0;
}
.login-box button {
  width: 100%;
  margin-top: 12px;
}
.login-box .eyebrow {
  margin-bottom: 15px;
}
.login-foot {
  font-size: 12px;
  margin-top: 30px;
  color: var(--muted);
}
.bar {
  height: 9px;
  background: #edf3ef;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 12px;
}
.bar i {
  height: 100%;
  background: var(--brand);
  display: block;
}
.loading {
  padding: 80px;
  text-align: center;
}
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 23px;
  border-radius: 12px;
  background: #173c35;
  color: white;
  box-shadow: 0 5px 25px #16332e30;
  z-index: 100;
  display: none;
  max-width: 85vw;
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calday {
  background: #f7faf7;
  padding: 10px;
  min-height: 100px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}
.calday strong {
  display: block;
  margin-bottom: 8px;
}
.calday span {
  display: block;
  background: var(--brand-light);
  padding: 5px;
  border-radius: 5px;
  font-size: 12px;
  margin-top: 4px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.file-item span {
  flex: 1;
}
.external {
  max-width: 700px;
  margin: 25px auto;
  padding: 20px;
}
.searchresults {
  position: fixed;
  top: 74px;
  left: 260px;
  max-height: 65vh;
  overflow: auto;
  width: 440px;
  background: white;
  box-shadow: 0 12px 45px #163e492b;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  z-index: 20;
}
code {
  font-size: 13px;
  overflow-wrap: anywhere;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.6;
}
@media (max-width: 1100px) {
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .columns {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 194px;
  }
  .shell {
    margin-left: 194px;
  }
  main {
    padding: 26px;
  }
  .topbar {
    padding: 16px 26px;
  }
  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 720px) {
  .repeat-row {
    grid-template-columns: 1fr;
  }
  .date-selects {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .shell {
    margin-left: 0;
  }
  .topbar {
    min-height: 72px;
    padding: 12px 18px;
  }
  .topbar .search {
    min-width: 0;
  }
  .user span {
    display: none;
  }
  .user button {
    font-size: 12px;
    padding: 8px;
  }
  .user {
    gap: 5px;
  }
  main {
    padding: 22px 16px 105px;
  }
  .pagehead {
    align-items: flex-start;
    gap: 8px;
  }
  h1 {
    font-size: 26px;
  }
  .pagehead .actions {
    justify-content: flex-end;
  }
  .pagehead button {
    padding: 10px;
    font-size: 14px;
  }
  .metrics {
    gap: 10px;
  }
  .metric {
    padding: 17px;
  }
  .metric .number {
    font-size: 31px;
    margin: 12px 0 5px;
  }
  .panel {
    padding: 18px;
  }
  .columns {
    gap: 15px;
  }
  .bottomnav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 1px solid var(--line);
    background: white;
    z-index: 20;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .bottomnav button {
    flex: 1;
    border: 0;
    display: grid;
    gap: 4px;
    min-height: 50px;
    padding: 5px;
    font-size: 13px;
    color: var(--muted);
    background: white;
  }
  .bottomnav button.active {
    color: var(--brand);
    background: var(--brand-light);
  }
  .bottomnav b {
    font-size: 19px;
  }
  .gridform {
    grid-template-columns: 1fr;
  }
  .gridform .full,
  .sectionlabel {
    grid-column: 1;
  }
  .detail-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .tablewrap table,
  .tablewrap tbody,
  .tablewrap tr,
  .tablewrap td {
    display: block;
  }
  .tablewrap thead {
    display: none;
  }
  .tablewrap tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 13px;
    background: #fff;
  }
  .tablewrap td {
    border: 0;
    padding: 5px 0;
  }
  .tablewrap td:before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    display: inline-block;
    min-width: 80px;
  }
  .tablewrap td:first-child:before {
    display: none;
  }
  .tablewrap .namecell {
    font-size: 18px;
  }
  .tablewrap td:last-child {
    padding-top: 10px;
  }
  .tablewrap td:last-child:before {
    display: none;
  }
  .toolbar {
    gap: 8px;
  }
  .toolbar > * {
    min-width: 120px;
  }
  .login {
    display: block;
  }
  .login-intro {
    padding: 34px 28px;
  }
  .login-intro h1 {
    font-size: 28px;
    margin: 25px 0 6px;
  }
  .login-intro p {
    font-size: 14px;
  }
  .login-box {
    padding: 28px;
  }
  .login-intro .brand small {
    display: none;
  }
  .notice {
    padding: 12px;
    font-size: 14px;
  }
  .searchresults {
    top: 68px;
    left: 12px;
    width: calc(100% - 24px);
  }
  .calendar {
    grid-template-columns: repeat(2, 1fr);
  }
  .calday {
    min-height: 80px;
  }
  dialog {
    padding: 20px;
  }
  dialog .actions.end {
    bottom: -20px;
  }
  .external {
    margin: 0;
    padding: 18px;
  }
  .row {
    gap: 10px;
  }
  .row .actions button {
    padding: 9px;
    font-size: 14px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button,
  .button {
    transition:
      background 0.15s,
      transform 0.1s;
  }
  button:active,
  .button:active {
    transform: scale(0.98);
  }
}
