/* ============================================================
   wird-tracker.css   complements styles.css
   Uses existing CSS variables; dark mode is automatic.
   No font imports, no layout/width overrides.
   ============================================================ */

/*  Wird-specific tokens only 
   All colour/typography/layout defers to styles.css         */
:root {
  --wird-accent:       #7c5c3a;
  --wird-accent-hover: #b5895a;
  --wird-green:        #4a7c59;
  --wird-red:          #9b3a3a;
  --wird-card-bg:      color-mix(in oklab, var(--bg) 96%, var(--fg) 4%);
  --wird-bar-bg:       color-mix(in oklab, var(--bg) 82%, var(--fg) 18%);
  --wird-shadow:       0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.05);
  --wird-radius:       6px;
  --wird-t:            180ms ease;
}

:root[data-theme="dark"] {
  --wird-accent:       #b5895a;
  --wird-accent-hover: #d4a96a;
  --wird-green:        #6aad80;
  --wird-red:          #c26060;
  --wird-card-bg:      color-mix(in oklab, var(--bg) 88%, var(--fg) 12%);
  --wird-shadow:       0 1px 4px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.22);
}

#wird-app {
  display: grid;
  gap: 2.5rem;
  margin-top: 2rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.wird-panel {
  background: var(--wird-card-bg);
  border: 1px solid var(--border);
  border-radius: var(--wird-radius);
  padding: 1.5rem;
  box-shadow: var(--wird-shadow);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.wird-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.wird-panel-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

#today-date {
  font-size: .95rem;
  font-style: italic;
  color: var(--muted) !important;
  font-weight: 400;
  margin: 0;
}

#today-progress-wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
}

#today-progress-bar {
  width: 120px;
  height: 4px;
  background: var(--wird-bar-bg);
  border-radius: 99px;
  overflow: hidden;
}

#today-progress-fill {
  height: 100%;
  background: var(--wird-accent);
  border-radius: 99px;
  width: 0%;
  transition: width .4s ease;
}

#today-progress-label {
  font-family: monospace;
  font-size: .7rem;
  color: var(--muted);
  white-space: nowrap;
}

#wird-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.wird-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--wird-radius);
  padding: .85rem 1rem;
  transition: box-shadow var(--wird-t), transform var(--wird-t);
}

.wird-card:hover {
  box-shadow: var(--wird-shadow);
  transform: translateY(-1px);
}

.wird-card.done { border-left-color: var(--wird-green); }
.wird-card.over { border-left-color: var(--wird-accent); }
.wird-card.miss { border-left-color: var(--wird-red); }

.card-name {
  font-size: .88rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: .28rem;
}

.card-meta {
  font-family: monospace;
  font-size: .68rem;
  color: var(--muted);
  margin-bottom: .5rem;
}

.card-bar-wrap {
  height: 3px;
  background: var(--wird-bar-bg);
  border-radius: 99px;
  overflow: hidden;
}

.card-bar-fill {
  height: 100%;
  background: var(--wird-accent);
  border-radius: 99px;
  transition: width .4s ease;
}

.wird-card.done .card-bar-fill { background: var(--wird-green); }
.wird-card.over .card-bar-fill { background: var(--wird-accent-hover); }
.wird-card.miss .card-bar-fill { background: var(--wird-red); }

.card-log-btn {
  margin-top: .6rem;
  font-family: monospace;
  font-size: .66rem;
  color: var(--wird-accent);
  background: none;
  border: 1px solid var(--wird-accent);
  border-radius: 3px;
  padding: .16rem .42rem;
  cursor: pointer;
  transition: background var(--wird-t), color var(--wird-t);
}
.card-log-btn:hover {
  background: var(--wird-accent);
  color: var(--bg);
}

#trend-controls { display: flex; gap: .5rem; flex-wrap: wrap; }

#trend-controls select {
  font-family: monospace;
  font-size: .72rem;
  padding: .26rem .44rem;
  border: 1px solid var(--border);
  border-radius: var(--wird-radius);
  background: var(--code-bg);
  color: var(--fg);
  cursor: pointer;
}

#trend-chart {
  width: 100% !important;
  max-height: 220px;
  margin-top: .5rem;
}

