/* Fonts are served from this site (Readex Pro: Arabic + Latin; Handjet: only the letters of the wordmark). */
@font-face {
  font-family: 'Readex Pro'; font-style: normal; font-weight: 300 600; font-display: swap;
  src: url(fonts/readex-arabic.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Readex Pro'; font-style: normal; font-weight: 300 600; font-display: swap;
  src: url(fonts/readex-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Readex Pro'; font-style: normal; font-weight: 300 600; font-display: swap;
  src: url(fonts/readex-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Handjet'; font-style: normal; font-weight: 100 900; font-display: block;
  src: url(fonts/handjet-daftar.woff2) format('woff2');
  unicode-range: U+62a, U+62f, U+631, U+641;
}

/* Daftar (دفتر): lined paper sheets on the cobalt glazed-brick desk of qasimmuhammad.com.
   The one loud thing is the desk and its ochre index tabs; everything on paper stays quiet. */

:root {
  --glaze: #1b3a8c;          /* the desk: cobalt glazed brick */
  --bar: #142d6e;            /* masthead, a shade deeper */
  --ochre: #e8b04a;          /* glazed ochre tiles: whatever is active */
  --ochre-deep: #c8902e;
  --on-ochre: #14296b;
  --sand: #f1e4c3;           /* writing on the desk */
  --sand-2: rgba(241, 228, 195, .68);
  --sand-wash: rgba(241, 228, 195, .1);
  --sand-wash-2: rgba(241, 228, 195, .18);
  --brick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cpath d='M0 .75H120M0 30.75H120M.75 0V30M60.75 30V60' stroke='%2317337d' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");

  --paper: #fffdf5;
  --surface: #fffdf7;        /* menus and dialogs: the same paper, no lines */
  --ink: #23211c;
  --ink-2: #6a655a;
  --placeholder: rgba(35, 33, 28, .48);
  --rule: rgba(60, 130, 215, .36);
  --margin-rule: rgba(222, 72, 72, .55);
  --divider: rgba(0, 0, 0, .1);
  --hover: rgba(70, 60, 40, .1);
  --hover-soft: rgba(70, 60, 40, .06);
  --chip: rgba(70, 60, 40, .09);
  --chip-hover: rgba(70, 60, 40, .16);
  --link: #1a4fb8;
  --pad-edge-1: #f1ebdb;
  --pad-edge-2: #e3dbc6;
  --paper-shadow: 0 1px 0 rgba(8, 20, 60, .3), 0 3px 10px rgba(8, 20, 60, .3);
  --paper-shadow-hover: 0 2px 0 rgba(8, 20, 60, .3), 0 10px 24px rgba(8, 20, 60, .42);
  --pop-shadow: 0 10px 32px rgba(6, 16, 50, .45), 0 2px 6px rgba(6, 16, 50, .25);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --glaze: #102457;
  --bar: #0b1a40;
  --ochre: #d9a441;
  --ochre-deep: #ad7d24;
  --brick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cpath d='M0 .75H120M0 30.75H120M.75 0V30M60.75 30V60' stroke='%230c1c49' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  --paper: #262521;
  --surface: #2d2c29;
  --ink: #ebe8e1;
  --ink-2: #a39e93;
  --placeholder: rgba(235, 232, 225, .45);
  --rule: rgba(138, 180, 248, .16);
  --margin-rule: rgba(242, 139, 130, .4);
  --divider: rgba(255, 255, 255, .12);
  --hover: rgba(255, 255, 255, .1);
  --hover-soft: rgba(255, 255, 255, .07);
  --chip: rgba(255, 255, 255, .1);
  --chip-hover: rgba(255, 255, 255, .18);
  --link: #9cc0ff;
  --pad-edge-1: #1f1e1b;
  --pad-edge-2: #191816;
  color-scheme: dark;
}

/* Paper colours: light, then dark. "default" is plain cream notebook paper. */
.c-default { --note-bg: var(--paper); }
.c-coral   { --note-bg: #fbc4bf; }
.c-peach   { --note-bg: #f8c3a6; }
.c-sand    { --note-bg: #fff6b0; }
.c-mint    { --note-bg: #e3f5d4; }
.c-sage    { --note-bg: #c6e6dd; }
.c-fog     { --note-bg: #dde9f0; }
.c-storm   { --note-bg: #c3d9e6; }
.c-dusk    { --note-bg: #ddcde4; }
.c-blossom { --note-bg: #f8e6e1; }
.c-clay    { --note-bg: #ece5d3; }
.c-chalk   { --note-bg: #f0eff0; }
[data-theme="dark"] .c-coral   { --note-bg: #5e2230; }
[data-theme="dark"] .c-peach   { --note-bg: #5a2f1f; }
[data-theme="dark"] .c-sand    { --note-bg: #5c4310; }
[data-theme="dark"] .c-mint    { --note-bg: #26443a; }
[data-theme="dark"] .c-sage    { --note-bg: #164f4b; }
[data-theme="dark"] .c-fog     { --note-bg: #244c5a; }
[data-theme="dark"] .c-storm   { --note-bg: #273b4b; }
[data-theme="dark"] .c-dusk    { --note-bg: #3f2e4d; }
[data-theme="dark"] .c-blossom { --note-bg: #553243; }
[data-theme="dark"] .c-clay    { --note-bg: #423c33; }
[data-theme="dark"] .c-chalk   { --note-bg: #2c2c2e; }

/* Lined paper: a red margin line, a blank band at the top, then one blue rule per line of text.
   --line is the line spacing, --top the blank band, --mx where the margin line sits.
   Every text row inside uses exactly --line so writing sits on the rules. */
.note-card, .notepad, .editor-scroll {
  background-color: var(--note-bg, var(--paper));
  background-image:
    linear-gradient(var(--margin-rule), var(--margin-rule)),
    linear-gradient(var(--note-bg, var(--paper)), var(--note-bg, var(--paper))),
    linear-gradient(to bottom, transparent calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px));
  background-size: 2px 100%, 100% var(--top), 100% var(--line);
  background-position: left var(--mx) top 0, 0 0, 0 var(--top);
  background-repeat: no-repeat, no-repeat, repeat-y;
}
.note-card[dir="rtl"], .editor[dir="rtl"] .editor-scroll {
  background-position: right var(--mx) top 0, 0 0, 0 var(--top);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Readex Pro", Tahoma, "Noto Sans Arabic", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  background: var(--glaze) var(--brick);
  color: var(--sand);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
textarea::placeholder, input::placeholder { color: var(--placeholder); opacity: 1; }
:focus-visible { outline: 2px solid var(--ochre); outline-offset: 2px; }
a { color: var(--link); }
svg { display: block; }
.hidden { display: none !important; }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--ink-2);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .38; cursor: default; background: none; }
.icon-btn.spin svg { animation: spin .9s linear infinite; }

/* The homepage's ochre tile: pressed like a key. */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--ochre); color: var(--on-ochre);
  border-radius: 6px; padding: 9px 20px; font-weight: 600; line-height: 20px;
  box-shadow: inset 0 -3px 0 var(--ochre-deep);
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-primary:active { transform: translateY(1px); box-shadow: inset 0 -1px 0 var(--ochre-deep); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-primary svg { width: 18px; height: 18px; fill: currentColor; margin-inline-start: -4px; }
.text-btn { padding: 8px 18px; border-radius: 6px; font-weight: 500; line-height: 20px; color: var(--ink); }
.text-btn:hover { background: var(--hover-soft); }

/* ---------- masthead: wordmark, search, and the index tabs ---------- */
.masthead { position: sticky; top: 0; z-index: 30; background: var(--bar); transition: box-shadow .2s; }
.masthead.scrolled { box-shadow: 0 6px 18px rgba(4, 12, 40, .45); }
.bar { display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 20px; }
.wordmark {
  font-family: "Handjet", "Readex Pro", sans-serif;
  font-variation-settings: "ELSH" 6, "ELGR" 1, "wght" 520;
  font-size: 44px; line-height: 1; color: var(--ochre); text-decoration: none;
  padding: 0 4px 4px; flex: none;
}
.search {
  display: flex; align-items: center; flex: 0 1 400px; min-width: 0; height: 40px;
  margin-inline-start: 24px; padding: 0 4px;
  background: var(--sand-wash); border-radius: 8px; color: var(--sand);
}
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 15px; padding: 0 6px; }
.search input::placeholder { color: var(--sand-2); }
.search input::-webkit-search-cancel-button { display: none; }
.search .icon-btn { color: var(--sand-2); width: 34px; height: 34px; }
.search .icon-btn:hover { background: var(--sand-wash); color: var(--sand); }
.search:focus-within { background: var(--surface); color: var(--ink); }
.search:focus-within input::placeholder { color: var(--placeholder); }
.search:focus-within .icon-btn { color: var(--ink-2); }
.search-back, .search-toggle { display: none; }
.actions { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; flex: none; }
.bar .actions .icon-btn { color: var(--sand-2); }
.bar .actions .icon-btn:hover { background: var(--sand-wash); color: var(--sand); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ochre); margin: 0 8px; }

/* Index tabs stand on an ochre rule; the open one is an ochre tile joined to it. */
.tabs {
  display: flex; align-items: flex-end; height: 44px; padding: 0 20px;
  border-bottom: 3px solid var(--ochre);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs-main, .tabs-side { display: flex; align-items: flex-end; gap: 4px; flex: none; }
.tabs-side { margin-inline-start: auto; padding-inline-start: 24px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 34px; padding: 0 14px; border-radius: 7px 7px 0 0;
  background: var(--sand-wash); color: var(--sand);
  font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.tab:hover { background: var(--sand-wash-2); }
.tab svg { width: 17px; height: 17px; fill: currentColor; opacity: .85; }
.tab.active { height: 38px; background: var(--ochre); color: var(--on-ochre); font-weight: 600; }
.tab.active svg { opacity: 1; }
.tab-edit { padding: 0 10px; background: transparent; color: var(--sand-2); }
.tab-edit:hover { color: var(--sand); }

/* ---------- desk ---------- */
.main { padding: 28px 24px 140px; }

/* "Write a note" is a pad of paper: the sheets under it show as stacked edges. */
.notepad {
  --line: 28px; --top: 12px; --mx: 40px;
  display: flex; align-items: center; gap: 8px;
  width: min(528px, calc(100% - 16px)); height: 52px; margin: 0 8px 36px;
  padding-inline: calc(var(--mx) + 12px) 8px;
  border-radius: 3px; color: var(--ink); cursor: text;
  box-shadow: 0 3px 0 -1px var(--pad-edge-1), 0 6px 0 -2px var(--pad-edge-2), 0 8px 18px rgba(8, 20, 60, .4);
}
.notepad:hover { box-shadow: 0 3px 0 -1px var(--pad-edge-1), 0 6px 0 -2px var(--pad-edge-2), 0 12px 26px rgba(8, 20, 60, .5); }
.notepad .pad-text { flex: 1; font-size: 16px; color: var(--placeholder); }
.notepad .pad-list { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 6px; color: var(--ink-2); font-weight: 500; }
.notepad .pad-list:hover { background: var(--hover); color: var(--ink); }
.notepad .pad-list svg { width: 20px; height: 20px; fill: currentColor; }

.section { width: fit-content; max-width: 100%; margin: 0 0 28px; }
.section-label { font-size: 13px; font-weight: 500; color: var(--sand-2); margin: 0 0 10px 8px; }
.columns { display: flex; align-items: flex-start; }
.column { width: 272px; padding: 0 8px; flex: none; }
.list-mode .section { width: min(656px, 100%); }
.list-mode .column { width: 100%; }

/* A note card is a sheet of lined paper. Its own padding keeps text right of the margin line;
   rows that use the margin (checkboxes) pull back into it with a negative margin. */
.note-card {
  --line: 24px; --top: 12px; --mx: 32px; --pad-start: calc(var(--mx) + 10px); --pad-end: 14px;
  position: relative;
  padding: var(--top) var(--pad-end) 12px var(--pad-start);
  padding-inline: var(--pad-start) var(--pad-end);
  border-radius: 3px; box-shadow: var(--paper-shadow);
  margin-bottom: 16px; overflow: hidden; cursor: default;
  color: var(--ink);
  transition: box-shadow .2s ease;
}
.note-card:hover { box-shadow: var(--paper-shadow-hover); }
.note-card.dragging { opacity: .35; }
.note-card.drop-target { box-shadow: 0 0 0 3px var(--ochre); }
.note-card.editing { visibility: hidden; }
.note-card .card-date {
  display: flex; align-items: center; justify-content: flex-end; gap: 5px;
  height: var(--line); padding-inline-end: 30px;
  font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden;
}
.note-card .card-date svg { width: 13px; height: 13px; fill: currentColor; flex: none; }
.note-card .card-date span { overflow: hidden; text-overflow: ellipsis; }
.note-card .card-title {
  font-size: 16px; font-weight: 600; line-height: var(--line);
  overflow-wrap: anywhere; white-space: pre-wrap;
  max-height: calc(var(--line) * 6); overflow: hidden;
}
.note-card .card-body { font-size: 14px; line-height: var(--line); overflow-wrap: anywhere; white-space: pre-wrap; }
.note-card .card-body.big { font-size: 19px; }
.note-card .empty-note { color: var(--ink-2); line-height: var(--line); }
/* A pinned sheet has a real pin through its margin. */
.note-card .pushpin {
  position: absolute; top: 6px; inset-inline-start: calc(var(--mx) / 2 - 7px);
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffb0a6 0 16%, #d93a2f 46%, #8f1c16 100%);
  box-shadow: 1px 2px 2px rgba(0, 0, 0, .35);
}
.note-card .card-menu-btn { position: absolute; top: 8px; inset-inline-end: 4px; width: 28px; height: 28px; opacity: 0; transition: opacity .15s; }
.note-card:hover .card-menu-btn, .note-card:focus-within .card-menu-btn, .note-card.menu-open .card-menu-btn { opacity: 1; }
@media (hover: none) { .note-card .card-menu-btn { opacity: .75; } }
.card-list { list-style: none; margin: 0; padding: 0; }
.card-list li {
  display: flex; align-items: flex-start; font-size: 14px; line-height: var(--line);
  margin-inline-start: calc(-1 * var(--pad-start));
}
.card-list .tick {
  width: var(--mx); height: var(--line); margin-inline-end: 10px; flex: none;
  display: flex; align-items: center; justify-content: center; color: var(--ink-2); border-radius: 4px;
}
.card-list .tick:hover { background: var(--hover); color: var(--ink); }
.card-list .tick svg { width: 16px; height: 16px; fill: currentColor; }
.card-list .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.card-list li.done .txt { text-decoration: line-through; color: var(--ink-2); }
.card-list li.more { margin-inline-start: 0; color: var(--ink-2); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 2px 0; min-height: var(--line, 24px); }
.chip {
  display: inline-flex; align-items: center; max-width: 100%;
  height: 20px; padding: 0 9px; border-radius: 4px;
  background: var(--chip); font-size: 11.5px; font-weight: 500;
  color: var(--ink); white-space: nowrap; cursor: pointer;
}
.chip span { overflow: hidden; text-overflow: ellipsis; }
.chip:hover { background: var(--chip-hover); }
.chip .x { display: none; width: 16px; height: 16px; margin-inline: 2px -6px; border-radius: 50%; align-items: center; justify-content: center; }
.chip .x svg { width: 14px; height: 14px; fill: currentColor; }
.chip:hover .x { display: inline-flex; }
.chip .x:hover { background: var(--chip-hover); }

/* ---------- empty desk & banners ---------- */
.empty { display: flex; flex-direction: column; align-items: flex-start; max-width: 420px; margin: 8vh 8px 0; color: var(--sand-2); }
.empty > svg { width: 64px; height: 64px; fill: rgba(241, 228, 195, .3); margin-bottom: 16px; }
.empty > div { font-size: 18px; line-height: 28px; color: var(--sand); }
.empty p { margin: 4px 0 0; font-size: 14px; line-height: 22px; }
.empty .btn-primary { margin-top: 16px; }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 8px 28px; color: var(--sand); font-size: 15px; }

/* ---------- the open note: a full page, actions along its top edge ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 18, 52, .62);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes lift { from { transform: translateY(12px); opacity: 0; } }
.editor {
  display: flex; flex-direction: column; width: 100%; max-width: 720px;
  height: calc(100vh - 48px); height: calc(100dvh - 48px);
  background: var(--note-bg); color: var(--ink);
  border-radius: 4px; box-shadow: var(--pop-shadow);
  animation: lift .18s ease;
}
.sheet-head {
  display: flex; align-items: center; gap: 2px; flex: none;
  padding: 8px 10px; border-bottom: 2px solid var(--rule);
}
.sheet-head .spacer { flex: 1; }
.sheet-head .btn-primary { padding: 7px 18px; }
.editor-scroll {
  --line: 28px; --top: 16px; --mx: 50px;
  position: relative; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
  padding-block: var(--top) 24px;
  padding-inline: calc(var(--mx) + 12px) 20px;
  background-attachment: local, local, local;
  border-radius: 0 0 4px 4px;
}
.editor textarea {
  display: block; width: 100%; resize: none; overflow: hidden;
  border: 0; outline: 0; background: transparent; padding: 0; margin: 0;
}
.editor .f-title { font-size: 20px; line-height: var(--line); font-weight: 600; }
.editor .f-body { font-size: 16px; line-height: var(--line); min-height: calc(var(--line) * 3); }
.editor .links { display: flex; flex-direction: column; }
.editor .links a { display: flex; align-items: center; gap: 8px; height: var(--line); font-size: 13px; text-decoration: none; overflow: hidden; }
.editor .links a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor .links a svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.editor .links a:hover span { text-decoration: underline; }
.editor .chips { gap: 8px 6px; padding: 4px 0; }
.editor .edited { text-align: end; font-size: 12px; line-height: var(--line); color: var(--ink-2); }

/* The date line at the top of the page. The real date input is invisible and stretched over it,
   so a tap anywhere opens the device's own date picker. */
.editor .date-row { display: flex; justify-content: flex-end; height: var(--line); }
.date-pick { position: relative; display: inline-flex; border-radius: 4px; }
.date-pick:not(.ro):hover { background: var(--hover-soft); }
.date-pick:focus-within { outline: 2px solid var(--ochre); outline-offset: -2px; }
.date-face { display: inline-flex; align-items: center; gap: 6px; height: var(--line); padding: 0 6px; font-size: 14px; white-space: nowrap; }
.date-face svg { width: 16px; height: 16px; fill: var(--ink-2); }
.date-label { font-size: 12px; color: var(--ink-2); }
.date-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.date-input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }

/* checklist editing: the drag handle and checkbox live in the margin */
.list-item, .list-add, .checked-toggle { margin-inline-start: calc(-1 * (var(--mx) + 12px)); }
.list-item { display: flex; align-items: flex-start; min-height: var(--line); }
.list-item .handle { width: calc(var(--mx) - 28px); height: var(--line); display: flex; align-items: center; justify-content: center; color: var(--ink-2); opacity: 0; cursor: grab; flex: none; }
.list-item .handle svg { width: 18px; height: 18px; fill: currentColor; }
.list-item:hover .handle { opacity: .7; }
.list-item.drag-over, .list-add.drag-over { box-shadow: inset 0 2px 0 var(--ochre); }
.list-item .check { width: 28px; height: var(--line); flex: none; display: flex; align-items: center; justify-content: center; border-radius: 4px; color: var(--ink-2); }
.list-item .check:hover { background: var(--hover); color: var(--ink); }
.list-item .check svg { width: 18px; height: 18px; fill: currentColor; }
.list-item textarea { flex: 1; min-width: 0; font-size: 16px; line-height: var(--line); margin-inline-start: 12px; }
.list-item.done textarea { text-decoration: line-through; color: var(--ink-2); }
.list-item .del { width: var(--line); height: var(--line); border-radius: 4px; opacity: 0; }
.list-item:hover .del, .list-item:focus-within .del { opacity: 1; }
@media (hover: none) { .list-item .del { opacity: 1; } .list-item .handle { visibility: hidden; } }
.list-add { display: flex; align-items: center; height: var(--line); color: var(--ink-2); }
.list-add .plus { width: var(--mx); height: var(--line); display: flex; align-items: center; justify-content: flex-end; padding-inline-end: 4px; flex: none; }
.list-add .plus svg { width: 20px; height: 20px; fill: currentColor; }
.list-add input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; height: var(--line); padding: 0; margin-inline-start: 12px; color: var(--ink); }
.checked-toggle { display: flex; align-items: center; gap: 16px; height: var(--line); padding-inline-start: calc(var(--mx) - 24px); color: var(--ink-2); font-size: 14px; }
.checked-toggle svg { width: 20px; height: 20px; fill: currentColor; transition: transform .15s; }
.checked-toggle.collapsed svg { transform: rotate(-90deg); }
[dir="rtl"] .checked-toggle.collapsed svg { transform: rotate(90deg); }

/* ---------- menus, dialogs, toast: plain paper ---------- */
.popover {
  position: fixed; z-index: 300;
  background: var(--surface); color: var(--ink);
  border-radius: 8px; box-shadow: var(--pop-shadow);
  padding: 6px 0; min-width: 200px; max-width: calc(100vw - 16px); max-height: 75vh; overflow-y: auto;
  animation: fade .1s ease;
}
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; padding: 8px 16px; font-size: 14px; line-height: 20px; }
.menu-item:hover { background: var(--hover-soft); }
.menu-item svg { width: 20px; height: 20px; fill: var(--ink-2); flex: none; }
.menu-item .check-mark { margin-inline-start: auto; }
.menu-item.danger { color: #b3261e; }
.menu-item.danger svg { fill: currentColor; }
[data-theme="dark"] .menu-item.danger { color: #f2b8b5; }
.menu-sep { border-top: 1px solid var(--divider); margin: 6px 0; }
.menu-head { padding: 6px 16px 4px; font-size: 12px; color: var(--ink-2); }

.palette { display: grid; grid-template-columns: repeat(6, 32px); gap: 4px; padding: 6px 12px; }
.swatch {
  width: 30px; height: 30px; border-radius: 6px; margin: 1px;
  background: var(--note-bg); border: 2px solid rgba(0, 0, 0, .08); position: relative;
  display: flex; align-items: center; justify-content: center;
}
[data-theme="dark"] .swatch { border-color: rgba(255, 255, 255, .12); }
.swatch:hover { border-color: var(--ink-2); }
.swatch.on { border-color: var(--ochre-deep); box-shadow: 0 0 0 2px var(--ochre); }
.swatch svg { width: 16px; height: 16px; fill: var(--ink-2); }

.label-picker { width: 248px; padding: 8px 0 4px; }
.label-picker .head { padding: 2px 14px 6px; font-size: 14px; font-weight: 500; }
.label-picker .find { display: flex; align-items: center; margin: 0 14px 6px; border-bottom: 1px solid var(--divider); }
.label-picker .find input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 13px; height: 32px; min-width: 0; }
.label-picker .find svg { width: 16px; height: 16px; fill: var(--ink-2); }
.label-picker .opts { max-height: 240px; overflow-y: auto; }
.label-picker .opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; padding: 6px 14px; font-size: 13px; }
.label-picker .opt:hover { background: var(--hover-soft); }
.label-picker .opt svg { width: 18px; height: 18px; fill: var(--ink-2); flex: none; }
.label-picker .opt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-picker .create { border-top: 1px solid var(--divider); margin-top: 4px; padding-top: 8px; padding-bottom: 8px; }

.dialog-scrim {
  position: fixed; inset: 0; z-index: 200; background: rgba(8, 18, 52, .62);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade .15s ease;
}
.dialog {
  width: min(420px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); color: var(--ink);
  border-radius: 8px; box-shadow: var(--pop-shadow);
  animation: lift .15s ease;
}
.dialog h2 { margin: 0; padding: 20px 24px 4px; font-size: 17px; font-weight: 600; }
.dialog-body { padding: 12px 24px 8px; line-height: 21px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 16px 16px; }
.field {
  display: block; width: 100%; height: 44px; margin: 0 0 12px; padding: 0 12px;
  border: 1px solid rgba(0, 0, 0, .18); border-radius: 6px; background: transparent; color: var(--ink);
  font-size: 15px; outline: 0;
}
[data-theme="dark"] .field { border-color: rgba(255, 255, 255, .2); }
.field:focus { border-color: var(--ochre-deep); box-shadow: 0 0 0 2px var(--ochre); }
.form-error { color: #b3261e; font-size: 13px; min-height: 18px; margin: -4px 0 8px; }
[data-theme="dark"] .form-error { color: #f2b8b5; }

.label-row { display: flex; align-items: center; gap: 4px; margin: 0 -12px; }
.label-row input { flex: 1; min-width: 0; height: 36px; border: 0; border-bottom: 1px solid transparent; outline: 0; background: transparent; font-size: 14px; padding: 0 4px; }
.label-row input:focus { border-bottom-color: var(--divider); }

.toast {
  position: fixed; left: 24px; bottom: 24px; z-index: 400;
  display: flex; align-items: center; gap: 12px;
  min-width: 288px; max-width: calc(100vw - 48px);
  padding: 6px 6px 6px 16px; min-height: 48px; border-radius: 6px;
  background: var(--surface); color: var(--ink); box-shadow: var(--pop-shadow);
  border-inline-start: 4px solid var(--ochre);
  font-size: 14px; animation: lift .2s ease;
}
.toast .msg { flex: 1; }
.toast > button:not(.icon-btn) { color: var(--glaze); font-weight: 600; padding: 8px 12px; border-radius: 6px; }
[data-theme="dark"] .toast > button:not(.icon-btn) { color: var(--ochre); }
.toast > button:not(.icon-btn):hover { background: var(--hover-soft); }
.toast .icon-btn { width: 32px; height: 32px; }

/* ---------- sign in: the wordmark on the desk, a sheet to sign on ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px 16px; }
.login-mark {
  font-family: "Handjet", "Readex Pro", sans-serif;
  font-variation-settings: "ELSH" 6, "ELGR" 1, "wght" 520;
  font-size: clamp(88px, 22vw, 140px); line-height: 1; color: var(--ochre);
}
.login-card {
  width: min(400px, 100%); padding: 32px 28px 28px 56px; border-radius: 3px; color: var(--ink);
  background: linear-gradient(var(--margin-rule), var(--margin-rule)) left 36px top 0 / 2px 100% no-repeat, var(--paper);
  box-shadow: var(--paper-shadow-hover);
}
.login-card h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.login-card p { color: var(--ink-2); margin: 0 0 22px; font-size: 14px; line-height: 21px; }
.login-card .btn-primary { width: 100%; height: 44px; margin-top: 4px; }

.loading { display: flex; padding: 12vh 8px 0; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--sand-wash-2); border-top-color: var(--ochre); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fab { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- phone ---------- */
@media (max-width: 600px) {
  .bar { height: 56px; padding: 0 6px 0 12px; gap: 0; }
  .wordmark { font-size: 36px; }
  .search { display: none; }
  .search-toggle { display: inline-flex; }
  .actions .view-toggle, .actions .refresh { display: none; }
  .app.searching .wordmark, .app.searching .actions { display: none; }
  .app.searching .search { display: flex; flex: 1; margin: 0; }
  .app.searching .search-back { display: inline-flex; }
  .app.searching .search > .icon-btn:first-child + .icon-btn { display: none; }
  .tabs { padding: 0 8px; }
  .tabs-side { padding-inline-start: 12px; }
  .tab { padding: 0 12px; }
  .main { padding: 16px 8px 120px; }
  .notepad { display: none; }
  .columns { justify-content: stretch; }
  .column { flex: 1 1 0; width: auto; min-width: 0; padding: 0 4px; }
  .section { width: 100%; }
  .section-label, .banner, .empty { margin-inline-start: 4px; }
  .note-card { --mx: 22px; --pad-start: calc(var(--mx) + 8px); --pad-end: 10px; margin-bottom: 8px; }
  .note-card .card-title { font-size: 15px; }
  .note-card .pushpin { width: 12px; height: 12px; inset-inline-start: calc(var(--mx) / 2 - 6px); }
  .scrim { padding: 0; }
  .editor { max-width: none; height: 100vh; height: 100dvh; border-radius: 0; }
  .editor-scroll { --mx: 40px; border-radius: 0; padding-inline-end: 14px; }
  .toast { left: 8px; right: 8px; bottom: 8px; min-width: 0; max-width: none; }
  .fab {
    display: inline-flex; position: fixed; right: 16px; bottom: 20px; z-index: 20;
    width: 58px; height: 58px; border-radius: 12px;
    background: var(--ochre); color: var(--on-ochre);
    box-shadow: inset 0 -4px 0 var(--ochre-deep), 0 6px 16px rgba(4, 12, 40, .5);
  }
  .fab:hover { background: var(--ochre); color: var(--on-ochre); }
  .fab svg { width: 30px; height: 30px; }
  .fab.hidden { display: none; }
}
