@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --accent: #00d4aa;
  --accent-dim: #00a888;
  --accent-bg: #00d4aa15;
  --accent-border: #00d4aa40;
  --bg-base: #0a0a0f;
  --bg-card: #16161e;
  --bg-card-bottom: #111118;
  --bg-input: #0a0a0f;
  --bg-chip: #1a1a24;
  --text-primary: #e8e8ed;
  --text-heading: #fff;
  --text-secondary: #c8c8d0;
  --text-muted: #bbb;
  --text-dim: #9a9a9a;
  --text-dimmer: #7a7a7a;
  --text-dimmest: #6a6a6a;
  --border: #252530;
  --border-light: #333;
  --border-mid: #353540;
  --border-heavy: #404050;
  --danger: #ff8888;
  --danger-dim: #cc4444;
  --warning: #f59e0b;
  --info: #00b4d8;
  --info-dim: #0096c7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(145deg, #0a0a0f 0%, #12121a 50%, #0d0d14 100%);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, sans-serif;
}

/* Layout */
.container {
  min-height: 100vh;
  padding: 1rem;
}

.main-container {
  max-width: 800px;
  margin: 0 auto;
}

/* Loading */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.loading-pulse {
  font-size: 3rem;
  color: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-text {
  margin-top: 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--text-dimmer);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.main-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  margin: 0;
  color: var(--text-heading);
}

.main-title-link {
  text-decoration: none;
  color: inherit;
}

.main-title-link:hover {
  color: var(--accent);
}

.title-diamond {
  font-size: 0.4em;
  vertical-align: 0.3em;
  margin: 0 0.05em;
  opacity: 0.7;
}

.header-date {
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dimmer);
  margin: 0;
}

.logo-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.logo-mark::after {
  content: '\25C7';
  position: absolute;
  font-size: 3rem;
  color: var(--accent);
}

.logo-mark-header {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 1.1rem;
  color: var(--accent);
  transform-origin: center center;
}

.logo-mark-header::after {
  content: '\25C7';
  position: absolute;
  font-size: 2rem;
  color: var(--accent);
}

.logo-mark-star {
  font-size: 1.2rem;
}

.logo-mark-star::after {
  content: '\25C7';
  position: absolute;
  font-size: 2rem;
  color: var(--accent);
}

.logo-mark-square {
  font-size: 0.9rem;
}

.logo-mark-square::after {
  content: '\25C7';
  position: absolute;
  font-size: 2rem;
  color: var(--accent);
}