#trend-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.stat-chip { display: flex; flex-direction: column; gap: .12rem; }

.stat-chip .stat-val {
  font-family: monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--wird-accent);
}

.stat-chip .stat-lbl {
  font-size: .7rem;
  color: var(--muted);
}

#history-table-wrap { overflow-x: auto; }

#history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
}

#history-table th {
  text-align: left;
  font-family: monospace;
  font-size: .67rem;
  font-weight: 500;
  color: var(--muted);
  padding: .32rem .52rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#history-table td {
  padding: .44rem .52rem;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 45%, transparent);
  vertical-align: top;
  color: var(--fg);
}

#history-table tbody tr:hover {
  background: color-mix(in oklab, var(--bg) 90%, var(--fg) 10%);
}

.loading-cell { color: var(--muted); font-style: italic; }

.badge {
  display: inline-block;
  font-family: monospace;
  font-size: .62rem;
  padding: .11rem .36rem;
  border-radius: 3px;
  background: var(--chip-bg);
  color: var(--chip-fg);
}

.badge.done { background: color-mix(in oklab, var(--wird-green) 18%, var(--bg)); color: var(--wird-green); }
.badge.over { background: color-mix(in oklab, var(--wird-accent) 16%, var(--bg)); color: var(--wird-accent); }
.badge.miss { background: color-mix(in oklab, var(--wird-red) 16%, var(--bg)); color: var(--wird-red); }

.btn-primary {
  font-family: inherit;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .03em;
  background: var(--heading);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  padding: .36rem .85rem;
  cursor: pointer;
  transition: opacity var(--wird-t);
}
.btn-primary:hover { opacity: .78; }

dialog {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 12px 60px rgba(0,0,0,.25), 0 2px 8px rgba(0,0,0,.12);
  max-width: 520px;
  width: min(94vw, 520px);
  font-family: inherit;
  font-size: 1rem;
  overflow: hidden;
}

dialog::backdrop {
  background: rgba(0,0,0,.48);
  backdrop-filter: blur(4px);
}

dialog form {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 700px);
}

dialog h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
  padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-body {
  padding: 1.4rem 1.75rem;
  overflow-y: auto;
  flex: 1;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: 1.1rem;
}

.field-group label {
  font-size: .7rem;
  font-family: monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 500;
}

.field-group .optional { opacity: .55; }

.field-group input[type="text"],
.field-group input[type="number"],
.field-group input[type="date"],
.field-group select,
.field-group textarea {
  font-family: inherit;
  font-size: .95rem;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--fg);
  width: 100%;
  transition: border-color var(--wird-t), box-shadow var(--wird-t);
  box-sizing: border-box;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  outline: none;
  border-color: var(--wird-accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--wird-accent) 18%, transparent);
}

.toggle-row { display: flex; align-items: center; gap: .52rem; }

input[type="checkbox"][role="switch"] {
  appearance: none;
  -webkit-appearance: none;
  width: 33px;
  height: 18px;
  border-radius: 99px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--wird-t);
}
input[type="checkbox"][role="switch"]::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  top: 3px; left: 3px;
  transition: left var(--wird-t);
}
input[type="checkbox"][role="switch"]:checked { background: var(--wird-green); }
input[type="checkbox"][role="switch"]:checked::after { left: 18px; }

.modal-footer,
#modal-actions,
#khatm-modal-actions,
#motalah-modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .75rem;
  padding: 1.1rem 1.75rem 1.4rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  margin-top: 0;
}

#modal-cancel,
#khatm-cancel,
#motalah-cancel {
  font-family: inherit;
  font-size: .82rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .44rem 1rem;
  cursor: pointer;
  color: var(--muted);
  transition: border-color var(--wird-t), color var(--wird-t);
}
#modal-cancel:hover,
#khatm-cancel:hover,
#motalah-cancel:hover {
  border-color: var(--fg);
  color: var(--fg);
}

#meeting-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.meeting-meta-lbl {
  display: block;
  font-family: monospace;
  font-size: .67rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .2rem;
}

.meeting-meta-val {
  font-size: .95rem;
  font-weight: 600;
  color: var(--fg);
}

