:root {
  --bg: #fbf8f3; --paper: #ffffff; --ink: #1f1b16; --muted: #6b6258; --line: #e6dfd4; --soft: #f3ede4;
  --accent: #b4532a; --accent-ink: #ffffff; --accent-soft: #f7e3d8; --ok: #2f7d4f; --warn: #a15c00; --bad: #b3261e;
  --li: #0a66c2; --th: #1f1b16; --x: #5b6470; --bs: #1185fe;
  --radius: 12px; --shadow: 0 1px 2px rgba(31, 27, 22, .06), 0 4px 16px rgba(31, 27, 22, .05);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #16130f; --paper: #1f1b16; --ink: #f1ebe2; --muted: #a89e92; --line: #3a332b; --soft: #2a241e;
  --accent: #f08a5d; --accent-ink: #1a0f08; --accent-soft: #3d2619; --ok: #6cc28d; --warn: #e2a64c; --bad: #ff8a80;
  --li: #5aa2ec; --th: #e8e2d8; --x: #a3acb8; --bs: #5cb0ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
code { background: var(--soft); padding: 0 4px; border-radius: 4px; font-size: .9em; }
.hidden { display: none !important; }
.small { font-size: .86rem; }
.muted { color: var(--muted); }

.top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.back { text-decoration: none; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.session { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.credits { font-size: .85rem; color: var(--muted); }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; }
.hero { padding: 28px 0 8px; max-width: 760px; }
h1 { font-size: clamp(1.6rem, 4.6vw, 2.35rem); line-height: 1.15; margin: 0 0 10px; letter-spacing: -.01em; }
.lede { margin: 0 0 12px; color: var(--muted); font-size: 1.05rem; }
.trust { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.trust li { font-size: .82rem; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 14px 0; }
.lab { display: block; font-size: .84rem; font-weight: 600; color: var(--muted); margin: 0 0 4px; }
.plats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.plats .lab { width: 100%; }
.plat { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); font: inherit; font-size: .92rem; cursor: pointer; }
.plat[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--soft); font-weight: 600; }
.plat[aria-pressed="false"] .dot { opacity: .35; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.p-linkedin.dot { background: var(--li); } .p-threads.dot { background: var(--th); } .p-x.dot { background: var(--x); } .p-bluesky.dot { background: var(--bs); }

textarea, input[type="text"], input[type="date"], input[type="time"], input[type="number"], select {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%; max-width: 100%;
}
textarea { resize: vertical; line-height: 1.45; display: block; }
textarea:focus, input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dropzone { border-radius: 10px; }
.dropzone.over textarea { border-color: var(--accent); background: var(--accent-soft); }
.go { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }

.btn { font: inherit; font-size: .93rem; min-height: 40px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; padding: 9px 18px; }
.btn.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.btn.quiet { background: transparent; }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.samples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.sample { font: inherit; font-size: .9rem; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1px dashed var(--accent); background: transparent; color: var(--accent); cursor: pointer; }
.sample[aria-pressed="true"] { background: var(--accent-soft); border-style: solid; }
.note { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--soft); font-size: .9rem; }
.note.bad, .bad { color: var(--bad); }

.opts { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.opt { display: block; min-width: 140px; }
.more { flex-basis: 100%; }
.more summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: 6px 0; min-height: 40px; display: flex; align-items: center; }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; padding-top: 6px; }
.perweek { display: contents; }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; min-height: 40px; }
.check input { width: 18px; height: 18px; }

