:root {
  --bg: #0e1621;
  --bg-2: #17212b;
  --bg-3: #1d2733;
  --ink: #e9edef;
  --ink-2: #aab8c2;
  --ink-3: #6c7883;
  --accent: #ffb347;
  --accent-2: #ff7a3d;
  --bubble-me: #2b5278;
  --bubble-them: #182533;
  --danger: #e03e3e;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);
  --safe-right: env(safe-area-inset-right);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  /* --vh sættes af JS via VisualViewport så vi tager højde for iOS-keyboard */
  height: var(--vh, 100%);
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* Login screen */
.login {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}
.login .sun {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe8a3 0%, var(--accent) 35%, var(--accent-2) 75%, #b34a1a 100%);
  box-shadow: 0 0 40px 8px rgba(255,179,71,0.25), 0 0 90px 20px rgba(255,122,61,0.12);
  margin-bottom: 1.5rem;
}
.login h1 {
  font-size: 1.75rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--ink);
}
.login .subtitle {
  color: var(--ink-3);
  font-size: 0.95rem;
  margin-bottom: 2.5rem;
}
.login-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.login button {
  background: var(--accent);
  color: #1a0d00;
  border: none;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  min-width: 240px;
  transition: transform 0.1s, opacity 0.2s;
}
.login button.secondary {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--bg-3);
  font-weight: 400;
}
.login button:active { transform: scale(0.97); }
.login button:disabled { opacity: 0.5; cursor: not-allowed; }
.login .status {
  margin-top: 1.5rem;
  color: var(--ink-3);
  font-size: 0.9rem;
  min-height: 1.4em;
}
.login .status.error { color: var(--danger); }

.bootstrap {
  margin-top: 1.5rem;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bootstrap .hint {
  color: var(--ink-3);
  font-size: 0.82rem;
  text-align: left;
  line-height: 1.5;
}
.bootstrap .hint code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--bg-3);
  padding: 1px 5px;
  border-radius: 3px;
  word-break: break-all;
}
.bootstrap input {
  background: var(--bg-3);
  border: 1px solid var(--bg-3);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--ink);
  font-size: 16px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  outline: none;
  width: 100%;
}
.bootstrap input:focus { border-color: var(--accent); }
.bootstrap .row {
  display: flex;
  gap: 8px;
  justify-content: stretch;
}
.bootstrap .row button { flex: 1; min-width: 0; padding: 12px 16px; font-size: 15px; }

/* Chat shell */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.chat-header {
  background: var(--bg-2);
  padding: 14px 16px;
  padding-top: calc(14px + var(--safe-top));
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--bg-3);
  flex-shrink: 0;
}
.chat-header .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe8a3 0%, var(--accent) 35%, var(--accent-2) 75%, #b34a1a 100%);
  flex-shrink: 0;
}
.chat-header .meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.chat-header .name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-header .name {
  font-weight: 600;
  font-size: 1rem;
}
.chat-header .conn-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  transition: background 0.3s;
}
.chat-header .conn-dot.thinking { background: var(--accent); animation: pulse-dot 1.2s infinite ease-in-out; }
.chat-header .conn-dot.offline { background: var(--danger); }
@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}
.chat-header .model-picker {
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-size: 0.78rem;
  font-family: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  width: max-content;
  text-align: left;
}
.chat-header .model-picker:focus { color: var(--accent); }
.chat-header .model-picker option { background: var(--bg-2); color: var(--ink); }
.chat-header .header-btn {
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 36px; height: 36px;
  transition: background 0.15s, color 0.15s;
}
.chat-header .header-btn:active { background: var(--bg-3); color: var(--ink); }

.messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  font-size: 0.95rem;
  font-style: italic;
}
.bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 14px;
  word-wrap: break-word;
  position: relative;
}
.bubble.me {
  align-self: flex-end;
  background: var(--bubble-me);
  border-bottom-right-radius: 4px;
}
.bubble.them {
  align-self: flex-start;
  background: var(--bubble-them);
  border-bottom-left-radius: 4px;
}
.bubble .time {
  font-size: 0.7rem;
  color: var(--ink-3);
  margin-top: 2px;
  text-align: right;
}
.bubble .md p { margin: 0 0 0.5em; }
.bubble .md p:last-child { margin-bottom: 0; }
.bubble .md h1, .bubble .md h2, .bubble .md h3 {
  font-size: 1.05rem; margin: 0.4em 0 0.2em; font-weight: 600;
}
.bubble .md ul, .bubble .md ol { margin: 0.3em 0 0.5em 1.2em; }
.bubble .md li { margin-bottom: 0.15em; }
.bubble .md code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85em;
  background: rgba(0,0,0,0.25);
  padding: 1px 5px;
  border-radius: 3px;
}
.bubble .md pre {
  background: rgba(0,0,0,0.35);
  padding: 8px 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0.4em 0;
}
.bubble .md pre code { background: transparent; padding: 0; font-size: 0.82em; }
.bubble .md table {
  border-collapse: collapse;
  margin: 0.5em 0;
  font-size: 0.9em;
  width: 100%;
}
.bubble .md th, .bubble .md td {
  border: 1px solid rgba(255,255,255,0.15);
  padding: 4px 8px;
  text-align: left;
}
.bubble .md th { background: rgba(0,0,0,0.25); font-weight: 600; }
.bubble .md a { color: var(--accent); text-decoration: underline; }
.bubble .md blockquote {
  border-left: 3px solid var(--accent);
  margin: 0.4em 0;
  padding: 0.1em 0.6em;
  color: var(--ink-2);
}
.bubble .cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1s steps(2) infinite;
  margin-left: 1px;
}
@keyframes blink { 50% { opacity: 0; } }

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 2px;
}
.typing-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.bubble.error { background: rgba(224, 62, 62, 0.18); }

/* Composer */
.composer {
  background: var(--bg-2);
  padding: 8px 10px;
  padding-bottom: calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--bg-3);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.composer .input {
  flex: 1;
  background: var(--bg-3);
  border-radius: 18px;
  padding: 9px 14px;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.35;
  min-height: 36px;
  max-height: 30vh;
  overflow-y: auto;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.composer .input:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-3);
  pointer-events: none;
}
.composer button {
  background: var(--accent);
  color: #1a0d00;
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.1s;
}
.composer button:active { transform: scale(0.92); }
.composer button:disabled {
  background: var(--bg-3);
  color: var(--ink-3);
  cursor: not-allowed;
}
.composer #stop-btn {
  background: var(--danger);
  color: #fff;
  font-size: 12px;
}

/* Pull-to-refresh */
.ptr {
  height: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  transition: height 0.2s ease-out;
  background: var(--bg-2);
}
.ptr.armed { height: 50px; }
.ptr.refreshing { height: 50px; }
.ptr-spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--ink-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin-bottom: 14px;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
}
.ptr.armed .ptr-spinner { opacity: 1; transform: rotate(180deg); }
.ptr.refreshing .ptr-spinner { opacity: 1; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Retry-knap på fejlet user-bobble */
.bubble.me .retry {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--accent);
  background: rgba(255,179,71,0.12);
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid rgba(255,179,71,0.35);
}
.bubble.me .retry:active { background: rgba(255,179,71,0.25); }
.bubble.me.failed { opacity: 0.75; border-left: 2px solid var(--danger); }

/* ─── Sidenav ────────────────────────────────────────────── */
.sidenav {
  position: fixed;
  top: 0; left: 0;
  width: 250px; height: 100%;
  background: var(--bg-2);
  border-right: 1px solid var(--bg-3);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.22s ease-out;
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
}
.sidenav.open { transform: translateX(0); }
.sidenav-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--bg-3);
}
.sidenav-header .avatar.small {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe8a3 0%, var(--accent) 35%, var(--accent-2) 75%, #b34a1a 100%);
}
.sidenav-header .brand {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.sidenav-list { padding: 8px 0; flex: 1; }
.sidenav-list .nav-item {
  display: block;
  padding: 12px 18px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.95rem;
  border-left: 3px solid transparent;
}
.sidenav-list .nav-item:active { background: var(--bg-3); }
.sidenav-list .nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(255,179,71,0.06);
}
.sidenav-footer {
  padding: 10px 18px;
  border-top: 1px solid var(--bg-3);
  padding-bottom: calc(10px + var(--safe-bottom));
}
.sidenav-footer .logout-link {
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-size: 0.85rem;
  padding: 6px 0;
  cursor: pointer;
}
.sidenav-footer .logout-link:active { color: var(--ink); }
.sidenav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.22s;
  pointer-events: none;
}
.sidenav-backdrop.open { opacity: 1; pointer-events: auto; }