#meeting-status-msg {
  margin-left: auto;
}

.meeting-status {
  font-size: .85rem;
  padding: .3rem .7rem;
  border-radius: 4px;
  font-weight: 500;
}

.meeting-status.ok {
  background: color-mix(in oklab, var(--wird-green) 15%, var(--bg));
  color: var(--wird-green);
}

.meeting-status.due {
  background: color-mix(in oklab, var(--wird-accent) 15%, var(--bg));
  color: var(--wird-accent);
}

.meeting-status.overdue {
  background: color-mix(in oklab, var(--wird-red) 15%, var(--bg));
  color: var(--wird-red);
}

.meeting-status.pending {
  background: var(--chip-bg);
  color: var(--chip-fg);
}

#meeting-cycles h3 {
  font-size: .88rem;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.meeting-cycle-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

.meeting-cycle-table th {
  text-align: left;
  font-family: monospace;
  font-size: .67rem;
  font-weight: 500;
  color: var(--muted);
  padding: .3rem .5rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.meeting-cycle-table td {
  padding: .42rem .5rem;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 45%, transparent);
  color: var(--fg);
}

.meeting-cycle-table tbody tr:hover {
  background: color-mix(in oklab, var(--bg) 90%, var(--fg) 10%);
}

.rating-pips {
  display: flex;
  gap: .38rem;
  margin: .4rem 0 .1rem;
}

.rating-pip {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background var(--wird-t), border-color var(--wird-t), transform var(--wird-t);
  position: relative;
}

.rating-pip:hover {
  border-color: var(--wird-accent);
  transform: scale(1.15);
}

.rating-pip.filled {
  background: var(--wird-accent);
  border-color: var(--wird-accent);
}

.rating-pip.target-pip {
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--wird-green) 40%, transparent);
}

.rating-pip.target-pip.filled {
  background: var(--wird-green);
  border-color: var(--wird-green);
}

.rating-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.rating-label {
  font-style: italic;
  color: var(--muted);
}

.rating-pip-static {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  margin-right: .22rem;
  vertical-align: middle;
  transition: background var(--wird-t);
}

.rating-pip-static.filled {
  background: var(--wird-accent);
  border-color: var(--wird-accent);
}

.modal-pips {
  display: flex;
  gap: .55rem;
  margin-top: .35rem;
}

.modal-pip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background var(--wird-t), border-color var(--wird-t), transform var(--wird-t);
}

.modal-pip:hover {
  border-color: var(--wird-accent);
  transform: scale(1.12);
}

.modal-pip.filled {
  background: var(--wird-accent);
  border-color: var(--wird-accent);
}

.modal-pips {
  position: relative;
}

.card-pips {
  display: flex;
  gap: .4rem;
  margin-bottom: .45rem;
  align-items: center;
}

.card-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--wird-bar-bg);
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  transition: background var(--wird-t), border-color var(--wird-t);
  position: relative;
}

.card-pip.min-marker::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5px;
  height: 4px;
  background: var(--muted);
  opacity: .5;
  border-radius: 1px;
}

.wird-card.done  .card-pip.filled,
.wird-card.over  .card-pip.filled { background: var(--wird-green); border-color: var(--wird-green); }
.wird-card.miss  .card-pip.filled { background: var(--wird-red);   border-color: var(--wird-red);   }
.wird-card       .card-pip.filled { background: var(--wird-accent); border-color: var(--wird-accent); }

.card-rating-lbl {
  font-style: italic;
  margin-top: .1rem;
}

.modal-pips {
  display: flex;
  gap: .5rem;
  margin-top: .25rem;
}

.modal-pip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: .3rem .2rem;
  border-radius: 4px;
  transition: background var(--wird-t);
  flex: 1;
}

.modal-pip:hover { background: color-mix(in oklab, var(--bg) 85%, var(--fg) 15%); }

.pip-dot {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--wird-bar-bg);
  border: 2px solid var(--border);
  transition: background var(--wird-t), border-color var(--wird-t);
}

.modal-pip.selected .pip-dot {
  background: var(--wird-accent);
  border-color: var(--wird-accent);
}

