:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #d9e1ec;
  --text: #142033;
  --text-soft: #5b667a;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--text);
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(217, 225, 236, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.title-row,
.nav-row,
.search-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.title-row {
  align-items: flex-start;
}

.title-group {
  min-width: 0;
}

.title-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.status-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.page-title,
.login-card h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-copy {
  margin: 0.5rem 0 1rem;
  color: var(--text-soft);
}

.editor,
input,
button,
.button {
  font-size: 16px;
}

.nav-row a {
  color: var(--text-soft);
  text-decoration: none;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid transparent;
}

.nav-row a:hover,
.nav-row a:focus-visible {
  color: var(--accent);
  border-color: var(--accent-soft);
  outline: none;
}

.search-row input,
.pin-input {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
}

.date-row input:focus,
.search-row input:focus,
.pin-input:focus,
.editor:focus {
  outline: 2px solid rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.45);
}

.button,
button {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.button:hover,
button:hover {
  filter: brightness(1.03);
}

.button-secondary {
  background: #e8edf5;
  color: var(--text);
  box-shadow: none;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-soft);
  box-shadow: none;
  border: 1px solid var(--border);
  font-size: 1rem;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--accent);
  border-color: var(--accent-soft);
  outline: none;
}

.calendar-button {
  font-size: 1.05rem;
}

.date-picker-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.editor-card {
  padding: 0.4rem;
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.7rem 0;
}

.toolbar-button {
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
}

.editor {
  width: 100%;
  min-height: 72vh;
  padding: 1.35rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #fcfdff;
  color: var(--text);
  line-height: 1.7;
  resize: vertical;
  margin-top: 0.4rem;
}

.status {
  color: var(--text-soft);
  font-size: 0.92rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
}

.banner {
  background: #fff8e8;
  border: 1px solid #f7dd9a;
  padding: 0.75rem;
  border-radius: 12px;
}

.hidden {
  display: none;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-card {
  padding: 2rem;
  width: min(90vw, 360px);
}

.pin-input {
  width: 100%;
  margin-bottom: 0.75rem;
}

.error {
  color: #a40000;
}

.search-results {
  background: var(--surface);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.search-results h2 {
  margin-top: 0;
}

.search-row {
  align-items: stretch;
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
}

.search-results ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.85rem;
}

.search-results li {
  padding: 0.85rem 0.95rem;
  background: var(--surface-muted);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.search-results a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.snippet {
  color: var(--text-soft);
  white-space: pre-wrap;
  margin-top: 0.35rem;
}

@media (max-width: 720px) {
  .page {
    padding: 1rem 0.75rem 2rem;
  }

  .topbar {
    padding: 1rem;
  }

  .title-row,
  .nav-row,
  .search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .status {
    width: fit-content;
  }

  .nav-row a,
  .button,
  button,
  .search-row input {
    width: 100%;
    text-align: center;
  }

  .status-actions {
    width: 100%;
    justify-content: space-between;
  }

  .title-line {
    align-items: center;
  }
}
