:root {
  --bg: #0c0c10;
  --s1: #13131a;
  --s2: #1a1a24;
  --b1: #22222e;
  --b2: #2e2e3e;
  --text: #ddd8cc;
  --muted: #4a4a62;
  --muted2: #6a6a86;
  --accent: #e8c547;
  --green: #a8e05a;
  --danger: #e05a5a;
  --blue: #7ab4ff;
  --mono: "IBM Plex Mono", monospace;
  --sans: "IBM Plex Sans", sans-serif;
  --sab: env(safe-area-inset-bottom, 0px);
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  height: 100%;
  overscroll-behavior: none;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  flex-shrink: 0;
  background: var(--s1);
  border-bottom: 1px solid var(--b1);
  z-index: 10;
}
.brand {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent);
}
.brand span {
  color: var(--muted);
  font-weight: 400;
}
.week-badge {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

/* VIEWS */
.views {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.view.active {
  display: flex;
}

/* BOTTOM NAV */
.bottom-nav {
  display: flex;
  background: var(--s1);
  border-top: 1px solid var(--b1);
  flex-shrink: 0;
  padding-bottom: var(--sab);
  z-index: 10;
}
.bnav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 0;
  border: none;
  background: transparent;
  color: var(--muted2);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s;
}
.bnav-btn svg {
  width: 20px;
  height: 20px;
}
.bnav-btn.active {
  color: var(--accent);
}

::-webkit-scrollbar {
  width: 3px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--b2);
  border-radius: 2px;
}

/* ═══ SCORE BANNER ═══ */
.score-banner {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 14px;
  height: 34px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--b1);
  background: var(--s1);
}
.score-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.score-item + .score-item {
  border-left: 1px solid var(--b1);
  padding-left: 12px;
  margin-left: 12px;
}
.score-item-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}
.score-item-value {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
.score-item-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  margin-left: auto;
}

/* ═══ TRACKER ═══ */
.tracker-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tracker-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.day-strip {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  overflow-x: auto;
  flex-shrink: 0;
  border-bottom: 1px solid var(--b1);
  scrollbar-width: none;
}
.day-strip::-webkit-scrollbar {
  display: none;
}
.day-pill {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--b1);
  background: var(--s1);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--mono);
  color: var(--muted2);
  min-width: 52px;
}
.dp-name {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 600;
}
.dp-pct {
  font-size: 9px;
  color: var(--muted);
}
.day-pill.active {
  border-color: var(--accent);
  background: rgba(232, 197, 71, 0.08);
  color: var(--accent);
}
.day-pill.active .dp-pct {
  color: var(--accent);
}
.day-pill.today .dp-name::after {
  content: "·";
  color: var(--green);
  margin-left: 2px;
}
.day-pill.all-done {
  border-color: rgba(168, 224, 90, 0.35);
}
.day-pill.all-done .dp-pct {
  color: var(--green);
}

.tasks-area {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 0;
}
.day-hdr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.day-title {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
}
.day-pts {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.dprog-wrap {
  height: 3px;
  background: var(--b2);
  border-radius: 2px;
  margin-bottom: 14px;
}
.dprog-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s;
}
.dprog-fill.done {
  background: var(--green);
}

.task-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  border-radius: 10px;
  border: 1px solid var(--b1);
  background: var(--s1);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  margin-bottom: 8px;
}
.task-card:active {
  transform: scale(0.98);
}
.task-card.checked {
  border-color: #1e2e10;
  background: #0f180a;
  opacity: 0.55;
}
.chk {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--b2);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.task-card.checked .chk {
  background: var(--green);
  border-color: var(--green);
}
.chk-svg {
  display: none;
}
.task-card.checked .chk-svg {
  display: block;
}
.t-icon {
  font-size: 19px;
  flex-shrink: 0;
}
.t-info {
  flex: 1;
  min-width: 0;
}
.t-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-card.checked .t-label {
  text-decoration: line-through;
  color: var(--muted);
}
.t-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.t-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}
.view-toggle-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--b2);
  background: transparent;
  color: var(--muted2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
  transition: all 0.15s;
}
.view-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.view-toggle-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232, 197, 71, 0.08);
}
.view-toggle-btn svg {
  width: 15px;
  height: 15px;
}