.pip-lbl {
  font-family: monospace;
  font-size: .62rem;
  color: var(--muted);
  white-space: nowrap;
  transition: color var(--wird-t);
}

.modal-pip.selected .pip-lbl { color: var(--wird-accent); }

#motalah-today-row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.motalah-today-stat {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.motalah-today-val {
  font-family: monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--wird-accent);
}

.motalah-today-lbl {
  font-size: .68rem;
  color: var(--muted);
}

.motalah-session {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  padding: .55rem 0;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 45%, transparent);
  font-size: .88rem;
}

.motalah-session:last-child { border-bottom: none; }

.motalah-session-date {
  font-family: monospace;
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.motalah-session-dur {
  font-family: monospace;
  font-size: .82rem;
  font-weight: 600;
  color: var(--wird-accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.motalah-session-books {
  font-size: .78rem;
  color: var(--fg);
  flex: 1;
}

.motalah-book-chip {
  display: inline-block;
  font-size: .65rem;
  font-family: monospace;
  padding: .1rem .34rem;
  border-radius: 3px;
  background: color-mix(in oklab, var(--wird-accent) 14%, var(--bg));
  color: var(--wird-accent);
  margin: .1rem .15rem .1rem 0;
}

.motalah-session-note {
  font-size: .75rem;
  color: var(--muted);
  font-style: italic;
}

#nafl-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.nafl-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--wird-radius);
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .18rem;
  transition: box-shadow var(--wird-t), transform var(--wird-t), border-left-color var(--wird-t);
}

.nafl-card:hover {
  box-shadow: var(--wird-shadow);
  transform: translateY(-1px);
}

.nafl-card.nafl-done {
  border-left-color: var(--wird-green);
  background: color-mix(in oklab, var(--wird-green) 5%, var(--bg));
}

.nafl-icon { font-size: 1.3rem; line-height: 1; margin-bottom: .2rem; }

.nafl-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--heading);
}

.nafl-sub {
  font-family: monospace;
  font-size: .67rem;
  color: var(--muted);
  margin-bottom: .5rem;
}

.nafl-toggle {
  margin-top: auto;
  font-family: monospace;
  font-size: .66rem;
  padding: .18rem .44rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--wird-t), color var(--wird-t), border-color var(--wird-t);
  align-self: flex-start;
}

.nafl-toggle:hover:not(:disabled) {
  border-color: var(--wird-green);
  color: var(--wird-green);
}

.nafl-card.nafl-done .nafl-toggle {
  background: color-mix(in oklab, var(--wird-green) 15%, var(--bg));
  color: var(--wird-green);
  border-color: var(--wird-green);
}

.nafl-toggle:disabled { opacity: .5; cursor: default; }

#nafl-completion-bar-wrap {
  display: flex;
  align-items: center;
  gap: .75rem;
}

#nafl-bar-track {
  width: 120px;
  height: 4px;
  background: var(--wird-bar-bg);
  border-radius: 99px;
  overflow: hidden;
  flex-shrink: 0;
}

#nafl-completion-bar {
  height: 100%;
  background: var(--wird-green);
  border-radius: 99px;
  width: 0;
  transition: width .4s ease;
}

#nafl-completion-label {
  font-family: monospace;
  font-size: .7rem;
  color: var(--muted);
}

#khatm-stats-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

#khatm-list { display: flex; flex-direction: column; }

.khatm-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 0;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 45%, transparent);
  flex-wrap: wrap;
}

.khatm-item:last-child { border-bottom: none; }

.khatm-num {
  font-family: monospace;
  font-size: .68rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--wird-accent);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: default;
}

.khatm-item.milestone .khatm-num {
  background: var(--wird-green);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--wird-green) 28%, transparent);
}

.khatm-date {
  font-family: monospace;
  font-size: .78rem;
  font-weight: 600;
  color: var(--fg);
  flex-shrink: 0;
}

.khatm-type-badge {
  display: inline-block;
  font-family: monospace;
  font-size: .62rem;
  padding: .1rem .34rem;
  border-radius: 3px;
  background: color-mix(in oklab, var(--wird-accent) 14%, var(--bg));
  color: var(--wird-accent);
  flex-shrink: 0;
}

