/* Styles of the "sleep" module. Use the CSS variables from style.css (works in light and dark) and keep it phone-friendly: tap targets >= 44px. */
.sl-card .sl-big { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 12px; }
.sl-card .sl-big .btn { height: 56px; font-size: 15px; justify-content: center; min-width: 0; }
.sl-status { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.sl-alarmrow { padding: 6px 0; }
.sl-alarmrow input[type="time"] { height: 44px; min-width: 120px; width: auto; }
.sl-sub { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.sl-lbl { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.sl-wk { margin-top: 16px; }
.sl-why { margin-top: 6px; }
.sl-cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sl-cell { background: var(--sunk); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.sl-cell span { display: block; font-size: 11.5px; color: var(--muted); }
.sl-cell b { font-size: 20px; font-weight: 600; }
.sl-adv { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 32px; font-size: 13.5px; }
.sl-adv.ok b { color: var(--ok); }
.sl-adv.bad b { color: var(--accent); }
.sl-sug { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sl-sug b { font-size: 24px; font-weight: 600; }
.sl-sug .btn { height: 44px; }
.sl-switch { padding: 8px 0 0; border: 0; font-size: 13px; }
.sl-switch .switch { width: 48px; height: 28px; }
.sl-switch .switch i { top: 3px; left: 3px; width: 20px; height: 20px; }
.sl-switch .switch.on i { transform: translateX(20px); }
.sl-last { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sl-last b { font-size: 24px; font-weight: 600; }

.sl-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sl-stat { background: var(--sunk); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.sl-stat span { display: block; font-size: 11.5px; color: var(--muted); }
.sl-stat b { display: block; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.sl-page { display: grid; gap: 16px; }
.page-h .btns { flex-wrap: wrap; }

.sl-chart { width: 100%; height: auto; display: block; }
.sl-chart .sl-axis { font-size: 11px; fill: var(--muted); font-family: var(--mono); }
.sl-chart .sl-axis.b { fill: var(--fg); font-weight: 700; }
.sl-chart .sl-val { font-size: 10px; fill: var(--fg); font-family: var(--mono); }
.sl-chart .sl-ref { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }
.sl-chart .sl-base { stroke: var(--line2); stroke-width: 1; }
.sl-bar.ok { fill: var(--ok); background: var(--ok); }
.sl-bar.mid { fill: var(--muted); background: var(--muted); }
.sl-bar.low { fill: var(--accent); background: var(--accent); }
.sl-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.sl-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

.sl-row { display: grid; grid-template-columns: 78px 1fr auto; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 6px 2px; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; text-align: left; font: inherit; }
.sl-row:last-child { border-bottom: 0; }
.sl-row:hover { background: var(--sunk); }
.sl-rd { font-size: 13px; }
.sl-rt { font-size: 13px; min-width: 0; }

.sl-form label.sl-f { display: block; margin-top: 12px; }
.sl-form label.sl-f span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.sl-form input { height: 44px; width: 100%; font-size: 16px; }
.sl-form .sl-stack { flex-direction: column; align-items: stretch; }
.sl-form .sl-stack .btn { width: 100%; justify-content: center; }
.sl-form p { margin: 0 0 12px; }

.sl-set input[type="number"].num { height: 44px; width: 92px; }
.sl-rule { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sl-rule select { grid-column: 1 / 3; grid-row: 1; height: 44px; }
.sl-rule input[type="time"]:nth-of-type(1) { grid-column: 1; grid-row: 2; }
.sl-rule input[type="time"]:nth-of-type(2) { grid-column: 2; grid-row: 2; }
.sl-rule input[type="number"].num { width: 100%; height: 44px; grid-column: 3; grid-row: 1; }
.sl-rule input[type="time"] { width: 100%; min-width: 0; height: 44px; }
.sl-rule .sl-x { grid-column: 3; grid-row: 2; justify-self: end; width: 44px; height: 44px; }
.sl-addrule { margin-top: 12px; }
.sl-addrule .btn { height: 44px; }

@media (max-width: 860px) {
  .sl-card .sl-big .btn { padding: 0 8px; gap: 6px; font-size: 14.5px; }
  .sl-card .sl-big .btn span { white-space: nowrap; }
  .sl-cell b { font-size: 18px; }
  .sl-set .srow input[type="number"].num { width: 92px; }
}
.sl-set .srow { flex-wrap: nowrap; }
.sl-set .srow > span { flex: 1 1 auto; min-width: 0; }
.sl-set .srow input { flex: none; }
/* commute rule rows: row 1 = days + minutes, row 2 = from / to + delete; nothing overlaps on a phone (iOS time inputs ignore width) */
.sl-rule { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 76px; }
.sl-rule select { grid-column: 1 / 3; grid-row: 1; min-width: 0; }
.sl-rule input[type="number"].num { grid-column: 3; grid-row: 1; min-width: 0; text-align: center; }
.sl-rule input[type="time"] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; text-align: center; box-sizing: border-box; }
.sl-rule .sl-x { grid-column: 3; grid-row: 2; justify-self: center; }
/* commute rule rows: row 1 = days + minutes, row 2 = from / to + delete; nothing overlaps on a phone (iOS time inputs ignore width) */
.sl-rule { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 76px; }
.sl-rule select { grid-column: 1 / 3; grid-row: 1; min-width: 0; }
.sl-rule input[type="number"].num { grid-column: 3; grid-row: 1; min-width: 0; text-align: center; }
.sl-rule input[type="time"] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; text-align: center; box-sizing: border-box; }
.sl-rule .sl-x { grid-column: 3; grid-row: 2; justify-self: center; }
