/* «أدواتي» (Tools hub) + Reminders («التذكيرات») + Notes («الملاحظات»).
   Hub: three big tiles with one live hint each, the guide card (a little phone on a page of the notebook), then two
   quiet rows. Reminders read like a day planner: the clock time sits at the end of each row (where amounts sit in the
   ledger), teal for today, amber for missed. Notes are small pages of the shop notebook: their text sits on the same
   faint ruled lines as the app background, and a pinned note wears the logo's amber ribbon. Tokens only; no entrance
   animation (these pages are kept alive). */

/* ===================== Tools hub ===================== */
.tools-page { max-width: 720px; padding-top: var(--sp-2); }
.tools-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
.tools-tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); min-width: 0;
  min-height: 136px; padding: var(--sp-4) var(--sp-3) var(--sp-3); border-radius: var(--r-xl);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--card-shadow);
  color: var(--text); text-decoration: none; -webkit-tap-highlight-color: transparent;
  transition: border-color var(--dur), background var(--dur), transform 90ms var(--ease);
}
.tools-tile:hover { text-decoration: none; }
@media (hover: hover) { .tools-tile:hover { border-color: color-mix(in srgb, var(--brand) 38%, var(--border)); } }
.tools-tile:active { transform: scale(.975); background: var(--surface-2); }
.tools-tile:focus-visible, .tools-guide:focus-visible, .tools-row:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tools-tile-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 15px; flex: 0 0 auto; }
.tools-tile.tone-brand .tools-tile-icon { background: var(--brand-soft); color: var(--brand-strong); }
.tools-tile.tone-amber .tools-tile-icon { background: var(--accent-soft); color: var(--accent-strong); }
.tools-tile.tone-ink .tools-tile-icon { background: var(--surface-3); color: var(--text-2); }
.tools-tile-name { margin-top: auto; max-width: 100%; font-size: var(--fs-md); font-weight: 800; line-height: 1.3; overflow-wrap: break-word; }
.tools-tile-name.is-long { font-size: 13px; letter-spacing: -0.01em; } /* «بیرخستنەوەکان» stays one word on a phone */
@media (min-width: 721px) { .tools-tile-name.is-long { font-size: var(--fs-md); } }
.tools-tile-hint { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; font-size: var(--fs-xs); font-weight: 700; line-height: 1.4; color: var(--text-3); }
.tools-tile-hint > span { min-width: 0; overflow-wrap: anywhere; }
.tools-tile-hint.is-alert { color: var(--accent-strong); }
.tools-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
@media (max-width: 380px) {
  .tools-tiles { gap: 10px; }
  .tools-tile { padding: var(--sp-3) 10px; min-height: 128px; }
  .tools-tile-icon { width: 44px; height: 44px; border-radius: 13px; }
  .tools-tile-name { font-size: 14px; }
  .tools-tile-name.is-long { font-size: 12.5px; }
}
@media (max-width: 340px) {
  .tools-tile { padding-inline: 8px; }
  .tools-tile-name { font-size: 13px; }
  .tools-tile-name.is-long { font-size: 11.5px; }
}
@media (min-width: 721px) {
  .tools-tile { min-height: 156px; padding: var(--sp-5) var(--sp-4) var(--sp-4); }
  .tools-tile-icon { width: 54px; height: 54px; border-radius: 17px; }
  .tools-tile-name { font-size: var(--fs-lg); }
  .tools-tile-hint { font-size: var(--fs-sm); }
}

/* the guide: a little phone on a page of the notebook */
.tools-guide {
  position: relative; display: flex; align-items: center; gap: var(--sp-4); margin-top: var(--section-gap);
  min-height: 104px; padding: var(--sp-4) var(--sp-5); padding-inline-end: var(--sp-4); border-radius: var(--r-xl); overflow: hidden;
  background-color: var(--brand-softer);
  background-image: repeating-linear-gradient(to bottom, transparent 0 25px, color-mix(in srgb, var(--brand) 12%, transparent) 25px 26px);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--border));
  color: var(--text); text-decoration: none; transition: border-color var(--dur), transform 90ms var(--ease);
}
.tools-guide:hover { text-decoration: none; }
@media (hover: hover) { .tools-guide:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--border)); } }
.tools-guide:active { transform: scale(.985); }
.tools-guide::after { /* the logo's amber bookmark */
  content: ''; position: absolute; top: -1px; inset-inline-end: 54px; width: 14px; height: 22px;
  background: linear-gradient(180deg, var(--gold), var(--gold-2)); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
}
.tools-guide-phone {
  flex: 0 0 auto; display: flex; padding: 5px; width: 48px; height: 78px; border-radius: 13px;
  background: var(--surface); border: 2px solid var(--brand); box-shadow: 0 8px 16px -10px color-mix(in srgb, var(--brand) 60%, transparent);
  transform: rotate(-6deg);
}
[dir='rtl'] .tools-guide-phone { transform: rotate(6deg); }
.tools-guide-screen { flex: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--brand); color: var(--brand-ink); }
.tools-guide-screen .icon { margin-left: 2px; } /* a play triangle points right in every language */
.tools-guide-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tools-guide-title { font-size: var(--fs-xl); font-weight: 800; line-height: 1.3; }
.tools-guide-sub { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); line-height: 1.45; }
.tools-chev { flex: 0 0 auto; color: var(--text-3); }
.tools-guide .tools-chev { color: var(--brand); }

/* quiet rows: plan + settings */
.tools-rows { margin-top: var(--section-gap); overflow: hidden; }
.tools-row { display: flex; align-items: center; gap: var(--sp-3); min-height: 68px; padding: var(--sp-3) var(--sp-4); color: var(--text); text-decoration: none; transition: background var(--dur); }
.tools-row + .tools-row { border-top: 1px solid var(--border); }
.tools-row:hover { text-decoration: none; }
@media (hover: hover) { .tools-row:hover { background: var(--surface-2); } }
.tools-row:active { background: var(--surface-3); }
.tools-row-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto; background: var(--surface-2); color: var(--text-2); }
.tools-row-icon.tone-amber { background: var(--accent-soft); color: var(--accent-strong); }
.tools-row-icon.tone-brand { background: var(--brand-softer); color: var(--brand); }
.tools-row-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tools-row-title { font-weight: 800; line-height: 1.35; }
.tools-row-sub { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools-row-sub.is-alert { color: var(--accent-strong); font-weight: 700; }
.tools-ok { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px; border-radius: var(--r-pill); background: var(--brand-softer); color: var(--brand-strong); font-size: var(--fs-xs); font-weight: 800; }

/* ===================== Reminders ===================== */
.alarms-page { max-width: 720px; }

/* "Turn on notifications" card (teal) */
.alarm-push {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px 14px;
  padding: var(--sp-4); margin-bottom: var(--sp-5); border-radius: var(--r-lg);
  background: var(--brand-softer); border: 1px solid color-mix(in srgb, var(--brand) 24%, transparent);
}
.alarm-push-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px; background: var(--brand); color: var(--brand-ink); }
.alarm-push-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.alarm-push-title { font-size: var(--fs-md); font-weight: 800; line-height: 1.45; color: var(--text); }
.alarm-push-body { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.55; }
.alarm-push-btn { grid-column: 1 / -1; }
@media (min-width: 560px) {
  .alarm-push { grid-template-columns: auto minmax(0, 1fr) auto; }
  .alarm-push-btn { grid-column: auto; }
}
.alarm-push-warn { margin-bottom: 14px; }

.alarm-add { margin-bottom: var(--sp-1); }
.alarm-empty { padding-top: 28px; }

/* Sections */
.alarm-sec { margin-top: var(--section-gap); }
.alarm-sec-title { display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; font-size: var(--fs-md); font-weight: 800; color: var(--text); }
.alarm-sec-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-xs); font-weight: 800; }
.sec-today .alarm-sec-count { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); }
.sec-overdue .alarm-sec-count { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.alarm-sec-toggle { margin-inline-start: auto; }
.alarm-list { overflow: hidden; }

/* Row: ✓ | title + meta | time — plus, under the title, the record it was made from (a chip) */
.alarm-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: stretch; }
.alarm-row.has-ref .alarm-check { grid-row: span 2; }
.alarm-ref {
  grid-column: 2; justify-self: start; display: inline-flex; align-items: center; gap: 5px; max-width: calc(100% - 20px);
  min-height: 32px; margin: -6px 0 12px; margin-inline-start: 6px; padding: 0 10px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-xs); font-weight: 700;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.alarm-ref > .icon:first-child { color: var(--brand); flex: 0 0 auto; }
