:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-hover: #22263a;
  --bg-input: #141720;
  --border: #2a2f42;
  --text: #e8eaf0;
  --text-muted: #8b90a5;
  --accent: #4f8ef7;
  --accent-hover: #3a7ae8;
  --danger: #e74c5e;
  --danger-hover: #c93d4e;
  --success: #3ecf8e;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Auth screen */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #1a2540 0%, var(--bg) 70%);
}

.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.logo { text-align: center; margin-bottom: 32px; }
.logo-icon { font-size: 48px; margin-bottom: 8px; }
.logo h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.subtitle { color: var(--text-muted); font-size: 14px; margin-top: 6px; }

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 8px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 20%;
}
.step-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
  text-align: center;
}

.auth-form .form-group { margin-bottom: 16px; }
.auth-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.auth-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.auth-input:focus { border-color: var(--accent); }

.error-msg {
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

/* App layout */
#app-screen { min-height: 100vh; display: flex; flex-direction: column; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.logo-small { font-size: 24px; }
.brand { font-weight: 700; font-size: 18px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.user-badge {
  background: var(--bg-hover);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.layout { display: flex; flex: 1; }

.sidebar {
  width: 220px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-shrink: 0;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, color 0.2s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: rgba(79,142,247,0.15); color: var(--accent); }
.nav-icon { font-size: 18px; }

.stats {
  margin-top: auto;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stat-item { display: flex; flex-direction: column; }
.stat-value { font-size: 18px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); }

.main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.toolbar h2 { font-size: 22px; font-weight: 700; }
.toolbar-actions { display: flex; gap: 10px; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  margin-bottom: 20px;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(79,142,247,0.05);
}
.drop-icon { font-size: 32px; display: block; margin-bottom: 8px; }
.drop-zone p { color: var(--text-muted); font-size: 14px; }

/* File list */
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.2s;
}
.file-item:hover { background: var(--bg-hover); }
.file-icon { font-size: 28px; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.file-actions { display: flex; gap: 8px; flex-shrink: 0; }
.file-actions .btn { padding: 8px 14px; font-size: 13px; }

.upload-btn { cursor: pointer; }
.upload-btn input { display: none; }

.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}
.empty-state span { font-size: 40px; display: block; margin-bottom: 12px; }

/* Notes */
.notes-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  height: calc(100vh - 160px);
}

.notes-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
}
.note-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}
.note-item:hover { background: var(--bg-hover); }
.note-item.active { background: rgba(79,142,247,0.1); border-left: 3px solid var(--accent); }
.note-item-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-item-preview {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-item-date { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.note-editor {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.note-editor-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.note-editor-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 12px;
}
.note-title-input {
  font-size: 20px;
  font-weight: 700;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  padding: 8px 0;
  outline: none;
}
.note-content-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  resize: none;
  outline: none;
}
.note-actions { display: flex; gap: 10px; padding-top: 8px; }
.note-actions .btn { width: auto; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .notes-layout { grid-template-columns: 1fr; height: auto; }
  .notes-list { max-height: 200px; }
}
