/* ════════════════════════════════
   CLOCK
═══════════════════════════════ */
.clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  line-height: 1;
}

.clock__time {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.clock__colon {
  opacity: .4;
  animation: blink 1s step-end infinite;
}

.clock__sec {
  font-size: .5em;
  opacity: .3;
  font-weight: 400;
  vertical-align: baseline;
  letter-spacing: 0;
  margin-left: 3px;
}

.clock__date {
  font-size: .72rem;
  color: var(--text-muted);
  letter-spacing: .04em;
}

@keyframes blink {
  0%, 100% { opacity: .4; }
  50%       { opacity: .1; }
}

/* ════════════════════════════════
   SCRATCHPAD
═══════════════════════════════ */
.scratchpad { overflow: visible; }

.scratchpad__counter {
  font-size: .75rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 1px 8px;
}

.scratchpad__body {
  overflow: hidden;
  max-height: 600px;
  transition: max-height var(--t-slow);
}

.scratchpad:not(.scratchpad--open) .scratchpad__body {
  max-height: 0;
}

.scratchpad__textarea {
  width: 100%;
  min-height: 140px;
  background: none;
  border: none;
  outline: none;
  resize: vertical;
  color: var(--text);
  font-size: .9rem;
  line-height: 1.7;
  padding: 16px 20px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.scratchpad__textarea::placeholder { color: var(--text-dim); }

/* ════════════════════════════════
   BACKGROUND MODAL
═══════════════════════════════ */
.modal--wide { max-width: 560px; }

.bg-presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}

.bg-preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 6px;
  cursor: pointer;
  transition: border-color var(--t-fast);
}

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

.bg-preset--active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.bg-preset__swatch {
  width: 100%;
  height: 36px;
  border-radius: 4px;
  display: block;
  border: 1px solid rgba(255,255,255,.08);
}

.bg-preset__label {
  font-size: .72rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.bg-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bg-color-input {
  width: 48px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  padding: 2px;
  background: var(--surface-2);
}

/* ════════════════════════════════
   FOOTER / DATA IO
═══════════════════════════════ */
.footer {
  display: flex;
  gap: 10px;
  width: 100%;
  height: 42px;
}

.btn-data {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 5px 10px;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}

.theme-wrap,
.accent-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.theme-wrap .btn-data--theme,
.accent-wrap .btn-data--accent {
  flex: 1;
  width: 100%;
}

.btn-data:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Theme switcher ── */
.theme-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.btn-data--theme {
  gap: 5px;
}

.theme-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 130px;
  z-index: 50;
}

.theme-dropdown[hidden] { display: none; }

.theme-option {
  display: flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: .88rem;
  font-weight: 500;
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--t-fast);
  text-align: left;
  width: 100%;
}

.theme-option:hover { background: var(--surface-2); }

.theme-option--active {
  background: var(--surface-3);
  color: var(--accent);
  font-weight: 600;
}

.theme-option__icon {
  font-size: .85rem;
  width: 16px;
  text-align: center;
}

/* ════════════════════════════════
   GREETING
═══════════════════════════════ */
.greeting {
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -.02em;
}

/* ════════════════════════════════
   SEARCH
═══════════════════════════════ */
.hero {
  position: relative; /* for dropdown positioning */
}

.search-form {
  width: 100%;
  max-width: 580px;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
  transition: border-color var(--t-normal), box-shadow var(--t-normal);
}

.search-form:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Engine toggle button (left side of search bar) */
.search-engine-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  padding: 0 12px;
  height: 100%;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--t-fast);
  flex-shrink: 0;
}

.search-engine-btn:hover { background: var(--surface-2); }

.search-engine-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: block;
}

.search-engine-chevron {
  font-size: .6rem;
  color: var(--text-muted);
}

/* Dropdown */
.engine-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  z-index: 50;
}

.engine-dropdown[hidden] { display: none; }

.engine-option {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: .88rem;
  padding: 9px 12px;
  cursor: pointer;
  transition: background var(--t-fast);
  text-align: left;
}

.engine-option img {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

.engine-option:hover { background: var(--surface-2); }

.engine-option--active {
  background: var(--surface-3);
  color: var(--accent);
}

.search-form__input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: .97rem;
  padding: 13px 10px;
}

