:root {
  --color-bg: #ffffff;
  --color-bg-soft: #f7f7f8;
  --color-text: #111111;
  --color-text-muted: #6b7280;
  --color-border: #ececec;
  --color-primary: #5b4fe5;
  --color-primary-dark: #4338ca;
  --color-accent: #d6fb3d;
  --color-accent-dark: #aacf12;
  --color-fixed: #ff7a45;
  --color-added: #2bb673;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --font: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

a { color: inherit; }

h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #ffffff;
  border-bottom: 1px solid var(--color-border);
}

.topbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  font-size: 20px;
  text-decoration: none;
  color: var(--color-text);
}

.logo__img {
  height: 26px;
  width: auto;
  display: block;
}

.logo__suffix {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 15px;
  padding-left: 8px;
  border-left: 1px solid var(--color-border);
}

.topbar__search { flex: 1; max-width: 420px; }

.topbar__search input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-bg-soft);
  font-family: var(--font);
  font-size: 14px;
}

.topbar__search input:focus { outline: 2px solid var(--color-primary); }

/* ---------- Buttons ---------- */

.btn {
  font-family: var(--font);
  font-weight: 700;
  font-size: 14px;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.98); }

.btn--primary {
  background: var(--color-primary);
  color: #fff;
}

.btn--primary:hover { background: var(--color-primary-dark); }

.btn--block { width: 100%; padding: 13px; font-size: 15px; }

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn--ghost:hover { color: var(--color-text); border-color: var(--color-text); }

/* ---------- Layout ---------- */

.layout {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  padding: 32px 24px 96px;
  min-width: 0;
}

.layout > * { min-width: 0; }

.sidebar {
  position: sticky;
  top: calc(var(--topbar-h, 65px) + 20px);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-height: calc(100vh - var(--topbar-h, 65px) - 32px);
  overflow-y: auto;
}

.sidebar__block h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.filter-list { display: flex; flex-direction: column; gap: 4px; }

.filter-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  color: var(--color-text);
}

.filter-chip:hover { background: var(--color-bg-soft); }

.filter-chip.is-active { background: #111; color: #fff; }

.filter-chip__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filter-chip__count {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 12px;
}

.filter-chip.is-active .filter-chip__count { color: rgba(255, 255, 255, 0.65); }

.month-nav { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }

.month-nav a {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 14px;
  text-decoration: none;
  color: var(--color-text-muted);
}

.month-nav a:hover { background: var(--color-bg-soft); color: var(--color-text); }

.month-nav a span.count {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 12px;
}

/* ---------- Content ---------- */

.content__head { margin-bottom: 40px; }

.content__head h1 { font-size: 40px; }

.content__subtitle { color: var(--color-text-muted); margin-top: 8px; font-size: 15px; }

.timeline { display: flex; flex-direction: column; }

.month-group { margin-bottom: 48px; }

.month-group__title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 20px;
  scroll-margin-top: calc(var(--sticky-h, 90px) + 16px);
}

.entry {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 20px;
  padding: 18px 0;
  border-top: 1px solid var(--color-border);
  min-width: 0;
}

.entry > * { min-width: 0; }

.entry:first-child { border-top: none; }

.entry__date {
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
  padding-top: 2px;
  white-space: nowrap;
}

.entry__body {
  background: var(--color-bg-soft);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.entry__tags { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
}

.tag--added { background: rgba(43, 182, 115, 0.12); color: var(--color-added); }
.tag--improved { background: rgba(91, 79, 229, 0.12); color: var(--color-primary); }
.tag--fixed { background: rgba(255, 122, 69, 0.14); color: var(--color-fixed); }
.tag--other { background: var(--color-bg); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.tag--area { background: #111; color: var(--color-accent); }
.tag--owner { background: var(--color-bg); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.tag--category { background: rgba(91, 79, 229, 0.08); color: var(--color-primary); border: 1px solid rgba(91, 79, 229, 0.18); }

.entry__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
}

.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: 80px 0;
}

/* ---------- Login page ---------- */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-soft);
  background-image: radial-gradient(circle at 20% 20%, rgba(214, 251, 61, 0.35), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(91, 79, 229, 0.15), transparent 45%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.06);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 22px;
  margin-bottom: 8px;
}

.login-sub { color: var(--color-text-muted); font-size: 14px; margin: 0 0 24px; }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; }

.field input {
  font-family: var(--font);
  font-size: 15px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-soft);
}

.field input:focus { outline: 2px solid var(--color-primary); }

.login-error { color: var(--color-fixed); font-size: 13px; font-weight: 600; margin: 0; }

html { overflow-x: clip; }
body { overflow-x: clip; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 24px; padding-top: 16px; }

  .sidebar {
    position: sticky;
    top: var(--topbar-h, 65px);
    z-index: 5;
    flex-direction: column;
    gap: 8px;
    max-height: none;
    overflow: visible;
    background: #fff;
    margin: 0 -16px;
    padding: 10px 16px 12px;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 8px 16px -12px rgba(0, 0, 0, 0.12);
  }

  .sidebar__block { display: flex; align-items: center; gap: 10px; }

  .sidebar__block h3 {
    margin-bottom: 0;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .entry { grid-template-columns: 1fr; gap: 6px; }
  .entry__date { padding-top: 0; }

  .filter-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
  }

  .filter-chip { flex: 0 0 auto; white-space: nowrap; padding: 6px 10px; }

  .month-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-height: none;
    gap: 6px;
  }

  .month-nav a {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    background: var(--color-bg-soft);
    white-space: nowrap;
    padding: 6px 10px;
  }
}

@media (max-width: 600px) {
  .topbar__inner {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 10px;
  }

  .topbar__search { order: 3; max-width: none; flex-basis: 100%; }

  .layout { padding: 16px 16px 64px; }

  .content__head h1 { font-size: 28px; }

  .entry__body { padding: 14px 16px; }

  .login-card { padding: 28px 22px; }

  .sidebar { flex-direction: column; align-items: stretch; gap: 8px; }
  .sidebar__block { gap: 8px; }
}