.khatm-gap {
  font-family: monospace;
  font-size: .7rem;
  color: var(--muted);
  flex-shrink: 0;
}

.khatm-note {
  font-size: .75rem;
  color: var(--muted);
  font-style: italic;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#heatmap-panel .wird-panel-header select {
  font-family: monospace;
  font-size: .72rem;
  padding: .26rem .44rem;
  border: 1px solid var(--border);
  border-radius: var(--wird-radius);
  background: var(--code-bg);
  color: var(--fg);
  cursor: pointer;
}

#heatmap-wrap { overflow-x: auto; padding-bottom: .4rem; }

#heatmap-month-labels {
  position: relative;
  padding-left: 28px;
  margin-bottom: .3rem;
  min-width: max-content;
  height: 1rem;
}

.hm-month-lbl {
  font-family: monospace;
  font-size: .6rem;
  color: var(--muted);
  position: absolute;
  white-space: nowrap;
}

#heatmap-grid {
  display: flex;
  gap: 3px;
  min-width: max-content;
}

.hm-dow-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-right: 4px;
  width: 24px;
}

.hm-dow-lbl {
  height: 12px;
  font-family: monospace;
  font-size: .57rem;
  color: var(--muted);
  line-height: 12px;
  white-space: nowrap;
}

.hm-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hm-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
  transition: transform 120ms ease;
  cursor: default;
}

.hm-cell:not(.hm-empty):hover {
  transform: scale(1.45);
  outline: 1.5px solid var(--wird-accent);
  z-index: 1;
  position: relative;
}

.hm-cell.hm-empty { background: transparent; }

.hm-cell[data-level="0"] { background: var(--wird-bar-bg); }
.hm-cell[data-level="1"] { background: color-mix(in oklab, var(--wird-accent) 28%, var(--bg)); }
.hm-cell[data-level="2"] { background: color-mix(in oklab, var(--wird-accent) 52%, var(--bg)); }
.hm-cell[data-level="3"] { background: color-mix(in oklab, var(--wird-accent) 76%, var(--bg)); }
.hm-cell[data-level="4"] { background: var(--wird-accent); }

.hm-cell.hm-today { outline: 1.5px solid var(--wird-accent-hover); }

#heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: .9rem;
  justify-content: flex-end;
}

.hm-legend-lbl {
  font-size: .65rem;
  color: var(--muted);
}

.hm-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.hm-swatch[data-level="0"] { background: var(--wird-bar-bg); }
.hm-swatch[data-level="1"] { background: color-mix(in oklab, var(--wird-accent) 28%, var(--bg)); }
.hm-swatch[data-level="2"] { background: color-mix(in oklab, var(--wird-accent) 52%, var(--bg)); }
.hm-swatch[data-level="3"] { background: color-mix(in oklab, var(--wird-accent) 76%, var(--bg)); }
.hm-swatch[data-level="4"] { background: var(--wird-accent); }

#heatmap-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.book-search-wrap {
  position: relative;
}

#motalah-book-search {
  font-family: inherit;
  font-size: .95rem;
  padding: .6rem .75rem .6rem 2.2rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--fg);
  width: 100%;
  box-sizing: border-box;
  transition: border-color var(--wird-t), box-shadow var(--wird-t);
}

#motalah-book-search:focus {
  outline: none;
  border-color: var(--wird-accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--wird-accent) 18%, transparent);
}

.book-search-icon {
  position: absolute;
  left: .65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: .85rem;
  pointer-events: none;
}

#book-search-results {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  background: var(--bg);
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

#book-search-results.open { display: block; }

.book-result-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .75rem;
  cursor: pointer;
  transition: background var(--wird-t);
  font-size: .88rem;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 40%, transparent);
}

.book-result-item:last-child { border-bottom: none; }

.book-result-item:hover { background: color-mix(in oklab, var(--bg) 88%, var(--fg) 12%); }

.book-result-item.selected { background: color-mix(in oklab, var(--wird-accent) 10%, var(--bg)); }

.book-result-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  background: transparent;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  transition: background var(--wird-t), border-color var(--wird-t);
}

.book-result-item.selected .book-result-check {
  background: var(--wird-accent);
  border-color: var(--wird-accent);
  color: var(--bg);
}

