/* ══════════════════════════════════════════════════
   MaxNote · V2.0 — kept by a pocket moth
   (font faces live in fonts.css — all bundled locally)
   ══════════════════════════════════════════════════ */

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

:root {
  --bg: #fdfcff;
  --bg-sidebar: #f6f4fb;
  --bg-list: #faf9fd;
  --bg-hover: #efeaf9;
  --bg-active: #e9e2f8;
  --bg-input: #ffffff;
  --border: #e7e2f2;
  --text: #251f33;
  --text-muted: #8b849c;

  --violet: #7c3aed;
  --green: #10b981;
  --pink: #ec4899;
  --amber: #f59e0b;
  --teal: #14b8a6;
  --sky: #0ea5e9;

  --accent: var(--green);
  --accent-soft: #d1fae5;
  --grad: linear-gradient(135deg, #10b981 0%, #7c3aed 100%);
  --danger: #e5484d;
  --chip-bg: #d1fae5;
  --chip-text: #059669;
  --shadow: rgba(60, 20, 120, 0.10);
  --glow: rgba(16, 185, 129, 0.35);
  --grid-fine: #f1eef9;
  --grid-major: #e5dff2;
}

body.dark {
  --bg: #17141f;
  --bg-sidebar: #120f1a;
  --bg-list: #1b1726;
  --bg-hover: #262033;
  --bg-active: #2f2740;
  --bg-input: #211c2e;
  --border: #322b42;
  --text: #eae6f4;
  --text-muted: #8f88a3;

  --accent: #34d399;
  --accent-soft: #123a2c;
  --grad: linear-gradient(135deg, #34d399 0%, #a78bfa 100%);
  --danger: #ff6369;
  --chip-bg: #123a2c;
  --chip-text: #6ee7b7;
  --shadow: rgba(0, 0, 0, 0.45);
  --glow: rgba(52, 211, 153, 0.35);
  --grid-fine: #1f1a2b;
  --grid-major: #2a2340;
}

:root { --font-body: 'Lexend', -apple-system, "Segoe UI", Roboto, sans-serif; }
body[data-font="system"] { --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, sans-serif; }
body[data-font="serif"]  { --font-body: Georgia, "Times New Roman", serif; }
body[data-font="mono"]   { --font-body: Consolas, Monaco, "Courier New", monospace; }

html, body { height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  transition: background 0.35s ease, color 0.35s ease;
}

/* :not(#orders-root *) excludes the embedded Orders app — it ships its own
   Tailwind `.hidden` utility (paired with responsive overrides like
   `md:table`) and this !important rule would otherwise always win, no
   matter what Tailwind's cascade says, since it's a plain class-name
   collision, not a real conflict of intent. */
.hidden:not(#orders-root *) { display: none !important; }

/* ---- Icons ---- */
.icon {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px;
  flex-shrink: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Login ---- */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-sidebar);
  z-index: 100; overflow: hidden;
}
.login-orbs span {
  position: absolute; border-radius: 50%;
  filter: blur(70px); opacity: 0.5;
  animation: drift 14s ease-in-out infinite alternate;
}
.login-orbs span:nth-child(1) { width: 380px; height: 380px; background: var(--green); top: -90px; left: -70px; }
.login-orbs span:nth-child(2) { width: 320px; height: 320px; background: var(--violet); bottom: -80px; right: -60px; animation-delay: -5s; }
.login-orbs span:nth-child(3) { width: 240px; height: 240px; background: var(--amber); bottom: 10%; left: 12%; animation-delay: -9s; opacity: 0.3; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(60px, 40px) scale(1.15); }
}

.login-card {
  position: relative;
  background: var(--bg); border: 1px solid var(--border); border-radius: 20px;
  padding: 42px 40px 26px; width: 350px; text-align: center;
  box-shadow: 0 20px 60px var(--shadow);
  animation: card-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 20px; background: var(--grad); color: #fff;
  box-shadow: 0 10px 26px var(--glow);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.login-logo:hover { transform: rotate(-8deg) scale(1.08); }
.login-logo .icon { width: 30px; height: 30px; }
.login-card h1 {
  font-size: 26px; margin-bottom: 4px;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.login-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 22px; }
.login-card input {
  width: 100%; padding: 11px 14px; margin-bottom: 12px;
  border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--bg-input); color: var(--text); font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.login-card button {
  position: relative; overflow: hidden;
  width: 100%; padding: 11px; border: none; border-radius: 12px;
  background: var(--grad); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.login-card button:hover { transform: translateY(-2px); box-shadow: 0 10px 24px var(--glow); }
.login-card button:active { transform: translateY(0); }
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.login-signature {
  margin-top: 14px; font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* ---- Layout ---- */
.app { display: flex; height: 100vh; animation: fade-in 0.4s ease; position: relative; }

/* ---- Column Resizers ---- */
.column-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
  cursor: col-resize;
  z-index: 10;
  transition: background 0.2s ease;
}

.column-resizer:hover,
.column-resizer.resizing {
  background: var(--accent);
}

.column-resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 40px;
  background: var(--border);
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.column-resizer:hover::after {
  opacity: 1;
}

.column-resizer.resizing::after {
  opacity: 1;
  background: var(--accent);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- Sidebar ---- */
.sidebar {
  width: 236px; min-width: 236px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: background 0.35s ease;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 14px 8px;
}
.brand { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.brand-icon { width: 20px; height: 20px; color: var(--accent); }
.brand:hover .brand-icon { transform: rotate(-12deg) scale(1.15); }

.theme-btn:hover .icon { transform: rotate(40deg) scale(1.15); }

.new-note-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin: 8px 14px 14px;
  padding: 10px; border: none; border-radius: 24px;
  background: var(--grad); background-size: 160% 160%; background-position: 0% 50%;
  color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 16px var(--glow);
  transition: background-position 0.4s ease, transform 0.2s, box-shadow 0.2s;
}
.new-note-btn:hover {
  background-position: 100% 50%;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px var(--glow);
}
.new-note-btn:hover .icon { transform: rotate(90deg); }
.new-note-btn:active { transform: translateY(0) scale(0.98); }

.sidebar-nav { flex: 1; overflow-y: auto; padding-bottom: 10px; }

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px; font-size: 14px; cursor: pointer;
  border-radius: 10px; margin: 1px 8px;
  white-space: nowrap; overflow: hidden;
  transition: background 0.18s, transform 0.18s;
}
.nav-item:hover { background: var(--bg-hover); transform: translateX(3px); }
.nav-item:hover .nav-icon { transform: scale(1.2) rotate(-6deg); }
.nav-item.active { background: var(--bg-active); font-weight: 600; }
.nav-item .nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-icon { width: 16px; height: 16px; }
.ic-all { color: var(--sky); }
.ic-cal { color: var(--teal); }
.ic-orders { color: var(--accent); }
.ic-trash { color: var(--danger); }
.nb-c0 { color: var(--green); }
.nb-c1 { color: var(--pink); }
.nb-c2 { color: var(--amber); }
.nb-c3 { color: var(--teal); }
.nb-c4 { color: var(--sky); }
.nav-count { margin-left: auto; color: var(--text-muted); font-size: 11px; background: var(--bg-active); border-radius: 9px; padding: 1px 7px; transition: background 0.18s; }
.nav-actions { display: flex; gap: 1px; margin-left: auto; flex-shrink: 0; opacity: 1; }
.nav-actions .icon-btn { padding: 4px; }

.nav-section { margin-top: 14px; }
.nav-section-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 16px; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted);
}
.nav-section-title .icon { width: 13px; height: 13px; }

.font-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
  min-width: 0; width: 100%;
}
.font-row label { flex-shrink: 0; }
.font-select-wrap {
  flex: 1; min-width: 0; overflow: hidden;
}
.font-row select {
  display: block; width: 100%; max-width: 100%;
  padding: 4px 8px;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--bg-input); color: var(--text); font-size: 12px;
  font-family: var(--font-body); cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.font-row select:hover { border-color: var(--accent); }