.logo-mark-user {
  font-size: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-mark-user svg {
  width: 1rem;
  height: 1rem;
  margin-top: -0.15rem;
}

.logo-mark-user::after {
  content: '\25C7';
  position: absolute;
  font-size: 2rem;
  color: var(--accent);
}

.diff-title-icon {
  color: var(--accent);
  font-size: 0.75em;
  margin-right: 0.25rem;
}

.logo-mark-spinning {
  animation: diamond-spin 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.profile-badge {
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  transition: color 0.15s ease;
}

.profile-badge:hover {
  color: var(--accent);
}

.profile-badge-icon {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--accent);
}

.profile-caret {
  font-size: 0.55rem;
  transition: transform 0.2s ease;
}

.profile-caret-open {
  transform: rotate(180deg);
}

/* Sync Status Icon */
.sync-status {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.5rem;
  margin-left: 0.25rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}

.sync-status-cloud {
  font-size: 1.4rem;
  color: var(--text-dimmer);
  line-height: 1;
}

.sync-status-indicator {
  position: absolute;
  font-size: 0.5rem;
  font-weight: 700;
  top: 50%;
  right: -0.1rem;
  transform: translateY(-50%);
  line-height: 1;
}

.sync-status-ok {
  color: var(--accent);
}

.sync-status-pending {
  color: var(--warning);
}

.sync-status-spinning {
  color: var(--accent);
  font-size: 0.6rem;
  animation: sync-spin 1s linear infinite;
}

@keyframes sync-spin {
  from { transform: translateY(-50%) rotate(0deg); }
  to { transform: translateY(-50%) rotate(360deg); }
}

/* Inline sync dropdown (inside profile cards) */
.profile-card-id .sync-dropdown-wrapper,
.profile-card-id .sync-status-static {
  margin-left: 0.5rem;
  vertical-align: middle;
}

.profile-card-id .sync-dropdown {
  right: auto;
  left: 0;
  font-family: system-ui, -apple-system, sans-serif;
}

.sync-status-static {
  display: inline-flex;
  align-items: center;
  position: relative;
  opacity: 0.6;
}

.sync-status-hover {
  display: none;
  color: var(--accent);
}

.sync-dropdown-wrapper:hover .sync-status-hover,
.sync-dropdown-wrapper:focus-within .sync-status-hover {
  display: block;
}

.sync-dropdown-wrapper:hover .sync-status-ok,
.sync-dropdown-wrapper:focus-within .sync-status-ok {
  display: none;
}

/* Sync Dropdown */
.sync-dropdown-wrapper {
  position: relative;
  display: inline-flex;
}

.sync-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0.75rem;
  min-width: 250px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.sync-dropdown-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sync-dropdown-input-row {
  display: flex;
  gap: 0.375rem;
  align-items: center;
}

.sync-dropdown-input-row .sync-dropdown-input {
  flex: 1;
  min-width: 0;
}

.sync-dropdown-input {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 0.5rem 0.625rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  width: 100%;
}

.sync-dropdown-input:focus {
  outline: none;
  border-color: var(--accent-border);
}

.sync-dropdown-input::placeholder {
  color: var(--text-dimmest);
}

.sync-dropdown-btn {
  background: var(--accent);
  color: var(--bg-base);
  border: none;
  border-radius: 6px;
  padding: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

.sync-dropdown-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.sync-dropdown-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sync-dropdown-error {
  color: var(--danger);
  font-size: 0.8rem;
}

.sync-dropdown-result {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-size: 0.85rem;
}

.sync-dropdown-result-icon {
  font-size: 1rem;
}

.sync-dropdown-syncing {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.sync-dropdown-syncing-icon {
  animation: spin 1s linear infinite;
}

.sync-dropdown-info {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.sync-dropdown-form .sync-dropdown-info {
  margin-bottom: 0.25rem;
}

.sync-dropdown-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sync-dropdown-status .sync-dropdown-info {
  flex: 1;
}

.sync-dropdown-btn-icon {
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-dim);
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.15s;
}

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

.sync-dropdown-forget {
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--text-dimmest);
  background: transparent;
  border: 1px solid var(--border-light);
  cursor: pointer;
  margin-top: 0.25rem;
}

.sync-dropdown-forget:hover {
  color: var(--text-dim);
  border-color: var(--border-mid);
}

.sync-dropdown-remember {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin-top: 0.25rem;
}

.sync-dropdown-remember input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.sync-dropdown-remember-text {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Wizard */
.setup-container {
  max-width: 640px;
  margin: 0 auto;
  padding-top: 2rem;
}

.setup-header {
  text-align: center;
  margin-bottom: 2rem;
}

.setup-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  margin: 0;
  color: var(--text-heading);
}

.setup-diamond {
  font-size: 0.4em;
  vertical-align: 0.3em;
  margin: 0 0.05em;
  opacity: 0.7;
}

.setup-subtitle {
  font-size: 0.8rem;
  color: var(--text-dimmer);
  letter-spacing: 0.1em;
  margin-top: 0.25rem;
}

.step-indicator {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-light);
  transition: all 0.3s ease;
}

.step-dot-active {
  background: var(--accent);
  box-shadow: 0 0 12px #00d4aa50;
}

.step-dot-complete {
  background: #00d4aa50;
}

.setup-content {
  background: linear-gradient(180deg, #16161e 0%, #111118 100%);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 2rem;
  min-height: 320px;
  display: grid;
}

.setup-content > div {
  grid-area: 1 / 1;
}

.step-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--text-heading);
}

.step-desc {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.input-group {
  margin-bottom: 1rem;
}

.input-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dimmer);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.text-input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-heading);
  outline: none;
  transition: border-color 0.2s;
}

.text-input:focus {
  border-color: var(--accent);
}