.book-result-title {
  font-weight: 500;
  color: var(--fg);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-result-author {
  font-size: .72rem;
  color: var(--muted);
  font-family: monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

#selected-books-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .5rem;
  min-height: 0;
}

.selected-book-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .7rem;
  font-family: monospace;
  padding: .22rem .5rem;
  border-radius: 4px;
  background: color-mix(in oklab, var(--wird-accent) 14%, var(--bg));
  color: var(--wird-accent);
  border: 1px solid color-mix(in oklab, var(--wird-accent) 30%, transparent);
}

.selected-book-chip button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--wird-accent);
  padding: 0;
  font-size: .75rem;
  line-height: 1;
  opacity: .7;
  transition: opacity var(--wird-t);
}

.selected-book-chip button:hover { opacity: 1; }

.book-no-results {
  padding: .75rem;
  font-size: .82rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

/* ============================================================
   wird-mobile.css
   Mobile-specific fixes and overrides for wird-tracker.
   Include this AFTER wird-tracker.css.

   Addresses:
   - Full-width overflow from heatmap / table / chart
   - Breakpoint gap between site (600px) and wird (520/540px)
   - Tap-target sizes across all interactive elements
   - Modal sheet usability
   - Grid reflowing on small screens
   ============================================================ */

#wird-app {
  overflow-x: hidden;
  max-width: 100%;
}

@media (max-width: 600px) {

  #wird-app {
    gap: 1.25rem;
    margin-top: 1rem;
  }

  .wird-panel {
    padding: 1rem;
    border-radius: 4px;
  }

  .wird-panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
  }

  #wird-cards,
  #nafl-cards {
    grid-template-columns: 1fr;
  }

  #history-table-wrap,
  #heatmap-wrap,
  #trend-chart {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  #heatmap-month-labels,
  #heatmap-grid {
    display: inline-flex;
  }

  #heatmap-month-labels {
    display: block;
  }

  #trend-chart {
    max-width: 100% !important;
    max-height: 200px;
  }

  #trend-stats,
  #heatmap-stats,
  #khatm-stats-row,
  #motalah-today-row {
    gap: .6rem;
  }

  .stat-chip .stat-val,
  .motalah-today-val {
    font-size: .88rem;
  }

  #today-progress-wrap {
    flex-wrap: wrap;
    gap: .4rem;
  }

  #today-progress-bar {
    width: 90px;
  }

  #meeting-status-row {
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
  }

  #meeting-status-msg {
    margin-left: 0;
  }

  #history-table th,
  #history-table td {
    white-space: normal;
    word-break: break-word;
  }

  #history-table th {
    font-size: .62rem;
    padding: .28rem .4rem;
  }

  #history-table td {
    font-size: .8rem;
    padding: .38rem .4rem;
  }

  .khatm-item {
    gap: .5rem;
  }

  .khatm-note {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  #trend-controls {
    gap: .4rem;
  }

  #trend-controls select {
    font-size: .7rem;
    padding: .3rem .5rem;
  }

  #nafl-completion-bar-wrap {
    flex-wrap: wrap;
    gap: .4rem;
  }

  #book-search-results {
    max-height: 160px;
  }

  .card-log-btn,
  .nafl-toggle {
    padding: .38rem .75rem;
    font-size: .74rem;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .rating-pip {
    width: 22px;
    height: 22px;
  }

  .card-pip {
    width: 13px;
    height: 13px;
  }
}