.sumline { font-weight: 600; margin: 14px 0 8px; }
.weektabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.wtab { font: inherit; font-size: .86rem; min-height: 40px; white-space: nowrap; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.wtab[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* the time grid */
.calwrap { margin-top: 6px; }
.tgrid { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line); gap: 1px; }
.tgrid > div { background: var(--paper); }
.corner { background: var(--soft) !important; }
.dhead { padding: 6px 8px; text-align: center; background: var(--soft) !important; font-size: .85rem; }
.dhead b { display: block; }
.dhead span { color: var(--muted); }
.hlabel { font-size: .75rem; color: var(--muted); padding: 6px 4px; text-align: right; background: var(--soft) !important; }
.cell { padding: 4px; min-height: 52px; display: flex; flex-direction: column; gap: 4px; }
.wkend { background-image: repeating-linear-gradient(135deg, transparent 0 8px, rgba(127, 110, 90, .05) 8px 9px); }
.nonerow { grid-column: 1 / -1; padding: 14px; color: var(--muted); }

.slot { font: inherit; text-align: left; width: 100%; border: 1px solid var(--line); border-left: 4px solid var(--x); border-radius: 7px; background: var(--paper); color: var(--ink); padding: 5px 7px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-height: 40px; }
.slot.p-linkedin { border-left-color: var(--li); } .slot.p-threads { border-left-color: var(--th); } .slot.p-x { border-left-color: var(--x); } .slot.p-bluesky { border-left-color: var(--bs); }
.slot.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.s-head { display: flex; flex-wrap: wrap; gap: 4px; font-size: .7rem; color: var(--muted); }
.s-plat { font-weight: 700; color: var(--ink); }
.s-fmt { padding: 0 5px; border-radius: 4px; background: var(--soft); }
.s-text { font-size: .8rem; line-height: 1.3; overflow-wrap: anywhere; }
.s-pil { font-size: .7rem; color: var(--muted); }
.s-hook { font-size: .74rem; color: var(--muted); font-style: italic; }
.tgrid .s-hook { display: none; }
.slot.k-open { background: transparent; border-style: dashed; border-left-style: dashed; color: var(--muted); }
.slot.k-empty { background: var(--accent-soft); }
.slot.k-empty .s-text { color: var(--accent); font-weight: 600; }
.slot.k-ai { box-shadow: inset 0 0 0 1px var(--accent); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 0; }
.lg { width: 14px; height: 10px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); }
.lg-plan { background: var(--paper); border-left: 4px solid var(--li); }
.lg-ai { box-shadow: inset 0 0 0 1px var(--accent); }
.lg-empty { background: var(--accent-soft); }
.lg-open { border-style: dashed; }

.agenda { display: none; }
.aday { border-top: 1px solid var(--line); padding: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.aday.quiet { padding: 6px 0; }
.ahead { font-weight: 700; font-size: .9rem; }

.editor { border: 1px solid var(--accent); border-radius: 10px; padding: 12px; margin-top: 12px; background: var(--bg); }
.ed-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ed-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ed-grid .wide { grid-column: 1 / -1; }

.exports { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; align-items: center; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 10px; }
.h2 { font-size: 1.05rem; margin: 18px 0 8px; }
.checks, .flags, .plain, .saved { list-style: none; margin: 0; padding: 0; }
.checks li, .flags li { padding: 6px 0 6px 24px; position: relative; font-size: .9rem; border-bottom: 1px solid var(--line); }
.checks li::before, .flags li::before { position: absolute; left: 2px; top: 6px; font-weight: 700; }
.checks li.ok::before, .flags li.ok::before { content: "\2713"; color: var(--ok); }
.checks li.warn::before, .flags li.warn::before { content: "!"; color: var(--warn); left: 7px; }
.checks li.info::before { content: "+"; color: var(--accent); left: 6px; }
.plain li { padding: 4px 0; font-size: .9rem; }
.btable { width: 100%; border-collapse: collapse; font-size: .86rem; }
.btable th, .btable td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.btable th { color: var(--muted); font-weight: 600; }

.aibox summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 8px; }
.ai-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.progress { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.ph { display: flex; justify-content: space-between; }
.steps { margin: 8px 0 0; padding-left: 20px; font-size: .88rem; color: var(--muted); }
.steps li.now { color: var(--ink); font-weight: 600; }
.steps li.done { color: var(--ok); }
.steps li.fail { color: var(--bad); }

.saved li { border-bottom: 1px solid var(--line); }
.hist { font: inherit; background: none; border: 0; color: var(--ink); text-align: left; padding: 10px 0; width: 100%; cursor: pointer; min-height: 40px; }
.about { max-width: 760px; color: var(--ink); padding-top: 10px; }
.about h3 { font-size: .98rem; margin: 14px 0 4px; }
.about p { margin: 0 0 10px; color: var(--muted); }
.foot { border-top: 1px solid var(--line); padding: 18px 16px 30px; max-width: 1120px; margin: 0 auto; font-size: .85rem; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: .9rem; z-index: 20; max-width: calc(100% - 32px); }

@media (max-width: 760px) {
  .tgrid { display: none; }
  .agenda { display: block; }
  .twocol { grid-template-columns: 1fr; }
  .ed-grid { grid-template-columns: 1fr 1fr; }
  .back-t { display: none; }
  .hero { padding-top: 18px; }
  .opt { min-width: 0; flex: 1 1 140px; }
}
@media (max-width: 420px) {
  .brand strong { font-size: .95rem; }
  .btable th:nth-child(2), .btable td:nth-child(2) { display: none; }
}
@media print {
  .top, .start, .aibox, .exports, #historyCard, .about, .foot, .opts, .weektabs, .editor { display: none !important; }
}
