:root {
  font: 14px/1.6 "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  color: #443c2d;
  background: #f7f5ef;
  --paper: #fffdf8;
  --line: #e7dfcf;
  --muted: #786d59;
  --gold: #aa7516;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header { min-height: 60px; display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 10px 30px; background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead, .side-brand { display: flex; align-items: center; gap: 11px; }
.masthead strong, .side-brand strong { font-size: 18px; white-space: nowrap; }
.masthead span, #page-name, small { color: var(--muted); }
.side-brand { padding: 4px 5px 25px; }
.side-brand small { display: block; font-size: 11px; letter-spacing: .12em; }
main { max-width: 1560px; padding: 18px 30px 44px; margin: 0 auto; }
.authenticated main { max-width: none; padding-left: 240px; }
.authenticated header { margin-left: 210px; font-size: 13px; }
.authenticated header .masthead { display: none; }
#workspace { max-width: 1500px; margin: 0 auto; }
nav { position: fixed; inset: 0 auto 0 0; width: 210px; overflow-y: auto; padding: 22px 16px; background: var(--paper); border-right: 1px solid var(--line); }
nav button { display: flex; justify-content: flex-start; gap: 10px; width: 100%; margin: 0 0 6px; padding: 10px 12px; border: 1px solid transparent; background: transparent; color: #776b58; }
nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
nav button.active { color: #835a12; background: #fbefd3; border-color: #e8d3a1; font-weight: 650; }
.section-heading, .card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading { margin: 17px 0 20px; }
h1 { font-size: 27px; line-height: 1.35; margin: 0; }
h2 { font-size: 18px; margin: 0 0 16px; line-height: 1.45; }
p { color: var(--muted); margin: 8px 0 15px; }
.section-heading p { font-size: 13px; margin: 5px 0 0; }
.card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 11px; padding: 20px 22px; margin: 0 0 18px; box-shadow: 0 4px 20px #45351b05; }
.card-heading { margin-bottom: 14px; }
.card-heading h2 { margin: 0; }
.work-columns { display: grid; grid-template-columns: minmax(340px,1.25fr) minmax(260px,.85fr); gap: 18px; align-items: start; }
.directory-columns { grid-template-columns: minmax(340px,1.35fr) minmax(300px,.85fr); }
.pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 16px; }
.toolbar, .row { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.toolbar { align-items: center; }
.toolbar label, .row label { margin-bottom: 0; }
.row { margin-bottom: 14px; }
.row label { flex: 1; min-width: 165px; }
label { display: block; color: #675b49; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
label small { display: block; font-weight: normal; font-size: 12px; margin-top: 5px; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { display: block; width: 100%; min-width: 0; margin-top: 5px; background: #fff; padding: 8px 10px; border: 1px solid #d7cdbb; border-radius: 7px; font-weight: normal; }
input::placeholder, textarea::placeholder { color: #918775; }
input:read-only, textarea:read-only { background: #f6f3eb; }
textarea { resize: vertical; font: 13px/1.55 Consolas, monospace; }
button { display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; max-width: 100%; cursor: pointer; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
button:hover { border-color: #c89b46; background: #fff4dc; }
button.primary { background: linear-gradient(115deg,#e3ac31,#c88e1f); border-color: #c79122; color: #301f05; font-weight: 650; }
button.primary:hover { background: #edb93e; }
button.secondary { color: #7b5415; background: #fff5db; border-color: #e2c58a; }
button.danger { color: #a43e30; background: #fff5f2; border-color: #e7b9af; }
button.text-button { background: transparent; border: 0; color: #805816; padding: 0 0 5px; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }
#push-store-field label { margin-bottom: 6px; }
button:disabled { opacity: .48; cursor: default; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid #ac761c; outline-offset: 2px; }
#status, #push-role-note, #directory-state { border: 1px solid #e8dcc0; padding: 8px 13px; border-radius: 7px; font-size: 13px; color: #716044; background: #fff8e8; white-space: pre-wrap; overflow-wrap: anywhere; }
#status { margin: 0 0 14px; }
#status.error { color: #8d3428; border-color: #e6b9ac; background: #fff0eb; }
#login-panel { max-width: 410px; margin: clamp(40px,10vh,110px) auto 32px; padding: 27px; }
#login-form button, #push-publish { width: 100%; }
.range-box { min-width: 0; padding: 16px 0 0; margin: 23px 0 8px; border: 0; border-top: 1px solid var(--line); }
.range-box legend { padding: 0 14px 0 0; font-weight: 650; font-size: 17px; }
.range-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.range-picker label { flex: 1; display: inline-flex; gap: 7px; justify-content: center; align-items: center; margin: 0; padding: 8px 5px; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; white-space: nowrap; }
.range-picker label:has(:checked) { border-color: #dcb66b; background: #fcf0d4; color: #805816; }
.range-picker input { display: inline; width: 14px; height: 14px; margin: 0; accent-color: #ae7919; }
.icon-sample { display: flex; gap: 13px; align-items: center; padding: 16px; margin-bottom: 18px; color: #fff; background: #171717; border-radius: 8px; overflow-wrap: anywhere; }
.icon-sample canvas { flex: none; width: 54px; height: 54px; border-radius: 9px; background: #252525; }
.recipients { max-height: 300px; overflow-y: auto; list-style: none; padding: 0; margin: 10px 0 15px; }
.recipients li { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 8px 2px; }
.recipients small, td small { display: block; font: 12px/1.6 Consolas, monospace; overflow-wrap: anywhere; }
.recipients span { white-space: nowrap; color: var(--muted); }
details { padding: 10px 12px; margin: 12px 0; border: 1px solid var(--line); border-radius: 7px; }
summary { cursor: pointer; color: #756344; font-weight: 600; }
details[open] > summary { margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
.table-scroll { overflow: auto; }
td, th { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
th { font-size: 12px; font-weight: 550; color: var(--muted); background: #faf7ef; }
td button { font-size: 12px; margin: 2px 6px 2px 0; padding: 4px 8px; }
#code-panel, #preview-result article, #activity-preview-result article { padding: 12px 15px; background: #faf4e5; border-radius: 7px; margin: 12px 0; }
pre { background: #f4f1e8; padding: 13px; max-height: 480px; white-space: pre-wrap; overflow: auto; overflow-wrap: anywhere; }
@media (max-width: 1000px) {
  .authenticated main { padding-left: 194px; padding-right: 18px; }
  .authenticated header { margin-left: 176px; }
  nav { width: 176px; padding: 16px 10px; }
  .side-brand strong { font-size: 16px; }
  .work-columns { grid-template-columns: minmax(0,1fr) minmax(230px,.8fr); gap: 12px; }
  .card { padding: 16px; }
}
@media (max-width: 760px) {
  header { min-height: 46px; padding: 7px 14px; }
  .authenticated header { margin-left: 0; }
  main, .authenticated main { padding: 12px 14px 22px; }
  nav { position: static; display: flex; gap: 5px; flex-wrap: wrap; width: auto; padding: 0; border: 0; background: transparent; }
  nav button { width: auto; margin: 0; padding: 6px 9px; font-size: 13px; }
  .side-brand, nav svg { display: none; }
  .section-heading { margin: 16px 0 12px; }
  h1 { font-size: 24px; }
  .work-columns { grid-template-columns: minmax(0,1fr); }
  .card { margin-bottom: 6px; }
  td, th { padding: 8px 5px; }
  .row label { min-width: 100%; }
  #store-toolbar { margin: 15px 0; }
}
@media (max-width: 430px) {
  .pair { grid-template-columns: minmax(0,1fr); }
  .range-picker { gap: 4px; }
  .range-picker label { font-size: 12px; }
  .card { padding: 13px; }
}

/* Shared shdesk.date editor: the same file serves local disks and cloud fallback. */
#tab-shdesk .section-heading { align-items: flex-start; }
#tab-shdesk .section-heading p { margin: 5px 0 0; }
.sd-connection { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-left: 4px solid #c28d2c; }
.sd-connection strong { font-size: 16px; }
.sd-connection p { margin: 6px 0; }
.sd-connection small { display: block; max-width: 750px; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; }
.sd-versions { display: flex; gap: 18px; flex: none; color: var(--muted); font-size: 12px; }
.sd-versions b { display: block; color: #342e22; font-size: 23px; margin-top: 5px; font-weight: 650; }
.sd-action-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.sd-actions p { margin: 10px 0 0; font-size: 12px; }
.sd-small-note { color: var(--muted); }
.sd-unsaved { color: #9b5c09; font-weight: 600; }
.sd-scope-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; }
.sd-scope-row label { min-width: 250px; flex: 1; margin: 0; }
.sd-scope-row select { margin-bottom: 0; }
#sd-scope-note { margin: 10px 0 0; font-size: 12px; }
#sd-store-form { padding-top: 20px; margin-top: 16px; border-top: 1px solid var(--line); }
.sd-editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.sd-editor-layout > div { min-width: 0; }
.sd-editor-layout .card-heading h2 { margin: 0; }
.sd-editor-layout .card-heading { margin-bottom: 14px; }
#sd-activity-count { color: var(--muted); font-size: 11px; display: block; margin-top: 4px; }
.sd-item { padding: 14px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 14px; }
.sd-item-info { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.sd-item-info strong { font-size: 14px; display: inline-block; margin-right: 9px; }
.sd-item-info small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.sd-item-meta { font-size: 11px; color: #826c43; }
.sd-item-info .sd-item-target { color: #554a35; }
.sd-item-buttons { display: flex; flex: none; gap: 5px; }
.sd-item-buttons button, .sd-removed button { padding: 5px 9px; font-size: 12px; }
.sd-empty-note { padding: 20px 12px; text-align: center; background: #faf7ef; border-radius: 8px; color: var(--muted); }
.sd-edit-form { margin-top: 16px; padding: 18px; background: #faf7ef; border: 1px solid #e4d7be; border-radius: 8px; }
.sd-edit-form h2 { font-size: 16px; }
.sd-edit-form small { font-size: 11px; font-weight: 400; line-height: 1.65; }
.sd-form-note { display: block; margin-top: 8px; color: var(--muted); }
.sd-removed { margin-top: 10px; padding: 11px; border-radius: 6px; background: #f5f1e8; display: flex; flex-wrap: wrap; gap: 7px; }
.sd-removed > small { width: 100%; color: var(--muted); }
.sd-preview { position: sticky; top: 20px; padding: 19px; }
.sd-preview h2 { margin-bottom: 4px; }
.sd-preview p { font-size: 11px; }
.sd-demo-grid { width: 150px; margin: 18px auto 10px; padding: 17px; border-radius: 13px; background: #4a4a48; display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px 16px; }
.sd-demo-grid span { display: block; width: 25px; height: 25px; border-radius: 6px; background: #c8c4b8; opacity: .55; }
.sd-preview-icons { min-height: 118px; background: #111; border-radius: 8px; padding: 20px 9px 14px; display: flex; align-items: flex-start; justify-content: center; gap: 13px; }
.sd-preview-icon { position: relative; min-width: 0; width: 66px; flex: 0 1 66px; text-align: center; color: #fff; font-size: 11px; line-height: 1.5; }
.sd-preview-icon canvas { display: block; width: 56px; max-width: 100%; height: auto; border-radius: 10px; margin: 0 auto 7px; }
.sd-preview-icon > span { display: block; overflow-wrap: anywhere; }
.sd-preview-badge { position: absolute; top: -10px; right: -8px; background: #e94930; padding: 2px 5px; border: 1px solid #ffaf6c; border-radius: 5px; color: #fff; font-size: 11px; white-space: nowrap; max-width: 90px; overflow: hidden; }
.sd-preview-help { font-size: 11px; line-height: 1.8; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--line); }
@media (max-width: 1230px) {
  .sd-editor-layout { grid-template-columns: minmax(0, 1fr); }
  .sd-preview { position: static; max-width: 350px; }
  .sd-connection { align-items: flex-start; }
}
@media (max-width: 760px) {
  .sd-connection { display: block; }
  .sd-versions { margin-top: 13px; }
  .sd-scope-row label { min-width: 100%; }
  .sd-item { align-items: flex-start; flex-direction: column; gap: 8px; }
  .sd-edit-form { padding: 12px; }
  #tab-shdesk .section-heading { gap: 10px; }
}