/* ═══ KANBAN ═══ */
.kanban-panel {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  scrollbar-width: thin;
}
.kanban-panel::-webkit-scrollbar {
  height: 4px;
}
.kanban-panel::-webkit-scrollbar-thumb {
  background: var(--b2);
  border-radius: 2px;
}
.kb-col {
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 10px;
  border: 1px solid var(--b1);
  background: var(--s1);
  overflow: hidden;
}
.kb-col.kb-today {
  border-color: rgba(232, 197, 71, 0.35);
}
.kb-col-hdr {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--b1);
  flex-shrink: 0;
}
.kb-col-name {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text);
}
.kb-col.kb-today .kb-col-name {
  color: var(--accent);
}
.kb-col-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.kb-col-pct {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}
.kb-prog {
  flex: 1;
  height: 3px;
  background: var(--b2);
  border-radius: 2px;
}
.kb-prog-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s;
}
.kb-tasks {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: none;
}
.kb-tasks::-webkit-scrollbar {
  display: none;
}
.kb-card {
  border-radius: 8px;
  border: 1px solid var(--b1);
  background: var(--bg);
  padding: 9px 10px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.kb-card:active {
  transform: scale(0.97);
}
.kb-card.kb-done {
  opacity: 0.45;
  border-color: rgba(168, 224, 90, 0.2);
  background: #0a120a;
}
.kb-card.kb-conflict {
  border-color: rgba(224, 90, 90, 0.35);
  background: #130a0a;
}
.kb-card-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}
.kb-chk {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--b2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.kb-card.kb-done .kb-chk {
  background: var(--green);
  border-color: var(--green);
}
.kb-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.kb-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kb-card.kb-done .kb-label {
  text-decoration: line-through;
  color: var(--muted);
}
.kb-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.kb-time {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}
.kb-pts {
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(232, 197, 71, 0.1);
  color: var(--accent);
}
.kb-card.kb-done .kb-pts {
  background: rgba(168, 224, 90, 0.1);
  color: var(--green);
}
.kb-conflict-tag {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--danger);
}
.kb-empty {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  padding: 16px 0;
  letter-spacing: 1px;
}
.t-conflict-badge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(224, 90, 90, 0.12);
  color: var(--danger);
  letter-spacing: 0.5px;
}
.task-card.conflict {
  border-color: rgba(224, 90, 90, 0.35);
  background: #160e0e;
}
.task-card.conflict.checked {
  border-color: #1e2e10;
  background: #0f180a;
}
.ed-row.ed-conflict {
  border-color: rgba(224, 90, 90, 0.4);
}
.time-display-btn.conflict {
  border-color: rgba(224, 90, 90, 0.5);
  color: var(--danger);
}
.time-display-btn.conflict .tdb-val {
  color: var(--danger);
}
.t-delete {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.t-delete:hover {
  background: rgba(224, 90, 90, 0.15);
  border-color: var(--danger);
  color: var(--danger);
}
@media (hover: hover) {
  .t-delete {
    opacity: 0;
  }
  .task-card:hover .t-delete {
    opacity: 1;
  }
}

.week-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--b1);
  flex-shrink: 0;
  background: var(--s1);
}
.wb-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}
.wb-track {
  flex: 1;
  height: 5px;
  background: var(--b2);
  border-radius: 3px;
}
.wb-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 3px;
  transition: width 0.5s;
}
.wb-pct {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  min-width: 36px;
  text-align: right;
}

