:root {
  --bg0: #141413;
  --bg1: #1b1a18;
  --bg2: #222120;
  --bg3: #2a2927;
  --bg4: #32302e;

  --b1: #2c2b28;
  --b2: #3a3835;
  --b3: #504e4a;

  --t1: #f4efe6;
  --t2: #ccc5b8;
  --t3: #8a8278;
  --t4: #504b45;

  --accent: #e0855a;
  --accent-lo: #7a3e22;
  --accent-glow: #e0855a18;
  --green: #72d17e;
  --green-lo: #274d2e;
  --blue: #7ab8e8;
  --red: #e08080;
  --yellow: #d4ac54;

  --mono: 'JetBrains Mono', monospace;
  --sans: 'Geist', system-ui, sans-serif;

  --topbar-h: 44px;
  --sidebar-w: 262px;
  --statusbar-h: 24px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg0);
  color: var(--t1);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--b2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--b3);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity .15s;
}

a:hover {
  opacity: .75;
  text-decoration: underline;
}

/* ── APP SHELL ── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* ── TOPBAR ── */
#topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--bg1);
  border-bottom: 1px solid var(--b1);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.tb-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  height: 100%;
  border-right: 1px solid var(--b1);
  width: var(--sidebar-w);
  flex-shrink: 0;
}

.tb-logo-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 10px var(--accent-glow);
}

.tb-logo-text {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--t3);
  letter-spacing: .01em;
}

.tb-logo-text b {
  color: var(--t1);
  font-weight: 600;
}

.tb-breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 18px;
  flex: 1;
  overflow: hidden;
}

.tb-crumb {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--t4);
  white-space: nowrap;
}

.tb-crumb.lit {
  color: var(--t2);
}

.tb-sep {
  color: var(--t4);
  font-size: 13px;
}

.tb-right {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 100%;
  border-left: 1px solid var(--b1);
}

.tb-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg2);
  border: 1px solid var(--b2);
  border-radius: 5px;
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--t3);
  white-space: nowrap;
}

.tb-chip .hi {
  color: var(--accent);
  font-weight: 600;
}

.tb-chip .fire {
  font-size: 13px;
}

.tb-prog-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg2);
  border: 1px solid var(--b2);
  border-radius: 5px;
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--t3);
}

.tb-prog-track {
  width: 72px;
  height: 3px;
  background: var(--b2);
  border-radius: 2px;
  overflow: hidden;
}

.tb-prog-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
  box-shadow: 0 0 6px var(--accent-glow);
}

.tb-pct {
  color: var(--accent);
  font-weight: 600;
  min-width: 28px;
  text-align: right;
}

/* ── BODY ── */
#body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg1);
  border-right: 1px solid var(--b1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sb-sec {
  padding: 11px 14px 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--t4);
  flex-shrink: 0;
}

.sb-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 6px;
}

.sb-week {
  border-bottom: 1px solid var(--b1);
}

.sb-week-hdr {
  display: flex;
  align-items: center;
  gap: 0;
  height: 33px;
  padding: 0 8px 0 10px;
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}

.sb-week-hdr:hover {
  background: var(--bg2);
}

.sb-week-hdr.open {
  background: var(--bg2);
}

.sb-arrow {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: var(--t4);
  transition: transform .18s;
  flex-shrink: 0;
  margin-right: 5px;
}

.sb-arrow.open {
  transform: rotate(90deg);
}

.sb-w-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
  margin-right: 8px;
}

.sb-w-name {
  flex: 1;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--t3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-week-hdr.open .sb-w-name {
  color: var(--t1);
}

.sb-w-badge {
  font-family: var(--mono);
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid var(--b2);
  color: var(--t4);
  flex-shrink: 0;
}

.sb-w-badge.active {
  border-color: transparent;
}

.sb-days {
  display: none;
  background: var(--bg0);
  border-top: 1px solid var(--b1);
}

.sb-days.open {
  display: block;
}

.sb-day {
  display: flex;
  align-items: center;
  height: 27px;
  padding: 0 10px 0 34px;
  cursor: pointer;
  user-select: none;
  border-left: 2px solid transparent;
  transition: background .1s, border-color .1s;
  gap: 7px;
}

.sb-day:hover {
  background: var(--bg2);
}

.sb-day.sel {
  background: var(--bg3);
  border-left-color: var(--accent);
}

.sb-day.done-d {
  background: transparent;
}

.sb-d-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--b3);
  flex-shrink: 0;
  transition: background .2s;
}

.sb-day.done-d .sb-d-dot {
  background: var(--green-lo);
}

