:root {
  --bg: #ffffff;
  --text: #111111;
  --text-muted: #6b6b6b;
  --border: #ececec;
  --danger: #d1453b;
  --max-width: 40rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

header .brand {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: inherit;
  text-decoration: none;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

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

main {
  flex: 1;
  padding: 2.5rem 1.5rem;
  display: flex;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: var(--max-width);
}

.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 22rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
}

.login-card h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
  text-align: center;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
input:focus, textarea:focus {
  outline: none;
  border-color: #bbb;
}
textarea {
  resize: vertical;
  min-height: 4.5rem;
}

button.btn {
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  border: none;
  background: var(--text);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
button.btn:hover { background: #000; }
button.btn:disabled { opacity: 0.5; cursor: default; }
.login-card button.btn { width: 100%; }

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  text-align: center;
  min-height: 1.1em;
}

.back-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}
.back-link:hover { color: var(--text); }

.page-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.page-title-row h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.delete-link:hover { color: var(--danger); }

.section { margin-bottom: 2.5rem; }
.section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
}
.section-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.5;
}
.section-hint a { color: inherit; }

.company-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}
.company-card:hover { border-color: #ccc; }
.company-card .note-meta time { margin-left: auto; }

.source-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: #f6f6f6;
  border-radius: 5px;
  padding: 0.15rem 0.5rem;
  margin-bottom: 0.5rem;
}

.analysis-card p { color: var(--text); font-size: 0.92rem; }

.copy-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 0.75rem;
}

#copy-prompt-btn { margin-bottom: 1.25rem; }

.note-form {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.note-form button.btn { align-self: flex-end; }

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.note-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.note-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.note-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: pre-wrap;
  line-height: 1.5;
}

.note-meta {
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.note-meta time { font-size: 0.75rem; color: #999; }

.note-actions { display: flex; gap: 0.75rem; }
.note-actions button {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}
.note-actions button:hover { color: var(--text); }
.note-actions button.delete:hover { color: var(--danger); }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
}

footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
