:root {
  color-scheme: light;
  --ink: #25342a;
  --muted: #566359;
  --green: #344a39;
  --line: #dbe3db;
  --paper: #f2f5ef;
  --white: #fff;
  --accent: #e1ecde;
  font-family: system-ui, 'Microsoft YaHei', 'PingFang SC', sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.12; letter-spacing: -.04em; }
h2 { font-size: 1.25rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button { padding: .68rem 1rem; border: 1px solid #cbd6ca; border-radius: .6rem; background: #fff; font-weight: 650; white-space: nowrap; cursor: pointer; }
button:disabled { opacity: .65; cursor: wait; }
button:hover:not(:disabled) { background: #eaf2e8; }
.primary { background: var(--green); color: #fff; border-color: var(--green); }
.primary:hover:not(:disabled) { background: #243b2b; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #749d76; outline-offset: 2px; }
.block { width: 100%; }
input, select, textarea { min-width: 0; width: 100%; padding: .72rem .8rem; border: 1px solid #cbd7cc; border-radius: .55rem; background: #fbfdfb; }
label { font-size: .9rem; font-weight: 650; }
.error { color: #983d31; font-size: .9rem; }
.error:empty { display: none; }
.hint { color: var(--muted); font-size: .88rem; line-height: 1.55; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: .95rem; }

.login { display: grid; grid-template-columns: 1.15fr 1fr; max-width: 58rem; min-height: 28rem; margin: min(12vh, 6rem) auto 2rem; border-radius: 1.2rem; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 25px 80px #263c2820; }
.login-intro { display: grid; align-content: center; gap: 1.25rem; padding: clamp(2rem, 5vw, 4rem); background: var(--green); color: #f8fcf7; }
.login-intro h1 { font-size: clamp(2.4rem, 6vw, 3.65rem); }
.login-intro p { max-width: 20rem; line-height: 1.65; color: #dce8dc; }
.login-form { display: grid; grid-template-columns: 1fr; align-content: center; gap: .65rem; padding: clamp(1.4rem, 4vw, 3.4rem); border: 0; border-radius: 0; }
.login-form h2 { margin-bottom: .6rem; }
.login-form .block { margin-top: .6rem; }

.workspace { display: grid; grid-template-columns: 14rem minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.15rem; padding: 1.15rem 1rem; background: #22362a; color: #eef4eb; overflow-y: auto; }
.identity { display: flex; align-items: center; gap: .65rem; font-weight: 750; letter-spacing: .06em; }
.identity small { display: block; margin-top: .16rem; color: #bed0c0; font-size: .8rem; font-weight: 500; letter-spacing: 0; }
.brand-sign { display: grid; place-items: center; min-width: 2.65rem; height: 2.65rem; border: 1px solid #a9c6ab; border-radius: .65rem; }
.sidebar nav { display: grid; gap: .16rem; }
.nav-group { margin: .5rem .82rem .08rem; color: #afc3b2; font-size: .76rem; font-weight: 600; }
.sidebar button { padding: .49rem .82rem; text-align: left; color: inherit; background: transparent; border-color: transparent; }
.sidebar button:hover:not(:disabled), .sidebar button.selected { background: #4a6650; color: #fff; }
.sidebar-end { display: grid; margin-top: auto; color: #c2d2c4; font-size: .88rem; }
.sidebar-end span { padding: .3rem 1rem; }

.main { width: 100%; max-width: 88rem; margin-inline: auto; padding: clamp(1.3rem, 4vw, 3.5rem); }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; }
.section-header p { margin-top: .42rem; color: var(--muted); line-height: 1.45; }
.flash { padding: .7rem .92rem; margin-bottom: 1rem; background: #dcecdc; border-radius: .5rem; }
.flash.is-error { color: #86392e; background: #f8e5e0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stats article { padding: 1.15rem; border: 1px solid var(--line); border-radius: .75rem; background: #fafff8; }
.stats span { color: var(--muted); }
.stats strong { display: block; margin-top: .3rem; font-size: 1.9rem; line-height: 1.1; }
.filters { display: grid; grid-template-columns: auto minmax(10rem, 1fr) auto minmax(7rem, 10rem) auto; gap: .65rem; align-items: center; padding: 1rem; border-bottom: 1px solid var(--line); }
.table-wrap { overflow: auto; }
table { width: 100%; min-width: 40rem; border-collapse: collapse; text-align: left; }
th, td { padding: .83rem 1rem; border-bottom: 1px solid #edf0eb; }
th { font-size: .88rem; color: var(--muted); background: #f8faf7; }
td .secondary { display: block; margin-top: .2rem; color: var(--muted); font-size: .85rem; }
.badge { display: inline-block; padding: .28rem .55rem; border-radius: 100vw; background: #e8ede6; color: #3a4f40; font-size: .84rem; white-space: nowrap; }
.badge.new { background: #ffead2; color: #7a4113; }
.badge.scheduled, .badge.published { background: #d7e9d8; color: #2e5734; }
.badge.cancelled { background: #f5e8e3; color: #783b33; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.dashboard-heading { align-items: flex-end; margin-bottom: 1.35rem; }
.dashboard-date { margin-bottom: .5rem; color: #37694c; font-size: .9rem; font-weight: 650; }
.dashboard-stats { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: .8rem; margin-bottom: 1rem; }
.dashboard-stats button { min-width: 0; min-height: 6.25rem; padding: .9rem 1.05rem; text-align: left; border-radius: .85rem; }
.dashboard-stats button:first-child { background: #244632; color: white; border-color: #244632; }
.dashboard-stats button:first-child:hover { background: #30583e; }
.dashboard-stats .warning-card { background: #fff1e2; border-color: #efcfae; color: #823b17; }
.dashboard-stats span, .dashboard-stats strong { display: block; }
.dashboard-stats span { white-space: normal; font-size: .86rem; }
.dashboard-stats strong { font-size: 2rem; font-variant-numeric: tabular-nums; margin-top: .2rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.22fr) minmax(0,1fr); gap: 1rem; align-items: start; }
.desk-panel { padding: 1rem; min-width: 0; }
.desk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .7rem; padding-bottom: .65rem; }
.desk-head h2 { font-size: 1.13rem; }
.desk-head p { margin-top: .35rem; }
.period-label { display: grid; gap: .24rem; flex: 0 0 auto; color: var(--muted); font-size: .75rem; }
.period-label select { padding: .34rem .53rem; font-size: .88rem; }
.desk-link { border: 0; padding: .34rem .5rem; font-size: .86rem; color: #2c5a40; }
.desk-row { display: flex; justify-content: space-between; align-items: center; gap: .7rem; width: 100%; min-height: 2.6rem; padding: .65rem .35rem; border: 0; border-top: 1px solid #e8ede7; border-radius: 0; text-align: left; white-space: normal; }
.desk-row-label { display: grid; gap: .22rem; }
.desk-row-label.right { text-align: right; }
.desk-row-label small { color: var(--muted); }
.desk-row strong { font-size: .9rem; }
.queue-item { min-height: 3.45rem; }
.dashboard-empty { padding: 1.25rem .4rem; font-size: .9rem; }
.trend-bars { height: 12.75rem; display: flex; align-items: stretch; gap: clamp(2px,.45vw,8px); }
.trend-day { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) 1.85rem; }
.trend-track { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0 calc(25% - 1px), #edf1ec calc(25% - 1px) 25%); }
.trend-fill { display: block; margin-inline: auto; width: 78%; max-width: 2.6rem; border-radius: .3rem .3rem 0 0; background: #4c775b; text-align: center; color: white; font-size: .73rem; min-height: 2px; }
.trend-fill.zero { background: #dce5da; }
.trend-date { justify-self: center; margin-top: .32rem; width: max-content; font-size: .71rem; color: var(--muted); position: relative; }
.trend-day:first-child .trend-date { justify-self: start; }
.trend-day:last-child .trend-date { justify-self: end; }
.service-rollup { display: grid; gap: .6rem; }
.service-row { display: grid; grid-template-columns: minmax(4.8rem, auto) minmax(0,1fr) auto; align-items: center; gap: .6rem; font-size: .87rem; }
.service-row progress { width: 100%; height: .72rem; accent-color: #4c775b; }
.appointment-filters { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .7rem; padding: 1rem; border-bottom: 1px solid var(--line); }
.appointment-filters label, .appointment-fields label, .manual-grid label, .list-toolbar label { display: grid; gap: .3rem; }
.appointment-filters .action-group { grid-column: 1 / -1; }
.appointment-filters input, .appointment-filters select { padding: .53rem .65rem; }
.list-toolbar { display: flex; justify-content: space-between; align-items: flex-end; padding: .75rem 1rem; gap: .6rem; }
.list-toolbar p { align-self: center; }
.list-pager { display: flex; justify-content: flex-end; align-items: center; padding: .7rem 1rem; gap: .6rem; font-size: .87rem; }
.list-pager button, .list-toolbar button { padding: .5rem .64rem; font-size: .86rem; }
.appointment-fields, .manual-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }
.appointment-fields { grid-template-columns: repeat(3,minmax(0,1fr)); }
#appointment-dialog { width: min(46rem, calc(100% - 1.4rem)); }
.history-head { display: flex; justify-content: space-between; align-items: center; }
.history-head h3 { margin: .45rem 0; font-size: 1rem; }
.history-entry { padding: .68rem .7rem; margin-top: .4rem; border-left: 3px solid #b8caba; background: #f8faf7; }
.history-entry time { margin-left: .65rem; }
.follow-note { margin-top: .35rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.overdue, td .overdue { color: #9e4827; }
@media (max-width: 940px) {
  .dashboard-stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: minmax(0,1fr); }
  .appointment-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .dashboard-stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem; }
  .dashboard-stats button { min-height: 5.2rem; padding: .65rem; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .appointment-fields { grid-template-columns: minmax(0,1fr); }
  .nav-group { display: none; }
}

.panorama-grid { display: grid; grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr); align-items: start; gap: 1rem; }
.upload, .dialog-form { padding: 1.15rem; }
.upload, .dialog-form { display: grid; gap: .65rem; }
.upload h2 { margin-bottom: .42rem; }
.upload .primary { margin-top: .45rem; }
.scene-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: .8rem; }
.scene { overflow: hidden; }
.scene img { width: 100%; height: 9rem; display: block; object-fit: cover; background: #354639; }
.scene-copy { padding: .95rem; }
.scene-copy h2 { font-size: 1.05rem; }
.scene-meta { display: flex; align-items: center; justify-content: space-between; gap: .42rem; color: var(--muted); font-size: .85rem; margin: .45rem 0 .7rem; }
.scene-actions { display: flex; gap: .45rem; flex-wrap: wrap; }

dialog { width: min(40rem, calc(100% - 1.4rem)); max-height: calc(100% - 1.4rem); overflow: auto; border: 1px solid var(--line); border-radius: 1rem; background: #fff; color: var(--ink); padding: 0; }
dialog::backdrop { background: #1320199c; }
dialog .section-header { margin-bottom: .2rem; }
.quiet { background: #f0f5ee; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: .5rem .9rem; margin: 0 0 .55rem; padding: .8rem; border-radius: .55rem; background: #f4f8f2; overflow-wrap: anywhere; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.toggle { display: flex; align-items: center; gap: .55rem; margin: .3rem 0; }
.toggle input { width: 1.05rem; height: 1.05rem; }
.viewer-dialog { width: min(56rem, calc(100% - 1.4rem)); }
#viewer { display: block; width: 100%; height: clamp(16rem, 54vh, 34rem); border-radius: .65rem; background: #242d26; cursor: grab; touch-action: none; }
#viewer:active { cursor: grabbing; }
.viewer-controls { display: flex; align-items: center; gap: .5rem; }
.viewer-controls p { flex: 1; color: var(--muted); }
.content-filters { display: grid; grid-template-columns: minmax(12rem, 1.6fr) repeat(5, minmax(0, 1fr)) auto; align-items: end; gap: .55rem; padding: 1rem; border-bottom: 1px solid var(--line); }
.content-filters label, .dialog-form label:not(.toggle), .contact-form label { display: grid; gap: .35rem; }
.content-filters select { padding-inline: .48rem; }
.media-cell { display: flex; align-items: center; gap: .65rem; }
.media-thumb { width: 4rem; height: 3rem; object-fit: cover; border-radius: .4rem; background: #e6ede5; }
.customer-avatar { width: 2.5rem; height: 2.5rem; object-fit: cover; border-radius: 50%; }
.member-person, .member-pager { display: flex; align-items: center; gap: .65rem; }
.member-pager { justify-content: flex-end; padding: 1rem; }
.member-fields { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1rem; margin-block: 1.15rem; }
.member-fields dt { color: var(--muted); }
.member-fields dd { margin: 0; overflow-wrap: anywhere; }
.member-history { display: grid; gap: .65rem; padding-left: 1.2rem; }
.member-history button { margin-left: .6rem; padding: .35rem .5rem; font-size: .82rem; }
.branding-preview { display: flex; align-items: center; min-height: 5rem; padding: .7rem 1rem; background: #f8f6ef; border-radius: .6rem; }
.branding-preview img { display: block; width: min(100%, 16rem); max-height: 4rem; object-fit: contain; object-position: left center; }
#branding-form .branding-toggle { display: flex; align-items: center; gap: .5rem; }
.branding-points-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.branding-point { display: grid; grid-template-columns: 1fr 1.35fr auto auto; align-items: end; gap: .5rem; margin: .5rem 0; }
#branding-form .branding-default { display: flex; align-items: center; gap: .3rem; min-height: 2.7rem; white-space: nowrap; }
@media (max-width: 600px) { .branding-point { grid-template-columns: 1fr 1fr; } }
.action-group { display: flex; gap: .4rem; }
.action-group button { padding: .44rem .6rem; font-size: .87rem; }
.editor-dialog { width: min(49rem, calc(100% - 1.4rem)); }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.editor-actions { position: sticky; bottom: -1.15rem; display: grid; gap: .55rem; padding: .75rem 1.15rem 1.15rem; margin: .35rem -1.15rem -1.15rem; border-top: 1px solid var(--line); background: #fff; }
.wide { grid-column: 1 / -1; }
.asset-preview { display: flex; flex-wrap: wrap; gap: .65rem; }
.asset-preview:empty { display: none; }
.asset-item { display: grid; gap: .3rem; justify-items: center; font-size: .83rem; color: var(--muted); }
.asset-item img { width: 6rem; height: 4.35rem; object-fit: cover; border-radius: .35rem; }
.asset-item button { padding: .28rem .4rem; font-size: .82rem; }
.contact-form { max-width: 44rem; padding: 1.2rem; margin-bottom: 1rem; display: grid; gap: .9rem; }
.contact-form .primary { justify-self: start; }
.clip-dialog { width: min(33rem, calc(100% - 1.4rem)); }
#clip-preview { display: block; width: min(100%, 26rem, 42vh); aspect-ratio: 9 / 16; margin: 0 auto; object-fit: contain; background: #203627; border-radius: .55rem; }

@media (max-width: 850px) {
  .workspace { grid-template-columns: 10rem minmax(0, 1fr); }
  .filters { grid-template-columns: auto minmax(0, 1fr); }
  .content-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .panorama-grid { grid-template-columns: 1fr; }
}
@media (max-width: 610px) {
  .login { grid-template-columns: 1fr; margin: .8rem; }
  .login-intro { gap: .7rem; }
  .workspace { display: block; }
  .sidebar { position: static; height: auto; gap: .7rem; padding: .85rem; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .sidebar nav .nav-group { display: none; }
  .sidebar-end { display: flex; justify-content: space-between; align-items: center; }
  .stats { grid-template-columns: 1fr 1fr; }
  .section-header { flex-wrap: wrap; }
  .content-filters, .editor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
