:root {
  font-family:"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  color:#28342f;
  background:#f5f3ee;
  font-size:14px;
  --ink:#253b33;
  --accent:#42634f;
  --muted:#7c827a;
  --line:#e3e4db;
  --paper:#fffefa
}
* {
  box-sizing:border-box
}
body {
  margin:0
}
button,input,textarea,select {
  font:inherit
}
button,a,input,textarea,select {
  touch-action:manipulation
}
button,a {
   -webkit-tap-highlight-color:transparent
}
button {
  cursor:pointer
}
button:disabled {
  cursor:default;
  opacity:.45
}
button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible {
  outline:3px solid #9cbda8;
  outline-offset:3px
}
button {
  border:0;
  background:none;
  color:inherit
}
a {
  color:var(--ink)
}
[hidden] {
  display:none!important
}
h1,h2,h3,p {
  margin-top:0
}
h1,h2,h3,.brand,.nav-note {
  font-family:"Noto Serif SC","Songti SC",SimSun,serif
}
h1 {
  font-size:34px;
  letter-spacing:1px;
  line-height:1.4;
  margin-bottom:9px
}
h2 {
  font-size:21px;
  font-weight:600;
  letter-spacing:.5px;
  margin:0
}
h3 {
  font-size:20px;
  font-weight:500;
  margin-bottom:8px
}
p {
  line-height:1.8;
  color:#7a8078
}
.eyebrow {
  font-size:10px;
  letter-spacing:2.8px;
  font-weight:600;
  color:#899386;
  margin-bottom:17px
}
.topbar {
  height:88px;
  padding:0 44px;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:#f9f8f3
}
.brand {
  text-decoration:none;
  font-size:24px;
  font-weight:600;
  display:flex;
  align-items:center;
  gap:19px;
  letter-spacing:2px
}
.theme-tie-list { list-style:none; padding:0; margin:14px 0; }
.theme-tie-item { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; padding:10px 0; border-bottom:1px solid var(--line, #d7d3ca); }
.theme-tie-item > span { min-width:0; overflow-wrap:anywhere; }
.theme-tie-item small { display:block; font-size:11px; opacity:.7; }
.theme-tie-actions { display:flex; flex-wrap:wrap; gap:6px; }
.theme-tie-actions button { padding:6px 9px; font-size:12px; }
.brand-logo {
  display:block;
  width:42px;
  height:42px;
  flex-shrink:0;
  object-fit:contain;
  border-radius:10px
}
.login-logo {
  display:block;
  width:72px;
  height:72px;
  object-fit:contain;
  border-radius:16px;
  margin-bottom:18px
}
.brand span {
  font:10px "Segoe UI",sans-serif;
  letter-spacing:3px;
  color:#86917f;
  border-left:1px solid #cfd4c9;
  padding:4px 0 4px 18px
}
.top-right {
  display:flex;
  align-items:center;
  gap:25px
}
.connection {
  font-size:12px;
  color:#6c7e6e
}
.shell {
  display:grid;
  grid-template-columns:202px minmax(0,1fr);
  max-width:1680px;
  margin:auto
}
.navigation {
  padding:38px 18px 0 26px;
  border-right:1px solid var(--line);
  min-height:calc(100vh - 88px)
}
.nav-item {
  width:100%;
  text-align:left;
  padding:15px 18px;
  display:block;
  font-weight:600;
  margin-bottom:9px;
  border-radius:7px;
  color:#758072
}
.nav-item span {
  display:block;
  font-size:10px;
  letter-spacing:.5px;
  font-weight:400;
  margin-top:7px;
  color:#8d9689
}
.nav-item.active {
  background:#e7ecdf;
  color:#2b4935
}
.nav-item.active span {
  color:#75886b
}
.nav-note {
  font-size:17px;
  line-height:2.2;
  letter-spacing:4px;
  color:#a0a795;
  margin:75px 0 0 20px
}
main {
  min-width:0;
  padding:42px 42px 0
}
.page-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:27px
}
.page-heading p {
  margin:0;
  font-size:13px
}
.edition {
  font-size:11px;
  letter-spacing:1px;
  color:#8a927f;
  border-bottom:1px solid #b6c1ab;
  padding-bottom:8px
}
.date-toolbar {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:25px
}
.date-picker {
  display:flex;
  align-items:center;
  gap:7px
}
.date-label input {
  font-size:15px;
  width:163px;
  padding:10px 8px;
  background:transparent;
  border:0;
  font-weight:600
}
.square {
  border:1px solid #dedfd5;
  border-radius:6px;
  padding:8px 11px;
  background:#faf9f4;
  font-size:12px
}
.quiet {
  padding:9px 6px;
  color:#788276;
  font-size:12px
}
.status {
  font-size:11px;
  color:#7c8d76
}
.workspace {
  display:grid;
  grid-template-columns:minmax(320px,1.05fr) minmax(260px,.95fr);
  gap:32px;
  align-items:start
}
.editor-stack {
  display:grid;
  gap:20px;
  padding-bottom:28px
}
.paper {
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:11px;
  padding:24px
}
.section-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px
}
.section-heading>div {
  display:flex;
  align-items:center;
  gap:12px
}
.section-number {
  font:italic 15px Georgia,serif;
  color:#a4af98
}
.hint {
  font-size:11px;
  line-height:1.9;
  color:#697360;
  margin:10px 0
}
.subtle {
  font-size:11px;
  color:#999f91
}
.small-button {
  background:#edf1e6;
  border:1px solid #dce3d2;
  padding:8px 12px;
  border-radius:6px;
  font-size:11px;
  color:#526745;
  white-space:nowrap;
  text-decoration:none;
  display:inline-block
}
.small-button:hover {
  background:#e3eadb
}
.task {
  border:1px solid #e2e5da;
  border-radius:7px;
  background:#fffefa;
  margin-top:12px;
  padding:13px
}
.task-main {
  display:flex;
  gap:11px;
  align-items:flex-start
}
.task-main input[type=checkbox] {
  margin-top:10px;
  flex-shrink:0;
  width:17px;
  height:17px;
  accent-color:#537652
}
.task-title {
  width:100%;
  min-width:0;
  border:0!important;
  border-bottom:1px solid transparent!important;
  background:none!important;
  padding:6px 0!important;
  font-size:14px!important
}
.task-title:focus {
  border-bottom-color:#c5d0bd!important;
  outline:none
}
.task.important {
  border-color:#aebfa2;
  border-left:3px solid #69825b
}
.task.completed .task-title {
  text-decoration:line-through;
  color:#99a08f
}
.task-actions {
  display:flex;
  gap:13px;
  align-items:center;
  padding-left:28px;
  margin-top:6px;
  flex-wrap:wrap
}
.task-actions button {
  font-size:10px;
  padding:4px 0;
  color:#89927f
}
.task-actions button.active {
  color:#486735;
  font-weight:600
}
.task-actions .delete {
  margin-left:auto
}
.task-actions button:hover {
  color:#2e4e25
}
.task-details {
  padding:5px 0 0 28px
}
.task-details label {
  font-size:10px
}
.task-details input {
  font-size:12px;
  padding:7px 9px
}
.task.hidden-task {
  opacity:.6
}
.empty {
  text-align:center;
  border:1px dashed #dce1d3;
  border-radius:7px;
  padding:34px 12px;
  margin-top:18px
}
.empty p {
  font-size:12px
}
.empty h3 {
  font-size:18px
}
.primary,.secondary {
  border-radius:7px;
  padding:11px 17px;
  font-size:12px;
  white-space:nowrap;
  line-height:1.4
}
.primary {
  background:var(--accent);
  color:#fffdf6;
  border:1px solid var(--accent)
}
.primary:hover:enabled {
  background:#344e3f
}
.secondary {
  border:1px solid #d7dece;
  background:#fffefa;
  color:#56664c
}
.secondary:hover:enabled {
  background:#f0f3e9
}
.preview-column {
  position:sticky;
  top:25px;
  padding:0 4px
}
.preview-heading {
  font-size:11px;
  color:#7a8574;
  display:flex;
  justify-content:space-between;
  margin:2px 0 13px
}
.preview-heading span:last-child {
  font-size:10px;
  letter-spacing:1px;
  color:#a0a692
}
.page-image {
  background:white;
  border:1px solid #d6d9cf;
  box-shadow:0 10px 32px #3949350b;
  aspect-ratio:1072/1448;
  overflow:hidden
}
.page-image img {
  display:block;
  width:100%;
  height:auto
}
.preview-empty {
  height:100%;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  color:#b6bbad
}
.preview-empty h2 {
  font-size:25px;
  font-weight:400
}
.preview-empty p {
  font-size:11px;
  color:#a3ab99;
  margin-top:15px
}
.warnings {
  font-size:11px;
  color:#967238;
  line-height:1.8;
  padding-left:16px
}
.action-bar {
  position:sticky;
  bottom:0;
  background:#f5f3eef5;
  backdrop-filter:blur(12px);
  border-top:1px solid #dce1d3;
  padding:17px 0;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  z-index:5
}
.action-bar strong {
  display:block;
  font-size:12px;
  font-weight:600
}
.action-bar span {
  display:block;
  font-size:10px;
  color:#8b9382;
  margin-top:6px
}
.actions {
  display:flex;
  gap:9px
}
label {
  display:block;
  font-size:12px;
  color:#717c68;
  margin:16px 0 0;
  line-height:1.8
}
input:not([type=checkbox]),textarea,select {
  display:block;
  width:100%;
  border:1px solid #dfe3d7;
  border-radius:6px;
  background:#fafbf6;
  padding:10px 11px;
  color:#34402d;
  margin-top:6px;
  min-height:40px
}
textarea {
  resize:vertical
}
select {
  padding-right:26px
}
.form-row {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:14px
}
.button-row {
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-top:18px
}
.check-label {
  display:flex;
  align-items:center;
  gap:8px
}
.check-label input {
  accent-color:#537652
}
.settings-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:22px;
  padding-bottom:40px
}
.badge {
  font-size:10px;
  padding:5px 8px;
  background:#f0f2e9;
  border:1px solid #e1e7d7;
  color:#7b8870;
  border-radius:5px;
  white-space:nowrap
}
.callout {
  background:#eff3e7;
  border:1px solid #d6e0c9;
  padding:16px;
  border-radius:7px;
  margin-top:18px
}
.callout strong {
  font-size:12px
}
.callout p {
  font-size:11px
}
.callout code {
  font-size:22px;
  letter-spacing:4px;
  display:block;
  margin:10px 0;
  color:#405d33
}
.device-row {
  border-top:1px solid var(--line);
  padding-top:14px;
  margin-top:15px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px
}
.device-row strong {
  font-size:13px
}
.device-row small {
  display:block;
  font-size:10px;
  color:#929b87;
  margin-top:7px
}
.ms-task {
  padding:11px 0;
  border-top:1px solid #eef0e7;
  display:flex;
  align-items:flex-start;
  gap:10px;
  font-size:12px;
  line-height:1.7
}
.ms-task input {
  accent-color:#537652;
  margin-top:4px
}
.ms-task span {
  flex:1
}
.ms-task small {
  display:block;
  color:#929b87;
  font-size:10px
}
.ms-task button {
  font-size:10px;
  color:#829373
}
.preview-controls {
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
  margin-bottom:25px
}
.large-preview {
  max-width:640px;
  margin:0 auto 40px
}
.large-preview img {
  display:block;
  width:100%;
  border:1px solid #d4dac9;
  box-shadow:0 12px 40px #3949350d
}
details {
  margin-top:18px
}
summary {
  font-size:12px;
  color:#7b886e;
  cursor:pointer;
  padding:4px 0
}
.gate {
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:25px
}
.login-paper {
  width:400px;
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:12px;
  padding:42px
}
.login-paper h1 {
  font-size:35px
}
.login-paper>p {
  font-size:12px
}
.login-paper .primary {
  margin-top:26px;
  width:100%
}
.error {
  color:#ac5746
}
.toast {
  position:fixed;
  bottom:100px;
  left:50%;
  transform:translateX(-50%);
  background:#2e4336;
  color:white;
  padding:13px 22px;
  border-radius:8px;
  z-index:30;
  max-width:min(92vw,560px);
  font-size:12px;
  line-height:1.7;
  box-shadow:0 6px 20px #17291b22
}
.toast.error {
  background:#8b5145
}
dialog {
  border:1px solid #d3dcc7;
  border-radius:12px;
  padding:28px;
  color:#34452f;
  max-width:calc(100vw - 30px)
}
dialog::backdrop {
  background:#28302366
}
dialog h2 {
  margin-bottom:15px
}
dialog p {
  font-size:13px
}
.dialog-actions {
  display:flex;
  gap:10px;
  justify-content:flex-end;
  margin-top:25px
}
.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0
}
@media(min-width:1450px) {
  main {
    padding:48px 58px 0
  }
  .workspace {
    gap:45px
  }
  .paper {
    padding:28px
  }
  .preview-column {
    padding:0 20px
  }
}
@media(max-width:1100px) {
  .shell {
    grid-template-columns:160px minmax(0,1fr)
  }
  .navigation {
    padding:32px 12px
  }
  .nav-item {
    padding:14px 12px
  }
  .nav-item span {
    font-size:9px
  }
  main {
    padding:32px 24px 0
  }
  .workspace {
    gap:20px;
    grid-template-columns:minmax(300px,1.2fr) minmax(220px,.8fr)
  }
  .paper {
    padding:19px
  }
  .edition {
    display:none
  }
  .settings-grid {
    grid-template-columns:1fr
  }
  .actions {
    gap:6px
  }
  .actions button {
    padding:11px 12px
  }
}
@media(max-width:800px) {
  .topbar {
    height:68px;
    padding:0 20px
  }
  .brand {
    font-size:22px;
    gap:12px
  }
  .brand-logo {
    width:36px;
    height:36px
  }
  .brand span {
    font-size:8px;
    letter-spacing:2px;
    padding-left:12px
  }
  .top-right {
    gap:10px
  }
  .connection {
    display:none
  }
  .shell {
    display:block
  }
  .navigation {
    position:sticky;
    top:0;
    z-index:8;
    min-height:0;
    border:0;
    border-bottom:1px solid #dfe4d5;
    padding:0 12px;
    display:flex;
    background:#f5f3eef5;
    backdrop-filter:blur(12px)
  }
  .nav-item {
    width:auto;
    flex:1;
    text-align:center;
    font-size:12px;
    padding:15px 3px;
    margin:0;
    border-radius:0;
    border-bottom:2px solid transparent;
    font-weight:400
  }
  .nav-item.active {
    background:none;
    border-color:#648051;
    font-weight:600
  }
  .nav-item span,.nav-note {
    display:none
  }
  main {
    padding:27px 18px 0
  }
  h1 {
    font-size:28px
  }
  .eyebrow {
    font-size:9px;
    letter-spacing:2.2px;
    margin-bottom:13px
  }
  .page-heading {
    margin-bottom:21px
  }
  .page-heading p {
    font-size:11px
  }
  .workspace {
    display:block
  }
  .preview-column {
    position:static;
    padding:0;
    margin:2px auto 25px;
    max-width:460px
  }
  .editor-stack {
    gap:16px
  }
  .paper {
    padding:21px 18px
  }
  .section-heading h2 {
    font-size:20px
  }
  .date-toolbar {
    align-items:flex-start;
    flex-direction:column;
    margin-bottom:17px
  }
  .date-label input {
    width:150px;
    padding:8px 3px
  }
  .date-picker {
    width:100%;
    justify-content:space-between;
    gap:3px
  }
  .square {
    font-size:10px;
    padding:8px
  }
  .date-toolbar .status {
    font-size:10px
  }
  .action-bar {
    margin:0 -18px;
    padding:13px 14px calc(13px + env(safe-area-inset-bottom));
    gap:7px;
    flex-wrap:wrap
  }
  .action-bar>div:first-child {
    display:flex;
    align-items:center;
    justify-content:space-between;
    width:100%
  }
  .action-bar strong {
    font-size:10px
  }
  .action-bar span {
    font-size:10px;
    margin:0
  }
  .actions {
    width:100%;
    gap:7px
  }
  .actions button {
    flex:1;
    padding:11px 5px;
    font-size:11px
  }
  .form-row {
    gap:10px
  }
  .settings-grid {
    gap:17px
  }
  .toast {
    bottom:120px
  }
  .login-paper {
    padding:30px 25px
  }
  .preview-controls {
    gap:8px
  }
  .preview-controls button {
    font-size:11px
  }
  .dialog-actions {
    flex-wrap:wrap
  }
  .task-title {
    font-size:13px!important
  }
  .page-heading h1 {
    letter-spacing:.3px
  }
}
@media(prefers-reduced-motion:no-preference) {
  button,a {
    transition:background-color .15s,color .15s,border-color .15s
  }
}