/* ─── Views (chat / hub / composer) ─────────────────────── */
.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.view-header {
  background: var(--bg-2);
  padding: 14px 12px;
  padding-top: calc(14px + var(--safe-top));
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--bg-3);
  flex-shrink: 0;
}
.view-header h1 {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
}
.menu-btn { font-size: 1.4rem !important; }

/* ─── Hub-cards ─────────────────────────────────────────── */
.hub-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: calc(20px + var(--safe-bottom));
}
.card {
  background: var(--bg-2);
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid var(--bg-3);
}
.card h2 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.card-toggle {
  background: transparent;
  border: none;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0;
  margin-bottom: 0;
  color: var(--ink-3);
  font-family: inherit;
}
.card-toggle .card-toggle-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.card-toggle .chevron {
  font-size: 0.85rem;
  transition: transform 0.2s ease-out;
}
.card-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.card-toggle[aria-expanded="true"] + .todos-list { margin-top: 10px; }
.card-toggle:active { color: var(--ink-2); }
.todo-row.done-display .text {
  text-decoration: line-through;
  color: var(--ink-3);
}
.todo-row.done-display .check {
  background: var(--ink-3);
  border-color: var(--ink-3);
}
.todo-row.done-display .check.undo {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.todo-row.done-display .check.undo:hover {
  background: transparent;
  border-color: var(--accent);
}
.todo-row.done-display .check.undo:hover::after { color: var(--accent); content: "↺" !important; }
.todo-row.done-display .check.undo:active { transform: scale(0.92); }
.todo-row.done-display .check::after { content: "✓"; color: var(--bg); font-size: 14px; line-height: 18px; padding-left: 4px; }
.todo-row.undoing { opacity: 0.4; transition: opacity 0.2s; }
.todo-row .done-when {
  background: rgba(74,222,128,0.12);
  color: #5cd699;
  padding: 1px 6px;
  border-radius: 3px;
}
.card .count {
  color: var(--ink-3);
  font-weight: 400;
  font-size: 0.78rem;
}
.card .loading { color: var(--ink-3); font-size: 0.9rem; font-style: italic; }

.weather-content {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.weather-loc {
  flex: 1;
  min-width: 130px;
}
.weather-loc h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ink-2);
}
.weather-loc .temp {
  font-size: 1.6rem;
  font-weight: 300;
  color: var(--ink);
}
.weather-loc .meta {
  font-size: 0.78rem;
  color: var(--ink-3);
  margin-top: 2px;
}

.todos-list { list-style: none; }
.todo-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--bg-3);
}
.todo-row:last-child { border-bottom: none; }
.todo-row .check {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--ink-3);
  background: transparent;
  cursor: pointer;
  margin-top: 2px;
  transition: background 0.15s, border-color 0.15s;
}
.todo-row .check:hover { border-color: var(--accent); }
.todo-row.done .check {
  background: var(--accent);
  border-color: var(--accent);
}
.todo-row.done .check::after { content: "✓"; color: #1a0d00; font-size: 14px; line-height: 18px; padding-left: 4px; }
.todo-row.done .text { text-decoration: line-through; color: var(--ink-3); }
.todo-row .body { flex: 1; min-width: 0; }
.todo-row .text {
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--ink);
  word-wrap: break-word;
}
.todo-row .meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--ink-3);
}
.todo-row .id-tag {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--bg-3);
  padding: 1px 6px;
  border-radius: 3px;
}
.todo-row .prio-high { color: #e53e3e; font-weight: 600; }
.todo-row .prio-medium { color: #ed8936; }
.todo-row .prio-low { color: var(--ink-3); }
.todo-row .deadline {
  background: var(--bg-3);
  padding: 1px 6px;
  border-radius: 3px;
}
.todo-row .deadline.overdue { background: rgba(229,62,62,0.18); color: #ff8585; }
.todo-row .deadline.today { background: rgba(255,179,71,0.18); color: var(--accent); }
.todo-row .blocked-reason {
  font-style: italic;
  color: #ff9d6c;
  margin-top: 3px;
  font-size: 0.78rem;
}

.plan-day {
  padding: 6px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--bg-3);
}
.plan-day:last-child { border-bottom: none; }
.plan-day .day-label {
  color: var(--ink-2);
  font-weight: 600;
  display: inline-block;
  width: 80px;
}
.plan-day .activity {
  display: block;
  margin: 2px 0 0 80px;
  color: var(--ink-3);
  font-size: 0.8rem;
}

.time-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--bg-3);
}
.time-row:last-child { border-bottom: none; }
.time-row .project { color: var(--ink); }
.time-row .hours { color: var(--accent); font-weight: 600; }
.time-row.total { padding-top: 10px; font-weight: 600; }