.sb-day.sel .sb-d-dot {
  background: var(--accent);
}

.sb-d-lbl {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--t4);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-day.sel .sb-d-lbl {
  color: var(--t2);
}

.sb-day.done-d .sb-d-lbl {
  color: var(--t4);
}

.sb-d-chk {
  font-family: var(--mono);
  font-size: 10px;
  flex-shrink: 0;
}

.sb-foot {
  flex-shrink: 0;
  border-top: 1px solid var(--b1);
  padding: 10px 14px;
}

.sb-foot-title {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--t4);
  margin-bottom: 8px;
}

.sb-time-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sb-time-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.sb-time-val {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  min-width: 50px;
}

.sb-time-lbl {
  font-size: 11px;
  color: var(--t3);
}

/* ── MAIN ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg0);
}

#main-tbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--bg1);
  border-bottom: 1px solid var(--b1);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  flex-shrink: 0;
}

.mt-daynum {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--t3);
  background: var(--bg2);
  border: 1px solid var(--b2);
  border-radius: 4px;
  padding: 2px 8px;
}

.mt-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--t1);
  flex: 1;
  letter-spacing: -.01em;
}

.mt-wtag {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--b2);
}

.mt-done {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--t3);
}

.mt-done .c {
  font-weight: 600;
}

#main-scroll {
  flex: 1;
  overflow-y: auto;
}

/* ── TASKS PANE ── */
.tasks-pane {
  padding: 20px 26px 0;
}

.pane-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--b1);
}

.pane-lbl {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--t4);
}

.pane-prog {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.pane-prog-track {
  width: 60px;
  height: 2px;
  background: var(--b2);
  border-radius: 1px;
  overflow: hidden;
}

.pane-prog-fill {
  height: 100%;
  border-radius: 1px;
  transition: width .3s ease;
}

.pane-prog-txt {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t4);
  min-width: 28px;
  text-align: right;
}

/* task row */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 10px;
  border-bottom: 1px solid var(--b1);
  cursor: pointer;
  border-radius: 5px;
  margin: 0 -10px;
  transition: background .12s;
}

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

.task-item:hover {
  background: var(--bg2);
}

.task-cb {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--b3);
  background: transparent;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.task-cb.chk {
  border-color: transparent;
}

.task-cb.chk::after {
  content: '✓';
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  color: #111;
}

.task-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.task-lbl {
  font-size: 13.5px;
  color: var(--t1);
  line-height: 1.55;
  transition: color .15s;
  font-weight: 450;
}

.task-lbl.done {
  color: var(--t4);
  text-decoration: line-through;
  text-decoration-color: var(--b3);
}

/* hint — collapsible */
.task-hint {
  font-size: 11.5px;
  color: var(--t3);
  line-height: 1.6;
  padding-left: 1px;
  margin-top: 6px;
  display: none;
}

.task-hint.visible {
  display: block;
}

.task-hint.done {
  color: var(--t4);
}

/* hint toggle button in toolbar */
.mt-hint-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--t3);
  background: var(--bg2);
  border: 1px solid var(--b2);
  border-radius: 5px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  user-select: none;
}

.mt-hint-btn:hover {
  border-color: var(--b3);
  color: var(--t2);
}

.mt-hint-btn.on {
  color: var(--accent);
  border-color: var(--accent-lo);
  background: var(--accent-glow);
}

.mt-export-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--t3);
  background: var(--bg2);
  border: 1px solid var(--b2);
  border-radius: 5px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  user-select: none;
}

.mt-export-btn:hover {
  border-color: var(--b3);
  color: var(--t2);
}

/* day completion celebration */
@keyframes glow-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 var(--accent-glow)
  }

  50% {
    box-shadow: 0 0 18px 4px var(--accent-glow)
  }
}

.day-complete-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  margin: 16px 26px 0;
  background: var(--accent-glow);
  border: 1px solid var(--accent-lo);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: .03em;
  animation: glow-pulse 2s ease infinite;
}

/* apply task special styling */
.task-item.apply-task .task-lbl {
  color: var(--green);
}

.task-item.apply-task .task-cb {
  border-color: var(--green-lo);
}

.task-item.apply-task .task-cb.chk {
  background: var(--green);
}

.task-item.apply-task .task-cb.chk::after {
  color: #111;
}

/* ── NOTES PANE ── */
.notes-pane {
  padding: 18px 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notes-hdr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--b1);
}

.notes-sub {
  font-size: 11px;
  color: var(--t4);
  font-style: italic;
}