.font-row select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.sidebar-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px 4px;
}
.footer-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--text-muted);
  font-size: 13px; cursor: pointer; text-decoration: none;
  border-radius: 8px; padding: 4px 6px;
  transition: color 0.18s, background 0.18s, transform 0.18s;
}
.footer-link:hover { color: var(--accent); background: var(--bg-hover); transform: translateY(-1px); }
.footer-link .icon { width: 14px; height: 14px; }

.signature {
  padding: 2px 14px 10px; font-size: 11.5px; color: var(--text-muted);
  display: flex; align-items: center; gap: 7px;
  min-width: 0;
}
.sig-line {
  font-size: 11px; letter-spacing: 0.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sig-moth {
  width: 22px; height: 14px; flex-shrink: 0;
  fill: currentColor; opacity: 0.72;
}
.sig-moth .antenna {
  fill: none; stroke: currentColor; stroke-width: 0.7; stroke-linecap: round;
}
.sig-moth .wing-l, .sig-moth .wing-r {
  transform-box: fill-box; transform-origin: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.signature:hover .sig-moth, .login-card:hover .sig-moth { color: var(--accent); opacity: 1; }
.signature:hover .sig-moth .wing-l, .login-card:hover .sig-moth .wing-l { transform: rotate(-16deg) translateY(-1px); }
.signature:hover .sig-moth .wing-r, .login-card:hover .sig-moth .wing-r { transform: rotate(16deg) translateY(-1px); }
.version-stamp {
  margin-left: auto;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em;
  color: var(--accent); border: 1.5px solid var(--accent);
  border-radius: 6px; padding: 1px 6px; transform: rotate(-4deg);
  opacity: 0.85; transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
}
.signature:hover .version-stamp { transform: rotate(4deg) scale(1.15); opacity: 1; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); border-radius: 9px; padding: 6px; line-height: 1;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--accent); transform: translateY(-1px); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.small .icon { width: 13px; height: 13px; }
.icon-btn.active-pin { color: var(--amber); }
.icon-btn.active-pin .icon { fill: var(--amber); stroke: var(--amber); }
#delete-btn:hover { color: var(--danger); }
.danger-hover:hover { color: var(--danger); }
#pin-btn:hover .icon { transform: rotate(-20deg) scale(1.15); }

/* ---- Note list pane ---- */
.note-list-pane {
  width: 324px; min-width: 260px;
  background: var(--bg-list);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: background 0.35s ease;
}
.note-list-header { padding: 12px 12px 6px; }
.search-wrap { position: relative; }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-muted); pointer-events: none;
  transition: color 0.2s;
}
.search-wrap:focus-within .search-icon { color: var(--accent); }
#search-input {
  width: 100%; padding: 9px 12px 9px 34px;
  border: 1.5px solid var(--border); border-radius: 22px;
  background: var(--bg-input); color: var(--text); font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.note-list-title-row {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 8px 16px 6px;
}
.note-list-title-row { gap: 8px; }
.note-list-title-row h2 { flex: 1; font-size: 17px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#export-nb-btn { align-self: center; }
.list-count { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }

/* ---- Export dropdown ---- */
.export-menu {
  position: fixed; z-index: 60;
  display: flex; flex-direction: column; min-width: 172px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px var(--shadow);
  padding: 5px; overflow: hidden;
  animation: menu-in 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.export-menu .menu-title {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); padding: 5px 10px 3px;
}
.export-menu button {
  display: block; text-align: left;
  background: none; border: none; color: var(--text);
  font-size: 13px; font-family: var(--font-body);
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.export-menu button:hover { background: var(--accent-soft); color: var(--accent); transform: translateX(3px); }

.trash-actions { padding: 0 16px 8px; }
.danger-btn {
  padding: 6px 14px; border: 1.5px solid var(--danger); border-radius: 9px;
  background: none; color: var(--danger); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.danger-btn:hover { background: var(--danger); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 14px rgba(229, 72, 77, 0.35); }

.note-list { flex: 1; overflow-y: auto; padding: 2px 8px 12px; }

.note-card {
  position: relative;
  padding: 12px 14px; cursor: pointer;
  border-radius: 12px; margin-bottom: 6px;
  border: 1px solid transparent;
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.note-card::before {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 2px; background: var(--grad);
  opacity: 0; transform: scaleY(0.3);
  transition: opacity 0.2s, transform 0.25s;
}
.note-card:hover {
  background: var(--bg-hover);
  transform: translateX(4px);
  box-shadow: 0 4px 14px var(--shadow);
}
.note-card:hover::before { opacity: 1; transform: scaleY(1); }
.note-card.active { background: var(--bg-active); border-color: var(--border); }
.note-card.active::before { opacity: 1; transform: scaleY(1); }
.note-card-title {
  font-size: 14px; font-weight: 650; margin-bottom: 3px;
  display: flex; align-items: center; gap: 5px;
  overflow: hidden;
}
.note-card-title .title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-mark { width: 12px; height: 12px; color: var(--amber); fill: var(--amber); flex-shrink: 0; }
.note-card-actions { display: flex; gap: 1px; margin-left: auto; flex-shrink: 0; opacity: 0; transition: opacity 0.15s; }
.note-card:hover .note-card-actions { opacity: 1; }
.note-card-actions .icon-btn { padding: 4px; }
.note-card-preview {
  font-size: 13px; color: var(--text-muted);
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  margin-bottom: 5px; word-break: break-word;
}
.note-card-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.note-card-tag {
  background: var(--chip-bg); color: var(--chip-text);
  padding: 1px 8px; border-radius: 9px; font-size: 10px; font-weight: 600;
  transition: transform 0.18s;
}
.note-card:hover .note-card-tag { transform: translateY(-1px); }
.note-list-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ---- Editor ---- */
.editor-pane { flex: 1; display: flex; flex-direction: column; background: var(--bg); min-width: 0; transition: background 0.35s ease; }

.editor-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: var(--text-muted);
}
.editor-empty-icon {
  width: 92px; height: 92px; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 28px; background: var(--accent-soft); color: var(--accent);
  animation: float 4s ease-in-out infinite;
}
.editor-empty-icon .icon { width: 42px; height: 42px; stroke-width: 1.6; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-10px) rotate(-4deg); }
}

.editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.editor-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px 0;
}
#note-notebook {
  border: 1.5px solid transparent; background: none; color: var(--text-muted);
  font-size: 13px; padding: 4px 8px; border-radius: 9px; cursor: pointer; max-width: 220px;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}