/* ═══ HISTORY ═══ */
#view-history {
  overflow-y: auto;
}
.hist-header {
  padding: 20px 16px 8px;
}
.hist-title {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
}
.hist-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
}
.hist-list {
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hist-card {
  border: 1px solid var(--b1);
  border-radius: 12px;
  background: var(--s1);
  overflow: hidden;
}
.hist-card-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
}
.hw-label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}
.hw-meta {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  margin-top: 3px;
}
.h-badge {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.h-badge.gs {
  background: rgba(168, 224, 90, 0.12);
  color: var(--green);
}
.h-badge.ga {
  background: rgba(232, 197, 71, 0.12);
  color: var(--accent);
}
.h-badge.gb {
  background: rgba(122, 180, 255, 0.12);
  color: var(--blue);
}
.h-badge.gc {
  background: rgba(224, 90, 90, 0.12);
  color: var(--danger);
}
.h-chevron {
  font-size: 9px;
  color: var(--muted);
  transition: transform 0.2s;
  display: inline-block;
}
.hist-card-hdr.open .h-chevron {
  transform: rotate(180deg);
}
.h-prog {
  height: 3px;
  background: var(--b2);
}
.h-prog-fill {
  height: 100%;
  transition: width 0.5s;
}
.h-detail {
  display: none;
  padding: 12px 16px;
  border-top: 1px solid var(--b1);
}
.h-detail.open {
  display: block;
}
.h-day-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--b1);
  cursor: pointer;
  transition: background 0.1s;
}
.h-day-row:hover {
  background: rgba(255, 255, 255, 0.02);
}
.h-day-row:last-of-type {
  border-bottom: none;
}
.h-day-chevron {
  font-size: 13px;
  color: var(--muted);
  margin-left: 2px;
  transition: transform 0.2s;
  display: inline-block;
  width: 12px;
  flex-shrink: 0;
}
.h-task-list {
  display: none;
  background: var(--bg);
  border-bottom: 1px solid var(--b1);
  padding: 4px 0;
}
.h-task-list.open {
  display: block;
}
.h-task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
}
.h-task-row.h-task-done {
  opacity: 0.6;
}
.h-task-chk {
  font-family: var(--mono);
  font-size: 11px;
  width: 14px;
  flex-shrink: 0;
  color: var(--green);
}
.h-task-row:not(.h-task-done) .h-task-chk {
  color: var(--muted);
}
.h-task-icon {
  font-size: 15px;
  flex-shrink: 0;
}
.h-task-label {
  flex: 1;
  font-size: 12px;
  color: var(--text);
}
.h-task-row.h-task-done .h-task-label {
  text-decoration: line-through;
  color: var(--muted);
}
.h-task-pts {
  font-family: var(--mono);
  font-size: 10px;
  flex-shrink: 0;
}
.h-day-name {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted2);
  width: 36px;
  flex-shrink: 0;
}
.h-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--b2);
  border-radius: 2px;
}
.h-bar-fill {
  height: 100%;
  border-radius: 2px;
}
.h-day-pct {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  width: 30px;
  text-align: right;
  flex-shrink: 0;
}
.h-score-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}
.hist-empty {
  text-align: center;
  padding: 48px 24px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 2px;
  line-height: 2.2;
  text-transform: uppercase;
}

/* ═══ EDITOR ═══ */
.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--b1);
  flex-shrink: 0;
  background: var(--s1);
}
.editor-day-label {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
}
.ed-daytabs {
  display: flex;
  gap: 5px;
  padding: 10px 14px;
  overflow-x: auto;
  flex-shrink: 0;
  border-bottom: 1px solid var(--b1);
  scrollbar-width: none;
}
.ed-daytabs::-webkit-scrollbar {
  display: none;
}
.ed-tab {
  flex: 0 0 auto;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--b1);
  background: transparent;
  color: var(--muted2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
}
.ed-tab.active {
  border-color: var(--accent);
  background: rgba(232, 197, 71, 0.08);
  color: var(--accent);
}

.editor-tasks {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}
.ed-row {
  background: var(--s1);
  border: 1px solid var(--b1);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ed-row-r1 {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 8px;
  align-items: center;
}
.ed-row-r2 {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.ed-row-r3 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pts-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.pts-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 3px;
  border-radius: 2px;
  background: var(--b2);
  outline: none;
  cursor: pointer;
}
.pts-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
}
.pts-val {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  width: 20px;
  text-align: right;
}

.ed-add-row {
  background: var(--s2);
  border: 1px dashed var(--b2);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ifield {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--b2);
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.ifield:focus {
  border-color: var(--accent);
}
.ifield-icon-btn {
  width: 44px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--b2);
  background: var(--bg);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
  flex-shrink: 0;
}
.ifield-icon-btn:hover,
.ifield-icon-btn.open {
  border-color: var(--accent);
}

