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

:root {
  --bg: #0f0f13;
  --bg-card: #18181f;
  --bg-input: #1e1e28;
  --border: #2a2a38;
  --border-hover: #3a3a50;
  --text: #e8e8f0;
  --text-muted: #8888a8;
  --text-dim: #555568;
  --accent: #7c6af7;
  --accent-hover: #9180ff;
  --accent-light: rgba(124, 106, 247, 0.12);
  --danger: #f0544f;
  --danger-light: rgba(240, 84, 79, 0.1);
  --success: #4ade80;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.3);
}

html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Header */
.site-header {
  background: rgba(15,15,19,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.logo:hover { color: var(--text); opacity: 0.85; }
.logo svg { color: var(--accent); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm { padding: 5px 11px; font-size: 0.8125rem; }
.btn-full { width: 100%; justify-content: center; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: var(--bg-input);
  color: var(--text);
  border-color: var(--border);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid transparent;
}
.btn-danger-ghost:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

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

/* Main */
.main-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 2px;
}

/* Search */
.search-form { flex-shrink: 0; }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  padding: 7px 32px 7px 34px;
  width: 260px;
  transition: border-color 0.15s;
  outline: none;
}

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

.search-clear {
  position: absolute;
  right: 8px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
}
.search-clear:hover { color: var(--text-muted); }

.search-results-note {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

/* Bookmark list */
.bookmark-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bookmark-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color 0.15s;
}

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

.bookmark-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.bookmark-meta { flex: 1; min-width: 0; }

.bookmark-title {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.bookmark-title:hover { color: var(--accent-hover); }

.bookmark-url {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.bookmark-url:hover { color: var(--accent); }

.bookmark-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.bookmark-notes {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 10px;
  line-height: 1.5;
}

.bookmark-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.tag {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(124,106,247,0.2);
  transition: all 0.15s;
}
.tag:hover {
  background: rgba(124,106,247,0.22);
  color: var(--accent-hover);
}

.summary-section { margin-top: 10px; }

.summary-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.summary-label-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  display: block;
  margin-bottom: 5px;
}

.summary-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.bookmark-footer {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.bookmark-date {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 72px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  color: var(--text-dim);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.875rem;
  margin-bottom: 20px;
}

/* Form page */
.form-page { max-width: 520px; }

.form-header { margin-bottom: 24px; }

.bookmark-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.required { color: var(--accent); }

.field input,
.field textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  width: 100%;
}

.field input:focus,
.field textarea:focus { border-color: var(--accent); }
.field input::placeholder,
.field textarea::placeholder { color: var(--text-dim); }
.field textarea { resize: vertical; }

.field-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 6px;
}

/* Auth */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-card);
}

.auth-logo {
  color: var(--accent);
  margin-bottom: 16px;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Alerts */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.alert-error {
  background: var(--danger-light);
  border: 1px solid rgba(240,84,79,0.25);
  color: var(--danger);
}

/* Responsive */
@media (max-width: 600px) {
  .page-header { flex-direction: column; }
  .search-input { width: 100%; }
  .search-form { width: 100%; }
  .search-wrap { width: 100%; }
  .bookmark-header { flex-wrap: wrap; }
  .bookmark-actions { order: -1; margin-left: auto; }
  .form-page { max-width: 100%; }
}