.notes-saved {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--green);
  margin-left: auto;
  opacity: 0;
  transition: opacity .3s;
}

.notes-saved.show {
  opacity: 1;
}

.notes-ta {
  width: 100%;
  background: var(--bg1);
  border: 1px solid var(--b2);
  border-radius: 6px;
  color: var(--t2);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  padding: 12px 14px;
  resize: vertical;
  outline: none;
  min-height: 130px;
  transition: border-color .2s, box-shadow .2s;
}

.notes-ta::placeholder {
  color: var(--t4);
  font-style: italic;
}

.notes-ta:focus {
  border-color: var(--b3);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── EMPTY / OVERVIEW ── */
#empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--t4);
  padding: 40px;
}

.empty-icon {
  font-size: 30px;
  opacity: .35;
}

.empty-ttl {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--t3);
}

.empty-sub {
  font-size: 11.5px;
  color: var(--t4);
  text-align: center;
  line-height: 1.7;
}

.week-ov {
  padding: 22px 26px 28px;
}

.ov-hdr {
  margin-bottom: 20px;
}

.ov-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.ov-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.02em;
}

.ov-sub {
  font-size: 12px;
  color: var(--t3);
  margin-top: 4px;
}

.ov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 9px;
}

.ov-card {
  background: var(--bg1);
  border: 1px solid var(--b2);
  border-radius: 7px;
  padding: 14px 15px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}

.ov-card:hover {
  background: var(--bg2);
  border-color: var(--b3);
  transform: translateY(-1px);
}

.ov-card.cmp {
  border-color: var(--green-lo);
}

.ov-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.ov-dnum {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  width: 28px;
  height: 20px;
  border-radius: 3px;
  background: var(--bg2);
  border: 1px solid var(--b2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ov-dnum.cmp {
  background: transparent;
  border: none;
  font-size: 14px;
}

.ov-stat {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t4);
}

.ov-title-sm {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--t2);
  margin-bottom: 9px;
  line-height: 1.35;
}

.ov-dots {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.ov-dot {
  width: 6px;
  height: 6px;
  border-radius: 1.5px;
  background: var(--b2);
}

/* ── STATUS BAR ── */
#statusbar {
  height: var(--statusbar-h);
  min-height: var(--statusbar-h);
  background: var(--bg1);
  border-top: 1px solid var(--b1);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 14px;
  flex-shrink: 0;
}

.sb-item {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t4);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.sb-item b {
  color: var(--t3);
  font-weight: 500;
}

.sb-item.accent b {
  color: var(--accent);
}

.sb-sep {
  color: var(--b3);
  font-size: 11px;
}

.sb-right {
  margin-left: auto;
}

/* ── ANIMS ── */
@keyframes fi {
  from {
    opacity: 0;
    transform: translateY(5px)
  }

  to {
    opacity: 1;
    transform: none
  }
}

@keyframes pop {
  0% {
    transform: scale(1)
  }

  40% {
    transform: scale(1.18)
  }

  70% {
    transform: scale(.95)
  }

  100% {
    transform: scale(1)
  }
}

.fi {
  animation: fi .2s ease both;
}

.task-item {
  animation: fi .15s ease both;
}

.task-cb.popping {
  animation: pop .3s cubic-bezier(.4, 0, .2, 1);
}

/* ── APP LOCKED STATE ── */
#app.locked {
  display: none !important;
}

/* ── LOGIN GATE ── */
#loginGate {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  overflow: hidden;
}

#loginGate::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  opacity: .06;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: gate-pulse 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes gate-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: .06; }
  50% { transform: translate(-50%, -50%) scale(1.15); opacity: .1; }
}

#loginGate.hidden {
  display: none;
}

.gate-card {
  width: 370px;
  max-width: 90%;
  background: var(--bg1);
  border: 1px solid var(--b2);
  border-radius: 12px;
  padding: 36px 30px 28px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255,255,255,0.03) inset;
  position: relative;
  animation: gate-card-in .4s ease both;
}

@keyframes gate-card-in {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.gate-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}

.gate-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

.gate-logo-text {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--t3);
  letter-spacing: .01em;
}

.gate-logo-text b {
  color: var(--t1);
  font-weight: 600;
}

.gate-title {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  color: var(--t1);
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: -.02em;
}

.gate-sub {
  font-size: 12px;
  color: var(--t4);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 22px;
}

.gate-error {
  color: var(--red);
  font-size: 11.5px;
  text-align: center;
  margin-bottom: 10px;
  min-height: 16px;
}

.gate-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--b2);
  border-radius: 6px;
  color: var(--t2);
  font-family: var(--sans);
  font-size: 13px;
  padding: 11px 12px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.gate-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.gate-input::placeholder {
  color: var(--t4);
}

.gate-btn {
  width: 100%;
  border: none;
  border-radius: 6px;
  padding: 11px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
  transition: opacity .2s, transform .1s, background .2s;
}

.gate-btn:hover:not(:disabled) {
  opacity: .88;
  transform: translateY(-1px);
}

.gate-btn:active:not(:disabled) {
  transform: translateY(0);
}

.gate-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.gate-btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px rgba(224, 133, 90, .25);
}

.gate-btn-secondary {
  background: transparent;
  color: var(--t3);
  border: 1px solid var(--b2);
}

.gate-btn-secondary:hover:not(:disabled) {
  background: var(--bg2);
  color: var(--t2);
}

.gate-footer {
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t4);
  margin-top: 16px;
  letter-spacing: .03em;
}

/* ── USER BADGE (topbar) ── */
.user-badge {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--bg2);
  border: 1px solid var(--green-lo);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--green);
}

.user-email {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-logout-btn {
  background: none;
  border: none;
  color: var(--t4);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  margin-left: 4px;
  transition: color .15s;
  font-family: var(--mono);
}

.user-logout-btn:hover {
  color: var(--red);
}

.sync-status {
  font-size: 10px;
  color: var(--t4);
}
.sync-status.ok { color: var(--green); }
.sync-status.syncing { color: var(--accent); }
.sync-status.error { color: var(--red); }

/* ── AI FLOATING OVERLAY ── */

/* FAB Button */
.ai-fab {
  position: fixed;
  bottom: 32px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--bg2);
  border: 1px solid var(--b2);
  color: var(--t3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  z-index: 1500;
  transition: all .2s ease;
}

.ai-fab:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg3);
}

.ai-fab--open {
  transform: rotate(90deg);
  background: var(--bg3);
  border-color: var(--accent);
  color: var(--accent);
}

/* Overlay Container */
.ai-overlay {
  position: fixed;
  bottom: 76px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 120px);
  z-index: 1500;
  pointer-events: none;
  opacity: 0;
  transform: translateY(16px) scale(.96);
  transition: opacity .25s ease, transform .25s ease;
}

.ai-overlay--open {
  pointer-events: all;
  opacity: 1;
  transform: none;
}

/* Box */
.ai-box {
  background: var(--bg1);
  border: 1px solid var(--b2);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  box-shadow: 0 12px 48px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.03) inset;
  overflow: hidden;
}

/* Header */
.ai-box__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg2);
  border-bottom: 1px solid var(--b2);
  flex-shrink: 0;
}

.ai-box__header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-box__icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #c96e4a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 8px rgba(224,133,90,.25);
}

.ai-box__title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--t1);
  letter-spacing: -.01em;
}

.ai-box__sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t4);
  margin-top: 1px;
}

.ai-box__header-right {
  display: flex;
  gap: 4px;
}

.ai-box__clear, .ai-box__close {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--t4);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}

.ai-box__clear:hover, .ai-box__close:hover {
  background: var(--bg1);
  color: var(--t2);
}

/* Context bar */
.ai-box__ctx {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: rgba(255,255,255,.01);
  border-bottom: 1px solid var(--b2);
  flex-shrink: 0;
}

.ai-box__ctx-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  flex-shrink: 0;
}

.ai-box__ctx-text {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--t3);
}

/* Messages */
.ai-box__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 180px;
  max-height: 340px;
  scroll-behavior: smooth;
}

.ai-box__messages::-webkit-scrollbar { width: 4px; }
.ai-box__messages::-webkit-scrollbar-thumb { background: var(--b2); border-radius: 4px; }

/* Task Picker */
.ai-picker__header {
  text-align: center;
  padding: 8px 0 14px;
}

.ai-picker__title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: 4px;
}

.ai-picker__sub {
  font-size: 11.5px;
  color: var(--t4);
}

.ai-picker__task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  background: var(--bg2);
  border: 1px solid var(--b2);
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s ease;
  margin-bottom: 6px;
  text-align: left;
  color: var(--t2);
  font-family: var(--sans);
}

.ai-picker__task:hover {
  border-color: var(--accent);
  background: rgba(224, 133, 90, .05);
  transform: translateX(3px);
}

.ai-picker__task--done {
  opacity: .55;
}

.ai-picker__task--general {
  border-style: dashed;
  margin-top: 4px;
}

