* { box-sizing: border-box; }
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e3e6ea;
  --text: #1c2330;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-d: #1d4ed8;
  --error: #dc2626;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--error); font-size: 14px; min-height: 18px; }

input, textarea, button {
  font: inherit;
  border-radius: 8px;
}
input, textarea {
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
button {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}
button:hover { background: var(--accent-d); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.ghost:hover { background: #eef0f3; color: var(--text); }

/* Auth */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 10px 30px rgba(0,0,0,.05);
}
.card h1 { margin: 0 0 4px; }
.card form { display: grid; gap: 12px; margin-top: 18px; }
.switch { margin-top: 14px; }
.switch a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* App */
#app { max-width: 760px; margin: 0 auto; padding: 20px; }
header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
header h1 { margin: 0; font-size: 24px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar input { flex: 1; }
.toolbar button { white-space: nowrap; }

.add-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  display: grid;
  gap: 10px;
}
.add-form .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.add-actions { display: flex; align-items: center; gap: 10px; }

.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.list li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.list .name { font-weight: 600; }
.list .org { color: var(--muted); font-size: 14px; }
.list .contact-meta { margin-top: 4px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.list .contact-meta a { color: var(--accent); text-decoration: none; }
.list .notes { margin-top: 6px; font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

@media (max-width: 520px) {
  .add-form .grid { grid-template-columns: 1fr; }
}