.search-form__input::placeholder { color: var(--text-dim); }

.search-form__btn {
  background: var(--accent);
  border: none;
  padding: 10px 20px;
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .03em;
  transition: background var(--t-fast);
  margin: 4px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

.search-form__btn:hover { background: var(--accent-hover); }

/* ════════════════════════════════
   ICON BUTTON
═══════════════════════════════ */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: .95rem;
  transition: all var(--t-fast);
  flex-shrink: 0;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ════════════════════════════════
   TODO
═══════════════════════════════ */
.todo-counter {
  font-size: .78rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
}

.todo-input-row {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.todo-input-row input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 9px 13px;
  font-size: .88rem;
  outline: none;
  transition: border-color var(--t-normal);
}

.todo-input-row input:focus { border-color: var(--border-focus); }
.todo-input-row input::placeholder { color: var(--text-dim); }

.todo-input-row .btn-add {
  background: var(--accent);
  border: none;
  border-radius: var(--r-sm);
  color: #fff;
  padding: 9px 14px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  transition: background var(--t-fast);
}

.todo-input-row .btn-add:hover { background: var(--accent-hover); }

/* List */
.todo-list { flex: 1; }

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}

.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: var(--surface-2); }

.todo-item__check {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.todo-item__text {
  flex: 1;
  font-size: .88rem;
  word-break: break-word;
  line-height: 1.4;
}

.todo-item--done .todo-item__text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-item__del {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: .85rem;
  padding: 3px 5px;
  border-radius: var(--r-sm);
  opacity: 0;
  transition: color var(--t-fast), opacity var(--t-fast);
}

.todo-item:hover .todo-item__del { opacity: 1; }
.todo-item__del:hover { color: var(--danger); }

.todo-item__edit {
  flex: 1;
  background: var(--surface-3);
  border: 1.5px solid var(--accent);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: .88rem;
  padding: 3px 8px;
  outline: none;
  font-family: var(--font);
}

.todo-item--editing .todo-item__del { opacity: 0; pointer-events: none; }

.todo-item__text { cursor: default; }
.todo-item:not(.todo-item--done) .todo-item__text { cursor: text; }

/* ════════════════════════════════
   BOOKMARKS TOOLBAR
═══════════════════════════════ */
.bookmarks-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.select {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 8px 10px;
  font-size: .85rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--t-normal);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2368687a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.select:focus { border-color: var(--border-focus); }

/* ════════════════════════════════
   CATEGORY BLOCK
═══════════════════════════════ */
.category-block {
  border-bottom: 1px solid var(--border);
}

.category-block:last-child { border-bottom: none; }

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  cursor: pointer;
  user-select: none;
  transition: background var(--t-fast);
}

.category-header:hover { background: var(--surface-2); }

.category-chevron {
  color: var(--text-dim);
  font-size: .65rem;
  transition: transform var(--t-normal);
  flex-shrink: 0;
}

.category-block--open .category-chevron {
  transform: rotate(90deg);
}

.category-name {
  flex: 1;
  font-size: .92rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.category-count {
  font-size: .72rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 1px 7px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
}

.category-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.category-header:hover .category-actions { opacity: 1; }

.btn-cat {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .88rem;
  padding: 3px 5px;
  border-radius: var(--r-sm);
  transition: color var(--t-fast);
}

.btn-cat:hover { color: var(--accent); }
.btn-cat--danger:hover { color: var(--danger); }

/* ════════════════════════════════
   BOOKMARKS GRID
═══════════════════════════════ */
.bookmarks-grid {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  padding: 14px 16px;
}

.category-block--open .bookmarks-grid {
  display: grid;
}

/* Bookmark card */
.bookmark-card {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  text-decoration: none;
  color: var(--text);
}

.bookmark-card:hover {
  border-color: var(--accent);
  background: var(--surface-3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.bookmark-favicon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: contain;
}

.bookmark-label {
  font-size: .72rem;
  text-align: center;
  color: var(--text-muted);
  word-break: break-word;
  line-height: 1.3;
}

.bookmark-edit,
.bookmark-del {
  position: absolute;
  top: 5px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: .6rem;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background var(--t-fast);
}

.bookmark-edit {
  left: 5px;
  background: var(--accent);
}

.bookmark-del {
  right: 5px;
  background: var(--danger);
}

.bookmark-card:hover .bookmark-edit,
.bookmark-card:hover .bookmark-del { display: flex; }
.bookmark-edit:hover { background: var(--accent-hover); }
.bookmark-del:hover { background: var(--danger-hover); }

/* Add bookmark placeholder */
.bookmark-add-card {
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: var(--r-md);
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: .72rem;
  transition: all var(--t-fast);
}

.bookmark-add-card:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.bookmark-add-card__plus {
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 300;
}

/* ════════════════════════════════
   EMPTY STATE
═══════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: .85rem;
  text-align: center;
}

.empty-state__icon { font-size: 2rem; opacity: .5; }

/* ════════════════════════════════
   QUICK LINKS
═══════════════════════════════ */
.quick-links-wrap { width: 100%; }

.quick-links-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  width: 100%;
}

.ql-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 8px 10px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  position: relative;
  transition: border-color var(--t-fast), transform var(--t-fast), background var(--t-fast);
}