/* TIME PICKER */
.time-display-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--b2);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  width: 100%;
}
.time-display-btn:hover,
.time-display-btn.open {
  border-color: var(--accent);
  color: var(--accent);
}
.time-display-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--muted);
}
.tdb-val {
  flex: 1;
}

.editor-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--b1);
  flex-shrink: 0;
  background: var(--s1);
  display: flex;
  gap: 8px;
  padding-bottom: calc(12px + var(--sab));
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--b2);
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0c0c10;
  font-weight: 700;
}
.btn-primary:hover {
  background: #f5d55a;
  border-color: #f5d55a;
  color: #0c0c10;
}
.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}
.btn-sq {
  width: 38px;
  height: 38px;
  padding: 0;
}
.empty {
  text-align: center;
  padding: 40px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 2px;
}

/* ═══ ICON PICKER MODAL ═══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
#iconModal {
  z-index: 300;
}
.modal-overlay.open {
  display: flex;
}
.modal-sheet {
  background: var(--s1);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 0;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--sab);
}
.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--b2);
  border-radius: 2px;
  margin: 12px auto 0;
}
.modal-title {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px 8px;
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 8px 16px 16px;
  overflow-y: auto;
}
.icon-opt {
  font-size: 22px;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.icon-opt:hover {
  background: var(--s2);
  border-color: var(--b2);
}
.icon-opt.selected {
  border-color: var(--accent);
  background: rgba(232, 197, 71, 0.1);
}

/* ═══ TIME PICKER MODAL ═══ */
.time-modal-sheet {
  background: var(--s1);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  padding-bottom: var(--sab);
  display: flex;
  flex-direction: column;
}
.time-modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
}
.time-modal-title {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}
.time-modal-done {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 1px;
}

.time-pickers-wrap {
  display: flex;
  gap: 0;
  padding: 8px 20px 20px;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.time-picker-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.tpg-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}
.tpg-pickers {
  display: flex;
  gap: 4px;
  align-items: center;
}
.time-sep {
  font-family: var(--mono);
  font-size: 20px;
  color: var(--muted);
  padding: 0 2px;
  margin-top: -4px;
}
.drum-wrap {
  position: relative;
  width: 56px;
  height: 120px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--b2);
  background: var(--bg);
}
.drum-wrap::before,
.drum-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 36px;
  z-index: 2;
  pointer-events: none;
}
.drum-wrap::before {
  top: 0;
  background: linear-gradient(to bottom, var(--bg), transparent);
}
.drum-wrap::after {
  bottom: 0;
  background: linear-gradient(to top, var(--bg), transparent);
}
.drum-selector {
  position: absolute;
  top: 50%;
  left: 4px;
  right: 4px;
  height: 36px;
  transform: translateY(-50%);
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: rgba(232, 197, 71, 0.06);
  pointer-events: none;
  z-index: 1;
}
.drum-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.15s ease;
  padding: 42px 0;
}
.drum-item {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  width: 100%;
  user-select: none;
  transition: color 0.1s;
}
.drum-item.active {
  color: var(--accent);
}
.between-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
  text-align: center;
  padding: 0 4px;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: calc(64px + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--accent);
  color: #0c0c10;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 9px 18px;
  border-radius: 8px;
  z-index: 999;
  opacity: 0;
  transition: all 0.25s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══ MATERIAIS TABS ═══ */
.refs-header {
  padding: 16px 16px 0;
  flex-shrink: 0;
  border-bottom: 1px solid var(--b1);
}
.refs-title {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}
.refs-tabs {
  display: flex;
  gap: 0;
}
.refs-tab {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--muted2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.refs-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.refs-panel {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  flex-direction: column;
}
.refs-panel.active {
  display: flex;
}

/* ═══ LIVROS ═══ */
.books-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--b1);
  flex-shrink: 0;
}
.books-filters {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.books-filters::-webkit-scrollbar {
  display: none;
}
.bfilter {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--b1);
  background: transparent;
  color: var(--muted2);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.bfilter.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232, 197, 71, 0.08);
}
.books-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 12px 16px 24px;
  display: block;
}
.books-list > * + * {
  margin-top: 8px;
}
.book-card {
  border: 1px solid var(--b1);
  border-radius: 10px;
  background: var(--s1);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.book-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.book-info {
  flex: 1;
  min-width: 0;
}
.book-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.book-author {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}
.book-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.book-badge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 10px;
}
.book-rating {
  font-size: 10px;
  color: var(--accent);
}
.book-notes {
  font-size: 11px;
  color: var(--muted2);
  margin-top: 5px;
  line-height: 1.5;
}
.book-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.book-act-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.book-act-btn:hover {
  background: var(--b2);
  color: var(--text);
}
.book-act-btn.del:hover {
  background: rgba(224, 90, 90, 0.15);
  color: var(--danger);
}
.books-empty {
  text-align: center;
  padding: 48px 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  line-height: 2;
}
/* ═══ ESTUDOS ═══ */
#view-studies {
  flex-direction: column;
  overflow: hidden;
}
.studies-header {
  padding: 16px 16px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--b1);
}
.studies-title {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
}
.studies-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 3px;
}
.studies-back {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  letter-spacing: 1px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.studies-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 14px 16px 24px;
  display: block;
}
.studies-body > * + * {
  margin-top: 10px;
}
.studies-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.subj-card-wrap {
  position: relative;
  display: flex;
}
.subj-card {
  border: 1px solid var(--b1);
  border-radius: 10px;
  background: var(--s1);
  padding: 10px 12px 9px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.subj-card:active {
  transform: scale(0.97);
}
.subj-card:hover {
  border-color: var(--b2);
}
.subj-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.subj-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.subj-name {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
}
.subj-lvl {
  font-family: var(--mono);
  font-size: 8px;
  margin-top: 1px;
}
.subj-prog-wrap {
  height: 3px;
  background: var(--b2);
  border-radius: 2px;
}
.subj-prog-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s;
}
.subj-prog-label {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--muted);
}
.subj-del-ext {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--b2);
  background: var(--bg);
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
  z-index: 2;
}
.subj-del-ext:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.lvl-tabs {
  display: flex;
  border-bottom: 1px solid var(--b1);
  background: var(--s2);
}
.lvl-tab {
  flex: 1;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--muted2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.lvl-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.lvl-tab-panel {
  display: none;
  flex-direction: column;
}
.lvl-tab-panel.active {
  display: flex;
}
.lvl-content {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lvl-content-desc {
  font-size: 12px;
  color: var(--text);
  line-height: 1.7;
}
.lvl-content-resources {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lvl-content-res-title {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.lvl-content-res-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--b1);
  background: var(--s1);
  text-decoration: none;
  transition: background 0.1s;
}
.lvl-content-res-link:hover {
  background: var(--b1);
}
.lvl-content-res-name {
  font-size: 12px;
  color: var(--text);
  flex: 1;
}
.lvl-content-res-arrow {
  font-size: 11px;
  color: var(--muted);
}
.lvl-challenges {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lvl-challenge {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--b1);
  background: var(--s1);
}
.lvl-challenge-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  width: 18px;
}
.lvl-challenge-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.6;
}
.lvl-no-content {
  padding: 20px 16px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 1px;
}
.lvl-legend {
  display: flex;
  gap: 12px;
  padding: 10px 0 2px;
  flex-wrap: wrap;
}
.lvl-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}
.lvl-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.lvl-card {
  border: 1px solid var(--b1);
  border-radius: 10px;
  overflow: hidden;
}
.lvl-card-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.lvl-card-hdr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.lvl-num {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  width: 28px;
  flex-shrink: 0;
  text-align: center;
}
.lvl-info {
  flex: 1;
}
.lvl-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.lvl-meta {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
}
.lvl-badge {
  font-family: var(--mono);
  font-size: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.lvl-chevron {
  font-size: 12px;
  color: var(--muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.lvl-items {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--b1);
}
.lvl-items.open {
  display: flex;
}
.lvl-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--b1);
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.lvl-item:last-child {
  border-bottom: none;
}
.lvl-item:hover {
  background: rgba(255, 255, 255, 0.02);
}
.lvl-item.done {
  opacity: 0.5;
}
.lvl-item-chk {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--b2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-top: 1px;
}
.lvl-item.done .lvl-item-chk {
  background: var(--green);
  border-color: var(--green);
}
.lvl-item-label {
  flex: 1;
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
  padding-top: 1px;
}
.lvl-item.done .lvl-item-label {
  text-decoration: line-through;
  color: var(--muted);
}
.lvl-complete-badge {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(168, 224, 90, 0.06);
  border-top: 1px solid rgba(168, 224, 90, 0.15);
  font-family: var(--mono);
  font-size: 9px;
  color: var(--green);
}
.lvl-complete-badge.show {
  display: flex;
}
.lvl-card.completed {
  border-color: rgba(168, 224, 90, 0.25);
}
.lvl-card.completed .lvl-card-hdr {
  background: rgba(168, 224, 90, 0.04);
}

.refs-plano-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--b1);
  flex-shrink: 0;
}
.refs-plano-toolbar .btn {
  margin-left: auto;
}
.refs-plano-toolbar .btn + .btn {
  margin-left: 0;
}
.refs-edit-actions {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--s2);
  border-bottom: 1px solid var(--b1);
}
.refs-edit-actions.visible {
  display: flex;
}
.refs-phase.edit-mode .refs-phase-hdr {
  cursor: default;
}
.refs-phase-edit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--b1);
  background: var(--s2);
}
.refs-tech-edit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px 6px 42px;
  background: rgba(255, 255, 255, 0.02);
}
.refs-add-btn {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--accent);
  background: transparent;
  border: 1px dashed rgba(232, 197, 71, 0.3);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}