.ai-picker__task-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg1);
  border: 1px solid var(--b2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  flex-shrink: 0;
  font-weight: 600;
}

.ai-picker__task-body { flex: 1; min-width: 0; }

.ai-picker__task-text {
  font-size: 12px;
  line-height: 1.5;
}

.ai-picker__task-badge {
  font-size: 10px;
  color: var(--green);
  font-family: var(--mono);
  margin-top: 2px;
  display: inline-block;
}

/* Welcome state */
.ai-welcome {
  padding: 8px 0;
}

.ai-welcome__task {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: 6px;
  line-height: 1.5;
}

.ai-welcome__hint {
  font-size: 11.5px;
  color: var(--t4);
  line-height: 1.55;
  margin-bottom: 16px;
}

.ai-welcome__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Quick buttons */
.ai-qbtn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg2);
  border: 1px solid var(--b2);
  border-radius: 16px;
  padding: 6px 13px;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--t3);
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}

.ai-qbtn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(224,133,90,.2);
}

/* Chat Messages */
.ai-msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 90%;
  animation: aiMsgIn .2s ease both;
}

@keyframes aiMsgIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.ai-msg--pop { animation-duration: .3s; }

.ai-msg__label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 0 2px;
}

.ai-msg--user { align-self: flex-end; align-items: flex-end; }
.ai-msg--ai { align-self: flex-start; align-items: flex-start; }
.ai-msg--user .ai-msg__label { color: var(--accent); }
.ai-msg--ai .ai-msg__label { color: var(--green); }

.ai-msg__bubble {
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.65;
  padding: 10px 14px;
  border-radius: 12px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.ai-msg--user .ai-msg__bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 4px rgba(224,133,90,.15);
}

.ai-msg--ai .ai-msg__bubble {
  background: var(--bg2);
  color: var(--t2);
  border: 1px solid var(--b2);
  border-bottom-left-radius: 4px;
}

.ai-msg--ai .ai-msg__bubble strong { color: var(--t1); }
.ai-msg--ai .ai-msg__bubble em { color: var(--accent); }

.ai-msg--err .ai-msg__bubble {
  background: rgba(255,80,80,.06);
  color: var(--red);
  border: 1px solid rgba(255,80,80,.12);
  font-size: 11.5px;
}

/* Code blocks */
.ai-cb {
  background: var(--bg0);
  border: 1px solid var(--b2);
  border-radius: 8px;
  margin: 8px 0;
  overflow: hidden;
}

.ai-cb__hdr {
  padding: 4px 12px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--t4);
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid var(--b2);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.ai-cb code {
  display: block;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--t2);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.ai-ic {
  background: rgba(224,133,90,.08);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 11px;
}

/* Typing dots */
.ai-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 2px 0;
}

.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--t4);
  animation: aiTypePulse 1.2s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: .15s; }
.ai-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes aiTypePulse {
  0%, 100% { opacity: .3; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1); }
}

/* Input row */
.ai-box__input-row {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--b2);
  background: var(--bg2);
  flex-shrink: 0;
}

.ai-box__input {
  flex: 1;
  background: var(--bg1);
  border: 1px solid var(--b2);
  border-radius: 8px;
  color: var(--t2);
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.ai-box__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224,133,90,.08);
}

.ai-box__input::placeholder { color: var(--t4); }
.ai-box__input:disabled { opacity: .5; }

.ai-box__send {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  box-shadow: 0 2px 8px rgba(224,133,90,.2);
}

.ai-box__send:hover:not(:disabled) {
  opacity: .88;
  transform: translateY(-1px);
}

.ai-box__send:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* Model Picker UI */
.ai-box__model-picker-wrap {
  position: relative;
  margin-top: 4px;
}

.ai-box__model-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--b2);
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--t2);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}

.ai-box__model-btn:hover {
  border-color: var(--accent);
  color: var(--t1);
  background: var(--bg4);
}

.ai-model-picker {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 150px;
  background: rgba(27, 26, 24, 0.98);
  backdrop-filter: blur(12px);
  border: 1px solid var(--b2);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 100;
  display: none;
  animation: pickerIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pickerIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

.ai-model-picker--open {
  display: block;
}

.ai-model-opt {
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all .15s;
}

.ai-model-opt:hover {
  background: rgba(224, 133, 90, 0.1);
}

.ai-model-opt--active {
  background: var(--accent-glow);
  border: 1px solid rgba(224, 133, 90, 0.2);
}

.ai-model-opt__name {
  font-size: 11px;
  font-weight: 600;
  color: var(--t1);
}

.ai-model-opt__provider {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0;
}
