/* Free online sleep diary (/sleep-diary). Load after calculators.css. */

.tool h2.dy-h { margin: 0 0 14px; font-size: 22px; letter-spacing: -0.01em; }
.tool + .tool { margin-top: 20px; }

.dy-stats { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dy-stats li { padding: 14px 16px; border-radius: var(--radius-card); background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--hairline); min-width: 0; }
.dy-stats b { display: block; font: 800 30px/1.05 var(--rounded); font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.dy-stats span { display: block; margin-top: 4px; font-size: 13px; color: var(--text-3); }
.dy-stats small { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-2); margin-bottom: 6px; }

.dy-grid-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: start; }
.dy-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 4px; font-size: 11px; color: var(--text-3); line-height: 1; height: 100%; }
.dy-days span { display: flex; align-items: center; }
.dy-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, auto); grid-auto-columns: minmax(0, 1fr); gap: 4px; max-width: calc(26 * 28px); }
.dy-tile { aspect-ratio: 1; width: 100%; min-width: 0; padding: 0; border: 0; border-radius: 5px; background: var(--l0); cursor: pointer; }
.dy-tile[data-l="1"] { background: var(--l1); }
.dy-tile[data-l="2"] { background: var(--l2); }
.dy-tile[data-l="3"] { background: var(--l3); }
.dy-tile[data-l="4"] { background: var(--l4); }
.dy-tile.future { background: transparent; cursor: default; }
.dy-tile.sel { outline: 2px solid var(--text); outline-offset: 1px; }
.dy-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dy-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 10px; font-size: 13px; color: var(--text-3); }
.dy-key { display: inline-flex; align-items: center; gap: 4px; }
.dy-key i { width: 11px; height: 11px; border-radius: 3px; background: var(--l0); }
.dy-key i:nth-child(2) { background: var(--l1); }
.dy-key i:nth-child(3) { background: var(--l2); }
.dy-key i:nth-child(4) { background: var(--l3); }
.dy-key i:nth-child(5) { background: var(--l4); }
.dy-empty { margin: 12px 0 0; font-size: 15px; color: var(--text-2); }

.dy-form-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.dy-form-head h2 { margin: 0; }
.tool input[type="date"], .tool input[type="text"] {
  box-sizing: border-box; display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 48px; padding: 10px 14px;
  border: 0; border-radius: var(--radius-control); background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--hairline);
  color: var(--text); font: 600 17px/1.2 var(--rounded); color-scheme: inherit; -webkit-appearance: none; appearance: none; text-align: left;
}
.tool input[type="text"] { font-family: inherit; font-weight: 500; }
.tool input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
.tool input[type="date"]:focus-visible, .tool input[type="text"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field-wide { grid-column: 1 / -1; }
.dy-rested { display: flex; gap: 6px; }
.dy-rested label { flex: 1; position: relative; cursor: pointer; }
.dy-rested input { position: absolute; opacity: 0; pointer-events: none; }
.dy-rested span { display: grid; place-items: center; min-height: 44px; border-radius: var(--radius-control); background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--hairline); font: 700 16px/1 var(--rounded); color: var(--text-2); }
.dy-rested input:checked + span { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.dy-rested input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-solid { min-height: 46px; padding: 10px 20px; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-family: inherit; font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer; }
.btn-solid:hover { filter: brightness(1.08); }
.btn-ghost:disabled { opacity: 0.45; cursor: default; }
.dy-preview { margin: 16px 0 0; font-size: 16px; color: var(--text-2); }
.dy-chip { display: inline-grid; place-items: center; min-width: 2.4em; padding: 4px 8px; border-radius: 999px; font: 800 15px/1 var(--rounded); color: #0B0D1A; background: var(--l0); }
.dy-chip[data-l="1"] { background: var(--l1); }
.dy-chip[data-l="2"] { background: var(--l2); }
.dy-chip[data-l="3"] { background: var(--l3); }
.dy-chip[data-l="4"] { background: var(--l4); }
.dy-msg { min-height: 1.4em; margin: 10px 0 0; font-size: 14px; font-weight: 600; color: var(--l4); }
.dy-settings { margin-top: 18px; }
.dy-settings summary { cursor: pointer; font-size: 15px; font-weight: 600; color: var(--text-2); }
.dy-settings .fields { margin-top: 14px; }
.dy-upsell { margin: 22px 0 0; padding: 16px 18px; border-radius: var(--radius-card); background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); font-size: 15px; color: var(--text); }
.dy-upsell a { font-weight: 700; }

/* Printable sheet: hidden on screen, the only thing printed. */
.dy-sheet { display: none; }
@media print {
  @page { size: landscape; margin: 12mm; }
  html, body { background: #fff !important; color: #000 !important; }
  body > :not(.dy-sheet) { display: none !important; }
  .dy-sheet { display: block; font: 11pt/1.3 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; color: #000; }
  .dy-sheet h1 { margin: 0 0 2mm; font-size: 20pt; letter-spacing: -0.01em; }
  .dy-sheet .meta { display: flex; justify-content: space-between; gap: 8mm; margin: 0 0 4mm; font-size: 10pt; }
  .dy-sheet table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .dy-sheet th, .dy-sheet td { border: 0.6pt solid #888; padding: 1.6mm 2mm; text-align: left; vertical-align: top; font-size: 9.5pt; }
  .dy-sheet th { background: #eee !important; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .dy-sheet td { height: 8.2mm; }
  .dy-sheet col.c-note { width: 26%; }
  .dy-sheet .foot { display: flex; justify-content: space-between; margin-top: 4mm; font-size: 9pt; color: #333; }
}

@media (max-width: 720px) {
  .dy-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .dy-stats b { font-size: 26px; }
  .dy-grid, .dy-days { gap: 3px; }
  .dy-tile { border-radius: 4px; }
}
