/* ─── Design tokens ──────────────────────────────────────────────────────────── */
:root {
  --bg:      #0c0c0e;
  --bg2:     #131316;
  --bg3:     #1a1a1f;
  --border:  rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text:    #e8e6e0;
  --muted:   #7a7875;
  --accent:  #c9a96e;
  --accent2: #7eb8a4;
  --accent3: #a89bcc;
  --danger:  #cc7a7a;
  --serif:   'DM Serif Display', Georgia, serif;
  --sans:    'Instrument Sans', system-ui, sans-serif;
  --mono:    'DM Mono', monospace;
  --radius:  8px;
}

/* ─── Auth overlay ───────────────────────────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.auth-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 320px;
  padding: 40px 24px;
}
.auth-logo {
  font-family: var(--serif);
  font-size: 32px;
  color: var(--text);
  letter-spacing: -0.5px;
}
.auth-logo em { color: var(--accent); font-style: italic; }
.auth-hint {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
#auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.auth-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 28px;
  letter-spacing: 8px;
  text-align: center;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.15s;
}
.auth-input:focus { border-color: var(--accent); }
.auth-submit {
  width: 100%;
  background: var(--accent);
  color: #0c0c0e;
  border: none;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.auth-submit:hover { opacity: 0.85; }
.auth-error {
  font-size: 12px;
  color: var(--danger);
  text-align: center;
  min-height: 16px;
}

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

/* ─── Base ───────────────────────────────────────────────────────────────────── */
html { height: 100%; }
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.app {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

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

.logo {
  font-family: var(--serif);
  font-size: 28px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.logo em { font-style: italic; color: var(--accent); }

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  line-height: 1.5;
}

.google-status {
  font-family: var(--mono);
  font-size: 10px;
  margin-top: 2px;
}
.google-status.connected    { color: var(--accent2); }
.google-status.disconnected { color: var(--muted); }
.google-status a { color: inherit; text-decoration: underline; cursor: pointer; }

.sync-buttons { display: flex; gap: 6px; }

.sync-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.sync-btn:hover:not(:disabled) { border-color: var(--accent2); color: var(--accent2); }
.sync-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Capture ────────────────────────────────────────────────────────────────── */
.capture-section {
  margin-bottom: 40px;
}

.capture-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 10px;
}

.capture-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}
.capture-box:focus-within { border-color: var(--border2); }

textarea#capture-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  padding: 16px;
  resize: none;
  min-height: 80px;
  display: block;
}
textarea#capture-input::placeholder { color: var(--muted); }

.capture-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  gap: 12px;
}

.source-select {
  background: transparent;
  border: none;
  outline: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  appearance: none;
  padding-right: 4px;
}
.source-select option { background: var(--bg3); color: var(--text); }

.capture-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.char-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

button.submit-btn {
  background: var(--accent);
  color: #0c0c0e;
  border: none;
  border-radius: 5px;
  padding: 7px 16px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
button.submit-btn:hover:not(:disabled) { opacity: 0.85; }
button.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }
button.submit-btn.loading { opacity: 0.6; }

/* ─── File attach ────────────────────────────────────────────────────────────── */
.attach-btn,
.mic-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.5;
  transition: opacity 0.15s;
  line-height: 1;
}
.attach-btn:hover,
.mic-btn:hover { opacity: 1; }

.mic-btn.listening {
  opacity: 1;
  animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.mic-btn.querying {
  opacity: 1;
  animation: mic-pulse-query 1s ease-in-out infinite;
}
@keyframes mic-pulse-query {
  0%, 100% { opacity: 1; filter: hue-rotate(200deg) saturate(2); }
  50%       { opacity: 0.3; filter: hue-rotate(200deg) saturate(2); }
}

/* ─── Query card ─────────────────────────────────────────────────────────────── */
.query-card {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--accent3);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 24px;
}

.query-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.query-card-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent3);
}

.query-dismiss {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.query-dismiss:hover { opacity: 1; }

.query-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
}

.query-answer {
  font-size: 14px;
  color: var(--text);
  line-height: 1.65;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 12px 0;
  padding: 6px 10px;
  background: rgba(126,184,164,0.07);
  border: 1px solid rgba(126,184,164,0.2);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 11px;
}
.file-chip-icon { opacity: 0.7; flex-shrink: 0; }
.file-chip-name {
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.file-chip-size { color: var(--muted); flex-shrink: 0; }
.file-chip-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}
.file-chip-remove:hover { color: var(--danger); }

.capture-box.drag-over {
  border-color: var(--accent2);
  background: rgba(126,184,164,0.04);
}
.capture-box.drag-over textarea { opacity: 0.5; }

/* ─── Lens bar ───────────────────────────────────────────────────────────────── */
.lens-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.lens-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.lens-btn:hover:not(.active) { color: var(--text); }
.lens-btn.active {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border2);
}