#note-notebook:hover { border-color: var(--border); background: var(--bg-input); color: var(--text); }
.editor-meta-right { display: flex; align-items: center; gap: 2px; }
.note-date { color: var(--text-muted); font-size: 12px; margin-right: 8px; }

#note-title {
  border: none; background: none; color: var(--text);
  font-size: 27px; font-weight: 800; letter-spacing: -0.02em;
  padding: 8px 22px 4px; outline: none; width: 100%;
}
#note-title::placeholder { color: var(--text-muted); opacity: 0.55; }

.tag-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 2px 22px 10px; }
.note-tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--chip-bg); color: var(--chip-text);
  padding: 3px 11px; border-radius: 13px; font-size: 12px; font-weight: 600;
  animation: chip-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: transform 0.18s, box-shadow 0.18s;
}
.tag-chip:hover { transform: translateY(-2px); box-shadow: 0 4px 10px var(--shadow); }
@keyframes chip-in {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}
.tag-chip button {
  background: none; border: none; color: var(--chip-text);
  cursor: pointer; font-size: 13px; padding: 0; line-height: 1;
  transition: transform 0.15s;
}
.tag-chip button:hover { transform: scale(1.35); }
#tag-input {
  border: none; background: none; color: var(--text);
  font-size: 12px; outline: none; width: 90px; padding: 3px 0;
}
#tag-input::placeholder { color: var(--text-muted); }

.toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
  padding: 6px 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.toolbar button {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text);
  min-width: 31px; height: 29px; padding: 0 8px;
  border-radius: 8px; cursor: pointer; font-size: 13px;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.toolbar button .icon { width: 15px; height: 15px; }
.toolbar button:hover {
  background: var(--accent-soft); color: var(--accent);
  transform: translateY(-2px);
}
.toolbar button:active { transform: scale(0.9); }
.toolbar-sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; }

.note-content {
  flex: 1; overflow-y: auto; outline: none;
  padding: 16px 22px 60px; font-size: 15px; line-height: 1.65;
}
.note-content:empty::before { content: 'Start writing...'; color: var(--text-muted); opacity: 0.55; }
.note-content h1 { font-size: 24px; margin: 14px 0 6px; letter-spacing: -0.015em; }
.note-content h2 { font-size: 19px; margin: 12px 0 5px; }
.note-content p { margin: 4px 0; }
.note-content ul, .note-content ol { margin: 6px 0; padding-left: 26px; }
.note-content blockquote {
  border-left: 3px solid; border-image: var(--grad) 1;
  margin: 8px 0; padding: 4px 14px; color: var(--text-muted);
}
.note-content pre {
  background: var(--bg-list); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; margin: 8px 0; font-family: Consolas, Monaco, monospace;
  font-size: 13px; white-space: pre-wrap; word-break: break-word;
}
.note-content a { color: var(--accent); }
.note-content img { max-width: 100%; border-radius: 8px; }
.note-content input[type="checkbox"] { margin-right: 6px; accent-color: var(--accent); }

.editor-status {
  padding: 4px 22px 8px; font-size: 11px; color: var(--text-muted);
  min-height: 22px;
}

/* ---- Editor date field ---- */
.editor-meta-left { display: flex; align-items: center; gap: 4px; }
#note-date-input {
  border: 1.5px solid transparent; background: none; color: var(--text-muted);
  font-size: 12px; font-family: var(--font-body);
  padding: 3px 8px; border-radius: 9px; cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}
#note-date-input:hover { border-color: var(--border); background: var(--bg-input); color: var(--text); }
#note-date-input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.6; }
.note-card-date {
  display: inline-flex; align-items: center; gap: 3px;
  color: var(--teal); font-weight: 600;
}
.note-card-date .icon { width: 11px; height: 11px; }

