/* write.css - aibusinessmanager.au / write */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #1e293b; background: #eef1f5; }
[hidden] { display: none !important; }
button, select, input { font: inherit; color: inherit; }
.muted { color: #64748b; }

/* top bar */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
       padding: 10px 18px; background: #0f172a; color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; }
.brand small { display: block; font-weight: 400; font-size: 11.5px; color: #94a3b8; }
.logo { width: 32px; height: 32px; border-radius: 8px; background: #0f766e; display: grid; place-items: center; font-weight: 800; }
.top nav { display: flex; gap: 8px; }
.btn { border: 1px solid #0f766e; background: #0f766e; color: #fff; border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: #475569; color: inherit; }
.top .btn.ghost { color: #e2e8f0; }
.btn.small { padding: 5px 10px; font-size: 13.5px; }
.btn.danger, button.danger { color: #b91c1c; }
.btn.ghost.danger { border-color: #fca5a5; }

/* list */
.list-view { max-width: 880px; margin: 0 auto; padding: 24px 18px 60px; }
.intro h1 { margin: 0 0 6px; font-size: 24px; }
.intro p { margin: 6px 0; max-width: 70ch; }
.doc-list { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.doc { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center; background: #fff; border: 1px solid #e2e8f0;
       border-radius: 10px; padding: 12px 14px; }
.doc .name { font-weight: 650; font-size: 16px; color: #0f172a; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.doc .name:hover { text-decoration: underline; }
.doc .meta { grid-column: 1; font-size: 13px; color: #64748b; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.doc .acts { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 8px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: #e2e8f0; color: #334155; }
.tag.kept { background: #ccfbf1; color: #115e59; }
.tag.warn { background: #fee2e2; color: #991b1b; }
.empty { background: #fff; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 30px; text-align: center; }
.counts { margin-top: 14px; font-size: 13px; }

/* editor */
.edit-view { display: flex; flex-direction: column; min-height: calc(100vh - 52px); }
.toolbar { position: sticky; top: 52px; z-index: 20; display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 6px 12px; background: #fff;
           border-bottom: 1px solid #e2e8f0; }
.grp { display: flex; align-items: center; gap: 2px; }
.grp + .grp { padding-left: 10px; border-left: 1px solid #e2e8f0; }
.toolbar button, .subbar button { min-width: 32px; height: 32px; padding: 0 7px; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; font-size: 14px; }
.toolbar button:hover, .subbar button:hover { background: #f1f5f9; }
.toolbar button.on { background: #ccfbf1; border-color: #5eead4; }
.toolbar button svg { width: 18px; height: 18px; vertical-align: middle; }
.toolbar select { height: 32px; border: 1px solid #e2e8f0; border-radius: 6px; padding: 0 6px; background: #fff; max-width: 140px; }
.colour { position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; }
.colour:hover { background: #f1f5f9; }
.colour input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.sw { font-weight: 800; border-bottom: 4px solid #c0392b; line-height: 1.1; padding: 0 3px; }
.sw.hl { border-bottom-color: #fff176; color: #94a3b8; }
.subbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 14px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-size: 14px; }
.subbar.find input { height: 32px; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0 8px; width: 170px; }
.subbar .x { margin-left: auto; }

.docbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; max-width: 860px; width: 100%; margin: 16px auto 0; padding: 0 18px; }
.title { flex: 1 1 260px; min-width: 0; font-size: 20px; font-weight: 700; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; background: transparent; }
.title:hover, .title:focus { border-color: #cbd5e1; background: #fff; outline: none; }
.docbar-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.save-state { font-size: 13px; color: #64748b; min-width: 70px; text-align: right; }
.save-state.bad { color: #b91c1c; font-weight: 600; }
.keep { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; cursor: pointer; padding: 4px 10px; border-radius: 99px; border: 1px solid #cbd5e1; background: #fff; }
.keep:has(input:checked) { background: #ccfbf1; border-color: #5eead4; color: #115e59; }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
             box-shadow: 0 10px 30px rgba(15,23,42,.15); padding: 6px; display: flex; flex-direction: column; min-width: 190px; }
.menu-list button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu-list button:hover { background: #f1f5f9; }
.expiry { max-width: 860px; width: 100%; margin: 2px auto 0; padding: 0 26px; font-size: 13px; color: #64748b; }
.expiry.warn { color: #b91c1c; font-weight: 600; }
.expiry button { border: 0; background: none; color: #0f766e; font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; }
.notice { max-width: 860px; width: calc(100% - 36px); margin: 10px auto 0; padding: 10px 14px; border-radius: 10px; background: #fef3c7; border: 1px solid #fcd34d; font-size: 14px;
          display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.notice.bad { background: #fee2e2; border-color: #fca5a5; }

/* the page */
.desk { flex: 1; padding: 16px 12px 40px; }
.page { width: 100%; max-width: 794px; min-height: 1123px; margin: 0 auto; background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.12), 0 8px 24px rgba(15,23,42,.06);
        padding: 72px 80px; outline: none; font: 15px/1.6 Arial, sans-serif; color: #111; overflow-wrap: break-word; }
.page:empty::before { content: "Start writing..."; color: #94a3b8; }
.page h1 { font-size: 28px; margin: 24px 0 10px; line-height: 1.25; }
.page h2 { font-size: 22px; margin: 20px 0 8px; line-height: 1.3; }
.page h3 { font-size: 18px; margin: 16px 0 6px; }
.page p { margin: 0 0 10px; }
.page blockquote { margin: 10px 0; padding: 2px 0 2px 16px; border-left: 4px solid #cbd5e1; color: #475569; font-style: italic; }
.page ul, .page ol { margin: 0 0 10px; padding-left: 28px; }
.page a { color: #0563c1; }
.page img { max-width: 100%; height: auto; }
.page img.sel { outline: 3px solid #14b8a6; }
.page table { border-collapse: collapse; width: 100%; margin: 10px 0; table-layout: fixed; }
.page td, .page th { border: 1px solid #bfbfbf; padding: 6px 8px; vertical-align: top; min-width: 30px; }
.page th { background: #f1f5f9; text-align: left; }
.page hr { border: 0; border-top: 1px solid #999; margin: 16px 0; }
.page ::selection { background: #99f6e4; }
.page mark.wp-find { background: #fde047; color: inherit; }

.status { position: sticky; bottom: 0; display: flex; justify-content: space-between; gap: 10px; padding: 5px 16px; font-size: 12.5px; background: #fff; border-top: 1px solid #e2e8f0; }

.toast { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 9px 16px; border-radius: 10px; z-index: 60; font-size: 14px;
         box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100% - 30px); }

/* phones */
@media (max-width: 700px) {
    .top { padding: 8px 10px; }
    .brand small, #navDocs { display: none; }
    .toolbar { top: 48px; flex-wrap: nowrap; overflow-x: auto; padding: 6px 8px; }
    .grp { flex: none; }
    .toolbar select { max-width: 110px; }
    .page { padding: 28px 20px; min-height: 70vh; font-size: 16px; }
    .desk { padding: 10px 0 30px; }
    .docbar { padding: 0 10px; margin-top: 10px; }
    .expiry { padding: 0 18px; }
    .doc { grid-template-columns: 1fr; }
    .doc .acts { grid-column: 1; grid-row: auto; }
    .status span.muted { display: none; }
}

/* printing (and Save as PDF): just the page, on A4 */
@media print {
    @page { size: A4; margin: 20mm; }
    body { background: #fff; }
    .top, .toolbar, .subbar, .docbar, .expiry, .notice, .status, .toast, #listView { display: none !important; }
    .desk { padding: 0; }
    .page { box-shadow: none; padding: 0; max-width: none; min-height: 0; }
    .page:empty::before { content: none; }
    .page img.sel { outline: none; }
    .page h1, .page h2, .page h3 { break-after: avoid; }
    .page tr, .page img { break-inside: avoid; }
}

.who { color: #e2e8f0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; align-self: center; }
.top nav { align-items: center; }
.top a.btn { text-decoration: none; display: inline-block; }
.intro a { color: #0f766e; font-weight: 600; }
@media (max-width: 700px) { .who { display: none; } }
