:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --line: #d8dee8;
  --text: #1a2233;
  --muted: #5c6b82;
  --brand: #2b3d6b;
  --brand-soft: #e8f0fb;
  --accent: #0d7a56;
  --danger: #c62828;
  --shadow: 0 18px 50px rgb(16 32 64 / 8%);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

.page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .page { grid-template-columns: minmax(280px, 1fr) minmax(360px, 520px); }
}

.hero {
  display: none;
  padding: 2.5rem;
  background: linear-gradient(145deg, #1a2540 0%, #2b3d6b 50%, #1e3d5c 100%);
  color: #eef4ff;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 900px) {
  .hero { display: flex; }
}

.hero-title {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.65rem;
  font-weight: 600;
}

.hero-text, .hero-list {
  color: rgb(232 240 255 / 82%);
  line-height: 1.55;
}

.hero-list {
  margin: 1.25rem 0 0;
  padding-left: 1.2rem;
}

.hero-foot {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.65;
}

.main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 3rem;
}

.login-wrap, .dashboard {
  width: 100%;
  max-width: 420px;
}

.dashboard { max-width: 720px; }

.login-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.brand {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--brand);
}

.sub {
  margin: 0.1rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  font-weight: 650;
}

.lead {
  margin: 0 0 1.35rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form label span {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
}

input, textarea, button {
  font: inherit;
}

input, textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

#btn-login {
  position: relative;
  margin-top: 0.25rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

#btn-login:hover { filter: brightness(1.05); }
#btn-login:disabled { opacity: 0.75; cursor: wait; }

.btn-spin {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-left: 0.5rem;
  border: 2px solid rgb(255 255 255 / 35%);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: middle;
  animation: spin 0.7s linear infinite;
}

#btn-login[aria-busy="true"] .btn-label { opacity: 0.85; }
#btn-login[aria-busy="true"] .btn-spin { display: inline-block; }

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

.form-msg {
  margin: 1rem 0 0;
  font-size: 0.9rem;
}

.form-msg.err { color: var(--danger); }

.dashboard h1 {
  margin: 0.15rem 0 0;
  font-size: 1.25rem;
}

.dash-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.dash-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.tile.wide { max-width: 100%; }

.tile h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.tile-desc {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.btn-row { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.65rem; }

.btn-sm, .btn-outline {
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
}

.btn-sm.primary, #note-form button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-outline {
  background: transparent;
}

.code-block {
  margin: 0;
  padding: 0.65rem;
  border-radius: 8px;
  background: #f0f3f8;
  border: 1px solid var(--line);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.75rem;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
}

.stack { display: flex; flex-direction: column; gap: 0.5rem; }

.feed {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.feed li {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 0.85rem;
  background: var(--bg);
}

.feed.mono li { font-family: ui-monospace, Consolas, monospace; font-size: 0.72rem; }

.feed .meta { color: var(--muted); font-size: 0.75rem; display: block; }
