/* وضوح · تحسينات القراءة (v19). Loaded last. Display only: no data, no behaviour.
   1) Text floor 12px for all readable interface text (decorative ✦ ornaments and the book-cover engraving excluded).
   2) Contrast: secondary text on light surfaces ≥ 4.5:1 (WCAG AA). */
:root{--wd-soft:#5b6a60;--wd-soft-gold:#7f6338;--wd-soft-dark:#c9d6cc}

/* 1 · minimum text size */
html .sidebar-label,html .books-heading,html .nav-item small,html .secure-mark,html .brand small,html .top-search kbd,html .overline,
html .stat-card span,html .section-heading div>span,html .book-card p,html .recent-card-top,html .recent-card-bottom,html .dashboard-footer,
html .list-mini-label,html .list-note-top,html .list-note-bottom,html .save-indicator,html .paper-heading,html .editor-footer,html .modal-eyebrow,
html .settings-feature small,html .settings-feature>button,html .settings-note,html .auth-eyebrow,html .auth-foot,html .wuduh-sharing-button,
html .brand-eyebrow,html .book-tools button,html .recent-card p,html .note-list-item p,html .hero-eyebrow,html .editor-toolbar-breadcrumb,
html .long-date,html .top-actions .top-date,html .hero-copy button,html .section-heading p,html .section-heading>button,html .list-head p,
html .empty-list p,html .note-dropdown button,html .title-divider,html .modal-description,html .field-label,html .ghost-button,html .toast,
html .auth-error,html .auth-success,html .auth-secondary button,html .auth-hint,html .auth-remembered small,html .auth-remembered button,
html .new-book-side,html .sidebar-settings,html .top-search input,html .gold-button,html .hero-copy p
{font-size:12px}
html .gold-button,html .top-search input,html .hero-copy p,html .recent-card p,html .note-list-item p{font-size:12.5px}

/* 2 · contrast on light surfaces */
html .list-time,html .list-note-bottom,html .recent-card-top,html .list-head p,html .editor-footer,html .book-card p,html .book-card small,
html .book-card-foot,html .settings-feature small,html .section-heading p,html .empty-list,html .recent-card p,html .note-list-item p,
html .empty-editor p,html .editor-toolbar-breadcrumb,html .modal-description,html .long-date,html .top-breadcrumb,html .intro-row p,
html .empty-recent,html .top-search,html .top-actions .top-date,html .stat-card span,html .ghost-button,html .list-note-top,html .top-search kbd,
html .auth-subtitle,html .auth-hint,html .auth-foot,html .modal-close,html .dashboard-footer,html .format-hint,html .book-view-controls,
html .continue-card small,html .settings-sections p,html .top-search input::placeholder,html .note-body::placeholder,html .note-title-input::placeholder
{color:var(--wd-soft)}
html .list-mini-label,html .paper-heading,html .section-heading div>span,html .modal-eyebrow,html .overline,html .recent-card-bottom,
html .save-indicator.saving,html .settings-feature,html .auth-eyebrow,html .settings-note,html .title-divider,html .auth-divider
{color:var(--wd-soft-gold)}
html .top-settings,html .editor-actions>button,html .more-wrapper>button{color:#4f665a}
html .save-indicator{color:#3f6b48}
html .save-indicator.error,html .note-dropdown button.danger{color:#9a4a3d}
/* dark sidebar: readable secondary text */
html .sidebar .sidebar-label,html .sidebar .books-heading,html .sidebar .secure-mark,html .sidebar .nav-item small,html .sidebar .brand small,
html .sidebar .sidebar-quote,html .sidebar .nav-item,html .sidebar .sidebar-settings{color:var(--wd-soft-dark)}

/* 3 · top bar: date is information, not a button */
html .top-actions .top-date{background:none;border:0;padding-inline:4px;box-shadow:none}

/* 4 · editor: note title in the breadcrumb, share label, last edit */
.editor-toolbar-breadcrumb .wd-crumb-title{max-width:min(42vw,420px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:inline-block;vertical-align:bottom;color:#2f4a3f}
.editor-actions>button.wd-share-action{display:inline-flex;align-items:center;gap:6px;padding:7px 11px;border:1px solid #ddd6c5;border-radius:8px;color:#2f4a3f;font:inherit;font-size:13px;font-weight:600;background:#fffdf8}
.editor-actions>button.wd-share-action:hover{background:#f2eee5}
.wd-last-edit time{font-variant-numeric:tabular-nums}

/* 5 · formatting toolbar: icons with tooltips */
.writing-tools{align-items:center}
.writing-tools .wd-tool{display:inline-grid;place-items:center;min-width:34px;min-height:34px;padding:6px}
.writing-tools .wd-tool:disabled{opacity:.45}
.writing-tools .wd-tool-sep{width:1px;align-self:stretch;margin:4px 2px;background:#e3ddcf}
.writing-tools .wd-preview-toggle{display:inline-flex;align-items:center;gap:6px;margin-inline-start:auto}
html[dir=rtl] .writing-tools svg[class*=undo],html[dir=rtl] .writing-tools svg[class*=redo],html[dir=rtl] .writing-tools svg[class*=wudh-list],html[dir=rtl] .writing-tools svg[class*=wudh-check]{transform:scaleX(-1)}

/* 6 · notebook card tools */
.wd-book-tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.wd-book-tools .wd-book-share,.wd-book-menu>summary{display:inline-flex;align-items:center;gap:6px;padding:7px 11px;border:1px solid #ddd6c5;border-radius:8px;background:#fffdf8;color:#2f4a3f;font:inherit;font-size:13px;cursor:pointer;list-style:none;min-height:34px}
.wd-book-menu>summary::-webkit-details-marker{display:none}
.wd-book-menu{position:relative}
.wd-book-menu-list{position:absolute;inset-inline-start:0;top:calc(100% + 6px);z-index:30;display:grid;min-width:220px;padding:6px;background:#fffdf8;border:1px solid #ddd6c5;border-radius:10px;box-shadow:0 12px 30px rgba(24,46,42,.14)}
.wd-book-menu-list button{text-align:start;border:0;background:none;padding:9px 10px;border-radius:7px;font:inherit;font-size:13px;color:#2f4a3f;cursor:pointer}
.wd-book-menu-list button:hover:not(:disabled){background:#f2eee5}
.wd-book-menu-list button:disabled{color:#8b958d;cursor:default}

/* 7 · settings */
.settings-sections .wd-hint{font-size:12.5px;color:var(--wd-soft)}
.settings-sections .wd-quiet-danger{color:#8f3f33}

/* ---------- v20 · النسخ الاحتياطي ---------- */
html .settings-sections .wd-top-note{margin:0 0 18px;padding:12px 14px;border:1px solid rgba(127,99,56,.28);border-radius:10px;background:rgba(173,135,83,.08);color:var(--wd-soft);font-size:13px;line-height:1.8}
html .wd-backup-status{padding:12px 14px;border-radius:10px;border:1px solid rgba(91,106,96,.25);background:rgba(91,106,96,.06);margin-bottom:14px}
html .wd-backup-status p{margin:0;font-size:13.5px;line-height:1.8}
html .wd-backup-status.wd-due{border-color:#b7791f;background:#fff7e6}
html .wd-backup-status.wd-due p{color:#5c3d00}
html .wd-backup-group{padding:12px 0;border-top:1px solid rgba(91,106,96,.18)}
html .wd-backup-group h4{margin:0 0 4px;font-size:15px}
html .wd-backup-group>p{margin:0 0 10px;font-size:13px;line-height:1.8;color:var(--wd-soft)}
html .wd-backup-row{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end}
html .wd-backup-row label{display:flex;flex-direction:column;gap:4px;font-size:13px;min-width:150px;flex:1}
html .wd-backup-row button{flex:0 0 auto;min-height:44px}
html .wd-draft-list{list-style:none;margin:0 0 10px;padding:0;display:grid;gap:8px}
html .wd-draft-list li{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px;align-items:center;padding:10px 12px;border:1px solid rgba(91,106,96,.22);border-radius:10px}
html .wd-draft-list li>div:first-child{display:flex;flex-direction:column;gap:2px;min-width:0}
html .wd-draft-list strong{font-size:14px;overflow-wrap:anywhere}
html .wd-draft-list small{font-size:12px;color:var(--wd-soft)}
html .wd-draft-actions{display:flex;gap:6px;flex-wrap:wrap}
html .wd-backup-reminder{display:flex;flex-wrap:wrap;gap:12px;justify-content:space-between;align-items:center;margin:0 0 18px;padding:14px 16px;border:1px solid #b7791f;border-radius:12px;background:#fff7e6;color:#4a3300}
html .wd-backup-reminder strong{font-size:15px}
html .wd-backup-reminder p{margin:4px 0 0;font-size:13px;line-height:1.7;color:#5c3d00}
html .wd-reminder-actions{display:flex;flex-wrap:wrap;gap:8px}
html .wd-reminder-actions button{font-size:13px}
/* import preview dialog (built with DOM APIs in wuduh-backup.js) */
html .wd-import-dialog{width:min(560px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;border:0;border-radius:16px;padding:22px;background:#fffdf8;color:#1f2a24;box-shadow:0 20px 60px rgba(0,0,0,.25);font-size:14px}
html .wd-import-dialog::backdrop{background:rgba(20,28,24,.45)}
html .wd-import-dialog h2{margin:0 0 8px;font-size:20px}
html .wd-import-safe{margin:0 0 12px;padding:10px 12px;border-radius:10px;background:#eef5ef;color:#1f4d2e;font-size:13px;line-height:1.7}
html .wd-import-facts{display:grid;grid-template-columns:auto 1fr;gap:6px 12px;margin:0 0 12px;font-size:13.5px}
html .wd-import-facts dt{font-weight:700;color:#3d4a42}
html .wd-import-facts dd{margin:0;overflow-wrap:anywhere}
html .wd-import-dialog .wd-warn{color:#7a4a00;font-weight:600}
html .wd-import-options{border:1px solid rgba(91,106,96,.25);border-radius:10px;padding:10px 12px;margin:0 0 12px;display:grid;gap:8px}
html .wd-import-options legend{padding:0 6px;font-weight:700;font-size:13.5px}
html .wd-import-option{display:flex;flex-wrap:wrap;align-items:center;gap:8px;font-size:13.5px}
html .wd-import-option small{flex-basis:100%;padding-inline-start:26px;font-size:12px;color:#5b6a60}
html .wd-import-target{display:flex;flex-direction:column;gap:4px;font-size:13.5px}
html .wd-import-target select{font:inherit;padding:6px 8px;border-radius:8px;border:1px solid rgba(91,106,96,.4);background:#fff;color:inherit}
html .wd-import-sample summary{cursor:pointer;font-size:13px;color:#3d4a42}
html .wd-import-list{margin:8px 0;padding-inline-start:20px;font-size:13px;line-height:1.8}
html .wd-import-list em{font-style:normal;font-size:12px;color:#7a4a00;margin-inline-start:6px}
html .wd-import-total{font-size:14px;margin:10px 0}
html .wd-import-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap}
html .wd-import-actions button{font:inherit;padding:9px 16px;border-radius:10px;cursor:pointer;border:1px solid rgba(91,106,96,.4);background:#fff;color:#1f2a24}
html .wd-import-actions .gold-button{background:#8a6a3c;border-color:#8a6a3c;color:#fff;font-weight:700}
html .wd-import-actions button:disabled{opacity:.6;cursor:not-allowed}
@media (max-width:520px){html .wd-backup-row label{min-width:100%}html .wd-import-dialog{padding:16px}}

/* ---------- v21 · المحرر المباشر (تجريبي) ---------- */
html .wd-live-editor{display:block;white-space:normal;cursor:text}
html .wd-live-editor[hidden]{display:none}
html .wd-live-editor .cm-editor{min-height:inherit}
html .wd-live-editor.is-disabled{opacity:.7}
html .wd-live-editor .cm-content{white-space:pre-wrap}
html .wd-editor-fallback{margin:4px 0 8px;padding:8px 12px;border-radius:8px;background:#fff7e6;border:1px solid #b7791f;color:#5c3d00;font-size:13px}
html .settings-sections label.wd-check-pref{display:flex;flex-direction:row;align-items:center;gap:10px;font-weight:600}
html .settings-sections label.wd-check-pref input{width:18px;height:18px;margin:0;accent-color:#7f6338}

/* ---------- v22 · صفحة الزوار ومنطقة المالك ---------- */
/* visitor page: the sign-in card is unchanged; an introduction sits beside it (below it on phones) */
html .auth-screen.wd-landing-screen{grid-template-columns:minmax(0,1fr);gap:18px;align-content:start;justify-items:center}
html .wd-auth-column{display:grid;justify-items:center;gap:6px;width:100%;min-width:0}
html .wd-about-link{background:none;border:0;color:#efe3c6;font:inherit;font-size:14px;font-weight:600;text-decoration:underline;text-underline-offset:4px;min-height:44px;padding:8px 14px;cursor:pointer}
html .wd-about-link:focus-visible,html .wd-landing button:focus-visible,html .wd-owner-area button:focus-visible,html .wd-owner-entry:focus-visible{outline:3px solid #d6b57d;outline-offset:2px}
html .wd-landing{width:min(100%,540px);min-width:0;box-sizing:border-box;background:#fffdf6;color:#283b35;border:1px solid #d0ac72;border-radius:16px;padding:26px clamp(18px,4vw,34px);box-shadow:0 24px 70px #05180e66;text-align:start;line-height:1.8}
html .wd-landing:empty{display:none}
html .wd-landing-eyebrow{margin:0;font-size:12.5px;font-weight:600;letter-spacing:.5px;color:var(--wd-soft-gold)}
html .wd-landing-title{margin:2px 0 8px;font:700 30px/1.5 Amiri,serif;color:#1f3a30}
html .wd-landing-lead{margin:0 0 18px;font-size:15px;color:#3b4d45}
html .wd-landing-features{list-style:none;margin:0;padding:0;display:grid;gap:14px}
html .wd-landing-features li{display:flex;gap:12px;align-items:flex-start}
html .wd-landing-icon{flex:0 0 36px;height:36px;border-radius:10px;display:grid;place-items:center;background:#244135;color:#dec18e}
html .wd-landing-icon svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
html[dir=rtl] .wd-landing-icon svg{transform:none}
html .wd-landing-features strong{display:block;font-size:15px;color:#1f3a30}
html .wd-landing-features p{margin:0;font-size:13.5px;color:var(--wd-soft)}
html .wd-landing-trust{margin:18px 0 16px;padding-top:14px;border-top:1px solid #e5d9c2;font-size:13px;color:var(--wd-soft)}
html .wd-landing-actions{display:flex;flex-wrap:wrap;gap:10px}
html .wd-landing-actions button{flex:1 1 200px;min-height:46px;border-radius:9px;font:inherit;font-size:14px;font-weight:700;cursor:pointer;padding:10px 14px}
html .wd-landing-primary{background:#244135;color:#fff;border:1px solid #244135}
html .wd-landing-primary:hover:not(:disabled){background:#1a3328}
html .wd-landing-secondary{background:#fffdf8;color:#244135;border:1px solid #b49561}
html .wd-landing-secondary:hover:not(:disabled){background:#f6efe0}
html .wd-landing-actions button:disabled{cursor:default;opacity:.6}
@media(min-width:1000px){
 html .auth-screen.wd-landing-screen{grid-template-columns:minmax(0,540px) minmax(0,460px);gap:44px;align-content:center;align-items:center;justify-content:center}
 html .auth-screen.wd-landing-screen .wd-landing{order:-1}
 html .wd-about-link{display:none}
}
@media(max-width:420px){html .wd-landing{padding:20px 18px}html .wd-landing-title{font-size:26px}}
/* owner theme (light page background): keep the link readable and use the owner's colours */
html[data-wuduh-owner-theme] .wd-about-link{color:var(--ink)}
html[data-wuduh-owner-theme] .wd-landing{background:var(--paper);color:var(--ink);border-color:var(--line)}
html[data-wuduh-owner-theme] .wd-landing-title,html[data-wuduh-owner-theme] .wd-landing-features strong,html[data-wuduh-owner-theme] .wd-landing-lead{color:var(--ink)}

/* owner area: entry in the sidebar (owner only) and one dialog for the existing tools */
html .sidebar .wd-owner-entry{background:#d6b57d1a;color:var(--wd-soft-dark);border:1px solid #d6b57d55;border-radius:8px;width:100%;display:flex;align-items:center;gap:9px;text-align:start;padding:11px 10px;margin-bottom:8px;font:inherit;font-size:12.5px;font-weight:600;cursor:pointer}
html .sidebar .wd-owner-entry:hover{background:#d6b57d2e}
html .sidebar .wd-owner-entry svg{width:16px;height:16px;flex:0 0 16px;fill:none;stroke:#d6b57d;stroke-width:1.8;stroke-linejoin:round}
html[data-wuduh-owner-theme] .sidebar .wd-owner-entry{color:var(--wd-sidebar-text)}
html .wd-owner-area{width:min(640px,94vw);max-height:90dvh;box-sizing:border-box;padding:0;border:1px solid #d0ac72;border-radius:16px;background:#fffdf6;color:#283b35;font-family:inherit;line-height:1.8;overflow:auto}
html .wd-owner-area::backdrop{background:#112f2699}
html .wd-owner-area-head{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 20px;background:inherit;border-bottom:1px solid #e9e5d9}
html .wd-owner-area-head h2{margin:0;font:700 26px/1.4 Amiri,serif;color:#1f3a30}
html .wd-owner-area-close{font:inherit;font-size:13px;min-height:40px;padding:6px 14px;border:1px solid #ddd6c5;border-radius:8px;background:#fffdf8;color:#2f4a3f;cursor:pointer}
html .wd-owner-area-note{margin:14px 20px;padding:10px 12px;border-radius:10px;background:rgba(173,135,83,.08);border:1px solid rgba(127,99,56,.25);font-size:13px;color:var(--wd-soft)}
html .wd-owner-area-list{display:grid;gap:10px;padding:0 20px 20px}
html .wd-owner-tool{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px;border:1px solid #e3ddcf;border-radius:12px;background:#fff}
html .wd-owner-tool h3{margin:0 0 2px;font-size:16px;color:#1f3a30}
html .wd-owner-tool p{margin:0;font-size:13px;color:var(--wd-soft)}
html .wd-owner-tool button{flex:0 0 auto;font:inherit;font-size:13px;font-weight:600;min-height:44px;padding:8px 14px;border-radius:8px;border:1px solid #244135;background:#244135;color:#fff;cursor:pointer;white-space:nowrap}
html .wd-owner-tool button:hover{background:#1a3328}
html .wd-visitor-preview{width:min(760px,96vw)}
html .wd-landing.wd-landing-preview{width:auto;margin:0 20px 20px;box-shadow:none}
html .settings-sections .wd-open-owner-area{min-height:44px}
@media(max-width:560px){html .wd-owner-tool{flex-direction:column;align-items:stretch}html .wd-owner-tool button{width:100%;white-space:normal}html .wd-owner-area-head h2{font-size:22px}}

/* v23: trash auto-empty notice (filled by wuduh-publish.js only when the server schedule is active) */
html .list-head p.wd-trash-policy{margin-top:6px;font-size:12px;line-height:1.6;color:#4f5f55}
html .list-head p.wd-trash-policy:empty{display:none}
/* v25 · rich-editor notices (shown even when the editor module is not loaded) */
.wd-rich-notice{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin:0 0 12px;padding:10px 14px;border:1px solid #e5d8bd;border-radius:10px;background:#fbf6ea;color:#4a3d26;font-size:14px;line-height:1.7}
.wd-rich-notice button{border:1px solid #bc945c;background:#fff;color:#5c4320;border-radius:8px;padding:5px 12px;font:inherit;font-weight:600;cursor:pointer}
.wd-rich-notice button:hover{background:#f6ecd8}
.wd-rich-loading{padding:18px 4px;color:#89938b;font-size:14px}
.wd-original-dialog{max-width:min(720px,94vw);width:100%;border:1px solid #e9e5d9;border-radius:14px;padding:20px 22px;background:#fffdf8;color:#283b35}
.wd-original-dialog::backdrop{background:rgba(24,46,42,.45)}
.wd-original-dialog h2{font-family:var(--wd-heading-font,"Amiri"),serif;margin:0 0 6px;font-size:22px;color:#182e2a}
.wd-original-text{white-space:pre-wrap;overflow:auto;max-height:52vh;background:#f8f6ef;border:1px solid #e9e5d9;border-radius:10px;padding:12px 14px;font:14px/1.8 ui-monospace,Menlo,Consolas,monospace;unicode-bidi:plaintext;text-align:start}
/* v25: the top bar never pushes "New note" off-screen (1024px with a long breadcrumb used to overflow by ~46px). */
.top-search{min-width:0;flex-shrink:1}
.top-search input{min-width:0;width:100%}
.top-breadcrumb{flex-shrink:1;min-width:0;overflow:hidden}
.top-breadcrumb>*:last-child{min-width:0;overflow:hidden;text-overflow:ellipsis}
/* v25: progressive note list */
.wd-list-more{display:block;width:calc(100% - 24px);margin:10px 12px 18px;padding:10px;border:1px dashed var(--line,#e9e5d9);border-radius:10px;background:transparent;color:var(--muted,#89938b);font:inherit;font-size:13px;cursor:pointer}
.wd-list-more:hover{background:#f6f2e8;color:var(--ink,#283b35)}
/* v25: update notice */
.wd-update-toast{position:fixed;inset-inline-start:16px;bottom:calc(16px + env(safe-area-inset-bottom));z-index:1000;display:flex;align-items:center;gap:10px;max-width:calc(100vw - 32px);padding:10px 12px;border-radius:12px;background:var(--forest,#182e2a);color:#f8f6ef;box-shadow:0 10px 30px #0003;font-size:14px}
.wd-update-toast .gold-button{padding:7px 12px}
.wd-update-later{border:0;background:transparent;color:#d6d2c4;font:inherit;cursor:pointer}

/* ---------- v26 · الجهاز اللوحي (761–1000px): المحرر بعرض كامل ---------- */
/* Three columns (sidebar + list + editor) left the editor ~170px wide at 768. Between 761 and 1000 the sidebar stays,
   and the list and the editor take turns exactly like on phones (same show-mobile-editor state and back button). */
@media(min-width:761px) and (max-width:1000px){
 html .notes-layout{grid-template-columns:minmax(0,1fr)}
 html .notes-list-pane{width:100%}
 html .notes-layout.show-mobile-editor .notes-list-pane{display:none}
 html .notes-layout:not(.show-mobile-editor) .editor-pane{display:none}
 html .mobile-back{display:grid;place-items:center;border:0;color:#536b5c;background:transparent;padding:6px 2px;cursor:pointer}
}
@media(min-width:761px) and (max-width:1000px){html[data-wd-scheme=dark]:not([data-wuduh-owner-theme]) .mobile-back{color:#b4c5bb}}