@media (max-width: 600px) {

  dialog {
    position: fixed;
    inset: auto 0 0 0;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    margin: 0;
    max-height: 92dvh;
    z-index: 9999;
  }

  dialog::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 99px;
    background: var(--border);
    margin: .75rem auto .25rem;
    flex-shrink: 0;
  }

  dialog form {
    max-height: calc(92dvh - 1.25rem);
    display: flex;
    flex-direction: column;
  }

  dialog h3 {
    padding: .9rem 1.1rem .85rem;
    font-size: 1rem;
  }

  .modal-body {
    padding: 1rem 1.1rem;
    overflow-y: auto;
    flex: 1;
  }

  .modal-footer,
  #modal-actions,
  #khatm-modal-actions,
  #motalah-modal-actions {
    flex-direction: column-reverse;
    padding: .85rem 1.1rem 1.25rem;
    gap: .5rem;
  }

  .modal-footer > *,
  #modal-actions > *,
  #khatm-modal-actions > *,
  #motalah-modal-actions > * {
    width: 100%;
    text-align: center;
    justify-content: center;
    box-sizing: border-box;
  }

  #modal-cancel,
  #khatm-cancel,
  #motalah-cancel {
    padding: .65rem 1rem;
    font-size: .9rem;
    min-height: 44px;
  }

  .btn-primary {
    padding: .65rem 1rem;
    font-size: .9rem;
    min-height: 44px;
  }

  .field-group input[type="text"],
  .field-group input[type="number"],
  .field-group input[type="date"],
  .field-group select,
  .field-group textarea,
  #motalah-book-search {
    font-size: 1rem;
    padding: .72rem .8rem;
    min-height: 44px;
  }

  .modal-pip {
    padding: .4rem .25rem;
  }

  .pip-dot {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 380px) {

  .wird-panel {
    padding: .75rem;
  }

  .wird-panel-header h2 {
    font-size: 1rem;
  }

  .card-name {
    font-size: .82rem;
  }

  .stat-chip .stat-val,
  .motalah-today-val {
    font-size: .82rem;
  }

  .nafl-card {
    padding: .7rem .8rem;
  }

  .nafl-name {
    font-size: .84rem;
  }

  .khatm-num {
    width: 20px;
    height: 20px;
    font-size: .62rem;
  }

  .meeting-cycle-table {
    display: block;
    overflow-x: auto;
  }

  .motalah-session {
    flex-wrap: wrap;
    gap: .3rem;
  }

  .pip-lbl { display: none; }
  .modal-pip { flex: unset; }
}
/* ============================================================
   wird-export.css
   Styles for the PDF export button and modal.
   Add to wird-tracker.css (or a separate stylesheet).
   ============================================================ */

/* ── Export button ─────────────────────────────────────── */
.btn-export {
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  font-family: inherit;
  font-size: .78rem;
  font-weight: 500;
  color: var(--wird-accent);
  background: transparent;
  border: 1.5px solid var(--wird-accent);
  border-radius: 999px;
  padding: .34rem .82rem;
  cursor: pointer;
  transition:
    background var(--wird-t),
    color var(--wird-t),
    box-shadow var(--wird-t),
    transform var(--wird-t);
  white-space: nowrap;
  /* Accessible focus */
  outline-offset: 3px;
}

.btn-export:hover {
  background: var(--wird-accent);
  color: var(--bg);
  box-shadow: 0 2px 8px color-mix(in oklab, var(--wird-accent) 30%, transparent);
  transform: translateY(-1px);
}

.btn-export:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-export:focus-visible {
  outline: 2px solid var(--wird-accent);
}

.btn-export svg {
  flex-shrink: 0;
  transition: transform var(--wird-t);
}

.btn-export:hover svg {
  transform: translateY(1px);
}

/* ── Export modal ──────────────────────────────────────── */
.export-modal-desc {
  font-size: .85rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
  line-height: 1.55;
}

/* Date row: two pickers side by side */
.export-date-row {
  display: flex;
  align-items: flex-end;
  gap: .75rem;
  margin-bottom: 1rem;
}

.export-date-row .field-group {
  flex: 1;
  margin-bottom: 0;
}

.export-date-sep {
  font-family: monospace;
  font-size: .9rem;
  color: var(--muted);
  padding-bottom: .65rem;
  flex-shrink: 0;
  user-select: none;
}

/* Quick presets */
.export-presets {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1.25rem;
}

.export-preset {
  font-family: monospace;
  font-size: .68rem;
  padding: .2rem .55rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--code-bg);
  color: var(--muted);
  cursor: pointer;
  transition: border-color var(--wird-t), color var(--wird-t), background var(--wird-t);
}

.export-preset:hover {
  border-color: var(--wird-accent);
  color: var(--wird-accent);
}

.export-preset:focus-visible {
  outline: 2px solid var(--wird-accent);
  outline-offset: 2px;
}

