:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #162033;
  --muted: #657085;
  --line: #d9dfeb;
  --primary: #155eef;
  --primary-dark: #0f3f9f;
  --danger: #a4262c;
  --shadow: 0 10px 30px rgba(24, 36, 56, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 14px;
  cursor: pointer;
}
.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 700;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px clamp(14px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #0f172a;
  color: white;
  font-weight: 800;
}
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 2px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-button { width: 42px; padding: 0; }
.page {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 28px) 40px;
}
.narrow { width: min(860px, 100%); }
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.filters {
  display: grid;
  grid-template-columns: minmax(180px, 360px) 180px 96px;
  gap: 8px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
}
.last-update {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stats div, .form-shell, .notes-panel, .login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.stats div { padding: 14px; }
.stats strong { display: block; font-size: 1.7rem; }
.stats span { color: var(--muted); }
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 12px;
  align-items: start;
}
.lane {
  background: #eef2f8;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 220px;
}
.lane h2 {
  margin: 0;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 1rem;
}
.lane-items {
  display: grid;
  gap: 10px;
  padding: 10px;
}
.empty { color: var(--muted); margin: 8px; }
.card {
  background: white;
  border: 1px solid var(--line);
  border-left: 5px solid #98a2b3;
  border-radius: 8px;
  padding: 12px;
}
.marker-blue { border-left-color: #155eef; }
.marker-red { border-left-color: #c01048; }
.marker-green { border-left-color: #16803c; }
.marker-amber { border-left-color: #b54708; }
.card-head {
  display: flex;
  gap: 10px;
  align-items: start;
}
.marker {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: currentColor;
  margin-top: 5px;
}
.marker-blue .marker { color: #155eef; }
.marker-red .marker { color: #c01048; }
.marker-green .marker { color: #16803c; }
.marker-amber .marker { color: #b54708; }
.card h3 { margin: 0; font-size: 1rem; }
.card p { margin: 3px 0 0; color: var(--muted); overflow-wrap: anywhere; }
dl { display: grid; gap: 6px; margin: 12px 0; }
dl div { display: flex; justify-content: space-between; gap: 10px; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; font-weight: 700; overflow-wrap: anywhere; }
.notes { border-top: 1px solid var(--line); padding-top: 8px; }
.card-actions, .form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}
.card-actions a, .card-actions button, .note-list button, .form-actions a {
  color: var(--primary-dark);
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
  font-weight: 700;
}
.card-actions button, .note-list button { color: var(--danger); }
.notes-panel {
  margin-top: 16px;
  padding: 16px;
}
.notes-panel h2, .form-shell h1 { margin: 0 0 12px; }
.note-form { display: grid; gap: 8px; }
.note-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.note-list article {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.note-list p { margin: 0; color: var(--muted); }
.form-shell { padding: 18px; }
.item-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
label { display: grid; gap: 6px; font-weight: 700; }
label input, label select, label textarea { font-weight: 400; }
.span-two, .form-actions { grid-column: 1 / -1; }
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.login-shell { width: min(420px, 100%); }
.login-card { padding: 22px; }
.auth-brand { margin-bottom: 18px; }
.login-card form { display: grid; gap: 12px; }
.error {
  border: 1px solid #f3b5b8;
  background: #fff1f2;
  color: var(--danger);
  border-radius: 8px;
  padding: 10px;
}

@media (max-width: 1180px) {
  .board { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
}
@media (max-width: 720px) {
  .topbar { align-items: flex-start; }
  .brand small { display: none; }
  .button.primary { min-width: 92px; text-align: center; }
  .toolbar, .note-list article { display: grid; }
  .filters, .stats, .board, .item-form { grid-template-columns: 1fr; }
  .last-update { white-space: normal; }
  .span-two, .form-actions { grid-column: auto; }
}