@media (max-width:800px) {
  input:not([type=checkbox]),textarea,select {font-size:16px;}
  .task-actions button {min-height:36px;min-width:34px;}
  .primary,.secondary {min-height:44px;}
}

/* 0.3: live status is separate from editable forms. */
.refresh-panel {margin-bottom:28px;}
.refresh-panel p:last-child {margin-bottom:0;}
#full-refresh-status {font-size:13px;line-height:1.8;margin:10px 0;overflow-wrap:anywhere;}
#full-refresh-details,#ms-diagnostics {white-space:pre-line;overflow-wrap:anywhere;}
#full-refresh-progress {width:100%;height:8px;accent-color:var(--accent);}
.special-days-panel {min-width:0;}
.special-day {min-width:0;margin:18px 0;border:1px solid var(--line);border-radius:7px;padding:8px 16px 14px;}
.special-day legend {font-size:13px;padding:0 6px;overflow-wrap:anywhere;}
.special-day label {margin-top:10px;}
.ms-task {margin-top:0;}
.ms-task span {min-width:0;overflow-wrap:anywhere;}
.ms-task.completed span {color:#727b70;}
.ms-task.completed span>small {color:#687362;}
.ms-task button {flex-shrink:0;min-height:36px;}
@media(max-width:800px) {
  .refresh-panel {margin-bottom:22px;}
  .refresh-panel .section-heading h2 {font-size:20px;}
  .special-day {padding:8px 12px 14px;}
  .special-day .form-row {grid-template-columns:minmax(0,1fr);gap:0;}
  .special-days-panel .section-heading {flex-wrap:wrap;}
  .check-label {align-items:flex-start;}
  .check-label input {flex-shrink:0;margin-top:6px;min-width:18px;min-height:18px;}
}
