:root {
  --ink: #16312e;
  --muted: #667b77;
  --line: #dfe8e4;
  --paper: #f5f7f4;
  --white: #fff;
  --green: #1f6b5d;
  --green-dark: #123d37;
  --green-soft: #dff0e9;
  --gold: #c69442;
  --gold-soft: #f8ecd7;
  --red: #b7473e;
  --red-soft: #f8e3e0;
  --blue: #3f6f89;
  --blue-soft: #e1edf2;
  --shadow: 0 12px 36px rgba(20, 59, 52, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: 250px; display: flex; flex-direction: column; padding: 28px 20px 22px; color: #e9f5f0; background: var(--green-dark); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; color: var(--green-dark); background: #d9b875; border-radius: 12px 5px 12px 5px; font-family: Georgia, serif; font-size: 25px; font-weight: 700; }
.brand strong { display: block; letter-spacing: .16em; font-family: Georgia, serif; font-size: 21px; }
.brand small { display: block; margin-top: 1px; color: #a9c7be; font-size: 11px; letter-spacing: .16em; }
.main-nav { display: flex; flex: 1; flex-direction: column; gap: 7px; margin-top: 54px; }
.main-nav a { display: flex; align-items: center; gap: 13px; padding: 13px 15px; color: #b9d0ca; border-radius: 11px; font-size: 14px; transition: .2s; }
.main-nav a span { width: 22px; color: #86aaa0; font-size: 20px; text-align: center; }
.main-nav a:hover, .main-nav a.active { color: #fff; background: rgba(255,255,255,.09); }
.main-nav a.active { box-shadow: inset 3px 0 #d9b875; }
.sidebar-user { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.12); }
.avatar { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; color: #fff; background: var(--green); border-radius: 50%; font-weight: 700; }
.sidebar-user strong, .sidebar-user small { display: block; }
.sidebar-user strong { font-size: 13px; }
.sidebar-user small { margin-top: 3px; color: #9ebbb4; font-size: 11px; }
.sidebar-user form { margin: 0; }
.sidebar-user button { color: #a9c7be; background: transparent; border: 0; font-size: 18px; }
.main-content { min-height: 100vh; margin-left: 250px; padding: 48px 54px 70px; }
.mobile-header, .mobile-nav { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-head h1 { margin: 4px 0 7px; font-family: Georgia, "Songti SC", serif; font-size: clamp(30px, 4vw, 43px); font-weight: 600; letter-spacing: -.035em; }
.page-head p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 14px; }
.eyebrow { margin: 0 0 6px; color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; }
.back-link { display: inline-block; margin-bottom: 19px; color: var(--muted); font-size: 13px; }
.back-link:hover { color: var(--green); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: 10px; font-weight: 700; font-size: 13px; transition: .18s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(18,61,55,.12); }
.btn-primary { color: #fff; background: var(--green); }
.btn-secondary { color: var(--green-dark); background: #e7efeb; border-color: #d4e1dc; }
.btn-ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.btn-danger { color: var(--red); background: var(--red-soft); border-color: #efcbc7; }
.btn-block { width: 100%; }

.messages { position: fixed; top: 18px; right: 24px; z-index: 30; width: min(420px, calc(100vw - 40px)); }
.message { margin-bottom: 8px; padding: 13px 16px; color: #fff; background: var(--green); border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; }
.message.error { background: var(--red); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 26px; }
.stat-card { display: flex; align-items: center; gap: 18px; min-height: 128px; padding: 23px; overflow: hidden; background: var(--white); border: 1px solid rgba(24,67,60,.07); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-card:hover { border-color: rgba(31,107,93,.25); }
.stat-icon { display: grid; place-items: center; width: 58px; height: 58px; flex: 0 0 58px; border-radius: 17px; font-size: 26px; }
.stat-card.emerald .stat-icon { color: var(--green); background: var(--green-soft); }
.stat-card.amber .stat-icon { color: #976817; background: var(--gold-soft); }
.stat-card.blue .stat-icon { color: var(--blue); background: var(--blue-soft); }
.stat-card small, .stat-card strong, .stat-card p { display: block; }
.stat-card small { color: var(--muted); font-size: 12px; }
.stat-card strong { margin: 2px 0; font-family: Georgia, serif; font-size: 33px; font-weight: 500; }
.stat-card p { margin: 0; color: var(--muted); font-size: 11px; }

.content-grid, .detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr); gap: 22px; }
.panel { margin-bottom: 22px; padding: 24px; background: var(--white); border: 1px solid rgba(24,67,60,.07); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 20px; font-weight: 600; }
.panel-head a { color: var(--green); font-size: 12px; font-weight: 700; }
.data-list { margin: 0 -8px -7px; }
.data-row { display: flex; align-items: center; gap: 13px; min-height: 67px; padding: 10px 8px; border-top: 1px solid #edf2ef; }
.data-row:first-child { border-top: 0; }
a.data-row:hover { background: #f7faf8; border-radius: 10px; }
.row-main { min-width: 0; flex: 1; }
.row-main strong, .row-main small { display: block; }
.row-main strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.order-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--green); }
.priority-high { color: var(--red)!important; background-color: var(--red-soft)!important; }
.order-dot.priority-high { background: var(--red)!important; }
.priority-low { color: var(--blue)!important; background-color: var(--blue-soft)!important; }
.order-dot.priority-low { background: var(--blue)!important; }
.notice-mini-list a { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 13px 0; border-top: 1px solid #edf2ef; }
.notice-mini-list a:first-child { border-top: 0; padding-top: 4px; }
.notice-mini-list time { color: var(--gold); font-family: Georgia, serif; font-size: 17px; }
.notice-mini-list strong, .notice-mini-list small { display: block; }
.notice-mini-list strong { font-size: 13px; }
.notice-mini-list small { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.alert-panel { border-left: 4px solid var(--gold); }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 58px; padding: 5px 9px; color: var(--muted); background: #edf1ef; border-radius: 999px; font-size: 10px; font-style: normal; font-weight: 800; white-space: nowrap; }
.badge.large { padding: 8px 14px; font-size: 12px; }
.status-new, .status-unpaid, .status-renovating { color: #976817; background: var(--gold-soft); }
.status-assigned, .status-partial { color: var(--blue); background: var(--blue-soft); }
.status-in_progress { color: #5d4b9a; background: #ebe7fa; }
.status-awaiting { color: #9c542a; background: #fae9dc; }
.status-closed, .status-paid, .status-occupied { color: var(--green); background: var(--green-soft); }
.status-cancelled, .status-void { color: var(--red); background: var(--red-soft); }
.status-vacant { color: var(--muted); background: #edf1ef; }
.money { color: var(--green-dark); font-family: Georgia, serif; font-size: 16px; white-space: nowrap; }
.overdue { color: var(--red)!important; font-weight: 700; }

.filter-bar { display: flex; align-items: center; gap: 10px; margin: -8px 0 20px; }
.filter-bar input, .filter-bar select { width: min(320px, 100%); min-height: 42px; padding: 0 13px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.filter-bar input:focus, .filter-bar select:focus, .form-control:focus, .login-card input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,107,93,.1); }
.table-panel { padding: 0; overflow: hidden; }
.responsive-table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 15px 18px; color: var(--muted); background: #f7f9f7; font-size: 11px; text-align: left; white-space: nowrap; }
td { padding: 16px 18px; border-top: 1px solid #edf2ef; font-size: 12px; vertical-align: middle; }
td a strong, td a small, td small { display: block; }
td a small, td small { margin-top: 4px; color: var(--muted); font-size: 10px; }
tbody tr:hover { background: #fafcfb; }
.empty { display: grid; place-items: center; min-height: 180px; color: var(--muted); text-align: center; }
.empty span { color: #b8c9c4; font-size: 38px; }
.empty p { margin: 8px 0 0; font-size: 13px; }
.empty small { margin-top: 5px; }
.empty.compact { min-height: 80px; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 19px; }
.property-card { overflow: hidden; background: #fff; border: 1px solid rgba(24,67,60,.08); border-radius: var(--radius); box-shadow: var(--shadow); transition: .2s; }
.property-card:hover { transform: translateY(-3px); box-shadow: 0 18px 42px rgba(20,59,52,.12); }
.property-visual { min-height: 118px; padding: 23px; color: #fff; background: linear-gradient(135deg, #174a42, #2d7a69); }
.property-visual span { display: block; font-family: Georgia, serif; font-size: 30px; }
.property-visual small { display: block; margin-top: 28px; color: #bcd7d0; font-size: 11px; }
.property-info { padding: 18px 20px 20px; }
.property-info > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.property-info h3 { margin: 0; font-size: 15px; }
.property-info p, .property-info > small { display: block; margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.detail-list { margin: 0; }
.detail-list div { display: grid; grid-template-columns: 100px 1fr; gap: 18px; padding: 11px 0; border-top: 1px solid #edf2ef; font-size: 12px; }
.detail-list div:first-child { border-top: 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; text-align: right; }
.resident-list > div { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid #edf2ef; }
.resident-list > div:first-child { border-top: 0; }
.resident-list strong, .resident-list small { display: block; }
.resident-list strong { font-size: 13px; }
.resident-list strong em { margin-left: 6px; padding: 2px 6px; color: var(--green); background: var(--green-soft); border-radius: 5px; font-size: 9px; font-style: normal; }
.resident-list small { margin-top: 4px; color: var(--muted); font-size: 10px; }

.form-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 860px; }
.form-group { min-width: 0; }
.form-group.full, .form-actions.full { grid-column: 1 / -1; }
.form-group label, .stack-form label, .action-box label { display: block; margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 700; }
.form-group label b { color: var(--red); }
.form-control, .login-card input { width: 100%; min-height: 43px; padding: 10px 12px; color: var(--ink); background: #fbfcfb; border: 1px solid var(--line); border-radius: 9px; outline: none; }
textarea.form-control { resize: vertical; }
input[type=file].form-control { padding: 8px; }
.field-error, .form-error { color: var(--red); font-size: 11px; }
.field-error { display: block; margin-top: 5px; }
.form-error { margin-bottom: 15px; padding: 10px 12px; background: var(--red-soft); border-radius: 8px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 5px; }
.description-text { min-height: 100px; color: #38514d; font-size: 13px; line-height: 1.9; }
.attachments { margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line); }
.attachments h3 { margin: 0 0 8px; font-size: 12px; }
.attachments a { display: block; padding: 5px 0; color: var(--green); font-size: 11px; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 14px; }
.timeline { position: relative; margin-left: 7px; padding-left: 26px; border-left: 1px solid #cbdad5; }
.timeline-item { position: relative; padding: 0 0 24px; }
.timeline-item:last-child { padding-bottom: 2px; }
.timeline-item > span { position: absolute; top: 3px; left: -32px; width: 11px; height: 11px; background: var(--green); border: 3px solid #dcece7; border-radius: 50%; }
.timeline-item strong, .timeline-item small { display: block; }
.timeline-item strong { font-size: 12px; }
.timeline-item small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.timeline-item p { margin: 7px 0 0; color: #526a65; font-size: 11px; line-height: 1.6; }
.action-box { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.action-buttons { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }

.bill-summary { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; overflow: hidden; background: var(--green-dark); border-radius: var(--radius); box-shadow: var(--shadow); }
.bill-summary > div { padding: 23px; color: #fff; border-left: 1px solid rgba(255,255,255,.1); }
.bill-summary > div:first-child { border-left: 0; }
.bill-summary > div.balance { background: rgba(255,255,255,.08); }
.bill-summary small, .bill-summary strong { display: block; }
.bill-summary small { color: #abc8c1; font-size: 10px; }
.bill-summary strong { margin-top: 8px; font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.bill-summary strong.date { font-size: 17px; }
.stack-form .form-group { margin-bottom: 13px; }

.notice-list { display: grid; gap: 14px; }
.notice-card { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 20px; padding: 23px; background: #fff; border: 1px solid rgba(24,67,60,.07); border-radius: var(--radius); box-shadow: var(--shadow); }
.notice-card:hover { border-color: rgba(31,107,93,.25); }
.notice-card time { display: grid; place-items: center; min-height: 68px; color: var(--green); border-right: 1px solid var(--line); }
.notice-card time strong { font-family: Georgia, serif; font-size: 29px; font-weight: 500; }
.notice-card time span { color: var(--muted); font-size: 10px; }
.notice-card h2 { margin: 3px 0 7px; font-family: Georgia, "Songti SC", serif; font-size: 18px; font-weight: 600; }
.notice-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.notice-card .arrow { color: var(--green); font-size: 20px; }
.article { max-width: 880px; margin: 0 auto; padding: 46px 58px; }
.article h1 { margin: 10px 0; font-family: Georgia, "Songti SC", serif; font-size: 35px; font-weight: 600; }
.article-meta { padding-bottom: 23px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 11px; }
.article-body { padding-top: 23px; color: #334c48; font-size: 14px; line-height: 2; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #fff; }
.login-intro { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: 55px 64px; overflow: hidden; color: #fff; background: var(--green-dark); }
.brand-light .brand-mark { color: var(--green-dark); }
.login-copy { position: relative; z-index: 2; margin: auto 0; }
.login-copy h1 { margin: 13px 0 24px; font-family: Georgia, "Songti SC", serif; font-size: clamp(42px, 5vw, 66px); font-weight: 500; line-height: 1.25; letter-spacing: -.04em; }
.login-copy > p:last-child { max-width: 500px; color: #afcac3; font-size: 14px; line-height: 1.9; }
.login-pattern { position: absolute; right: -140px; bottom: -160px; width: 520px; height: 520px; border: 1px solid rgba(217,184,117,.24); border-radius: 50%; box-shadow: 0 0 0 80px rgba(217,184,117,.035), 0 0 0 160px rgba(217,184,117,.025); }
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-card { width: min(390px, 100%); }
.login-card h2 { margin: 6px 0 30px; font-family: Georgia, "Songti SC", serif; font-size: 28px; font-weight: 600; }
.login-card label { display: block; margin: 15px 0 7px; font-size: 12px; font-weight: 700; }
.login-card .btn { margin-top: 22px; }
.login-help { margin-top: 18px; color: var(--muted); font-size: 10px; text-align: center; }
.login-mobile-brand { display: none; }

@media (max-width: 1050px) {
  .sidebar { width: 210px; }
  .main-content { margin-left: 210px; padding: 40px 30px 70px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .bill-summary { grid-template-columns: 1fr 1fr; }
  .bill-summary > div:nth-child(3) { border-left: 0; border-top: 1px solid rgba(255,255,255,.1); }
  .bill-summary > div:nth-child(4) { border-top: 1px solid rgba(255,255,255,.1); }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 76px 16px 88px; }
  .mobile-header { position: fixed; inset: 0 0 auto; z-index: 12; display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 17px; color: #fff; background: var(--green-dark); }
  .mobile-header .brand-mark { width: 31px; height: 31px; font-size: 19px; }
  .mobile-header .brand strong { font-size: 16px; }
  .mobile-header > span { color: #b7d0c9; font-size: 11px; }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 12; display: grid; grid-template-columns: repeat(5, 1fr); height: 68px; padding: 7px 5px max(7px, env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(18,61,55,.07); }
  .mobile-nav a { display: grid; place-items: center; align-content: center; gap: 2px; color: var(--muted); font-size: 9px; }
  .mobile-nav a span { font-size: 19px; }
  .mobile-nav .mobile-create span { display: grid; place-items: center; width: 43px; height: 43px; margin-top: -22px; color: #fff; background: var(--green); border: 4px solid #fff; border-radius: 50%; font-size: 24px; box-shadow: 0 5px 16px rgba(18,61,55,.25); }
  .page-head { align-items: flex-start; margin-bottom: 22px; }
  .page-head h1 { font-size: 30px; }
  .page-head .btn { min-height: 38px; padding: 0 12px; font-size: 11px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { min-height: 108px; padding: 16px; }
  .stat-card:last-child { grid-column: 1 / -1; }
  .stat-icon { width: 42px; height: 42px; flex-basis: 42px; border-radius: 12px; font-size: 20px; }
  .stat-card strong { font-size: 26px; }
  .content-grid, .detail-grid, .order-detail-grid { grid-template-columns: 1fr; gap: 0; }
  .panel { padding: 19px; border-radius: 15px; }
  .card-grid { grid-template-columns: 1fr; }
  .form-panel { grid-template-columns: 1fr; }
  .form-group.full, .form-actions.full { grid-column: auto; }
  .inline-form { grid-template-columns: 1fr; }
  .responsive-table table { min-width: 720px; }
  .notice-card { grid-template-columns: 57px 1fr; gap: 13px; padding: 17px; }
  .notice-card .arrow { display: none; }
  .notice-card time { min-height: 58px; }
  .article { padding: 26px 21px; }
  .article h1 { font-size: 27px; }
  .login-page { grid-template-columns: 1fr; background: var(--paper); }
  .login-intro { display: none; }
  .login-panel { min-height: 100vh; padding: 25px; }
  .login-card { padding: 28px 24px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
  .login-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 35px; }
  .bill-summary > div { padding: 18px; }
  .bill-summary strong { font-size: 21px; }
}

@media (max-width: 430px) {
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card:last-child { grid-column: auto; }
  .page-head { display: block; }
  .page-head > .btn { margin-top: 16px; }
  .bill-summary { grid-template-columns: 1fr 1fr; }
  .bill-summary > div { padding: 15px; }
  .bill-summary strong { font-size: 18px; }
}