/* ─── Composer ─────────────────────────────────────────── */
.composer-doc {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px;
  outline: none;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  min-height: 0;
}
.composer-doc:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-3);
  pointer-events: none;
  font-style: italic;
}
.composer-doc h1, .composer-doc h2, .composer-doc h3 { font-weight: 600; margin: 0.6em 0 0.3em; }
.composer-doc h1 { font-size: 1.5rem; }
.composer-doc h2 { font-size: 1.25rem; }
.composer-doc h3 { font-size: 1.1rem; }
.composer-doc p { margin: 0 0 0.8em; }
.composer-doc ul, .composer-doc ol { margin: 0.4em 0 0.8em 1.4em; }
.composer-doc li { margin-bottom: 0.2em; }
.composer-doc blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--ink-2); margin: 0.6em 0; }
.composer-doc strong { font-weight: 600; }
.composer-doc em { font-style: italic; }

.agent-picker {
  flex: 1;
  background: var(--bg-3);
  color: var(--ink);
  border: 1px solid var(--bg-3);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}
.agent-picker:focus { border-color: var(--accent); }
.agent-picker option { background: var(--bg-2); }

.ai-toolbar {
  position: absolute;
  background: var(--bg-3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  gap: 2px;
  z-index: 50;
  box-shadow: 0 4px 18px rgba(0,0,0,0.5);
}
.ai-toolbar button {
  background: transparent;
  border: none;
  color: var(--ink);
  padding: 7px 11px;
  font-size: 0.82rem;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}
.ai-toolbar button:hover { background: rgba(255,179,71,0.15); }
.ai-toolbar button:active { background: rgba(255,179,71,0.3); }

.ai-custom-pane {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 16px;
  right: 16px;
  background: var(--bg-2);
  border: 1px solid var(--bg-3);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 60;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.ai-custom-pane input {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid var(--bg-3);
  border-radius: 18px;
  padding: 8px 14px;
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
  outline: none;
}
.ai-custom-pane input:focus { border-color: var(--accent); }
.ai-custom-pane button {
  background: var(--accent);
  color: #1a0d00;
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}
.ai-custom-pane button#ai-custom-cancel {
  background: transparent;
  color: var(--ink-3);
}

.ai-diff {
  position: fixed;
  inset: auto 12px calc(12px + var(--safe-bottom)) 12px;
  max-height: 70vh;
  background: var(--bg-2);
  border: 1px solid var(--bg-3);
  border-radius: 14px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.ai-diff-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--bg-3);
  font-size: 0.85rem;
  color: var(--ink-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ai-diff-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--ink-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.ai-diff-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
}
.ai-diff-body h3 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.ai-diff-old, .ai-diff-new {
  background: var(--bg-3);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.ai-diff-old { opacity: 0.75; }
.ai-diff-new { border-left: 3px solid var(--accent); }
.ai-diff-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--bg-3);
}
.ai-diff-actions button {
  flex: 1;
  padding: 11px;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}
.ai-diff-reject {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--bg-3) !important;
}
.ai-diff-accept {
  background: var(--accent);
  color: #1a0d00;
  font-weight: 600;
}

/* Hidden by default */
[hidden] { display: none !important; }
