:root {
  --bg: #0d0d0f;
  --surface: #16161a;
  --surface2: #1e1e24;
  --border: #2a2a33;
  --accent: #c8f05a;
  --accent2: #5af0c8;
  --accent3: #f05ac8;
  --text: #f0ede8;
  --muted: #7a7a8a;
  --danger: #f05a5a;
  --warn: #f0b45a;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  min-height: 100vh;
}

/* ── CONTAINER ─────────────────────────────────────────── */
/* Extension: fixed 420px width, popup height */
/* Web: full page, centered, max 780px */
.container {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

/* When loaded as extension popup, cap width */
@media (max-width: 440px) {
  body {
    width: 420px;
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
  }
  .container {
    max-width: 420px;
    padding: 0 16px;
  }
}

/* ── HEADER ─────────────────────────────────────────────── */
header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 32px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.logo-name {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}
.logo-name span { color: var(--accent); font-style: italic; }
.logo-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-stats { display: flex; gap: 20px; }
.stat { text-align: right; }
.stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.stat-label {
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── ADD SECTION ────────────────────────────────────────── */
.add-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 24px;
  transition: border-color 0.2s;
}
.add-section:focus-within { border-color: var(--accent); }

.section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ── INPUTS ─────────────────────────────────────────────── */
input[type="text"],
input[type="url"],
select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
input[type="text"]:focus,
input[type="url"]:focus,
select:focus { border-color: var(--accent); }
input::placeholder { color: var(--muted); }

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%237a7a8a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

.form-row { display: flex; gap: 10px; margin-bottom: 10px; }
.field { flex: 1; }
.field label {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── REMIND TRIGGER ─────────────────────────────────────── */
.remind-trigger {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text);
  transition: border-color 0.15s;
  user-select: none;
}
.remind-trigger:hover,
.remind-trigger.active { border-color: var(--accent); }
.remind-trigger-arrow {
  color: var(--muted);
  font-size: 16px;
  transition: transform 0.2s;
}
.remind-trigger.active .remind-trigger-arrow { transform: rotate(90deg); }

/* ── ADD BUTTON ─────────────────────────────────────────── */
.add-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #0d0d0f;
  border: none;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Segoe UI', system-ui, sans-serif;
  margin-top: 4px;
  letter-spacing: 0.01em;
}
.add-btn:hover { background: #d8ff6a; transform: translateY(-1px); }
.add-btn:active { transform: translateY(0); }

/* ── CUSTOM CATEGORY ─────────────────────────────────────── */
#custom-category-wrap {
  animation: slideIn 0.18s ease;
  margin-bottom: 10px;
}
#custom-category-wrap input { border-color: var(--accent2); }
#custom-category-wrap input:focus { border-color: var(--accent); }

/* ── FILTERS ─────────────────────────────────────────────── */
.filters { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-btn {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Segoe UI', system-ui, sans-serif;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active {
  background: var(--accent);
  color: #0d0d0f;
  border-color: var(--accent);
  font-weight: 700;
}

/* ── SECTION HEADER ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.count-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 10px;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 999px;
}
.clear-done-btn {
  font-size: 10px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: underline;
  text-underline-offset: 2px;
  display: none;
  font-family: 'Segoe UI', system-ui, sans-serif;
}
.clear-done-btn:hover { color: var(--danger); }

/* ── TAB CARDS ──────────────────────────────────────────── */
#tabs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 40px;
}

