:root {
  --ink: #16352c;
  --ink-soft: #3d5c52;
  --muted: #6a857a;
  --line: rgba(22, 53, 44, 0.12);
  --paper: rgba(255, 255, 255, 0.72);
  --paper-strong: #f7fcf9;
  --accent: #1b7a5c;
  --accent-deep: #0f5a43;
  --accent-soft: #d7f0e4;
  --sky: #d9eef7;
  --leaf: #e7f6ee;
  --warn: #b45309;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(22, 53, 44, 0.08);
  --radius: 18px;
  --font-display: "Noto Serif SC", "Fraunces", serif;
  --font-body: "Noto Sans SC", system-ui, sans-serif;
  --header-h: 72px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background: #eef8f2;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

.bg-atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 480px at 12% -10%, rgba(61, 155, 122, 0.22), transparent 60%),
    radial-gradient(700px 420px at 90% 8%, rgba(90, 170, 200, 0.2), transparent 55%),
    linear-gradient(165deg, #eaf7f0 0%, #e4f2f8 48%, #f4faf6 100%);
}

.bg-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(22, 53, 44, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 53, 44, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 clamp(1rem, 4vw, 3rem);
  backdrop-filter: blur(14px);
  background: rgba(238, 248, 242, 0.78);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  background: rgba(247, 252, 249, 0.9);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.logo-mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.45rem;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 0 0 5px rgba(47, 155, 116, 0.12);
  animation: breathe 4.5s ease-in-out infinite;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-left: auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.site-nav a {
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--accent-deep);
}

.nav-cta {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(27, 122, 92, 0.22);
}

.nav-cta:hover {
  background: var(--accent-deep);
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  padding: 0;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  margin-inline: auto;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-toggle.is-open span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.menu-toggle.is-open span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

#app {
  min-height: calc(100vh - var(--header-h) - 88px);
}

.site-footer {
  padding: 2rem clamp(1rem, 4vw, 3rem) 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Hero */
.hero {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  align-content: center;
  gap: 1.4rem;
  padding: clamp(2rem, 8vh, 5rem) clamp(1.2rem, 5vw, 4rem) 4rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: auto -8% -20% 35%;
  height: min(70vh, 640px);
  background:
    radial-gradient(circle at 30% 40%, rgba(110, 200, 166, 0.45), transparent 42%),
    radial-gradient(circle at 70% 50%, rgba(154, 215, 234, 0.4), transparent 46%);
  filter: blur(8px);
  animation: drift 12s ease-in-out infinite alternate;
  pointer-events: none;
}

.brand-hero {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 10vw, 6.8rem);
  line-height: 1;
  letter-spacing: 0.12em;
  margin: 0;
  animation: rise 0.8s ease both;
}

.hero-title {
  position: relative;
  max-width: 14ch;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.4vw, 2.35rem);
  font-weight: 600;
  line-height: 1.35;
  animation: rise 0.9s ease 0.08s both;
}

.hero-lead {
  position: relative;
  max-width: 36rem;
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  animation: rise 1s ease 0.16s both;
}

.hero-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.4rem;
  animation: rise 1.05s ease 0.24s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 46px;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 28px rgba(27, 122, 92, 0.22);
}

.btn-primary:hover {
  background: var(--accent-deep);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.55);
  border-color: var(--line);
  color: var(--ink);
}

.btn-danger {
  background: transparent;
  border-color: rgba(180, 35, 24, 0.28);
  color: var(--danger);
}

.section {
  padding: 1.5rem clamp(1.2rem, 5vw, 4rem) 3.5rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
}

.section-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search-box,
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(27, 122, 92, 0.45);
  box-shadow: 0 0 0 4px rgba(27, 122, 92, 0.1);
}

.search-box {
  max-width: 420px;
}

.category-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.category-chip {
  display: block;
  padding: 1.15rem 1.2rem;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-chip:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.category-chip h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.category-chip p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.category-chip .meta {
  margin-top: 0.8rem;
  font-size: 0.82rem;
  color: var(--accent-deep);
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.post-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
  transition: background 0.2s ease;
}

.post-row:first-child {
  border-top: 1px solid var(--line);
}

.post-row:hover .post-title {
  color: var(--accent-deep);
}

.post-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.tag,
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.75rem;
}

.pill.pin {
  background: #fff3cd;
  color: #8a5a00;
}

.post-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  transition: color 0.2s ease;
}

.post-summary {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
}