/* ---- Quick templates modal ---- */
.template-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; }
.template-backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 10, 40, 0.45);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease;
}
.template-card {
  position: relative;
  background: var(--bg); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: 0 24px 70px var(--shadow);
  padding: 26px 26px 22px; width: min(680px, 92vw); max-height: 86vh; overflow-y: auto;
  animation: card-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.template-header { margin-bottom: 18px; }
.template-header h2 { font-size: 21px; letter-spacing: -0.01em; }
.template-header p { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.template-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
}
.template-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  background: var(--bg-list); border: 1.5px solid var(--border); border-radius: 14px;
  padding: 14px; cursor: pointer; text-align: left;
  color: var(--text); font-family: var(--font-body);
  animation: chip-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background 0.18s;
}
.template-tile:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 10px 22px var(--shadow);
}
.template-tile:hover .template-icon { transform: rotate(-8deg) scale(1.12); }
.template-icon {
  width: 34px; height: 34px; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: var(--grad); color: #fff;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.template-icon .icon { width: 17px; height: 17px; }
.template-tile:nth-child(5n+2) .template-icon { background: linear-gradient(135deg, var(--pink), var(--amber)); }
.template-tile:nth-child(5n+3) .template-icon { background: linear-gradient(135deg, var(--teal), var(--sky)); }
.template-tile:nth-child(5n+4) .template-icon { background: linear-gradient(135deg, var(--amber), var(--pink)); }
.template-tile:nth-child(5n) .template-icon { background: linear-gradient(135deg, var(--sky), var(--violet)); }
.template-name { font-size: 14px; font-weight: 700; }
.template-desc { font-size: 11.5px; color: var(--text-muted); }

/* ---- Calendar ---- */
.calendar-pane {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  background: var(--bg); padding: 18px 22px 22px;
  transition: background 0.35s ease;
}
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.calendar-header h2 { font-size: 22px; letter-spacing: -0.015em; }
.calendar-nav { display: flex; gap: 5px; }
.cal-nav-btn {
  min-width: 32px; height: 32px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--bg-input); color: var(--text); font-size: 15px; cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s, transform 0.18s;
}
.cal-nav-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.cal-today-btn { font-size: 12.5px; font-weight: 700; }
.calendar-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
  margin-bottom: 6px;
}
.calendar-weekdays div {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); text-align: center;
}
.calendar-grid {
  flex: 1; display: grid; grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(92px, 1fr); gap: 6px; min-height: 0; overflow-y: auto;
}
.cal-day {
  border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--bg-list); padding: 6px 7px;
  display: flex; flex-direction: column; gap: 4px; overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s, background 0.18s;
}
.cal-day:not(.empty):hover {
  border-color: var(--accent); transform: translateY(-2px);
  box-shadow: 0 8px 18px var(--shadow);
}
.cal-day.empty { border-color: transparent; background: none; }
.cal-day.today { border-color: var(--accent); background: var(--accent-soft); }
.cal-day-top { display: flex; align-items: center; justify-content: space-between; }
.cal-day-num { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.cal-day.today .cal-day-num {
  color: #fff; background: var(--grad);
  width: 21px; height: 21px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.cal-add {
  width: 20px; height: 20px; border: none; border-radius: 7px;
  background: none; color: var(--text-muted); font-size: 15px; line-height: 1;
  cursor: pointer; opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s, transform 0.15s;
}
.cal-day:hover .cal-add { opacity: 1; }
.cal-add:hover { background: var(--accent); color: #fff; transform: scale(1.15); }
.cal-chips { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-chip {
  border: none; border-radius: 7px; padding: 2px 7px;
  font-size: 11px; font-weight: 600; font-family: var(--font-body);
  text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.cal-chip:hover { transform: translateX(3px); box-shadow: 0 3px 8px var(--shadow); filter: brightness(1.06); }
.cal-chip.c0 { background: var(--chip-bg); color: var(--chip-text); }
.cal-chip.c1 { background: rgba(236, 72, 153, 0.14); color: var(--pink); }
.cal-chip.c2 { background: rgba(245, 158, 11, 0.16); color: var(--amber); }
.cal-chip.c3 { background: rgba(20, 184, 166, 0.14); color: var(--teal); }
.cal-chip.c4 { background: rgba(14, 165, 233, 0.14); color: var(--sky); }
body.dark .cal-chip.c1 { color: #f9a8d4; }
body.dark .cal-chip.c2 { color: #fcd34d; }
body.dark .cal-chip.c3 { color: #5eead4; }
body.dark .cal-chip.c4 { color: #7dd3fc; }

/* ---- Scrollbars ---- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Responsive ---- */
.menu-btn, .back-btn { display: none; }
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 65;
  background: rgba(15, 8, 30, 0.45); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

@media (max-width: 900px) and (min-width: 681px) {
  .sidebar { width: 196px; min-width: 196px; }
  .note-list-pane { width: 254px; min-width: 220px; }
}

@media (max-width: 680px) {
  /* Sidebar becomes a slide-in drawer */
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 70;
    width: min(300px, 84vw); min-width: 0;
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 12px 0 40px var(--shadow);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.open { transform: none; }

  /* Note list fills the screen */
  .note-list-pane { width: 100%; min-width: 0; flex: 1; border-right: none; }
  .note-list-header { display: flex; align-items: center; gap: 6px; }
  .note-list-header .search-wrap { flex: 1; }
  .menu-btn { display: inline-flex; }

  /* Editor slides in over the list */
  .editor-pane {
    position: fixed; inset: 0; z-index: 50;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .editor-pane.mobile-open { transform: none; }
  .back-btn { display: inline-flex; }
  .note-date { display: none; }
  #note-title { font-size: 22px; padding: 6px 16px 4px; }
  .tag-row { padding: 2px 16px 8px; }
  .note-content { padding: 12px 16px 80px; font-size: 16px; }

  /* Bigger touch targets */
  .icon-btn { padding: 9px; }
  .nav-actions, .note-card-actions { opacity: 1; }
  .nav-actions .icon-btn, .note-card-actions .icon-btn { padding: 7px; }
  .toolbar { padding: 4px 8px; overflow-x: auto; flex-wrap: nowrap; }
  .toolbar button { min-width: 38px; height: 36px; flex-shrink: 0; }
  .nav-item { padding: 11px 12px; }
  .note-card { padding: 14px; }
  .cal-nav-btn { min-width: 38px; height: 38px; }

  /* Calendar squeezes down */
  .calendar-pane { padding: 12px 10px calc(12px + env(safe-area-inset-bottom)); }
  .calendar-header h2 { font-size: 17px; flex: 1; }
  .calendar-grid { grid-auto-rows: minmax(72px, 1fr); gap: 4px; }
  .cal-day { padding: 4px 5px; border-radius: 9px; }
  .cal-chip { font-size: 9.5px; padding: 1px 5px; }
  .cal-add { opacity: 1; }

  /* Template modal fits phones */
  .template-card { padding: 18px 16px 16px; width: 94vw; max-height: 82vh; }
  .template-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }

  .login-card { width: min(350px, 92vw); padding: 34px 26px 22px; }
}

/* ═══════════ Boards — Freeform canvas (V2.0) ═══════════ */

.board-pane { flex: 1; display: flex; flex-direction: column; background: var(--bg); min-width: 0; }
.orders-pane { flex: 1; display: flex; flex-direction: column; background: var(--bg); min-width: 0; overflow: hidden; }

.board-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
}
.board-header h2 { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-save-status { font-size: 11.5px; color: var(--text-muted); flex: 1; min-width: 0; }
.board-header-actions { display: flex; gap: 4px; }

/* grid-paper background; size/position driven by the camera in board.js */
.board-viewport {
  position: relative; flex: 1; overflow: hidden; touch-action: none;
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, var(--grid-major) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-major) 1px, transparent 1px),
    linear-gradient(to right, var(--grid-fine) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-fine) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
}
.board-viewport.grabbing { cursor: grabbing; }
.board-viewport.pen-mode { cursor: crosshair; }

.board-world { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.board-nodes { position: absolute; top: 0; left: 0; }

.board-svg { position: absolute; top: 0; left: 0; width: 10px; height: 10px; overflow: visible; pointer-events: none; }
.board-svg .e-hit, .board-svg .i-hit { fill: none; stroke: transparent; stroke-width: 18; pointer-events: stroke; cursor: pointer; }
.board-svg .e-line { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.board-svg .i-line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.board-svg g.b-edge.selected .e-line { stroke-width: 4.5; }
.board-svg g.b-ink.selected .i-line { filter: drop-shadow(0 0 4px var(--glow)); stroke-width: 5; }
.edge-temp { fill: none; stroke-width: 2.5; stroke-dasharray: 6 6; pointer-events: none; }
.ink-temp { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }

/* ── Nodes ── */
.b-node { position: absolute; user-select: none; -webkit-user-select: none; cursor: grab; }
.b-node:active { cursor: grabbing; }
.b-node.selected { z-index: 5; }
.b-node.pop { animation: bubble-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes bubble-pop {
  0% { transform: scale(0.5); opacity: 0; }
  65% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

.b-bubble {
  width: max-content; min-width: 84px; max-width: 260px;
  padding: 12px 16px; border-radius: 18px; border: 1.6px solid;
  text-align: center; font-size: 15px; font-weight: 500; line-height: 1.4;
  color: var(--text); box-shadow: 0 4px 14px var(--shadow);
  transition: box-shadow 0.15s ease;
}
.b-bubble:hover { box-shadow: 0 6px 20px var(--shadow); }
.b-bubble .b-text { white-space: pre-wrap; word-break: break-word; min-height: 21px; outline: none; }
.b-bubble .b-text:empty::before { content: '···'; color: var(--text-muted); }
.b-bubble .b-text[contenteditable="true"], .b-bubble .b-text[contenteditable="plaintext-only"] {
  cursor: text; user-select: text; -webkit-user-select: text;
}

.b-bubble.c0 { background: #d1fae5; border-color: #10b981; }
.b-bubble.c1 { background: #fce7f3; border-color: #ec4899; }
.b-bubble.c2 { background: #fef3c7; border-color: #f59e0b; }
.b-bubble.c3 { background: #ccfbf1; border-color: #14b8a6; }
.b-bubble.c4 { background: #e0f2fe; border-color: #0ea5e9; }
body.dark .b-bubble.c0 { background: #123a2c; border-color: #34d399; }
body.dark .b-bubble.c1 { background: #3d2237; border-color: #f9a8d4; }
body.dark .b-bubble.c2 { background: #3d3117; border-color: #fcd34d; }
body.dark .b-bubble.c3 { background: #173733; border-color: #5eead4; }
body.dark .b-bubble.c4 { background: #16303f; border-color: #7dd3fc; }

.b-node.selected { box-shadow: 0 0 0 2.5px var(--accent), 0 6px 20px var(--shadow); }
.b-node.connect-target { box-shadow: 0 0 0 3px var(--accent), 0 0 18px var(--glow); }

.b-image { border-radius: 12px; box-shadow: 0 6px 18px var(--shadow); background: var(--bg-input); }
.b-image img { display: block; width: 100%; height: 100%; border-radius: 12px; pointer-events: none; }
.b-resize {
  position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--accent); border: 2.5px solid var(--bg);
  cursor: nwse-resize; opacity: 0; transition: opacity 0.15s; z-index: 3;
}
.b-node:hover .b-resize, .b-node.selected .b-resize { opacity: 1; }

/* connect handles */
.b-handle {
  position: absolute; width: 13px; height: 13px; border-radius: 50%;
  background: var(--bg-input); border: 2px solid var(--accent);
  opacity: 0; transition: opacity 0.15s, transform 0.12s; cursor: crosshair; z-index: 2;
}
.b-handle:hover { transform: scale(1.35); background: var(--accent); }
.h-n { top: -8px; left: 50%; margin-left: -7px; }
.h-s { bottom: -8px; left: 50%; margin-left: -7px; }
.h-e { right: -8px; top: 50%; margin-top: -7px; }
.h-w { left: -8px; top: 50%; margin-top: -7px; }
.b-node:hover .b-handle, .b-node.selected .b-handle { opacity: 1; }

/* connector labels */
.b-edge-label {
  position: absolute; transform: translate(-50%, -50%);
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 11px; font-size: 12px; font-weight: 600; color: var(--text);
  box-shadow: 0 2px 8px var(--shadow); cursor: pointer; white-space: nowrap;
  user-select: none; -webkit-user-select: none; z-index: 4;
}
.b-edge-label.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.edge-label-input {
  position: absolute; transform: translate(-50%, -50%); z-index: 30; width: 150px;
  border: 1.5px solid var(--accent); border-radius: 999px; padding: 6px 12px;
  font-size: 12.5px; font-family: var(--font-body); text-align: center;
  background: var(--bg-input); color: var(--text); outline: none;
  box-shadow: 0 4px 14px var(--shadow);
}

/* ── Floating toolbar ── */
.board-toolbar {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 3px; padding: 7px 10px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: 0 10px 30px var(--shadow); z-index: 20; max-width: calc(100% - 24px);
}
.tool-btn {
  width: 38px; height: 38px; border: none; border-radius: 50%; background: transparent;
  color: var(--text-muted); cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s ease;
}
.tool-btn .icon { width: 17px; height: 17px; }
.tool-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--accent); transform: translateY(-1px); }
.tool-btn.active { background: var(--accent); color: #fff; }
.tool-btn:disabled { opacity: 0.3; cursor: default; }
.tool-btn.danger:hover:not(:disabled) { background: rgba(229, 72, 77, 0.12); color: var(--danger); }
.board-toolbar-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; flex-shrink: 0; }

.board-colors { display: flex; gap: 6px; padding: 0 2px; }
.board-swatch {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; transition: transform 0.12s ease; flex-shrink: 0;
}
.board-swatch:hover { transform: scale(1.2); }
.board-swatch.active { border-color: var(--text); transform: scale(1.12); }
.sw0 { background: #10b981; } .sw1 { background: #ec4899; } .sw2 { background: #f59e0b; }
.sw3 { background: #14b8a6; } .sw4 { background: #0ea5e9; }
body.dark .sw0 { background: #34d399; } body.dark .sw1 { background: #f9a8d4; }
body.dark .sw2 { background: #fcd34d; } body.dark .sw3 { background: #5eead4; }
body.dark .sw4 { background: #7dd3fc; }

.board-zoom {
  position: absolute; right: 16px; bottom: 20px; display: flex; align-items: center; gap: 2px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 6px; box-shadow: 0 6px 20px var(--shadow); z-index: 20;
}
.board-zoom button {
  border: none; background: transparent; width: 26px; height: 26px; font-size: 16px;
  color: var(--text-muted); cursor: pointer; border-radius: 50%;
}
.board-zoom button:hover { background: var(--bg-hover); color: var(--accent); }
#zoom-label { font-size: 11.5px; color: var(--text-muted); min-width: 42px; text-align: center; }

/* ── Mobile ── */
@media (max-width: 680px) {
  .board-header { padding: 10px 12px; gap: 8px; }
  .board-header h2 { font-size: 15px; }
  .board-header-actions .icon-btn { width: 34px; height: 34px; }
  .board-toolbar { bottom: 12px; padding: 6px 8px; overflow-x: auto; scrollbar-width: none; }
  .board-toolbar::-webkit-scrollbar { display: none; }
  .tool-btn { width: 42px; height: 42px; }
  .board-swatch { width: 24px; height: 24px; }
  .board-zoom { display: none; } /* pinch to zoom instead */
  .b-handle { width: 17px; height: 17px; }
  .h-n { top: -10px; margin-left: -9px; } .h-s { bottom: -10px; margin-left: -9px; }
  .h-e { right: -10px; margin-top: -9px; } .h-w { left: -10px; margin-top: -9px; }
  .b-resize { width: 20px; height: 20px; right: -10px; bottom: -10px; }
}

/* ═══════════ CraigBoard (task queue) ═══════════ */

.tasks-pane { flex: 1; display: flex; flex-direction: column; background: var(--bg); min-width: 0; overflow-y: auto; padding: 20px 26px 40px; }
.tasks-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.tasks-header h2 { font-size: 20px; font-weight: 700; }
.tasks-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #08130d; border: none; border-radius: 8px;
  padding: 9px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: opacity 0.15s ease;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.55; cursor: default; }

.tasks-add-form {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 18px;
  background: var(--bg-list); border: 1px solid var(--border); border-radius: 10px;
}
.tasks-add-form input[type="text"] {
  flex: 1; min-width: 180px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 7px; padding: 8px 10px; font-size: 13.5px; color: var(--text);
}
.tasks-checkbox { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.tasks-add-form .btn-primary { padding: 8px 10px; }

.tasks-list { display: flex; flex-direction: column; gap: 8px; }
.tasks-list-done { margin-top: 8px; opacity: 0.75; }

.task-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; background: var(--bg-list); border: 1px solid var(--border); border-radius: 9px;
}
.task-item.task-done { opacity: 0.6; }
.task-check { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px; flex-shrink: 0; }
.task-item:not(.task-done) .task-check { color: var(--accent); }
.task-body { flex: 1; min-width: 0; }
.task-text { font-size: 14px; line-height: 1.4; word-break: break-word; }
.task-item.task-done .task-text { text-decoration: line-through; }
.task-flags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.task-flag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); background: var(--bg-hover); border-radius: 5px; padding: 2px 6px; }
.task-flag-star { color: var(--accent); }
.task-flag-dispatch { color: var(--red, #e05555); }
.task-flag-time { font-size: 11px; color: var(--text-muted); }
.task-actions { display: flex; gap: 4px; flex-shrink: 0; }

.tasks-done-details summary { cursor: pointer; font-size: 12.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 8px; }

/* Jimothy -> agent lanes. Each lane carries its own hue on the glyph and rail;
   status colours stay shared so Done means the same green everywhere. */
.lanes { margin-top: 30px; display: flex; flex-direction: column; gap: 26px; }
.lane { --hue: var(--accent); padding-top: 22px; border-top: 1px solid var(--border); }
.lane-codex { --hue: #3d86c6; }
.lane-hermes { --hue: #8b6fd6; }
body.dark .lane-codex { --hue: #6aa9e0; }
body.dark .lane-hermes { --hue: #a891ea; }
.lane-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.lane-glyph {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  color: var(--hue);
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--hue) 26%, transparent), color-mix(in srgb, var(--hue) 9%, transparent) 70%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue) 28%, transparent), 0 6px 16px -10px var(--hue);
}
.lane-glyph .icon { width: 18px; height: 18px; }
.lane-titles { flex: 1; min-width: 0; }
.lane-head h3 { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; }
.lane-head .tasks-sub { margin-top: 2px; }
.lane-arrow { width: 15px; height: 15px; color: var(--text-muted); }
.lane-count {
  flex-shrink: 0; margin-top: 3px; font-size: 11.5px; font-weight: 600; color: var(--hue);
  background: color-mix(in srgb, var(--hue) 11%, transparent); border-radius: 999px; padding: 3px 9px;
}
.lane-list .lane-item { box-shadow: inset 2px 0 0 color-mix(in srgb, var(--hue) 55%, transparent); }
.lane-list .lane-item:focus-within { border-color: color-mix(in srgb, var(--hue) 50%, var(--border)); }
.lane-chip {
  font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--bg-hover);
  border-radius: 5px; padding: 2px 7px; white-space: nowrap;
}
.lane-chip-ok { color: var(--hue); background: color-mix(in srgb, var(--hue) 12%, transparent); }
.lane-chip-warn { color: #c9821f; background: color-mix(in srgb, #e0a03a 15%, transparent); }
.lane-item.lane-cancelled { --lane: var(--text-muted); }
.lane-item.lane-scheduled { --lane: var(--hue); }
.lane-scheduled .lane-dot { animation: lane-pulse 3.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .lane-scheduled .lane-dot { animation: none; } }

/* Recurring chore: cron, next run and the last firings as a strip of dots. */
.chore {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px;
  font-size: 12px; color: var(--text-muted);
}
.chore-cron {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 11.5px;
  color: var(--text); background: color-mix(in srgb, var(--hue) 9%, var(--bg-hover)); border-radius: 5px; padding: 2px 7px;
}
.chore-runs { display: inline-flex; align-items: center; gap: 4px; }
.chore-run {
  --run: var(--text-muted); width: 9px; height: 9px; border-radius: 3px; background: var(--run);
  transition: transform 0.15s ease;
}
.chore-run:hover { transform: scale(1.35); }
.chore-run-done { --run: var(--green); }
.chore-run-failed { --run: var(--red, #e05555); }
.chore-run-rejected { --run: #e0a03a; }
.chore-run-cancelled { --run: var(--text-muted); opacity: 0.6; }
.chore-run-unverified { box-shadow: 0 0 0 1.5px #e0a03a; }
.lane-item { --lane: var(--text-muted); position: relative; transition: border-color 0.2s ease, transform 0.2s ease; }
.lane-item:hover { border-color: color-mix(in srgb, var(--lane) 45%, var(--border)); }
.lane-pending { --lane: var(--text-muted); }
.lane-running { --lane: var(--accent); }
.lane-done, .lane-shipped { --lane: var(--green); }
.lane-failed { --lane: var(--red, #e05555); }
.lane-rejected { --lane: #e0a03a; }
.lane-dot {
  width: 8px; height: 8px; margin: 7px 3px 0; flex-shrink: 0; border-radius: 50%;
  background: var(--lane); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lane) 16%, transparent);
}
.lane-running .lane-dot { animation: lane-pulse 1.6s ease-in-out infinite; }
@keyframes lane-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--lane) 22%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--lane) 4%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .lane-running .lane-dot { animation: none; } }
.lane-status { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--lane); background: color-mix(in srgb, var(--lane) 12%, transparent); border-radius: 5px; padding: 2px 6px; }
.lane-summary { margin-top: 5px; font-size: 13px; line-height: 1.5; color: var(--text-muted); word-break: break-word; }
.lane-needs { color: var(--text); }
.lane-link { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--accent); text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-link:hover { text-decoration: underline; }
.lane-link .icon { width: 12px; height: 12px; flex-shrink: 0; }

@media (max-width: 680px) {
  .tasks-pane { padding: 16px 14px 32px; }
  .lane-head { gap: 10px; }
  .lane-glyph { width: 30px; height: 30px; border-radius: 9px; }
  .lane-count { display: none; }
  .tasks-header { flex-direction: column; align-items: stretch; }
}
