:root {
  --navy: #051133; --navy2: #1A3059; --gold: #B59569; --gold-soft: #F3ECE0; --cream: #FAF8F4;
  --ink: #1d2433; --muted: #5d6678; --line: #e3ded4; --red: #9b1c1c; --green: #2f6b3a; --white: #fff;
  --serif: 'EB Garamond', Georgia, serif; --sans: 'Figtree', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 var(--sans); color: var(--ink); background: var(--cream); }
a { color: var(--navy2); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; font: 600 28px var(--serif); color: var(--navy); }

/* ── shell ─────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; }
.brand img { width: 34px; height: 34px; }
.brand b { font: 600 20px/1.1 var(--serif); display: block; }
.brand small { color: #c9cfdc; font-size: 12px; }
.side a { color: #dfe4ee; text-decoration: none; padding: 9px 12px; border-radius: 8px; display: flex; gap: 10px; align-items: center; font-weight: 500; }
.side a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side a.on { background: var(--gold); color: var(--navy); }
.side .sep { height: 1px; background: rgba(255,255,255,.12); margin: 10px 6px; }
.side .foot { margin-top: auto; font-size: 12px; color: #aeb6c8; padding: 0 8px; }
.side .foot a { display: inline; padding: 0; color: #dfe4ee; text-decoration: underline; }
.meter { height: 5px; background: rgba(255,255,255,.15); border-radius: 3px; margin: 6px 0 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--gold); }
main { padding: 28px 36px 60px; max-width: 1180px; width: 100%; }
h1 { font: 600 30px/1.2 var(--serif); color: var(--navy); margin: 0 0 4px; }
h2 { font: 600 21px/1.25 var(--serif); color: var(--navy); margin: 26px 0 10px; }
h3 { font-size: 15px; margin: 18px 0 6px; color: var(--navy2); }
.lede { color: var(--muted); margin: 0 0 20px; max-width: 70ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ── controls ──────────────────────────────────────────── */
.btn { border: 1px solid var(--line); background: #fff; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--navy2); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--navy2); padding: 5px 8px; }
.btn.quiet:hover { background: var(--gold-soft); }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
label.f { display: block; margin: 0 0 12px; }
label.f > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--navy2); }
label.f > em { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 3px; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.note { background: var(--gold-soft); border-left: 3px solid var(--gold); padding: 10px 14px; border-radius: 6px; margin: 0 0 16px; }
.note.red { background: #fbecec; border-color: var(--red); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs a.on { color: var(--navy); border-color: var(--gold); }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--gold-soft); color: var(--navy2); }
.pill.red { background: #fbecec; color: var(--red); }
.pill.green { background: #e7f2e9; color: var(--green); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.red { background: var(--red); }

/* ── writing ───────────────────────────────────────────── */
.tools { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px; }
.tool { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px; cursor: pointer; text-align: left; }
.tool b { display: block; color: var(--navy); }
.tool span { font-size: 12px; color: var(--muted); }
.tool.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: var(--gold-soft); }
.write { display: grid; grid-template-columns: 360px 1fr; gap: 22px; align-items: start; }
.sources { margin: 4px 0 14px; }
.src { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 6px; font-size: 13px; }
.src .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.src .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paper { background: #fff; border: 1px solid var(--line); border-radius: 12px; min-height: 420px; }
.paper-bar { display: flex; gap: 6px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.paper-bar .title { font-weight: 600; color: var(--navy); flex: 1; min-width: 160px; }
.doc { padding: 26px 34px 34px; font: 17px/1.55 var(--serif); }
.doc h2, .doc h3, .doc h4, .doc h5 { font-family: var(--serif); color: var(--navy); }
.doc h2 { font-size: 24px; margin-top: 8px; } .doc h3 { font-size: 20px; } .doc h4 { font-size: 18px; }
.doc table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 15px; }
.doc th, .doc td { border: 1px solid #cfc8ba; padding: 6px 8px; text-align: left; vertical-align: top; }
.doc th { background: var(--gold-soft); }
.doc blockquote { border-left: 3px solid var(--gold); margin: 10px 0; padding: 2px 14px; color: #3d4556; }
.doc code { background: #f3f1ec; padding: 0 4px; border-radius: 3px; font-size: 14px; }
.doc .empty { color: var(--muted); font: 15px var(--sans); }
.working { display: flex; gap: 10px; align-items: center; color: var(--muted); font: 14px var(--sans); padding: 8px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .3 } to { opacity: 1 } }
.html-frame { width: 100%; min-height: 560px; border: 0; display: block; }
.revise { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; gap: 8px; align-items: flex-end; }
.revise textarea { min-height: 44px; }
.edit-area { width: 100%; min-height: 560px; border: 0; padding: 20px; font: 14px/1.5 ui-monospace, Menlo, monospace; border-radius: 0 0 12px 12px; }
.list { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.list .it { display: flex; gap: 10px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--line); }
.list .it:first-child { border-top: 0; }
.list .it:hover { background: #fcfbf8; }
.list .it .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .it a.n { text-decoration: none; color: var(--ink); }
.ico { width: 22px; text-align: center; flex: none; }

/* ── modal ─────────────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(5,17,51,.45); display: grid; place-items: center; z-index: 40; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: min(860px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.narrow { width: min(520px, 100%); }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal header h2 { margin: 0; flex: 1; }
.modal .body { padding: 16px 20px; overflow: auto; }
.modal footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.crumbs a { cursor: pointer; }

/* ── duties ────────────────────────────────────────────── */
.now { background: var(--navy); color: #fff; border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; }
.now h2 { color: #fff; margin: 0 0 8px; font-size: 20px; }
.now .stats { display: flex; gap: 22px; font-size: 13px; color: #cfd5e2; margin-bottom: 4px; flex-wrap: wrap; }
.now .stats b { color: #fff; font-size: 16px; }
.pinned { background: var(--gold-soft); border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; font-size: 14px; }
.day { margin-bottom: 18px; }
.day h3 { margin: 0 0 6px; font: 600 17px var(--serif); color: var(--navy); display: flex; gap: 8px; align-items: baseline; }
.day h3 small { font: 13px var(--sans); color: var(--muted); }
.duty { display: grid; grid-template-columns: 26px 130px 1fr 70px auto; gap: 8px; align-items: center; padding: 7px 12px; border-top: 1px solid var(--line); background: #fff; }
.duty:first-child { border-top: 0; }
.duty.done .t { text-decoration: line-through; color: var(--muted); }
.duty .w { font-size: 13px; color: var(--navy2); font-variant-numeric: tabular-nums; }
.duty .m { font-size: 13px; color: var(--muted); text-align: right; }
.duty .t { min-width: 0; }
.duty .t small { display: block; color: var(--muted); font-size: 12px; }
.duty input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--navy); }
.duty .star { color: var(--gold); }
.duty.over { background: #fdf6f6; }
.quick { display: grid; grid-template-columns: 140px 110px 1fr 90px 120px auto; gap: 8px; align-items: end; margin-bottom: 16px; }
.quick label.f { margin: 0; }
.plan-row { display: grid; grid-template-columns: 24px 110px 120px 1fr 60px; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week .col { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 160px; font-size: 13px; }
.week .col.today { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.week .col h4 { margin: 0 0 6px; font-size: 13px; color: var(--navy); }
.week .wi { padding: 4px 0; border-top: 1px dashed var(--line); display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
.week .wi.done { color: var(--muted); text-decoration: line-through; }
.week .wi .tm { color: var(--navy2); font-size: 11px; white-space: nowrap; }
table.plain { border-collapse: collapse; width: 100%; background: #fff; }
table.plain th, table.plain td { border-bottom: 1px solid var(--line); padding: 7px 10px; text-align: left; font-size: 14px; vertical-align: top; }
table.plain th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fbfaf7; }
.signin { min-height: 100vh; display: grid; place-items: center; background: var(--navy); }
.signin .card { text-align: center; max-width: 420px; padding: 34px; }
.signin img { width: 64px; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .side .foot, .side .sep { display: none; } main { padding: 18px; }
  .write { grid-template-columns: 1fr; } .tools { grid-template-columns: repeat(2, 1fr); }
  .quick { grid-template-columns: 1fr 1fr; } .week { grid-template-columns: 1fr; } .duty { grid-template-columns: 26px 90px 1fr auto; } .duty .m { display: none; }
}
@media print {
  .side, .paper-bar, .revise, .no-print, .write > :first-child, .tools, h1, .lede { display: none !important; }
  .shell, .write { display: block; } main { padding: 0; max-width: none; } .paper { border: 0; } .doc { padding: 0; }
}

.row2{display:grid;grid-template-columns:1fr 1.4fr;gap:10px}