.post-side {
  text-align: right;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.page-banner {
  padding: 2.5rem clamp(1.2rem, 5vw, 4rem) 0.5rem;
}

.page-banner h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.page-banner p {
  margin: 0.6rem 0 0;
  color: var(--muted);
  max-width: 40rem;
}

.article-shell {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem clamp(1.2rem, 4vw, 2rem) 3rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 1rem 0 1.5rem;
}

.article-body {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: clamp(1.2rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}

.article-body h1,
.article-body h2,
.article-body h3 {
  font-family: var(--font-display);
  line-height: 1.35;
}

.article-body h1 {
  font-size: 1.8rem;
  margin-top: 0;
}

.article-body blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  background: rgba(215, 240, 228, 0.35);
  color: var(--ink-soft);
}

.article-body h2,
.article-body h3 {
  scroll-margin-top: calc(var(--header-h) + 12px);
}

.article-body pre {
  overflow: auto;
  padding: 1rem;
  border-radius: 12px;
  background: #14352c;
  color: #e8fff5;
}

.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.article-body :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--accent-soft);
}

.article-body img.zoomable-image,
.article-body img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: 1rem auto;
  border-radius: 10px;
  cursor: zoom-in;
}

.article-body .embed-html img {
  margin: 0;
  border-radius: 0;
  cursor: default;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
}

.image-lightbox[hidden] {
  display: none !important;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 24, 20, 0.72);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 1100px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.lightbox-image {
  max-width: 100%;
  max-height: calc(88vh - 70px);
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  transform-origin: center center;
  transition: transform 0.15s ease;
  cursor: default;
}

.lightbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.lightbox-toolbar .btn {
  background: rgba(255, 255, 255, 0.92);
}

body.lightbox-open {
  overflow: hidden;
}

.embed-html {
  margin: 1.2rem 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.embed-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.88rem;
}

.embed-tip {
  color: var(--muted);
  font-size: 0.8rem;
}

.embed-toolbar a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.embed-html iframe {
  display: block;
  width: 100%;
  min-height: 360px;
  border: 0;
  background: #fff;
}

.asset-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.asset-kind {
  display: inline-flex;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.75rem;
  font-weight: 600;
}

.asset-name {
  color: var(--ink);
  font-weight: 500;
  word-break: break-all;
}

.asset-size {
  color: var(--muted);
  font-size: 0.85rem;
}

