:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #202b30;
  background: #f4f6f5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --green: #087f5b;
  --line: #dce3e0;
  --muted: #6d7b79;
  --control-border: #cad7d1;
  --control-radius: 8px;
  --control-height: 42px;
  --focus-ring: #087f5b30;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select, option { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #edf2ef; }
.login-panel { width: min(100%, 380px); padding: 36px; border: 1px solid var(--line); border-radius: 16px; background: #fff; text-align: center; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: var(--green); color: #fff; font-size: 19px; font-weight: 700; }
.login-panel .brand-mark { margin: 0 auto 20px; }
h1 { margin: 0; font-size: 22px; font-weight: 650; }
.muted { color: var(--muted); }
.login-panel p { margin: 8px 0 22px; }
.login-panel img { display: block; width: 224px; height: 224px; margin: 10px auto; }
.login-panel label { display: block; text-align: left; margin: 18px 0 7px; font-size: 13px; }
.login-form label input { display: block; width: 100%; margin-top: 5px; }
.login-panel #login-error { margin: 10px 0; text-align: left; }
.login-panel #dev-login { margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--line); }
select, input {
  min-height: var(--control-height);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  padding: 8px 12px;
  background-color: #fff;
  font-size: 14px;
}
input::placeholder { color: var(--muted); }
select, input[type="date"], input[type="month"], input[type="time"] { cursor: pointer; }
input:hover, select:hover { border-color: #8eab9e; }
input:focus-visible, select:focus-visible {
  border-color: var(--green);
  outline-offset: 0;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
select {
  appearance: none;
  padding-inline-end: 34px;
  background-image: linear-gradient(45deg, transparent 48%, #4e7164 50%, #4e7164 69%, transparent 71%), linear-gradient(-45deg, transparent 48%, #4e7164 50%, #4e7164 69%, transparent 71%);
  background-position: right 16px center, right 11px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
@supports (appearance: base-select) and selector(::picker(select)) {
  select, select::picker(select) { appearance: base-select; }
  select { background-image: none; padding-inline-end: 12px; gap: 10px; align-items: center; }
  select::picker-icon {
    content: "";
    width: 7px;
    height: 7px;
    margin: -3px 1px 0 0;
    border: solid #4e7164;
    border-width: 0 1.5px 1.5px 0;
    rotate: 45deg;
  }
  select:open::picker-icon { rotate: 225deg; margin-top: 3px; }
  select::picker(select) {
    min-inline-size: max(anchor-size(width), 144px);
    max-block-size: min(320px, 45vh);
    margin-block: 6px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: #202b30;
    box-shadow: 0 10px 28px #183a2d24;
  }
  select option {
    min-height: 38px;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 10px;
    border-radius: 6px;
    font: inherit;
  }
  select option:hover, select option:focus-visible { background: #f1f6f4; }
  select option:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
  select option:checked { background: #e8f3ed; color: #086a4c; font-weight: 600; }
  select option::checkmark { order: 1; }
}
.login-panel select, .login-panel .primary-button { width: 100%; margin-top: 10px; }
.primary-button { min-height: var(--control-height); padding: 0 14px; border: 1px solid var(--green); border-radius: var(--control-radius); background: var(--green); color: #fff; font-weight: 600; }
.quiet-button { min-height: 34px; padding: 0 10px; border: 0; background: transparent; color: var(--green); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 226px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fff; padding: 22px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 9px 27px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 12px; }
nav { display: grid; gap: 4px; }
.nav-item { min-height: 38px; padding: 0 11px; border: 0; border-radius: 5px; background: transparent; color: #50605e; text-align: left; font-size: 13px; }
.nav-item:hover, .nav-item.active { background: #e8f3ed; color: #086a4c; font-weight: 600; }
.sidebar-bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 6px; border-top: 1px solid var(--line); padding: 13px 3px 0; }
.user-line { min-width: 0; display: flex; align-items: center; gap: 7px; font-size: 12px; }
.user-line span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-bottom .quiet-button { flex: none; white-space: nowrap; }
.online-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #1a9b6e; }
.main-area { width: min(100%, 1320px); margin: 0 auto; padding: 28px 38px 56px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 25px; }
.topbar .eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 11px; }
.topbar h1 { font-size: 20px; }
.topbar > .muted { font-size: 12px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.toolbar input, .toolbar select { min-width: 120px; }
.toolbar .search { width: min(300px, 100%); }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { margin-top: 12px; font-size: 23px; font-weight: 650; font-variant-numeric: tabular-nums; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 10px; font-size: 14px; font-weight: 650; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
th { background: #f8faf9; color: #687775; font-weight: 550; white-space: nowrap; }
th, td { height: 43px; padding: 8px 11px; border-bottom: 1px solid #edf0ef; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.amount, th.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td[data-label="付款日期及时间"] { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.name { min-width: 180px; max-width: 340px; line-height: 1.4; }
.status-select { min-height: 36px; padding-block: 4px; }
.tag { display: inline-flex; min-height: 21px; align-items: center; padding: 0 7px; border-radius: 4px; background: #e8f3ed; color: #086a4c; font-size: 11px; white-space: nowrap; }
.danger-tag { background: #fff0ed; color: #a53d30; }
.progress-bars { display: grid; gap: 11px; padding: 15px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.progress-row { display: grid; grid-template-columns: 94px minmax(30px, 1fr) 110px; align-items: center; gap: 10px; font-size: 12px; }
.track { appearance: none; width: 100%; height: 9px; border: 0; border-radius: 4px; background: #e8efeb; color: var(--green); overflow: hidden; }
.track::-webkit-progress-bar { background: #e8efeb; }
.track::-webkit-progress-value { background: var(--green); border-radius: 4px; }
.track::-moz-progress-bar { background: var(--green); border-radius: 4px; }
dialog { width: min(460px, calc(100% - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 14px; color: inherit; }
dialog[open] { box-shadow: 0 20px 56px #14211d30; }
dialog::backdrop { background: #14211d88; }
dialog h2 { margin: 0 0 14px; font-size: 15px; }
dialog img { display: block; max-width: 100%; min-height: 30px; max-height: 320px; margin: 0 auto 14px; }
#image-dialog form, .dialog-actions { display: flex; align-items: center; justify-content: end; gap: 8px; }
dialog a { display: inline-grid; align-items: center; font-size: 12px; }
.expense-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; font-size: 13px; }
.expense-form label { display: grid; gap: 5px; font-weight: 500; }
.expense-form label:has(input[name="note"]) { grid-column: 1 / -1; }
.expense-form input, .expense-form select { width: 100%; min-width: 0; font-weight: 400; }
.expense-form .dialog-actions { grid-column: 1 / -1; margin-top: 4px; }
.form-error { grid-column: 1 / -1; margin: 0; color: #a53d30; }
.account-form, #account-result { display: grid; gap: 12px; }
.account-form label, #account-result label { display: grid; gap: 5px; }
#account-result p, #account-warning { margin: 0; }
#view-booking fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
#view-booking legend { margin-bottom: 8px; color: var(--muted); }
#view-booking [data-records] { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
#view-booking [data-files] .identity-card > .muted { margin-inline-start: 8px; }
.progress-row .amount { text-align: right; font-variant-numeric: tabular-nums; }
.section-block { margin-top: 20px; }
.person-table td { white-space: nowrap; }
.identity-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 10px; }
.identity-card { padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.identity-top { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.identity-sub { margin-top: 8px; color: var(--muted); font-size: 12px; }
.identity-actions { margin-top: 12px; text-align: right; }
.action-button { min-height: 34px; padding: 0 10px; border: 1px solid var(--control-border); border-radius: var(--control-radius); background: #fff; color: #34413e; font-size: 13px; }
.toolbar .action-button, .dialog-actions .action-button { min-height: var(--control-height); font-size: 14px; }
.action-button:hover { border-color: var(--green); color: var(--green); }
.action-button.danger { color: #a53d30; }
.action-button + .action-button { margin-left: 6px; }
.empty, .loading { padding: 28px 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); text-align: center; font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 11px; color: var(--muted); font-size: 12px; }
.pager button { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.pager button:disabled { opacity: .45; cursor: default; }
.toast { position: fixed; right: 24px; bottom: 22px; max-width: min(380px, calc(100vw - 32px)); padding: 11px 14px; border-radius: 5px; background: #25332f; color: #fff; font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .15s ease; }
.toast.visible { opacity: 1; }
.toast.error { background: #8c3229; }
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; z-index: 3; top: 0; width: 100%; height: auto; padding: 10px 12px 8px; border: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 3px 10px; }
  .brand-mark { width: 31px; height: 31px; }
  nav { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; }
  .nav-item { min-height: 34px; padding: 0 4px; text-align: center; font-size: 11px; white-space: nowrap; }
  .sidebar-bottom { position: absolute; top: 9px; right: 10px; border: 0; padding: 0; }
  .sidebar-bottom .user-line { display: none; }
  .main-area { padding: 19px 13px 35px; }
  .topbar { margin-bottom: 17px; }
  .summary-grid { gap: 7px; }
  .metric { padding: 11px 9px; }
  .metric-value { font-size: 18px; }
  .metric-label { font-size: 10px; }
  .toolbar input, .toolbar select { flex: 1; min-width: 110px; }
  .toolbar input, .toolbar select, .expense-form input, .expense-form select { font-size: 16px; }
  .expense-actions .action-button, .person-actions .action-button { min-height: 38px; }
  .progress-row { grid-template-columns: 70px minmax(18px, 1fr) 86px; gap: 7px; font-size: 11px; }
  th, td { padding: 7px 8px; }
  :is(.expenses-table, .people-table) { overflow: visible; border: 0; background: transparent; }
  :is(.expenses-table, .people-table) :is(table, tbody) { display: block; }
  :is(.expenses-table, .people-table) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  :is(.expenses-table, .people-table) tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; padding: 13px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
  :is(.expenses-table, .people-table) td { height: auto; padding: 0; border: 0; min-width: 0; max-width: none; overflow-wrap: anywhere; }
  :is(.expenses-table, .people-table) td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; }
  .expenses-table td.expense-name { grid-column: 1 / -1; grid-row: 1; font-size: 15px; font-weight: 650; }
  .expenses-table .expense-name::before { display: none; }
  .expenses-table .amount { text-align: left; font-weight: 650; }
  .expenses-table .expense-actions, .expenses-table .empty, .people-table .person-actions { grid-column: 1 / -1; }
  .expense-actions, .person-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  :is(.expense-actions, .person-actions) .action-button + .action-button { margin: 0; }
}
@media (max-width: 420px) {
  #expense-dialog { max-height: calc(100dvh - 24px); padding: 18px; }
  .expense-form { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}