/* ─── View ───────────────────────────────────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px;
}

.view-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.view-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
}

.view-section {
  margin-bottom: 28px;
}

.empty-note {
  font-size: 13px;
  color: var(--muted);
  padding: 12px 0;
}

/* ─── Summary card (Morning Briefing) ───────────────────────────────────────── */
.summary-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 28px;
}

.summary-text {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--text);
  line-height: 1.7;
  margin-top: 10px;
}

/* ─── Focus mode ─────────────────────────────────────────────────────────────── */
.task-large .task-title {
  font-size: 16px;
  font-weight: 500;
}

.focus-empty {
  font-size: 14px;
  color: var(--muted);
  padding: 20px 0;
  font-style: italic;
}

.next-event .event-time {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.3;
}

.event-clock {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent3);
}

.event-countdown {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.event-active {
  border-color: var(--accent3);
  background: rgba(168,155,204,0.05);
}

.event-location {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  font-family: var(--mono);
}

.unresolved-badge {
  display: none;
  background: rgba(204,122,122,0.15);
  color: var(--danger);
  border: 1px solid rgba(204,122,122,0.25);
  border-radius: 20px;
  padding: 2px 10px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: default;
}
.unresolved-badge.visible { display: inline-flex; align-items: center; gap: 5px; }

.refresh-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.refresh-btn:hover { border-color: var(--border2); color: var(--text); }
.refresh-btn.spinning { opacity: 0.5; pointer-events: none; }

/* ─── Inbox list ─────────────────────────────────────────────────────────────── */
.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inbox-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.inbox-empty .empty-icon { font-size: 28px; margin-bottom: 10px; opacity: 0.5; }

.inbox-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 13px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.inbox-item:hover { border-color: var(--border2); }

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.priority-dot.high   { background: var(--danger); }
.priority-dot.medium { background: var(--accent); }
.priority-dot.low    { background: var(--muted); }

.item-body { min-width: 0; }

.item-content {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  overflow-wrap: break-word;
  margin-bottom: 5px;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.item-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.tag {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 3px;
  color: var(--accent2);
  background: rgba(126,184,164,0.08);
}

.type-badge {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.type-task  { background: rgba(201,169,110,0.1); color: var(--accent); }
.type-note  { background: rgba(168,155,204,0.1); color: var(--accent3); }
.type-idea  { background: rgba(126,184,164,0.1); color: var(--accent2); }
.type-event { background: rgba(168,155,204,0.12); color: var(--accent3); }

.drive-link {
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent2);
  text-decoration: none;
  opacity: 0.8;
  white-space: nowrap;
}
.drive-link:hover { opacity: 1; text-decoration: underline; }
.type-file  { background: rgba(255,255,255,0.06); color: var(--muted); }

.confidence-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}
.confidence-bar {
  width: 36px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.confidence-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent2);
}
.confidence-fill.low { background: var(--danger); }

/* ─── Today sections (legacy, kept for compat) ───────────────────────────────── */
.today-section { margin-bottom: 28px; }

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

/* ─── Events list ────────────────────────────────────────────────────────────── */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 28px;
}

.event-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  padding: 11px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items: center;
  transition: border-color 0.15s;
}
.event-item:hover { border-color: var(--border2); }

.event-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent3);
  text-align: right;
  line-height: 1.3;
  white-space: nowrap;
}

.event-title {
  font-size: 14px;
  color: var(--text);
  overflow-wrap: break-word;
}

/* ─── Tasks list ─────────────────────────────────────────────────────────────── */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 28px;
}

.task-item {
  position: relative;
  display: grid;
  grid-template-columns: 20px 8px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, opacity 0.2s;
}
.task-item:hover { border-color: var(--border2); }

.task-item.done { opacity: 0.45; }
.task-item.done .task-title { text-decoration: line-through; color: var(--muted); }

.task-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border2);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
  position: relative;
}
.task-check:hover { border-color: var(--accent2); }
.task-check.checked {
  background: var(--accent2);
  border-color: var(--accent2);
}
.task-check.checked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4l3 3 5-6' stroke='%230c0c0e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/10px no-repeat;
}

.task-dismiss {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  grid-column: unset;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  line-height: 1;
}
.task-item:hover .task-dismiss { opacity: 1; }
.task-dismiss:hover { color: var(--text); background: var(--surface2); }

.task-title {
  font-size: 14px;
  color: var(--text);
  overflow-wrap: break-word;
}

.task-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.tasks-divider {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 10px 4px 4px;
  opacity: 0.6;
}

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text);
  max-width: 340px;
  width: calc(100% - 40px);
  text-align: center;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#toast.success { border-color: rgba(126,184,164,0.3); color: var(--accent2); }
#toast.error   { border-color: rgba(204,122,122,0.3); color: var(--danger); }

/* ─── Loading skeleton ───────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
  height: 14px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-item {
  padding: 13px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .app { padding: 0 16px 80px; }
  .header { padding: 20px 0 18px; }
  .logo { font-size: 24px; }
}