.asset-open {
  margin-left: auto;
  color: var(--accent-deep);
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.editor-toolbar-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-sm {
  min-height: 36px;
  padding: 0.35rem 0.9rem;
  font-size: 0.88rem;
}

.editor-wrap {
  position: relative;
}

.editor-drop-hint {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(215, 240, 228, 0.88);
  color: var(--accent-deep);
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.editor-drop-hint.is-active {
  opacity: 1;
}

.rich-editor {
  min-height: 420px;
  max-height: none;
  outline: none;
  cursor: text;
  box-shadow: none;
}

.rich-editor:focus {
  border-color: rgba(27, 122, 92, 0.45);
  box-shadow: 0 0 0 4px rgba(27, 122, 92, 0.1);
}

.rich-editor:empty::before,
.rich-editor[data-placeholder]:has(> p:only-child:has(> br:only-child))::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.editor-bottom-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.editor-bottom-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  position: relative;
  max-width: min(42vw, 12rem);
}

.auth-user {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
}

.user-menu {
  position: relative;
  max-width: 100%;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  min-height: 36px;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.user-menu-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 9rem;
}

.user-menu-trigger:hover,
.user-menu.is-open .user-menu-trigger {
  border-color: rgba(27, 122, 92, 0.35);
  background: var(--accent-soft);
}

.user-menu-caret {
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.55;
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  left: auto;
  z-index: 50;
  min-width: 11.5rem;
  width: max-content;
  max-width: min(16rem, calc(100vw - 1.5rem));
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(247, 252, 249, 0.98);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.15rem;
  box-sizing: border-box;
}

.user-menu-panel[hidden] {
  display: none !important;
}

.user-menu-panel a,
.user-menu-panel button {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem 0.85rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.35;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.user-menu-panel a:hover,
.user-menu-panel button:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.auth-switch {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-pill {
  margin-left: 0.35rem;
  background: #e8f1ff;
  color: #1d4f91;
  vertical-align: middle;
}

.readonly-hint {
  align-self: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 1.25rem 0;
}

.comments {
  margin-top: 2rem;
}

.comments h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 1rem;
}

.comment {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.comment .who {
  font-weight: 600;
  margin-right: 0.5rem;
}

.comment .when {
  color: var(--muted);
  font-size: 0.82rem;
}

.comment p {
  margin: 0.4rem 0 0;
}

.comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.comment-reply {
  border-left: 2px solid var(--line);
  padding-left: 0.75rem;
}

.comment .markdown-body {
  margin-top: 0.4rem;
}

.comment .markdown-body p {
  margin: 0.35rem 0;
}

.comment .markdown-body pre {
  overflow: auto;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  background: #14352c;
  color: #e8fff5;
  font-size: 0.86rem;
}

.form-card {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem clamp(1.2rem, 4vw, 2rem) 3rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: clamp(1.2rem, 3vw, 1.8rem);
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field label {
  font-size: 0.92rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.field textarea {
  min-height: 280px;
  resize: vertical;
  line-height: 1.65;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.empty,
.error-box,
.loading {
  padding: 2rem 0;
  color: var(--muted);
  text-align: center;
}

.error-box {
  color: var(--danger);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  max-width: min(90vw, 420px);
  text-align: center;
  transition: transform 0.28s ease, opacity 0.28s ease, visibility 0.28s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(47, 155, 116, 0.12);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 10px rgba(47, 155, 116, 0.08);
  }
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-3%, -2%, 0) scale(1.05);
  }
}

@media (max-width: 900px) {
  .category-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .post-row {
    grid-template-columns: 1fr;
  }

  .post-side {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .menu-toggle {
    display: inline-flex;
  }

  .site-header {
    gap: 0.65rem;
  }

  .site-nav {
    position: fixed;
    inset: var(--header-h) 1rem auto;
    left: 1rem;
    right: 1rem;
    margin-left: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    padding: 0.8rem;
    border-radius: 16px;
    background: rgba(247, 252, 249, 0.96);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    z-index: 30;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
  }

  .nav-cta {
    text-align: center;
  }

  .header-actions {
    margin-left: auto;
  }

  .auth-nav {
    max-width: min(46vw, 10.5rem);
  }

  .user-menu-label {
    max-width: 7.5rem;
  }

  .user-menu-panel {
    min-width: 12rem;
    right: 0;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar .search-box {
    max-width: none;
    width: 100%;
  }

  .category-rail,
  .field-row {
    grid-template-columns: 1fr;
  }
}

.tag-link {
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.tag-link:hover,
.tag-link.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.tag-count {
  opacity: 0.65;
  font-size: 0.78em;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.25rem;
}

.public-pill {
  background: #e5f3ea;
  color: #1b7a5c;
}

.visibility-banner {
  margin: 0.85rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.visibility-banner.is-private {
  background: #fff3d6;
  color: #8a5a00;
  border: 1px solid rgba(138, 90, 0, 0.18);
}

.visibility-banner.is-public {
  background: #e5f3ea;
  color: #1b7a5c;
  border: 1px solid rgba(27, 122, 92, 0.18);
}

.notes-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.notes-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  flex: 1 1 240px;
  min-width: 0;
  justify-content: flex-end;
}

.notes-search {
  flex: 1 1 180px;
  width: auto;
  max-width: none;
  min-width: 0;
}

.notes-sort {
  flex: 0 1 10.5rem;
  width: auto;
  max-width: 100%;
  min-width: 0;
}

.notes-write {
  flex: 0 0 auto;
  white-space: nowrap;
}

.archive-toolbar .archive-select {
  max-width: 220px;
}

.notes-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.notes-tab {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
}

.notes-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-color: transparent;
}

.notes-summary {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.note-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.format-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.article-toc {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
}

.toc-title {
  font-weight: 650;
  margin-bottom: 0.45rem;
  color: var(--accent-deep);
}

.article-toc ol {
  margin: 0;
  padding-left: 1.1rem;
}

.article-toc li {
  margin: 0.25rem 0;
}

.article-toc .toc-h3 {
  margin-left: 0.85rem;
  list-style-type: circle;
}

.article-toc a {
  color: var(--ink-soft);
  text-decoration: none;
}

.article-toc a:hover {
  color: var(--accent-deep);
  text-decoration: underline;
}

.attachment-panel {
  margin-top: 1.75rem;
}

.attachment-panel h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
}

.attachment-list {
  display: grid;
  gap: 0.55rem;
}

.nav-extra {
  font-size: 0.9rem;
}

.admin-panel {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.admin-tab {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.65);
}

.admin-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-color: transparent;
}

.admin-form {
  margin-bottom: 1.5rem;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.admin-table th,
.admin-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  background: rgba(215, 240, 228, 0.45);
  font-weight: 600;
}

.admin-input {
  width: 100%;
  min-width: 6rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.pager-status {
  color: var(--muted);
  font-size: 0.9rem;
}

.pager .is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Mobile overrides must come after component base styles */
@media (max-width: 720px) {
  .notes-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .notes-tabs {
    width: 100%;
  }

  .notes-tab {
    flex: 1 1 auto;
    text-align: center;
  }

  .notes-filters {
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    flex: none;
    width: 100%;
  }

  .notes-search,
  .notes-sort,
  .notes-write {
    width: 100%;
    max-width: none;
    flex: none;
  }

  .archive-toolbar .archive-select {
    max-width: none;
    width: 100%;
  }

  .notes-write {
    text-align: center;
  }

  .form-card {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .form-grid {
    padding: 1rem;
  }

  .format-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .format-toolbar .btn {
    width: 100%;
    min-width: 0;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
    font-size: 0.82rem;
  }

  .editor-bottom-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .editor-bottom-bar .btn {
    width: 100%;
    justify-content: center;
  }

  .editor-bottom-hint {
    line-height: 1.45;
  }

  .article-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .article-actions .btn,
  .article-actions a.btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .note-row-actions {
    width: 100%;
  }

  .note-row-actions .btn {
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
  }
}