.export-preset.active {
  border-color: var(--wird-accent);
  background: color-mix(in oklab, var(--wird-accent) 12%, var(--bg));
  color: var(--wird-accent);
  font-weight: 600;
}

/* Checkbox options */
.export-options {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: .85rem 1rem;
  border-radius: var(--wird-radius);
  background: color-mix(in oklab, var(--bg) 90%, var(--fg) 10%);
  border: 1px solid var(--border);
}

.export-option-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .85rem;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
}

.export-option-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--wird-accent);
  cursor: pointer;
  flex-shrink: 0;
}

#export-modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .75rem;
  padding: 1.1rem 1.75rem 1.4rem;
  border-top: 1px solid var(--border);
}

#export-cancel {
  font-family: inherit;
  font-size: .82rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .44rem 1rem;
  cursor: pointer;
  color: var(--muted);
  transition: border-color var(--wird-t), color var(--wird-t);
}

#export-cancel:hover {
  border-color: var(--fg);
  color: var(--fg);
}

#export-submit:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* Mobile overrides */
@media (max-width: 600px) {
  .export-date-row {
    flex-direction: column;
    gap: .5rem;
  }

  .export-date-sep { display: none; }

  .export-presets { gap: .35rem; }

  .export-preset {
    padding: .3rem .6rem;
    font-size: .72rem;
  }

  #export-modal-actions {
    flex-direction: column-reverse;
    padding: .85rem 1.1rem 1.25rem;
    gap: .5rem;
  }

  #export-modal-actions > * {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }

  #export-cancel {
    padding: .65rem 1rem;
    font-size: .9rem;
    min-height: 44px;
  }
}
/* Daily Summary Panel */
#summary-controls {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.summary-presets {
  display: flex;
  gap: .3rem;
}

.summary-preset {
  font-family: monospace;
  font-size: .68rem;
  padding: .22rem .5rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--code-bg);
  color: var(--muted);
  cursor: pointer;
  transition: border-color var(--wird-t), color var(--wird-t), background var(--wird-t);
}

.summary-preset:hover {
  border-color: var(--wird-accent);
  color: var(--wird-accent);
}

.summary-preset.active {
  border-color: var(--wird-accent);
  background: color-mix(in oklab, var(--wird-accent) 12%, var(--bg));
  color: var(--wird-accent);
  font-weight: 600;
}

#summary-filter {
  font-family: monospace;
  font-size: .72rem;
  padding: .26rem .44rem;
  border: 1px solid var(--border);
  border-radius: var(--wird-radius);
  background: var(--code-bg);
  color: var(--fg);
  cursor: pointer;
}

#summary-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  min-width: 480px;
}

#summary-table th {
  text-align: center;
  font-family: monospace;
  font-size: .65rem;
  font-weight: 500;
  color: var(--muted);
  padding: .32rem .5rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#summary-table th:first-child {
  text-align: left;
}

#summary-table td {
  padding: .38rem .5rem;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 40%, transparent);
  text-align: center;
  font-family: monospace;
  font-size: .75rem;
  color: var(--fg);
  vertical-align: middle;
}

#summary-table td:first-child {
  text-align: left;
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
}

#summary-table tbody tr:hover {
  background: color-mix(in oklab, var(--bg) 90%, var(--fg) 10%);
}

#summary-table tbody tr.summary-today td:first-child {
  color: var(--wird-accent);
  font-weight: 600;
}

.summary-cell-done {
  color: var(--wird-green);
  font-weight: 600;
}

.summary-cell-over {
  color: var(--wird-accent);
  font-weight: 600;
}

.summary-cell-miss {
  color: var(--wird-red);
}

.summary-cell-empty {
  color: var(--muted);
  opacity: .4;
}

.summary-tfoot td {
  border-top: 1px solid var(--border);
  border-bottom: none;
  font-size: .68rem;
  color: var(--muted);
  padding-top: .55rem;
}

.summary-tfoot td:first-child {
  color: var(--muted);
  font-size: .68rem;
}

.summary-tfoot .summary-cell-done {
  font-size: .72rem;
}

/* cap history to scrollable */
#history-table-wrap {
  max-height: 420px;
  overflow-y: auto;
}