.alarm-ref-chev { flex: 0 0 auto; opacity: .6; }
@media (hover: hover) { .alarm-ref:hover { background: var(--brand-softer); border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); color: var(--text); } }
.alarm-ref:active { background: var(--brand-soft); }
.alarm-ref:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.alarm-linked { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; max-width: 100%; min-height: 30px; padding: 0 12px; border-radius: var(--r-pill); background: var(--brand-softer); color: var(--brand-strong); font-size: var(--fs-sm); font-weight: 700; }
.alarm-linked .icon { flex: 0 0 auto; }
.alarm-row + .alarm-row { border-top: 1px solid var(--border); }
.alarm-check { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 52px; padding-inline-start: 6px; }
.alarm-check-dot {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border-strong); color: transparent; background: var(--surface);
  transition: background var(--dur), border-color var(--dur), color var(--dur), transform 80ms var(--ease);
}
.alarm-check:active .alarm-check-dot { transform: scale(.9); }
@media (hover: hover) { .alarm-check:hover .alarm-check-dot { border-color: var(--brand); color: color-mix(in srgb, var(--brand) 55%, transparent); } }
.alarm-check:focus-visible { outline: none; }
.alarm-check:focus-visible .alarm-check-dot { box-shadow: 0 0 0 3px var(--brand-glow); border-color: var(--brand); }
.is-overdue .alarm-check-dot { border-color: color-mix(in srgb, var(--accent) 70%, var(--border-strong)); }
.alarm-check.on .alarm-check-dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.alarm-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 68px; padding-block: 11px; padding-inline: 6px 14px; text-align: start; color: var(--text); transition: background var(--dur); }
@media (hover: hover) { .alarm-main:hover { background: var(--surface-2); } }
.alarm-main:active { background: var(--surface-3); }
.alarm-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.alarm-title { font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.alarm-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: var(--fs-xs); color: var(--text-3); min-width: 0; }
.alarm-meta .icon { flex: 0 0 auto; }
.alarm-repeat { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: var(--r-pill); background: var(--brand-softer); color: var(--brand-strong); font-weight: 700; }
.alarm-who { display: inline-flex; align-items: center; gap: 3px; min-width: 0; max-width: 100%; font-weight: 600; color: var(--text-2); }
.alarm-note { min-width: 0; max-width: 100%; }
.alarm-pending { display: inline-flex; align-items: center; gap: 3px; color: var(--accent-strong); font-weight: 700; }

.alarm-when { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: end; }
.alarm-clock { font-size: var(--fs-lg); font-weight: 800; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text); }
.alarm-ampm { font-size: var(--fs-sm); font-weight: 700; }
.alarm-day { font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); white-space: nowrap; }
.is-today .alarm-clock { color: var(--brand-strong); }
.is-overdue .alarm-clock, .is-overdue .alarm-day { color: var(--accent-strong); }
.is-done .alarm-title { color: var(--text-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-3) 60%, transparent); }
.is-done .alarm-clock { color: var(--text-3); font-weight: 700; font-size: var(--fs-md); }

.alarm-all-done { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 26px 0 6px; color: var(--text-2); font-weight: 700; font-size: var(--fs-sm); text-align: center; }
.alarm-all-done .icon { color: var(--brand); flex: 0 0 auto; }
.alarm-done-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; margin-top: 20px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 700; text-align: start; }
.alarm-done-toggle > .icon:first-child { color: var(--brand); }
@media (hover: hover) { .alarm-done-toggle:hover { background: var(--surface-2); color: var(--text); } }

/* Sheet */
.alarm-suggest, .alarm-presets { flex-wrap: wrap; overflow: visible; }
.alarm-sheet .alarm-suggest { margin-top: -6px; }
.alarm-suggest .chip, .alarm-presets .chip { min-height: 38px; padding: 0 14px; }
.alarm-datetime { display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: 8px; }
.alarm-datetime .date-input { padding-inline: 12px; gap: 8px; font-size: var(--fs-md); }
.alarm-time { min-width: 0; font-weight: 700; font-variant-numeric: tabular-nums; padding-inline-start: 12px; }
/* the select's arrow sits on the left in Arabic/Kurdish: keep the time clear of it */
[dir='rtl'] .alarm-time { padding-left: 34px; padding-right: 12px; }
[dir='ltr'] .alarm-time { padding-right: 34px; padding-left: 12px; }
.alarm-summary { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; background: var(--brand-softer); color: var(--brand-strong); font-size: var(--fs-sm); font-weight: 700; line-height: 1.5; }
.alarm-summary .icon { flex: 0 0 auto; }
.alarm-summary.is-past { background: var(--warn-soft); color: var(--warn-ink); }
.alarm-summary.is-past .icon { color: var(--accent-strong); }
.alarm-repeat-seg .seg { white-space: normal; line-height: 1.2; text-align: center; padding: 0 6px; font-size: var(--fs-sm); min-height: 42px; }