.ql-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-2px);
}

.ql-card--ghost { opacity: .3; }

.ql-card--dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.ql-card__icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: contain;
}

.ql-card__icon--empty { font-size: 1.2rem; }

.ql-card__label {
  font-size: .68rem;
  color: var(--text-muted);
  text-align: center;
  word-break: break-word;
  line-height: 1.3;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ql-card__edit,
.ql-card__del {
  position: absolute;
  top: 4px;
  width: 16px; height: 16px;
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: .55rem;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ql-card__edit { left: 4px; background: var(--accent); }
.ql-card__del  { right: 4px; background: var(--danger); }

.ql-card:hover .ql-card__edit,
.ql-card:hover .ql-card__del { display: flex; }
.ql-card__edit:hover { background: var(--accent-hover); }

.ql-card--add {
  background: transparent;
  border-style: dashed;
  color: var(--text-dim);
  font-size: .72rem;
}

.ql-card--add:hover { border-color: var(--accent); color: var(--accent); }

.ql-card__plus {
  font-size: 1.4rem;
  line-height: 1;
  font-weight: 300;
}

/* ════════════════════════════════
   DRAG & DROP
═══════════════════════════════ */
.drag-handle {
  color: var(--text-dim);
  cursor: grab;
  font-size: 1rem;
  padding: 0 4px;
  flex-shrink: 0;
  user-select: none;
  transition: color var(--t-fast);
}

.drag-handle:hover { color: var(--text-muted); }
.drag-handle:active { cursor: grabbing; }

.drag--ghost { opacity: .3; }

.drag--over {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ════════════════════════════════
   DENSITY OVERRIDES
═══════════════════════════════ */
[data-density="compact"] {
  --panel-header-pad: 10px 16px;
  --item-pad:         7px 14px;
  --input-row-pad:    10px 12px;
  --grid-gap:         6px;
  --grid-min:         100px;
  --page-gap:         20px;
  --hero-gap:         12px;
}


/* Wire up vars */
.panel__header         { padding: var(--panel-header-pad, 16px 20px); }
.todo-item             { padding: var(--item-pad, 11px 16px); }
.todo-input-row        { padding: var(--input-row-pad, 14px 16px); }
.bookmarks-grid        { gap: var(--grid-gap, 10px); }
.bookmarks-grid        { grid-template-columns: repeat(auto-fill, minmax(var(--grid-min, 120px), 1fr)); }
.page                  { gap: var(--page-gap, 32px); }
.hero                  { gap: var(--hero-gap, 20px); }

/* ════════════════════════════════
   ACCENT PICKER
═══════════════════════════════ */
.accent-wrap { position: relative; flex: 1; }

.accent-btn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.2);
}

.accent-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 50;
  min-width: 200px;
}

.accent-dropdown[hidden] { display: none; }

.accent-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.accent-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--t-fast), border-color var(--t-fast);
  outline: none;
}

.accent-swatch:hover { transform: scale(1.2); }

.accent-swatch--active {
  border-color: var(--text);
  transform: scale(1.15);
}

.accent-custom {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