.refs-add-btn:hover {
  border-color: var(--accent);
  background: rgba(232, 197, 71, 0.05);
}
.refs-del-btn {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.refs-del-btn:hover {
  background: rgba(224, 90, 90, 0.15);
  border-color: var(--danger);
  color: var(--danger);
}
.refs-edit-btn {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.refs-edit-btn:hover {
  background: var(--b2);
  color: var(--text);
}
.refs-phase {
  border: 1px solid var(--b1);
  border-radius: 12px;
  overflow: hidden;
}
.refs-phase-hdr {
  padding: 12px 16px;
  background: var(--s1);
  border-bottom: 1px solid var(--b1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.refs-phase-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.refs-phase-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
}
.refs-phase-chevron {
  font-size: 13px;
  color: var(--muted);
  transition: transform 0.2s;
  display: inline-block;
}
.refs-phase-body {
  display: none;
  flex-direction: column;
  gap: 0;
}
.refs-phase-body.open {
  display: flex;
}
.refs-tech {
  border-bottom: 1px solid var(--b1);
}
.refs-tech:last-child {
  border-bottom: none;
}
.refs-tech-hdr {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.refs-tech-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.refs-tech-name {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.refs-tech-slot {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}
.refs-tech-chevron {
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.2s;
  display: inline-block;
}
.refs-links {
  display: none;
  flex-direction: column;
  gap: 0;
  background: var(--bg);
  padding: 4px 0 8px;
}
.refs-links.open {
  display: flex;
}
.refs-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 42px;
  text-decoration: none;
  transition: background 0.1s;
}
.refs-link:hover {
  background: rgba(255, 255, 255, 0.03);
}
.refs-link-info {
  flex: 1;
}
.refs-link-name {
  font-size: 13px;
  color: var(--text);
}
.refs-link-meta {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  margin-top: 1px;
}
.refs-link-badge {
  font-family: var(--mono);
  font-size: 8px;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
}
.badge-free {
  background: rgba(168, 224, 90, 0.12);
  color: var(--green);
}
.badge-paid {
  background: rgba(122, 180, 255, 0.12);
  color: var(--blue);
}
.refs-link-arrow {
  font-size: 12px;
  color: var(--muted);
}
.refs-goal {
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  line-height: 1.6;
  border-top: 1px solid var(--b1);
  background: var(--s2);
}
.lvl-content-panel {
  padding: 12px 14px;
  border-bottom: 1px solid var(--b1);
  background: rgba(255, 255, 255, 0.01);
}
.lvl-content-desc {
  font-size: 12px;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 10px;
}
.lvl-content-section {
  margin-bottom: 10px;
}
.lvl-content-section:last-child {
  margin-bottom: 0;
}
.lvl-content-section-title {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.lvl-content-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  text-decoration: none;
  color: var(--blue);
  font-size: 11px;
  transition: color 0.1s;
}
.lvl-content-link:hover {
  color: var(--accent);
}
.lvl-content-link::before {
  content: "↗";
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}
.lvl-challenge-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 0;
}
.lvl-challenge-item {
  font-size: 11px;
  color: var(--text);
  padding: 7px 10px;
  background: rgba(232, 197, 71, 0.05);
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  line-height: 1.5;
}
.lvl-items-sep {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
  padding: 7px 14px;
  background: var(--s2);
  border-bottom: 1px solid var(--b1);
  text-transform: uppercase;
}

/* DESKTOP */
@media (min-width: 680px) {
  .refs-body {
    max-width: 680px;
  }
  .tracker-body {
    flex-direction: row;
  }
  .day-strip {
    flex-direction: column;
    width: 150px;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--b1);
    border-bottom: none;
    padding: 14px 10px;
    align-items: stretch;
    gap: 4px;
  }
  .day-pill {
    flex-direction: row;
    justify-content: space-between;
    padding: 9px 12px;
    min-width: unset;
  }

  #view-editor {
    flex-direction: row;
  }
  .editor-left {
    width: 170px;
    flex-shrink: 0;
    border-right: 1px solid var(--b1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .ed-daytabs {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    gap: 4px;
    flex: 1;
  }
  .ed-tab {
    text-align: left;
  }
  .editor-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .editor-topbar-mobile {
    display: none;
  }
  .modal-overlay {
    align-items: center;
  }
  .modal-sheet,
  .time-modal-sheet {
    border-radius: 16px;
    max-height: 80vh;
  }
}
/* ═══ MATERIAIS — só livros ═══ */
.refs-header-simple {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--b1);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.refs-title-simple {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text);
}
#view-refs.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#view-refs .books-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}

/* ═══ JOURNAL NO HISTÓRICO ═══ */
.h-journal-entry {
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--b1);
  background: rgba(232, 197, 71, 0.04);
}
.h-journal-mood {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.h-journal-mood-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 1px;
}
.h-journal-desc {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted2);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ═══ JOURNAL TRACKER ═══ */
#journalPanel {
  padding: 0 14px 14px;
}
.journal-section {
  border: 1px solid var(--b1);
  border-radius: 10px;
  overflow: hidden;
  background: var(--s1);
}
.journal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}
.journal-hdr:hover {
  background: var(--b1);
}
.journal-hdr-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.journal-icon {
  font-size: 15px;
  line-height: 1;
}
.journal-title {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--muted2);
  text-transform: uppercase;
}
.journal-date {
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  margin-left: 4px;
}
.journal-chevron {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
}
.journal-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
}
.journal-body.open {
  max-height: 500px;
  border-top: 1px solid var(--b1);
}
.mood-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
  padding: 12px 14px 8px;
}
.mood-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 0 14px 12px;
}
.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border: 1px solid var(--b2);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  transition:
    border-color 0.12s,
    background 0.12s,
    transform 0.1s;
}
.mood-btn:hover {
  border-color: var(--muted2);
  background: var(--b1);
}
.mood-btn:active {
  transform: scale(0.95);
}
.mood-btn.active {
  border-color: var(--accent);
  background: rgba(232, 197, 71, 0.1);
}
.mood-emoji {
  font-size: 20px;
  line-height: 1;
}
.mood-name {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.mood-btn.active .mood-name {
  color: var(--accent);
}
.journal-desc-wrap {
  padding: 0 14px 14px;
}
.journal-desc {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--b2);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  padding: 10px 12px;
  resize: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
  min-height: 72px;
}
.journal-desc:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--s2);
}
.journal-desc::placeholder {
  color: var(--muted);
}