.alarm-pick-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--r-md); border: 1.5px dashed var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 700; text-align: start; }
.alarm-pick-btn > .icon:first-child { color: var(--brand); }
@media (hover: hover) { .alarm-pick-btn:hover { border-color: var(--brand); color: var(--text); } }
.alarm-picked { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 4px 6px 10px; padding-inline: 10px 4px; border-radius: var(--r-md); border: 1.5px solid color-mix(in srgb, var(--brand) 55%, var(--border-strong)); background: var(--brand-softer); }
.alarm-picker { display: flex; flex-direction: column; gap: 8px; }
.alarm-pick-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.alarm-pick-item { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 6px 12px; text-align: start; font-weight: 700; color: var(--text); }
.alarm-pick-item + .alarm-pick-item { border-top: 1px solid var(--border); }
@media (hover: hover) { .alarm-pick-item:hover { background: var(--surface-2); } }
.alarm-push-line { align-items: center; }
.alarm-push-line .grow { font-size: var(--fs-sm); line-height: 1.5; }

/* ===================== Notes ===================== */
.notes-page { max-width: var(--content-max); }
.notes-search { margin-bottom: var(--sp-5); }
.notes-grid { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: var(--sp-3); align-items: start; }
.notes-col { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }

.note-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 14px 14px 10px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--card-shadow);
  color: var(--text); text-decoration: none; overflow: hidden;
  transition: border-color var(--dur), background var(--dur);
}
.note-card:hover { text-decoration: none; }
@media (hover: hover) { .note-card:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); } }
.note-card:active { background: var(--surface-2); }
.note-card.is-pinned { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.note-ribbon { position: absolute; top: 0; inset-inline-end: 14px; width: 12px; height: 20px; background: var(--gold); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
.note-card-title { font-weight: 800; font-size: var(--fs-md); line-height: 1.45; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.is-pinned .note-card-title { padding-inline-end: 16px; }
/* the text sits on the notebook's ruled lines */
.note-card-body {
  font-size: var(--fs-sm); line-height: 24px; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden;
  background-image: repeating-linear-gradient(to bottom, transparent 0 23px, color-mix(in srgb, var(--brand) 13%, transparent) 23px 24px);
}
.note-card-body.no-title { color: var(--text); font-size: var(--fs-md); }
.is-pinned .note-card-body.no-title { padding-inline-end: 16px; }
.note-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }
.note-pending { display: inline-flex; color: var(--accent-strong); }

.note-new {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 116px; padding: 14px;
  border-radius: var(--r-lg); border: 1.5px dashed color-mix(in srgb, var(--brand) 45%, var(--border-strong));
  background: color-mix(in srgb, var(--brand-softer) 70%, transparent); color: var(--brand-strong); font-weight: 800; text-align: center;
  transition: background var(--dur), border-color var(--dur);
}
@media (hover: hover) { .note-new:hover { background: var(--brand-softer); border-color: var(--brand); } }
.note-new:active { background: var(--brand-soft); }

/* Note sheet: a page of the notebook */
.note-sheet .sheet-body { display: flex; flex-direction: column; }
.note-editor { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; }
.note-title-input {
  width: 100%; padding: 6px 2px 8px; border: 0; border-bottom: 1.5px solid var(--border); border-radius: 0; background: transparent;
  font-size: var(--fs-xl); font-weight: 800; color: var(--text); line-height: 1.4;
}
.note-title-input::placeholder, .note-body-input::placeholder { color: var(--text-3); font-weight: 600; }
.note-title-input:focus { outline: none; border-bottom-color: var(--brand); }
.note-body-input {
  flex: 1 1 auto; width: 100%; min-height: max(240px, 42vh); padding: 2px 2px 0; border: 0; border-radius: 0; resize: none;
  font: inherit; font-size: 16px; line-height: 30px; color: var(--text); background-color: transparent;
  background-image: repeating-linear-gradient(to bottom, transparent 0 29px, color-mix(in srgb, var(--brand) 16%, transparent) 29px 30px);
  background-attachment: local;
}
.note-body-input:focus { outline: none; }
@media (min-width: 721px) { .note-body-input { min-height: 340px; } }
.note-status { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; font-size: var(--fs-xs); font-weight: 700; color: var(--text-3); white-space: nowrap; }
.note-status.is-saved { color: var(--brand); }
.note-status.is-error { color: var(--accent-strong); }
.note-foot { display: flex; align-items: center; gap: 4px; }
.note-tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 10px; border-radius: 12px; font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); white-space: nowrap; transition: background var(--dur), color var(--dur); }
@media (hover: hover) { .note-tool:hover:not(:disabled) { background: var(--surface-2); color: var(--text); } }
.note-tool:disabled { opacity: .45; cursor: not-allowed; }
.note-tool.on { background: var(--accent-soft); color: var(--accent-ink); }
.note-tool.on .icon { color: var(--accent-strong); }
@media (hover: hover) { .note-tool.danger:hover { color: var(--danger); background: var(--danger-soft); } }
.note-foot .grow { flex: 1 1 auto; }
@media (max-width: 380px) { .note-tool { padding: 0 8px; } }
