/* Literature Ark — calm reading surfaces, iOS-inspired controls. */
:root {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #0b2d52; background: #f3f8fb; font-synthesis: none;
  --nav: #0b2d52; --brand: #128778; --brand-strong: #0b7165; --mint: #76e0ce;
  --line: #d8e4eb; --muted: #52677d; --surface: #fff; --soft: #e6f5f2;
  --shadow: 0 2px 5px #0b2d5203, 0 12px 32px #0b2d5206;
}
* { box-sizing: border-box; }
body { margin: 0; display: flex; min-height: 100svh; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, .button { cursor: pointer; min-height: 44px; padding: 11px 17px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--nav); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 550; line-height: 1.4; transition: background .18s, box-shadow .18s, transform .18s; touch-action: manipulation; }
button:active, .button:active { transform: scale(.975); }
button:disabled { opacity: .45; cursor: default; transform: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #128778; outline-offset: 4px; }
button.primary, .button.primary { background: var(--brand); color: white; border-color: transparent; box-shadow: 0 3px 7px #12877818; }
button.danger { color: #a63338; }
a { color: var(--brand-strong); }
.rail { width: 234px; margin: 14px 0 14px 14px; background: var(--nav); color: white; display: flex; flex-direction: column; gap: 18px; padding: 30px 18px 20px; position: sticky; top: 14px; height: calc(100svh - 28px); flex-shrink: 0; border-radius: 26px; box-shadow: 0 12px 32px #0b2d5214; }
.brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; font-weight: 650; font-size: 20px; padding: 0 8px; }
.brand img { width: 40px; height: 40px; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: #b4cece; margin-top: 5px; }
.product-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border: 1px solid #ffffff1f; border-radius: 14px; }
.product-switch a { min-height: 38px; display: grid; place-items: center; border-radius: 10px; color: #b9ceda; text-decoration: none; font-size: 12px; }
.product-switch a.active { background: #ffffff16; color: var(--mint); }
.rail-caption { font-size: 12px; color: #acc3d6; margin: 32px 12px 0; }
.rail #spaces { display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.rail #spaces button { background: transparent; color: #dfebf3; border: 1px solid transparent; text-align: left; justify-content: flex-start; width: 100%; padding: 14px; line-height: 1.7; }
.rail #spaces button.active { background: #ffffff12; border-color: #ffffff23; color: var(--mint); box-shadow: inset 3px 0 var(--mint); }
.rail-actions { display: grid; gap: 8px; margin-top: 8px; }
.rail-actions button { background: transparent; color: #d7e7ef; border-color: #ffffff20; font-size: 13px; }
.rail footer { margin-top: auto; display: grid; gap: 14px; font-size: 12px; padding: 20px 10px 0; border-top: 1px solid #ffffff17; }
#identity { font-size: 14px; font-weight: 550; }
.rail footer a { color: var(--mint); text-decoration: none; min-height: 28px; }
.rail footer small { color: #acc3d6; line-height: 1.8; }
main { flex: 1; min-width: 0; padding: 48px clamp(24px,3.5vw,64px) 64px; max-width: 1740px; }
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.eyebrow { font-size: 13px; color: var(--brand-strong); }
h1 { font-size: clamp(27px,2.7vw,38px); letter-spacing: -1.2px; font-weight: 650; line-height: 1.35; margin: 10px 0 14px; overflow-wrap: anywhere; }
h2 { font-size: 22px; font-weight: 650; letter-spacing: -.4px; margin: 0 0 16px; }
h3 { font-size: 17px; line-height: 1.6; margin: 0 0 10px; font-weight: 600; }
p { line-height: 1.8; }
#space-description { margin: 0; color: var(--muted); max-width: 62ch; font-size: 14px; }
.workspace-context { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.workspace-context span { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 10px; border-radius: 999px; background: var(--soft); color: var(--brand-strong); font-size: 11px; }
.connection { display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 13px; font-size: 11px; color: var(--muted); flex-shrink: 0; }
#messages-button { border-radius: 24px; background: #ffffffc9; box-shadow: var(--shadow); }
#message-count { background: var(--soft); color: var(--brand-strong); padding: 2px 7px; border-radius: 20px; font-size: 12px; }
.status { color: #a34229; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.status:empty { display: none; }
nav { display: flex; gap: 3px; overflow: auto; width: fit-content; max-width: 100%; padding: 5px; border: 1px solid #dce6ed; border-radius: 17px; margin: 0 0 32px; background: #e8eef3b8; scrollbar-width: none; }
nav button { border: 0; background: transparent; white-space: nowrap; color: var(--muted); min-height: 40px; padding: 10px 18px; border-radius: 12px; }
nav button.active { background: white; color: var(--nav); box-shadow: 0 2px 6px #0b2d5212; font-weight: 650; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.toolbar h2 { margin: 0 auto 0 0; }
.muted { color: var(--muted); font-size: 13px; }
.welcome { text-align: center; padding: 100px 20px; }
.welcome img { width: 72px; margin-bottom: 24px; }
.welcome p { color: var(--muted); }
.library-tools { display: flex; gap: 14px; align-items: center; margin: 0 0 22px; }
.library-search { position: relative; margin: 0; flex: 1; max-width: 420px; }
.library-search input { background: #e9f0f5; border-color: transparent; padding-left: 40px; }
.library-search svg { position: absolute; top: 14px; left: 14px; width: 19px; color: var(--muted); }
.library-tools .muted { margin-left: auto; }
.task-filter { width: 150px; margin: 0; }
.access-note { font-size: 12px; color: var(--muted); margin: -6px 0 24px; }
.access-note summary { cursor: pointer; padding: 8px 0; width: fit-content; }
.access-note p { margin: 8px 0; max-width: 78ch; }
.cards { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,310px),1fr)); gap: 20px; }
.paper, .task, .panel { background: var(--surface); border: 1px solid #e6edf2; border-radius: 22px; padding: 24px; box-shadow: var(--shadow); }
.role-guide { margin: 0 0 24px; }
.current-role { width: fit-content; margin: 0 0 18px; padding: 7px 12px; border-radius: 999px; background: var(--soft); color: var(--brand-strong); font-size: 12px; font-weight: 650; }
.role-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.role-card { padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #f8fbfc; }
.role-card strong { font-size: 14px; }
.role-card p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.paper { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.paper-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.paper-cover { width: 48px; height: 56px; display: grid; place-items: center; color: var(--brand); background: var(--soft); border-radius: 9px 14px 14px 9px; border-left: 3px solid #94cec4; }
.paper-cover svg { width: 24px; height: 28px; }
.paper h3 { overflow-wrap: anywhere; margin: 0; font-size: 18px; line-height: 1.65; }
.paper .paper-doi { overflow-wrap: anywhere; font-size: 12px; color: var(--muted); padding-bottom: 12px; }
.paper .toolbar { margin: auto 0 0; padding-top: 18px; border-top: 1px solid #edf1f4; gap: 6px; }
.paper .toolbar button, .paper .toolbar a { font-size: 12px; min-height: 40px; padding: 8px 11px; background: #f0f5f7; border-color: #d8e4eb; color: var(--nav); }
.paper .toolbar .primary { background: var(--soft); color: var(--brand-strong); box-shadow: none; margin-right: auto; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; background: var(--soft); color: var(--brand-strong); font-size: 11px; border-radius: 20px; font-weight: 550; }
.tag.secret, .tag.overdue { background: #fff0ea; color: #99432f; }
.task { margin-bottom: 16px; }
.task.targeted { border-color: var(--brand); box-shadow: 0 0 0 4px #11948622,var(--shadow); }
.task-meta { display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0; font-size: 13px; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4,1fr); gap: 1px; margin-bottom: 28px; border: 1px solid var(--line); background: var(--line); border-radius: 22px; overflow: hidden; }
.metric { padding: 26px; background: white; font-size: 13px; color: var(--muted); }
.metric strong { display: block; font-size: 38px; letter-spacing: -1px; font-weight: 600; margin-top: 12px; color: var(--nav); font-variant-numeric: tabular-nums; }
.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 20px; background: white; }
table { width: 100%; border-collapse: collapse; background: white; font-size: 13px; }
th,td { text-align: left; padding: 18px; border-bottom: 1px solid #e9eff3; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; background: #f8fafc; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
td button { margin: 3px; }
.empty { padding: 56px 24px; color: var(--muted); text-align: center; background: #ffffff90; border: 1px solid var(--line); border-radius: 22px; }
.reader { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(320px,.9fr); gap: 24px; }
.reader > div { min-width: 0; }
.page-preview { position: relative; background: #e4ebf0; padding: 20px; min-height: 260px; border-radius: 20px; }
.page-preview img { width: 100%; display: block; box-shadow: 0 4px 20px #0b2d5210; }
.watermark { position: absolute; inset: 20px; display: flex; align-items: center; justify-content: center; pointer-events: none; font-size: 18px; opacity: .35; transform: rotate(-25deg); color: var(--nav); word-break: break-word; }
.reader textarea { min-height: 150px; }
.reader .panel { margin-bottom: 16px; }
.reader .panel > button { margin: 4px 6px 0 0; }
.annotations { max-height: 400px; overflow: auto; }
.annotation { border-top: 1px solid var(--line); padding: 16px 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.annotation blockquote { margin: 8px 0; border-left: 3px solid #94cabb; padding-left: 12px; color: var(--muted); }
label { display: grid; gap: 9px; font-size: 13px; font-weight: 500; margin: 18px 0; }
input,textarea,select { min-height: 46px; width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 12px 14px; color: var(--nav); background: #f8fafc; }
textarea { resize: vertical; min-height: 110px; line-height: 1.8; }
input::placeholder, textarea::placeholder { color: #697d91; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 20px; margin-right: 8px; accent-color: var(--brand); }
.checks { max-height: 210px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.checks label { display: flex; align-items: center; margin: 8px 0; min-height: 36px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 14px; line-height: 1.8; background: #f4f7f8; padding: 18px; border-radius: 14px; max-height: 500px; overflow: auto; }
dialog { color: var(--nav); border: 1px solid #ffffffcf; border-radius: 28px; padding: 30px; width: min(760px,94vw); max-height: 90svh; background: #fffffff5; box-shadow: 0 30px 100px #08294730; }
dialog[open] { animation: sheet-in .22s cubic-bezier(.2,.8,.2,1); }
dialog::backdrop { background: #08294745; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
dialog header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
dialog header h2 { margin: 0; }
#dialog-close { position: relative; border: 0; border-radius: 50%; background: #edf1f4; width: 44px; padding: 0; flex-shrink: 0; }
#dialog-close::before,#dialog-close::after { content: ''; position: absolute; left: 13px; top: 21px; width: 18px; height: 2px; border-radius: 2px; background: var(--muted); transform: rotate(45deg); }
#dialog-close::after { transform: rotate(-45deg); }
#dialog-submit { margin-top: 18px; min-width: 150px; }
.message-row { padding: 18px 0; border-bottom: 1px solid var(--line); }
[hidden] { display: none !important; }
@supports(backdrop-filter:blur(20px)) { nav { backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); } }
@media(hover:hover) { button:not(:disabled):hover,.button:hover { background: #e8f5f2; } button.primary:hover,.button.primary:hover { background: var(--brand-strong); color: white; } .rail button:hover { background: #ffffff18; } .paper .toolbar .primary:hover { background: #d8eee8; color: var(--brand-strong); } nav button:hover { background: #ffffff8c; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@media(max-width:1100px) { main { padding: 36px 24px; }.rail { width: 205px; padding: 28px 14px 18px; }.top { flex-direction: column; gap: 18px; }.connection { flex-direction: row; align-items: center; }.reader { grid-template-columns: 1fr; }.metrics { grid-template-columns: repeat(2,1fr); } }
@media(max-width:700px) {
  body { display: block; }.rail { width: auto; margin: 10px; height: auto; position: static; padding: 20px; gap: 14px; border-radius: 24px; }
  .brand { padding: 0; font-size: 18px; }.brand img { width: 36px; height: 36px; }.brand small { font-size: 11px; }
  .product-switch { order: -1; }.rail-caption,.rail footer small { display: none; }.rail #spaces { flex-direction: row; }.rail #spaces button { white-space: nowrap; width: auto; flex-shrink: 0; padding: 9px 14px; }.rail #spaces button.active { box-shadow: none; }
  .rail-actions { display: flex; margin: 0; }.rail-actions button { flex: 1; }.rail footer { padding: 14px 0 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; }.rail footer a { min-height: auto; }
  main { padding: 26px 20px 48px; }.top { margin-bottom: 24px; }h1 { font-size: 28px; letter-spacing: -.8px; }h2 { font-size: 20px; }.eyebrow { font-size: 12px; }
  .connection { width: 100%; justify-content: space-between; }.cards { grid-template-columns: 1fr; gap: 16px; }.paper,.task,.panel { padding: 22px; }
  nav { position: sticky; top: 10px; z-index: 3; width: 100%; margin-bottom: 28px; background: #e8eef3f2; box-shadow: 0 5px 12px #0b2d5208; }nav button { padding: 10px 15px; }.workspace-context span:last-child{display:none}
  .toolbar { gap: 8px; }.toolbar h2 { width: 100%; margin-bottom: 7px; }.library-tools { flex-wrap: wrap; }.library-search { max-width: none; flex-basis: 100%; }.task-filter{width:100%;}.library-tools .muted { margin: 0; }
  .split,.role-grid { grid-template-columns: 1fr; }.welcome { padding: 50px 10px; }.metric { padding: 22px; }.metric strong { font-size: 32px; }
  dialog { width: 100%; max-width: 100%; max-height: 90svh; margin: auto 0 0; border-radius: 28px 28px 0 0; padding: 24px 22px max(24px,env(safe-area-inset-bottom)); }#dialog-submit { width: 100%; }
  .paper .toolbar h2 { display: none; }.paper .toolbar { flex-wrap: wrap; }.paper .toolbar .primary { margin-right: 0; }
  body.embedded .brand,body.embedded .product-switch,body.embedded .rail footer { display: none; }
  body.embedded .rail { margin: 8px 10px 0; padding: 10px; border-radius: 18px; }
  body.embedded .rail #spaces { order: 0; }
  body.embedded main { padding-top: 20px; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media(prefers-contrast:more) { :root { --line:#8c9cab; --muted:#344e68; }.muted { color: var(--muted); } }
.toolbar h2:empty{display:none}@media(max-width:700px){.rail{padding:16px;gap:10px}.rail footer{padding-top:10px}.brand small{margin-top:3px}#space-description{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}}
