/* DailyDawa free tools.
 *
 * Extends the existing design system rather than replacing it - the tokens
 * (--teal, --ink, --muted, --line, --radius) all come from landing.css, which
 * loads first. Nothing here introduces a second visual identity.
 *
 * Priorities, in order: readable on a phone, readable by someone in their
 * sixties, and prints properly. Base size is deliberately a notch larger than
 * the marketing pages, and tap targets are never under 44px.
 *
 * The print sheet at the bottom is load-bearing, not decorative: the Printable
 * Chart exists to come out of a printer and go on a fridge door.
 */

/* ----------------------------------------------------------------- hero */

.tool-hero {
  background:
    radial-gradient(circle at 12% 18%, rgba(15, 110, 92, .08) 0%, transparent 46%),
    radial-gradient(circle at 88% 82%, rgba(242, 163, 60, .06) 0%, transparent 46%),
    #F8FAFC;
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--line);
}

.tool-crumbs ol {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 18px; padding: 0; font-size: .88rem; color: var(--muted);
}
.tool-crumbs li + li::before { content: "/"; margin-right: 8px; opacity: .5; }
.tool-crumbs a { color: var(--muted); text-decoration: none; }
.tool-crumbs a:hover { color: var(--teal); text-decoration: underline; }

.tool-hero-row { display: flex; align-items: flex-start; gap: 20px; }
.tool-hero-icon {
  font-size: 2.4rem; line-height: 1; flex: 0 0 auto;
  width: 64px; height: 64px; border-radius: 18px;
  background: #fff; border: 1px solid var(--line);
  display: grid; place-items: center;
  box-shadow: 0 8px 24px -16px rgba(15, 60, 50, .4);
}
.tool-hero h1 {
  font-size: clamp(1.9rem, 4.4vw, 2.8rem);
  line-height: 1.12; margin: 6px 0 12px; color: #0F172A;
}
.tool-tagline {
  font-size: 1.12rem; color: #475569; line-height: 1.6;
  max-width: 62ch; margin: 0;
}

@media (max-width: 600px) {
  .tool-hero { padding: 26px 0 24px; }
  .tool-hero-row { gap: 14px; }
  .tool-hero-icon { width: 48px; height: 48px; font-size: 1.7rem; border-radius: 14px; }
}

/* ---------------------------------------------------------------- stage */

.tool-stage { padding: 32px 0 8px; }

.tool-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: 0 18px 50px -34px rgba(15, 60, 50, .35);
}
.tool-card + .tool-card { margin-top: 20px; }
.tool-card h2 { font-size: 1.3rem; margin: 0 0 6px; }
.tool-card > p.tool-card-sub { color: var(--muted); margin: 0 0 20px; font-size: .98rem; }

@media (max-width: 600px) { .tool-card { padding: 18px 16px; border-radius: 14px; } }

.tool-noscript {
  background: var(--saffron-soft); border: 1px solid #F0D9B0;
  border-radius: 14px; padding: 16px 18px; margin-bottom: 20px;
}

/* ---------------------------------------------------------------- forms */

.tool-field { display: flex; flex-direction: column; gap: 6px; }
.tool-field label, .tool-label {
  font-size: .86rem; font-weight: 600; color: #334155;
  text-transform: uppercase; letter-spacing: .03em;
}
.tool-field input[type="text"],
.tool-field input[type="search"],
.tool-field select,
.tool-field textarea {
  font: inherit; font-size: 1rem; color: var(--ink);
  padding: 11px 13px; border: 1px solid #CBD5E1; border-radius: 10px;
  background: #fff; width: 100%; min-height: 46px;
}
.tool-field textarea { min-height: 70px; resize: vertical; }
.tool-field input:focus, .tool-field select:focus, .tool-field textarea:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 110, 92, .14);
}
.tool-field .tool-hint { font-size: .83rem; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

.tool-form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }
@media (max-width: 760px) {
  .col-8, .col-6, .col-4, .col-3 { grid-column: span 12; }
}

/* Slot checkboxes - big, obvious, thumb-sized. */
.tool-slots { display: flex; flex-wrap: wrap; gap: 10px; }
.tool-slot {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; min-height: 46px;
  border: 1px solid #CBD5E1; border-radius: 999px;
  background: #fff; cursor: pointer; font-size: .96rem; user-select: none;
}
.tool-slot input { width: 18px; height: 18px; accent-color: var(--teal); margin: 0; }
.tool-slot:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); font-weight: 600; }
.tool-slot-time {
  font: inherit; font-size: .9rem; padding: 4px 6px;
  border: 1px solid #CBD5E1; border-radius: 8px; min-height: 34px;
}

.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.tool-actions .btn { min-height: 46px; }

/* ---------------------------------------------------------- autocomplete */

.dd-ac-wrap { position: relative; }
.dd-ac-results {
  display: none; position: absolute; z-index: 40; top: 100%; left: 0; right: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  margin-top: 4px; max-height: 280px; overflow-y: auto;
  box-shadow: 0 18px 40px -20px rgba(15, 60, 50, .4);
}
.dd-ac-results.show { display: block; }
.dd-ac-row {
  display: block; width: 100%; text-align: left; background: none;
  border: 0; border-bottom: 1px solid #F1F5F9; padding: 11px 14px; cursor: pointer;
}
.dd-ac-row:last-child { border-bottom: 0; }
.dd-ac-row:hover, .dd-ac-row:focus { background: var(--teal-soft); }
.dd-ac-row b { display: block; font-size: .96rem; color: var(--ink); }
.dd-ac-row span { display: block; font-size: .83rem; color: var(--muted); margin-top: 2px; }

/* --------------------------------------------------------------- output */

.tool-output { margin-top: 22px; }
.tool-output-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.tool-output-head h2 { margin: 0; font-size: 1.25rem; }
.tool-output-count { color: var(--muted); font-size: .92rem; }

.tool-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tool-table { width: 100%; border-collapse: collapse; font-size: .97rem; }
.tool-table th, .tool-table td {
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.tool-table th {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  color: #475569; background: var(--surface-tint); white-space: nowrap;
}
.tool-table tbody tr:last-child td { border-bottom: 0; }
.tool-table .tool-time { font-weight: 700; color: var(--teal); white-space: nowrap; }
.tool-table .tool-med-name { font-weight: 600; }
.tool-table .tool-med-sub { display: block; color: var(--muted); font-size: .86rem; }

/* Below 700px a 5-column table is unreadable, so each row becomes a card with
   the column name as its own label. */
@media (max-width: 700px) {
  .tool-table thead { display: none; }
  .tool-table, .tool-table tbody, .tool-table tr, .tool-table td { display: block; width: 100%; }
  .tool-table tr {
    border: 1px solid var(--line); border-radius: 12px;
    margin-bottom: 12px; padding: 6px 0; background: #fff;
  }
  .tool-table td { border-bottom: 0; padding: 7px 14px; }
  .tool-table td::before {
    content: attr(data-label); display: block;
    font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
    color: #64748B; font-weight: 600; margin-bottom: 2px;
  }
  .tool-table td:empty { display: none; }
}

.tool-empty {
  text-align: center; padding: 34px 20px; color: var(--muted);
  border: 1px dashed #CBD5E1; border-radius: 14px; background: #FCFDFD;
}
.tool-empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* Row of medicines already added (edit / reorder / remove). */
.tool-rowlist { list-style: none; margin: 0; padding: 0; }
.tool-rowlist li {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px; border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 10px; background: #fff;
}
.tool-rowlist .tool-row-main { flex: 1 1 auto; min-width: 0; }
.tool-rowlist .tool-row-name { font-weight: 600; }
.tool-rowlist .tool-row-meta { color: var(--muted); font-size: .88rem; margin-top: 3px; }
.tool-rowlist .tool-row-ctrls { display: flex; gap: 4px; flex: 0 0 auto; }
.tool-iconbtn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 1rem; line-height: 1;
  display: grid; place-items: center; color: #475569;
}
.tool-iconbtn:hover { background: var(--surface-tint); color: var(--teal); }
.tool-iconbtn.is-danger:hover { background: #FDECEC; color: #C0392B; border-color: #F5C6C6; }
.tool-iconbtn[disabled] { opacity: .35; cursor: not-allowed; }

/* Timeline (Dose Reminder Planner). */
.tool-timeline { list-style: none; margin: 0; padding: 0; }
.tool-timeline li {
  display: grid; grid-template-columns: 96px 1fr; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.tool-timeline li:last-child { border-bottom: 0; }
.tool-tl-time { font-weight: 700; color: var(--teal); }
.tool-tl-slot { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; }
.tool-tl-meds { margin: 0; padding: 0; list-style: none; }
.tool-tl-meds li { display: block; border: 0; padding: 3px 0; }
@media (max-width: 600px) { .tool-timeline li { grid-template-columns: 76px 1fr; gap: 10px; } }

/* --------------------------------------------------------------- prose */

.tool-prose { padding: 42px 0 8px; }
.tool-prose-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 44px; align-items: start; }
@media (max-width: 900px) { .tool-prose-grid { grid-template-columns: 1fr; gap: 28px; } }

.tool-prose-main h2 { font-size: 1.45rem; margin: 30px 0 12px; }
.tool-prose-main h2:first-child { margin-top: 0; }
.tool-prose-main p { color: #334155; line-height: 1.75; margin: 0 0 14px; max-width: 68ch; }
.tool-steps { padding-left: 22px; max-width: 68ch; }
.tool-steps li { margin-bottom: 10px; line-height: 1.7; color: #334155; }

.tool-faq details {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px; background: #fff;
}
.tool-faq summary {
  cursor: pointer; font-weight: 600; color: var(--ink);
  list-style: none; display: flex; justify-content: space-between; gap: 12px;
}
.tool-faq summary::-webkit-details-marker { display: none; }
.tool-faq summary::after { content: "+"; color: var(--teal); font-size: 1.3rem; line-height: 1; }
.tool-faq details[open] summary::after { content: "−"; }
.tool-faq p { margin: 10px 0 0; color: #475569; line-height: 1.7; }

.tool-side-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; margin-bottom: 18px;
}
.tool-side-card h3 { font-size: 1.05rem; margin: 0 0 12px; }
.tool-side-card p { font-size: .92rem; line-height: 1.65; color: #475569; margin: 0 0 12px; }
.tool-side-card p:last-child { margin-bottom: 0; }
.tool-note-safety { border-left: 3px solid var(--saffron); padding-left: 12px; }
.tool-note-privacy { border-left: 3px solid var(--teal); padding-left: 12px; }

.tool-related { list-style: none; margin: 0 0 12px; padding: 0; }
.tool-related li { margin-bottom: 8px; }
.tool-related a {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px; border-radius: 10px; text-decoration: none; color: inherit;
}
.tool-related a:hover { background: var(--surface-tint); }
.tool-related strong { display: block; font-size: .95rem; color: var(--ink); }
.tool-related em { display: block; font-style: normal; font-size: .84rem; color: var(--muted); margin-top: 2px; }
.tool-side-all { font-size: .92rem; font-weight: 600; color: var(--teal); text-decoration: none; }
.tool-side-all:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ cta */

.tool-cta { padding: 20px 0 64px; }
.tool-cta-inner {
  background: linear-gradient(135deg, #0F6E5C 0%, #0A4A3E 100%);
  color: #fff; border-radius: 22px; padding: 38px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 30px; align-items: center;
}
.tool-cta-inner h2 { color: #fff; font-size: 1.6rem; margin: 0 0 12px; }
.tool-cta-inner p { color: rgba(255, 255, 255, .88); line-height: 1.7; margin: 0 0 10px; max-width: 62ch; }
.tool-cta-meta { font-size: .9rem; color: rgba(255, 255, 255, .7) !important; }
.tool-cta-actions { display: flex; flex-direction: column; gap: 10px; }
.tool-cta-actions .btn-primary { background: #fff; color: var(--teal-dark); border-color: #fff; }
.tool-cta-actions .btn-primary:hover { background: #F1F5F9; color: var(--teal-dark); }
.tool-cta-actions .btn-outline { color: #fff; border-color: rgba(255, 255, 255, .45); }
.tool-cta-actions .btn-outline:hover { background: rgba(255, 255, 255, .12); color: #fff; }
@media (max-width: 820px) {
  .tool-cta-inner { grid-template-columns: 1fr; padding: 26px 20px; }
  .tool-cta-actions { flex-direction: row; flex-wrap: wrap; }
  .tool-cta-actions .btn { flex: 1 1 200px; }
}

/* ------------------------------------------------------------- tools hub */

.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.tool-tile {
  display: flex; flex-direction: column; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 26px; text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.tool-tile:hover {
  transform: translateY(-3px); border-color: #BFD8D0;
  box-shadow: 0 22px 48px -30px rgba(15, 60, 50, .5);
}
.tool-tile-icon { font-size: 2rem; line-height: 1; }
.tool-tile h3 { font-size: 1.18rem; margin: 0; color: var(--ink); }
.tool-tile p { color: #475569; line-height: 1.6; margin: 0; font-size: .96rem; flex: 1 1 auto; }
.tool-tile-cta { font-weight: 600; color: var(--teal); font-size: .95rem; }
.tool-tile.is-featured { border-color: var(--teal); background: linear-gradient(180deg, #F4FBF9 0%, #fff 60%); }
.tool-tile-flag {
  align-self: flex-start; font-size: .72rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--teal); background: var(--teal-soft);
  padding: 4px 10px; border-radius: 999px;
}

.tools-journey {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  color: var(--muted); font-size: .95rem; margin-top: 8px;
}
.tools-journey span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; }
.tools-journey span.is-paid { border-color: var(--teal); color: var(--teal); font-weight: 600; }
.tools-journey i { font-style: normal; opacity: .5; }

/* ------------------------------------------------------- printable sheet */

/* Hidden on screen; this is the only thing that prints. Built by each tool's
   JS from the user's own list. */
.print-sheet { display: none; }

@media print {
  /* Kill every piece of site furniture. The sheet must look like a document
     somebody made, not like a web page that was printed.
     Scoped to pages that actually HAVE a print sheet - otherwise printing the
     hub (or any tool without printable output) would yield a blank page. */
  body:has(.print-sheet) .nav,
  body:has(.print-sheet) .foot,
  body:has(.print-sheet) .wa-float,
  body:has(.print-sheet) .tool-hero,
  body:has(.print-sheet) .tool-stage,
  body:has(.print-sheet) .tool-prose,
  body:has(.print-sheet) .tool-cta,
  body:has(.print-sheet) .tool-noscript {
    display: none !important;
  }

  body:has(.print-sheet) { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body { font-size: 12pt; color: #000; }

  @page { size: A4 portrait; margin: 12mm; }

  .print-sheet { display: block !important; }

  .print-head {
    display: flex; justify-content: space-between; align-items: flex-end;
    border-bottom: 2.5pt solid #000; padding-bottom: 6pt; margin-bottom: 14pt;
  }
  .print-title { font-size: 20pt; font-weight: 700; margin: 0; line-height: 1.15; }
  .print-person { font-size: 13pt; margin: 3pt 0 0; }
  .print-meta { font-size: 9pt; text-align: right; color: #333; }

  .print-table { width: 100%; border-collapse: collapse; page-break-inside: auto; }
  .print-table th, .print-table td {
    border: 1pt solid #000; padding: 7pt 8pt; text-align: left;
    font-size: 11.5pt; vertical-align: middle;
  }
  .print-table th {
    background: #EFEFEF !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    font-size: 10pt; text-transform: uppercase; letter-spacing: .03em;
  }
  .print-table tr { page-break-inside: avoid; page-break-after: auto; }
  .print-table .print-medcell { font-weight: 700; font-size: 12.5pt; }
  .print-table .print-medsub { display: block; font-weight: 400; font-size: 10pt; color: #333; }

  /* The tick boxes people actually use a pen on. */
  .print-tick { display: inline-block; width: 15pt; height: 15pt; border: 1.2pt solid #000; }
  .print-tickcell { text-align: center; }
  .print-slotcell { text-align: center; font-size: 10pt; }

  .print-foot {
    margin-top: 14pt; border-top: 1pt solid #666; padding-top: 7pt;
    font-size: 9pt; color: #333; line-height: 1.45;
  }
  .print-foot strong { color: #000; }

  a[href]::after { content: ""; } /* don't append URLs after every link */
}

/* ---------------------------------------------------------- guide pages */
/* Use-case pages share the tools' chrome (hero, sidebar, CTA) and add a
   longer-form reading treatment for the body. */

.guide-body { padding-top: 34px; }
.guide-lede {
  font-size: 1.08rem; line-height: 1.75; color: var(--ink);
}
.guide-lede:first-child { font-size: 1.14rem; }
.guide-page .tool-prose-main h2 { margin-top: 38px; }
.guide-bullets { padding-left: 20px; max-width: 68ch; }
.guide-bullets li { margin-bottom: 11px; line-height: 1.7; color: #334155; }

/* The numbered artefact - the checklist that makes a page worth linking to. */
.guide-checklist {
  counter-reset: gstep; list-style: none; padding: 0; margin: 18px 0 20px;
  max-width: 68ch; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; overflow: hidden;
}
.guide-checklist li {
  counter-increment: gstep; position: relative;
  padding: 14px 18px 14px 54px; border-bottom: 1px solid var(--line);
  line-height: 1.65; color: #334155;
}
.guide-checklist li:last-child { border-bottom: 0; }
.guide-checklist li::before {
  content: counter(gstep); position: absolute; left: 16px; top: 13px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--teal-soft); color: var(--teal);
  font-size: .82rem; font-weight: 700; display: grid; place-items: center;
}

/* "When this isn't the answer" - the honesty panel. */
.guide-honesty {
  margin: 38px 0 8px; padding: 22px 24px;
  border: 1px solid #F0D9B0; background: var(--saffron-soft); border-radius: 14px;
}
.guide-honesty h2 { margin-top: 0 !important; font-size: 1.25rem; }
.guide-honesty p { color: #5C4A2E; }
.guide-honesty ul { padding-left: 20px; margin-bottom: 0; }
.guide-honesty li { margin-bottom: 9px; line-height: 1.7; color: #5C4A2E; }

@media (max-width: 600px) {
  .guide-checklist li { padding: 12px 14px 12px 46px; }
  .guide-checklist li::before { left: 12px; }
  .guide-honesty { padding: 18px 16px; }
}