.input-with-status {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-status .text-input {
  padding-right: 2.5rem;
}

.input-status {
  position: absolute;
  right: 0.875rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.input-status-valid {
  color: var(--accent);
}

.input-status-invalid {
  color: var(--danger);
}

/* API Key Choice */
.api-key-choice {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.api-key-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.api-key-option:hover {
  border-color: var(--accent-border);
  background: linear-gradient(135deg, var(--bg-card) 0%, #1a1a28 100%);
}

.api-key-option-icon {
  font-size: 1.25rem;
  color: var(--accent);
}

.api-key-option-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.api-key-option-text strong {
  color: var(--text-heading);
  font-size: 0.95rem;
}

.api-key-option-text span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.api-key-confirmed {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  color: var(--accent);
  font-size: 0.9rem;
}

.api-key-confirmed-icon {
  font-size: 1rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

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

/* Chips */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  background: var(--bg-chip);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  border-color: var(--text-dimmest);
}

.chip-selected {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

/* Depth Options */
.depth-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.depth-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-chip);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.depth-card:hover {
  border-color: var(--text-dimmest);
}

.depth-card-selected {
  background: #00d4aa10;
  border-color: var(--accent);
}

.depth-icon {
  font-size: 1.5rem;
}

.depth-label {
  font-weight: 600;
  color: var(--text-heading);
  min-width: 120px;
}

.depth-desc {
  font-size: 0.85rem;
  color: var(--text-dimmer);
}

/* Wizard Footer */
.setup-footer {
  display: flex;
  align-items: center;
  margin-top: 1.5rem;
  gap: 1rem;
}

.setup-footer-spacer {
  flex: 1;
}

/* Edit mode footer */
.edit-footer-actions,
.create-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.step-nav-btns {
  display: flex;
  gap: 0.25rem;
}

.btn-step-nav {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-step-nav:hover:not(:disabled) {
  border-color: var(--accent-border);
  color: var(--text-heading);
}

.btn-step-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Buttons */
.btn-primary {
  padding: 0.875rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: linear-gradient(135deg, #00d4aa 0%, #00a888 100%);
  border: none;
  border-radius: 8px;
  color: #000;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-aqua {
  background: linear-gradient(135deg, var(--info) 0%, var(--info-dim) 100%);
}

.btn-aqua:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 0 20px rgba(0, 180, 216, 0.4);
}

.btn-secondary {
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid #444;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-archive {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  background: var(--bg-chip);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: none;
}

.archive-icon {
  font-size: 0.7em;
  margin-right: 0.3em;
}

.btn-danger {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  background: #3a1a1a;
  border: 1px solid #5a2a2a;
  border-radius: 6px;
  color: var(--danger);
  cursor: pointer;
}

.btn-delete {
  padding: 0.5rem 0.75rem;
  font-size: 1.25rem;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
}

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

.btn-generate {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #00d4aa 0%, #00a888 100%);
  border: none;
  border-radius: 8px;
  color: #000;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.generate-icon {
  margin-top: -0.2rem;
}

.btn-retry {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dim) 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
}

.btn-refresh {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  background: var(--border);
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}

button:hover:not(:disabled) {
  filter: brightness(1.1);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Profile Summary */
.profile-summary {
  display: flex;
  gap: 2rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.profile-label-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.profile-label {
  font-size: 0.65rem;
  color: var(--text-dimmest);
  letter-spacing: 0.1em;
}

.profile-value {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.profile-value-wrap {
  word-break: break-word;
  line-height: 1.4;
}

.profile-switcher {
  width: 100%;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.profile-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.profile-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.profile-chip-active {
  border-color: var(--accent);
  color: var(--accent);
}

.profile-chip-add {
  border-style: dashed;
  color: var(--text-dimmest);
}

.profile-chip-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.profile-chip-remove {
  background: none;
  border: none;
  color: var(--text-dimmest);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.85;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.profile-chip-remove:hover {
  opacity: 1;
  color: var(--danger);
}

.profile-chip-rename {
  background: none;
  border: none;
  color: var(--text-dimmest);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.85;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.profile-chip-rename:hover {
  opacity: 1;
  color: var(--accent);
}

.edit-icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  line-height: 1;
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* Welcome Bar (above diff) */
.welcome-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 1rem 0;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.welcome-bar-right {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
}

.welcome-greeting {
  font-size: 2.75rem;
  font-weight: 700;
  color: var(--text-heading);
  display: block;
}

.welcome-ago {
  font-size: 0.85rem;
  color: var(--text-dim);
  display: block;
  margin-top: 0.25rem;
}

.diff-time {
  margin-left: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.9em;
  opacity: 0.7;
}

.diff-nav-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.diff-nav-arrow {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  padding: 0 0.25rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s, color 0.15s;
  line-height: 1;
}

.diff-nav-arrow:hover:not(.diff-nav-arrow-disabled) {
  opacity: 1;
  color: var(--accent);
}

.diff-nav-arrow-disabled {
  opacity: 0.25;
  cursor: default;
}

.diff-position-link {
  color: var(--text-dimmest);
  text-decoration: none;
  transition: color 0.15s;
}

.diff-position-link:hover {
  color: var(--accent);
}

.btn-generate-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-chip);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Welcome Area (no diff state) */
.welcome-area {
  text-align: center;
  padding: 3.5rem 2rem;
}

.welcome-heading {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0 0 0.75rem 0;
}

.welcome-heading-lg {
  font-size: 2.75rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 0.5rem 0;
  letter-spacing: 0.02em;
}

.welcome-text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* First-time tracking summary */
.first-time-tracking {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
  padding: 0.75rem 1rem;
  background: var(--bg-chip);
  border-radius: 8px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.first-time-tracking-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  flex-shrink: 0;
}

.first-time-tracking-items {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.first-time-tracking-edit {
  font-size: 0.75rem;
  color: var(--text-dimmer);
  text-decoration: none;
  flex-shrink: 0;
}

.first-time-tracking-edit:hover {
  color: var(--accent);
}

/* Recent Archive (below generate button) */
.recent-archive {
  margin-top: 2.5rem;
  text-align: left;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.recent-archive-item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.recent-archive-item:hover {
  background: var(--bg-chip);
}

.recent-archive-date {
  font-size: 0.75rem;
  color: var(--accent);
  white-space: nowrap;
  min-width: 80px;
}

.recent-archive-preview {
  font-size: 0.8rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-archive-more {
  display: block;
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-dimmer);
  text-decoration: none;
  cursor: pointer;
}

.recent-archive-more:hover {
  color: var(--accent);
}


/* Depth Selector */
.depth-selector {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.depth-option {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-dim);
  background: none;
  border: none;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
}

.depth-option:hover {
  filter: none !important;
}

.depth-option-active {
  color: var(--accent);
}

.depth-option-default {
  font-weight: 600;
}

.depth-option-icon {
  font-size: 0.85rem;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.depth-option:hover .depth-option-icon {
  opacity: 1;
}

.depth-option-active .depth-option-icon {
  opacity: 0.75;
}

/* Prompt Preview */
.prompt-preview-link {
  margin-top: 0.75rem;
}

.btn-prompt-preview {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-dimmer);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.prompt-preview-modal {
  width: 700px;
  max-width: 95vw;
  max-height: 85vh;
  background: #12121a;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.prompt-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.prompt-preview-title {
  font-size: 0.8rem;
  color: var(--text-dimmer);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.btn-close-prompt {
  background: none;
  border: none;
  color: var(--text-dimmer);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}

.prompt-preview-content {
  padding: 1.25rem;
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
}

/* Show Prompt Button */
.btn-show-prompt {
  margin-top: 1rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-dimmest);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* Prompt Modal */
.prompt-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.prompt-modal-content {
  width: 800px;
  max-width: 100%;
  max-height: 90vh;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.prompt-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.prompt-modal-title {
  font-size: 0.85rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0;
}

.prompt-modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}

.prompt-modal-close:hover {
  color: var(--text-heading);
}

.prompt-text {
  padding: 1.25rem;
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  flex: 1;
}

/* Generating State */
.generating-state {
  text-align: center;
  padding: 4rem 2rem;
}

.scan-animation {
  width: 280px;
  height: 4px;
  background: var(--bg-chip);
  border-radius: 2px;
  margin: 0 auto 2rem;
  overflow: hidden;
  position: relative;
}

.scan-line {
  position: absolute;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scan 1.5s ease-in-out infinite;
}

.scan-message-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  min-height: 2rem;
}

.scan-icon {
  font-size: 1.25rem;
  animation: pulse 1s ease-in-out infinite;
}

.generating-text {
  font-size: 0.95rem;
  color: var(--accent);
  margin: 0;
  font-weight: 500;
}

.scan-progress {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-light);
  transition: all 0.3s ease;
}

.progress-dot-active {
  background: var(--accent);
}

.generating-subtext {
  font-size: 0.8rem;
  color: var(--text-dimmest);
  margin-top: 0.5rem;
}

/* Error */
.error-box {
  padding: 2rem;
  background: linear-gradient(135deg, #2a1a1a 0%, #1a1215 100%);
  border: 1px solid #5a2a2a;
  border-radius: 12px;
  text-align: center;
}

.error-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.error-text {
  color: var(--danger);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

/* Diff Display */
.diff-container {
  background: linear-gradient(180deg, #16161e 0%, #111118 100%);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: visible;
}

.diff-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #12121a;
}

.diff-timestamp {
  font-size: 0.75rem;
  color: var(--text-dimmest);
}

.diff-title {
  padding: 1.5rem 2rem 0;
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.diff-content {
  padding: 1.5rem 2rem 2rem;
  overflow: visible;
}

.diff-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

/* Markdown Styles */
.md-h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-border);
  letter-spacing: 0.03em;
}

.md-h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  margin: 1.5rem 0 0.75rem 0;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #303040;
}

.md-h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e0e0e0;
  margin: 1rem 0 0.5rem 0;
}

.md-p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0.5rem 0;
  line-height: 1.65;
}

.md-list {
  margin: 0.75rem 0;
  padding-left: 0;
  list-style: none;
}

.md-list-item {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0.75rem 0;
  line-height: 1.6;
  padding-left: 1.25rem;
  position: relative;
  border-left: 2px solid #303040;
}

.md-bold {
  font-weight: 600;
  color: #e8e8f0;
}

.md-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--border);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--accent);
}

.md-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted #00d4aa60;
  padding-bottom: 1px;
}

.md-link:hover {
  color: #00ffcc;
}

.md-link:visited {
  color: #606070;
  border-bottom-color: #40404060;
}

.md-hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, #404050, transparent);
  margin: 1.25rem 0;
}

.md-sources {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid #303040;
}

.md-sources .md-h3 {
  font-size: 0.85rem;
  color: var(--text-dimmer);
  margin: 0 0 0.75rem 0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.md-sources-list {
  margin: 0;
  padding-left: 1.25rem;
  list-style: decimal;
}

.md-source-item {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0.35rem 0;
  line-height: 1.5;
}

.md-source-item .md-link {
  font-size: 0.8rem;
}

/* History */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-dimmer);
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.archive-card {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s;
}

.archive-card:hover {
  border-color: var(--border-light);
}

.archive-card-content {
  flex: 1;
  padding: 1rem 1.25rem;
  cursor: pointer;
}

.archive-date {
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.archive-cost {
  color: var(--text-dim);
  font-size: 0.7rem;
  margin-left: 0.5rem;
  opacity: 0.6;
}

.archive-preview {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Custom Chips */
.chip-custom {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding-right: 0.5rem;
}

.chip-remove {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
}

.chip-remove:hover {
  opacity: 1;
  filter: none;
}

.chip-add-inline {
  display: inline-flex;
}

.chip-add-input {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  background: var(--bg-chip);
  border: 1px dashed var(--border-light);
  border-radius: 20px;
  color: var(--text-muted);
  font-family: inherit;
  width: 120px;
  outline: none;
  transition: border-color 0.2s ease;
}

.chip-add-input:focus {
  border-color: var(--accent);
  color: var(--text-main);
}

.chip-add-input::placeholder {
  color: var(--text-dimmest);
}

/* Edit Overlay */
.edit-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.edit-overlay-content {
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  background: #12121a;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 2rem;
  box-sizing: border-box;
}

.edit-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.edit-tab {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.edit-tab:hover {
  color: var(--text);
  background: var(--surface);
}

.edit-tab-active {
  color: var(--accent);
  background: var(--accent-bg);
}

/* Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.05); }
}

@keyframes scan {
  0% { left: -40%; }
  100% { left: 100%; }
}

@keyframes diamond-spin {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}

/* Transitions for Alpine */
.fade-enter {
  opacity: 0;
}
.fade-enter-active {
  transition: opacity 0.3s ease;
}
.fade-leave-active {
  transition: opacity 0.2s ease;
}
.fade-leave-to {
  opacity: 0;
}

kbd {
  padding: 0.1rem 0.4rem;
  font-size: 0.85em;
  font-family: inherit;
  background: var(--bg-chip);
  border: 1px solid var(--border-light);
  border-radius: 4px;
}

/* Hidden helper */
[x-cloak] {
  display: none !important;
}

/* Cool Links / Bookmarks */

/* Header link */
.header-link {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.header-link:hover {
  color: var(--accent);
}

/* Bookmark button on hover */
.diff-content .md-p,
.diff-content .md-list-item {
  position: relative;
  transition: background 0.15s ease;
  border-radius: 4px;
}

.diff-content .md-p:hover,
.diff-content .md-list-item:hover {
  background: rgba(0, 212, 170, 0.04);
}

/* Bookmark button (injected dynamically) */
.bookmark-btn {
  position: absolute;
  right: -2.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  font-size: 1rem;
  font-weight: 700;
  color: #000;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
  z-index: 10;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.md-p:hover .bookmark-btn,
.md-list-item:hover .bookmark-btn {
  opacity: 1;
}

.bookmark-btn:hover {
  transform: translateY(-50%) scale(1.2) !important;
  filter: brightness(1.1) !important;
}

.bookmark-btn-saved {
  background: var(--accent) !important;
  color: #000 !important;
}

/* Always show existing bookmarks, faded and smaller */
.bookmark-btn-existing {
  background: var(--accent);
  opacity: 0.4;
  font-size: 0;  /* Hide any inner content for solid star */
  transform: translateY(-50%) scale(0.75);
}

.md-p:hover .bookmark-btn-existing,
.md-list-item:hover .bookmark-btn-existing {
  opacity: 0.8;
}

.bookmark-btn-existing:hover {
  opacity: 1 !important;
  font-size: 1.2rem;  /* Show the minus on hover */
}

.bookmark-btn-existing:hover::after {
  content: '−';
  font-weight: 700;
  color: #000;
}

/* Header link icon */
.header-link-icon {
  color: var(--accent);
}

/* Highlighted bookmark paragraph */
.bookmark-highlight {
  animation: bookmark-pulse 2s ease-out;
}

@keyframes bookmark-pulse {
  0% { background: rgba(0, 212, 170, 0.3); }
  100% { background: transparent; }
}

/* Bookmarks list */
.bookmarks-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bookmark-card {
  display: flex;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s;
}

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

.bookmark-card-content {
  flex: 1;
  padding: 1rem 1.25rem;
  cursor: pointer;
}

.bookmark-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
}

.bookmark-source {
  color: var(--accent);
  font-weight: 500;
}

.bookmark-dot {
  color: var(--text-dimmest);
}

.bookmark-date {
  color: var(--text-dimmer);
}

.bookmark-preview {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.bookmark-preview .md-p,
.bookmark-preview .md-list-item {
  margin: 0;
  font-size: inherit;
  padding-left: 0;
  border-left: none;
}

.bookmark-preview .md-p::after,
.bookmark-preview .md-list-item::after {
  display: none !important;
}

.bookmark-preview ul,
.bookmark-preview ol {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.bookmark-preview li {
  padding-left: 0;
}

.bookmark-preview li::marker {
  content: none;
}

.bookmark-added {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-dimmest);
}

.bookmark-detail-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-top: 1px solid var(--border);
  background: #12121a;
}

.bookmark-added-detail {
  font-size: 0.8rem;
  color: var(--text-dimmer);
}

.bookmark-orphan {
  opacity: 0.6;
}

.bookmark-orphan-message {
  font-style: italic;
}

.bookmark-orphan-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.empty-hint {
  font-size: 0.85rem;
  color: var(--text-dimmest);
  margin-top: 0.5rem;
}

/* Splash Page */
.splash-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.splash-content {
  max-width: 540px;
  text-align: center;
}

.splash-title {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.02em;
}

.splash-diamond {
  color: var(--accent);
  font-size: 0.35em;
  vertical-align: 0.35em;
  margin: 0 0.05em;
}

.splash-tagline {
  font-size: 1.15rem;
  color: var(--text-dim);
  margin: 0 0 2.5rem 0;
  line-height: 1.5;
}

.splash-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  text-align: left;
}

.splash-feature {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.splash-feature-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.splash-feature strong {
  display: block;
  color: var(--text-heading);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.splash-feature span {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.35;
}

@media (max-width: 540px) {
  .splash-features {
    grid-template-columns: 1fr;
  }
}

.splash-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--accent);
  color: #0a0a0f;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.splash-cta:hover {
  background: var(--accent-dim);
}

.splash-cta-icon {
  font-size: 1rem;
}

.splash-note {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-dimmest);
}

.splash-note a {
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.splash-note a:hover {
  color: var(--accent);
}

.splash-or {
  margin: 1rem 0;
  font-size: 0.85rem;
  color: var(--text-dimmest);
}

.splash-link {
  font-size: 0.9rem;
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.splash-link:hover {
  color: var(--accent);
}

.link-subtle {
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-subtle:hover {
  color: var(--accent);
}

/* Profiles Page */
.profiles-section {
  margin-bottom: 2.5rem;
}

.profiles-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0 0 0.5rem 0;
}

.profiles-section-desc {
  font-size: 0.85rem;
  color: var(--text-dimmer);
  margin: 0 0 1rem 0;
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.profile-card {
  position: relative;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-card:hover {
  border-color: var(--accent-border);
  background: linear-gradient(135deg, var(--bg-card) 0%, #1a1a28 100%);
}

.profile-card-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-border);
}

.profile-card-active .profile-card-icon {
  color: var(--accent-glow);
}

.profile-card-icon {
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.profile-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-status {
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.profile-status-local {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-light);
}

.profile-status-shared {
  color: var(--text-dim);
  background: rgba(0, 180, 216, 0.2);
  border: 1px solid rgba(0, 180, 216, 0.4);
}

.profile-status-warning {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.profile-status-share {
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--info);
  background: transparent;
  border: 1px solid rgba(0, 180, 216, 0.3);
  cursor: pointer;
  transition: all 0.15s ease;
}

.profile-status-share:hover {
  background: rgba(0, 180, 216, 0.1);
  border-color: var(--info);
  filter: none;
}

.profile-card-password {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color 0.15s;
}

.profile-card-password:hover {
  color: var(--accent);
}

.profile-card-id {
  font-size: 0.75rem;
  color: var(--text-dimmest);
  font-family: 'JetBrains Mono', monospace;
}

.profile-lock {
  margin-left: 0.3rem;
  font-size: 0.7rem;
  opacity: 0.6;
}

.profile-lock-open {
  opacity: 0.9;
}

.profile-card-remove {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.profile-card:hover .profile-card-remove {
  opacity: 0.7;
}

.profile-card-remove:hover {
  opacity: 1 !important;
  color: var(--danger);
}

/* Full Profile Card (with details) */
.profiles-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-card-full {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-card-full:hover {
  border-color: var(--accent-border);
}

.profile-card-full-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-border);
}

.profile-card-full-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.profile-card-full .profile-card-icon {
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 0;
}

.profile-card-full-active .profile-card-icon {
  color: var(--accent-glow);
}

.profile-card-full-title {
  flex: 1;
}

.profile-card-full-title .profile-card-name {
  margin-bottom: 0.125rem;
}

.profile-card-full-actions {
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.profile-card-full:hover .profile-card-full-actions {
  opacity: 1;
}

.profile-card-edit {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  text-decoration: none;
  transition: color 0.15s;
}

.profile-card-edit:hover {
  color: var(--accent);
}

.profile-card-full .profile-card-remove {
  position: static;
  opacity: 1;
  padding: 0.25rem 0.5rem;
}

.profile-card-full-details {
  padding: 0 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-detail-row {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.profile-detail-label {
  color: var(--text-dimmest);
  min-width: 80px;
  flex-shrink: 0;
}

.profile-detail-value {
  color: var(--text-dim);
  line-height: 1.4;
}

.profile-detail-counts {
  margin-top: 0.25rem;
  gap: 1rem;
}

.profile-count {
  font-size: 0.65rem;
  color: var(--text-dimmest);
  letter-spacing: 0.1em;
}

.profile-count-icon {
  color: var(--accent);
}

.share-info {
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  background: var(--bg-chip);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.share-info-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.share-info-icon {
  font-size: 1rem;
  width: 1.5rem;
  text-align: center;
}

.share-qr-container {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
}

.share-qr {
  border-radius: 8px;
  background: white;
  padding: 0.5rem;
}

.share-id-box {
  margin: 1rem 0;
}

.share-id-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.share-id-code {
  flex: 1;
  padding: 0.75rem;
  background: var(--bg-chip);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-copy {
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--info);
  background: rgba(0, 180, 216, 0.1);
  border: 1px solid rgba(0, 180, 216, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-copy:hover {
  background: rgba(0, 180, 216, 0.2);
  border-color: var(--info);
  filter: none;
}

.share-note {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 1rem 0;
}


/* Action Cards Row */
.profiles-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 2rem;
}

/* Action Card (Create/Import) */
button.profile-card-action {
  font: inherit;
  line-height: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.profile-card-action {
  min-height: 140px;
  text-decoration: none;
  text-align: left;
  border: 2px dashed var(--border-light);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.profile-card-action:hover,
button.profile-card-action:hover:not(:disabled) {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.08) 0%, rgba(0, 212, 170, 0.02) 100%);
  box-shadow: 0 0 25px rgba(0, 212, 170, 0.15);
  filter: none;
}

.profile-card-action-alt:hover,
button.profile-card-action-alt:hover:not(:disabled) {
  border-color: var(--info);
  background: linear-gradient(135deg, rgba(0, 180, 216, 0.08) 0%, rgba(0, 180, 216, 0.02) 100%);
  box-shadow: 0 0 25px rgba(0, 180, 216, 0.15);
}

.profile-card-action-alt:hover .profile-card-action-icon {
  background: linear-gradient(135deg, var(--info) 0%, var(--info-dim) 100%);
  box-shadow: 0 0 20px rgba(0, 180, 216, 0.4);
}

.profile-card-action-alt:hover .profile-card-name {
  color: var(--info);
}

.profile-card-action-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  font-size: 1.5rem;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

.profile-card-action:hover .profile-card-action-icon {
  background: linear-gradient(135deg, var(--accent) 0%, #00a896 100%);
  border-color: transparent;
  color: #0a0a0f;
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.4);
}

.profile-card-action:hover .profile-card-name {
  color: var(--accent);
}

.profile-card-action .profile-card-id {
  font-family: inherit;
  color: var(--text-dim);
}

@media (max-width: 500px) {
  .profiles-actions {
    grid-template-columns: 1fr;
  }
}

/* Import Modal */
.import-or {
  text-align: center;
  color: var(--text-dimmest);
  font-size: 0.85rem;
  margin: 1rem 0;
}

.btn-scan-large {
  width: 100%;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-body);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.btn-scan-large:hover {
  border-color: var(--accent);
  background: rgba(0, 212, 170, 0.1);
}

.btn-scan-icon {
  font-size: 1.25rem;
}

/* Add Profile Form */
.add-profile-form {
  display: flex;
  gap: 0.75rem;
}

.add-profile-form .text-input {
  flex: 1;
  min-width: 0;
}

.add-profile-error {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--danger);
}

.scan-icon {
  font-size: 0.9rem;
}

/* QR Scanner */
.scanner-modal {
  max-width: 360px;
}

.scanner-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin: 1rem 0;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-frame {
  width: 200px;
  height: 200px;
  border: 2px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scanner-error {
  text-align: center;
  color: var(--danger);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Unlock Modal */
.unlock-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.unlock-modal-content {
  width: 100%;
  max-width: 400px;
}

.unlock-modal-body {
  background: #12121a;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 2rem;
}

.unlock-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0 0 0.25rem 0;
}

.unlock-subtitle {
  font-size: 0.9rem;
  color: var(--accent);
  margin: 0 0 1.5rem 0;
}

.unlock-error {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 100, 100, 0.1);
  border: 1px solid rgba(255, 100, 100, 0.3);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--danger);
}

.unlock-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 0 0;
}

/* Share Page */
.share-loading {
  text-align: center;
  padding: 4rem 2rem;
}

.share-loading p {
  margin-top: 1rem;
  color: var(--text-dimmer);
}

.share-content {
  max-width: 500px;
  margin: 0 auto;
}

.share-profile-card {
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
}

.share-profile-icon {
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.share-profile-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 1.5rem 0;
}

.share-profile-details {
  text-align: left;
  margin-bottom: 1.5rem;
}

.share-detail {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.share-detail:last-child {
  border-bottom: none;
}

.share-detail-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dimmer);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.share-detail-value {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.share-actions {
  margin-top: 1.5rem;
}

.share-note {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-dimmest);
}

.share-qr-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.share-qr-section h3 {
  font-size: 0.9rem;
  color: var(--text-dimmer);
  margin: 0 0 1rem 0;
}

.share-qr-code {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.share-url {
  display: flex;
  gap: 0.5rem;
}

.share-url .text-input {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
}

/* Button Variants */
.btn-primary-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--accent);
  color: #0a0a0f;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary-sm:hover {
  background: var(--accent-dim);
}

/* Setup Error */
.setup-error {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(255, 100, 100, 0.1);
  border: 1px solid rgba(255, 100, 100, 0.3);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--danger);
}

/* Input hint */
.input-hint {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-dimmest);
}

.input-hint a {
  color: var(--text-dim);
  text-decoration: underline;
}

.input-hint a:hover {
  color: var(--accent);
}

/* Sync Result */
.sync-result {
  text-align: center;
  padding: 1rem 0;
}

.sync-result-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--accent) 0%, #00a896 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #0a0a0f;
}

.sync-result-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.sync-result-text strong {
  color: var(--accent);
}

/* Sync Banner */
.sync-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.sync-banner-icon {
  font-size: 1.1rem;
  color: var(--accent);
  animation: spin 2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.sync-banner-text {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.sync-banner-btn {
  padding: 0.4rem 0.75rem;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #0a0a0f;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.sync-banner-btn:hover {
  background: var(--accent-dim);
}

.sync-banner-dismiss {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}

.sync-banner-dismiss:hover {
  color: var(--text-secondary);
}

/* Inline sync result */
.sync-result-inline {
  padding: 0.75rem;
  background: rgba(0, 212, 170, 0.1);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--accent);
  margin-top: 0.75rem;
}