.tab-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  position: relative;
  overflow: hidden;
  animation: slideIn 0.2s ease;
  transition: border-color 0.15s, transform 0.15s;
}
.tab-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.tab-card[data-priority="high"]::before   { background: var(--danger); }
.tab-card[data-priority="medium"]::before { background: var(--warn); }
.tab-card[data-priority="low"]::before    { background: var(--accent2); }
.tab-card:hover { border-color: #3a3a45; transform: translateX(2px); }
.tab-card.done  { opacity: 0.45; }
.tab-card.done .tab-url,
.tab-card.done .tab-reason {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tab-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.tab-category {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid;
}
.cat-research { color: var(--accent2); border-color: var(--accent2); background: rgba(90,240,200,0.08); }
.cat-work     { color: #a78bfa; border-color: #a78bfa; background: rgba(167,139,250,0.08); }
.cat-buy      { color: var(--warn); border-color: var(--warn); background: rgba(240,180,90,0.08); }
.cat-read     { color: var(--accent); border-color: var(--accent); background: rgba(200,240,90,0.08); }
.cat-watch    { color: var(--accent3); border-color: var(--accent3); background: rgba(240,90,200,0.08); }
.cat-other    { color: var(--muted); border-color: var(--border); background: transparent; }

.priority-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-high   { background: var(--danger); }
.dot-medium { background: var(--warn); }
.dot-low    { background: var(--accent2); }

.tab-url {
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  display: block;
  max-width: 480px;
  cursor: pointer;
}
.tab-url:hover { text-decoration: underline; }
.tab-reason {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin: 5px 0 8px;
}
.tab-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.meta-item { font-size: 10px; color: var(--muted); }

.remind-badge { font-size: 10px; padding: 2px 7px; border-radius: 999px; }
.remind-badge.overdue { background: rgba(240,90,90,0.15); color: var(--danger); border: 1px solid rgba(240,90,90,0.3); }
.remind-badge.soon    { background: rgba(240,180,90,0.15); color: var(--warn); border: 1px solid rgba(240,180,90,0.3); }
.remind-badge.later   { background: rgba(200,240,90,0.08); color: var(--muted); border: 1px solid var(--border); }

/* ── CARD ACTIONS ───────────────────────────────────────── */
.tab-actions { display: flex; gap: 5px; align-items: flex-start; }
.icon-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover          { background: var(--border); color: var(--text); }
.icon-btn.done-btn:hover { background: rgba(200,240,90,0.15); color: var(--accent); border-color: var(--accent); }
.icon-btn.del-btn:hover  { background: rgba(240,90,90,0.15); color: var(--danger); border-color: var(--danger); }
.icon-btn.checked        { background: rgba(200,240,90,0.15); color: var(--accent); border-color: var(--accent); }

/* ── EMPTY STATE ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }
.empty-icon  { font-size: 40px; margin-bottom: 14px; opacity: 0.4; }
.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
  opacity: 0.6;
}
.empty-sub { font-size: 13px; line-height: 1.6; }

/* ── OVERLAY ─────────────────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 100;
}
.overlay.visible { display: block; }

/* ── PICKER POPUP (shared by calendar + clock) ──────────── */
.picker-popup {
  display: none;
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 310px;
  z-index: 200;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  animation: popIn 0.2s ease;
}
.picker-popup.visible { display: block; }

@keyframes popIn {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.picker-title { font-size: 13px; font-weight: 600; color: var(--text); }
.picker-close {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 15px; padding: 2px 6px;
  border-radius: 4px; transition: color 0.15s;
}
.picker-close:hover { color: var(--danger); }
.picker-back {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: 12px;
  padding: 2px 6px; border-radius: 4px;
  font-family: 'Segoe UI', system-ui, sans-serif;
  transition: background 0.15s;
}
.picker-back:hover { background: rgba(200,240,90,0.1); }

/* ── CALENDAR ───────────────────────────────────────────── */
.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 8px;
}
.cal-month-label { font-size: 13px; font-weight: 600; color: var(--text); }
.cal-nav-btn {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--muted); width: 28px; height: 28px; border-radius: 7px;
  cursor: pointer; font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.cal-nav-btn:hover { border-color: var(--accent); color: var(--accent); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 0 12px 14px;
}
.cal-day-hdr {
  text-align: center; font-size: 9px; color: var(--muted);
  font-weight: 600; padding: 3px 0; text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cal-day {
  text-align: center; font-size: 12px; padding: 7px 2px;
  border-radius: 7px; cursor: pointer; color: var(--text);
  transition: background 0.1s; line-height: 1;
}
.cal-day:hover:not(.cal-past):not(.cal-empty) { background: var(--surface2); }
.cal-day.cal-today    { color: var(--accent); font-weight: 700; }
.cal-day.cal-selected { background: var(--accent) !important; color: #0d0d0f; font-weight: 700; }
.cal-day.cal-past     { color: #333340; cursor: default; }
.cal-day.cal-empty    { cursor: default; }

/* ── CLOCK ──────────────────────────────────────────────── */
.clock-display { padding: 14px 18px 0; }
.clock-time-row {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-bottom: 12px;
}
.clock-segment { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.clock-arrow {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--muted); width: 32px; height: 22px; border-radius: 6px;
  cursor: pointer; font-size: 10px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s; user-select: none;
}
.clock-arrow:hover { border-color: var(--accent); color: var(--accent); }
.clock-num {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; width: 52px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: var(--text);
  letter-spacing: 0.02em;
}
.clock-ampm-seg { margin-left: 4px; }
.clock-ampm {
  width: 44px; height: 44px; font-size: 14px; font-weight: 700;
  color: var(--accent); border-color: var(--accent);
  background: rgba(200,240,90,0.08); cursor: pointer;
}
.clock-sep { font-size: 26px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }

.clock-face-wrap { display: flex; justify-content: center; margin-bottom: 10px; }
#clock-canvas { border-radius: 50%; cursor: pointer; }

.clock-quickrow {
  display: flex; gap: 5px; justify-content: center;
  flex-wrap: wrap; margin-bottom: 12px;
}
.clock-chip {
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); font-size: 10px; cursor: pointer;
  transition: all 0.12s; font-family: 'Segoe UI', system-ui, sans-serif;
}
.clock-chip:hover { border-color: var(--accent); color: var(--accent); }

.clock-confirm-row {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.clock-selected-label {
  font-size: 12px; font-weight: 600; text-align: center;
  padding: 7px 10px; border-radius: 7px;
  background: rgba(200,240,90,0.1);
  color: var(--accent); border: 1px solid rgba(200,240,90,0.3);
  min-height: 32px; display: flex; align-items: center; justify-content: center;
}
.clock-confirm-btn {
  width: 100%; padding: 10px;
  background: var(--accent); color: #0d0d0f;
  border: none; border-radius: 8px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: 'Segoe UI', system-ui, sans-serif;
  transition: all 0.15s;
}
.clock-confirm-btn:hover { background: #d8ff6a; }

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }