﻿:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #000000;
  --prose: #1a1a1a;
  --muted: #888888;
  --secondary: #555555;
  --divider: #cccccc;
  --border: #e0e0e0;
  --border-light: #cccccc;
  --hover: #333333;
}

* {
  box-sizing: border-box;
  border-radius: 0 !important;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: ui-monospace, "JetBrains Mono", "Consolas", monospace;
  background: var(--bg);
  color: var(--prose);
  font-size: 14px;
  line-height: 1.6;
}

/* ===== topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.repo-badge {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border-light);
  padding: 3px 8px;
}

/* ===== layout ===== */
.layout {
  display: flex;
  min-height: calc(100vh - 53px);
}
.sidebar {
  width: 160px;
  border-right: 1px solid var(--border);
  padding: 16px 0;
  flex-shrink: 0;
  background: var(--surface);
}
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 20px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.nav-item:hover {
  color: var(--text);
}
.nav-item.active {
  color: var(--text);
  border-left-color: var(--text);
  font-weight: 700;
}
.content {
  flex: 1;
  padding: 24px 28px;
  min-width: 0;
  overflow-x: auto;
}

/* ===== view ===== */
.view {
  display: none;
}
.view.active {
  display: block;
  animation: fade-in 0.3s ease both;
}
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.view-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 14px;
}
.status {
  color: var(--muted);
  font-size: 12px;
}

/* ===== inputs ===== */
.input {
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--text);
  outline: none;
}
.input:focus {
  border-color: var(--text);
}
.view-head .input {
  width: 260px;
  max-width: 50vw;
}
.textarea-sm {
  resize: vertical;
}

/* ===== buttons ===== */
.btn {
  font-family: inherit;
  font-size: 13px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover {
  color: var(--text);
  border-color: var(--text);
}
.btn-solid {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.btn-solid:hover {
  opacity: 0.85;
  color: var(--surface);
  border-color: var(--text);
}
.btn-ghost {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  padding: 4px 8px;
}
.btn-ghost:hover {
  color: var(--text);
}
.btn-danger {
  border-color: #d1242f;
  color: #d1242f;
}
.btn-danger:hover {
  background: #d1242f;
  color: #fff;
}

/* ===== table ===== */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  border: 1px solid var(--border);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}
.table th {
  background: #f5f5f5;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table td {
  font-size: 13px;
}
.table tr {
  animation: fade-in 0.3s ease both;
}
.table tr:hover td {
  background: #fafafa;
}
.row-title {
  font-weight: 700;
  color: var(--text);
}
.tag-inline {
  display: inline-block;
  border: 1px solid var(--border-light);
  padding: 1px 6px;
  margin: 2px 4px 2px 0;
  font-size: 11px;
  color: var(--secondary);
}
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  margin-right: 4px;
}
.badge-draft {
  border: 1px solid var(--muted);
  color: var(--muted);
}
.badge-pinned {
  background: var(--text);
  color: var(--surface);
}
.row-actions {
  white-space: nowrap;
}
.link-btn {
  background: none;
  border: none;
  color: var(--secondary);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-right: 8px;
}
.link-btn:hover {
  color: var(--text);
}

/* ===== chips ===== */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-light);
  padding: 4px 10px;
  font-size: 13px;
  color: var(--secondary);
  cursor: pointer;
  background: var(--surface);
  transition: all 0.15s;
}
.chip:hover {
  border-color: var(--text);
  color: var(--text);
}
.chip .count {
  color: var(--muted);
  font-size: 11px;
}
.chip.active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.chip .count {
  opacity: 0.7;
}
.tags-posts {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.tags-posts h3 {
  font-size: 14px;
  color: var(--text);
  margin: 0 0 12px;
}

/* ===== categories ===== */
.cat-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.cat-row {
  display: flex;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 22px 24px;
  cursor: default;
  transition: border-color 0.2s ease;
  animation: fade-in 0.3s ease both;
}
.cat-row:hover {
  border-color: var(--text);
}
.cat-row .cat-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.cat-row .c-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  font-family: ui-monospace, "JetBrains Mono", monospace;
  transition: color 0.2s ease;
}
.cat-row:hover .c-name {
  color: var(--secondary);
}
.cat-row .c-count {
  font-size: 28px;
  font-weight: 700;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  line-height: 1;
  color: var(--divider);
}
.cat-row .cat-dot {
  width: 28px;
  height: 3px;
  display: block;
  border: none;
}
.cat-row .c-unit {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ===== config form ===== */
.form {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field > span {
  font-size: 12px;
  color: var(--secondary);
  font-weight: 700;
}
.field-row {
  display: flex;
  gap: 14px;
}
.field-row .field {
  flex: 1;
}
.field-hint {
  font-size: 11px;
  color: var(--muted);
}
.slug-row {
  display: flex;
  gap: 8px;
}
.slug-row .input {
  flex: 1;
}
.form-actions {
  margin-top: 18px;
}

/* ===== toggle (switch + label on the LEFT) ===== */
.toggles {
  gap: 20px;
}
.toggle-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--secondary);
  cursor: pointer;
  user-select: none;
}
.toggle-left .switch {
  order: 2;
}
.toggle-left .t-label {
  order: 1;
  font-weight: 700;
  color: var(--text);
}

/* ===== MONO switch ===== */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--surface);
  border: 1px solid var(--border-light);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.switch .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--secondary);
  border: 1px solid var(--border-light);
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.switch input:checked ~ .track {
  background: var(--text);
  border-color: var(--text);
}
.switch input:checked ~ .thumb {
  transform: translateX(22px);
  background: var(--surface);
  border-color: var(--text);
}
.switch input:focus-visible ~ .track {
  border-color: var(--text);
}

/* ===== custom select (MONO dropdown) ===== */
.custom-select {
  position: relative;
  display: inline-block;
  min-width: 220px;
}
.custom-select .cs-trigger {
  width: 100%;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.custom-select .cs-trigger::after {
  content: "+";
  color: var(--muted);
  margin-left: 8px;
  font-weight: 700;
}
.custom-select .cs-trigger[aria-expanded="true"]::after {
  content: "-";
}
.cs-panel {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border-light);
  max-height: 240px;
  overflow-y: auto;
  animation: fade-in 0.15s ease both;
}
.cs-option {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--prose);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.cs-option:last-child {
  border-bottom: none;
}
.cs-option:hover {
  background: var(--bg);
  color: var(--text);
}

/* ===== editor modal ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 24px;
}
.modal.hidden,
.hidden {
  display: none !important;
}
.modal-box {
  background: var(--bg);
  border: 1px solid var(--border-light);
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.editor-grid {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 18px 20px;
  gap: 18px;
}
.editor-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.editor-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 360px;
}
.pane {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}
.pane-head {
  padding: 7px 12px;
  background: #f5f5f5;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.content-area {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  padding: 12px;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 13px;
  line-height: 1.7;
  background: var(--surface);
  color: var(--prose);
}
.preview {
  flex: 1;
  padding: 12px 16px;
  overflow-y: auto;
  background: var(--surface);
  color: var(--prose);
  line-height: 1.8;
}
.preview h1,
.preview h2,
.preview h3 {
  font-weight: 700;
  margin: 1em 0 0.5em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3em;
}
.preview code {
  background: #f0f0f0;
  padding: 1px 5px;
  border: 1px solid var(--border);
  font-size: 0.9em;
}
.preview pre {
  background: #1a1a1a;
  color: #f0f0f0;
  padding: 12px 16px;
  overflow-x: auto;
}
.preview pre code {
  background: none;
  border: none;
  color: inherit;
  padding: 0;
}
.preview blockquote {
  border-left: 3px solid var(--text);
  padding-left: 12px;
  color: var(--secondary);
  font-style: italic;
}
.preview a {
  color: var(--text);
  text-decoration: underline;
}
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ===== visual config ===== */
.sec {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 22px 0 4px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.sec:first-child {
  margin-top: 0;
}
.btn-sm {
  font-family: inherit;
  font-size: 11px;
  padding: 3px 9px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--secondary);
  cursor: pointer;
}
.btn-sm:hover {
  color: var(--text);
  border-color: var(--text);
}
.rows {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border: 1px dashed var(--border);
  padding: 10px;
}
.row {
  display: flex;
  gap: 7px;
  align-items: center;
}
.row-in {
  flex: 1;
}
.row-del {
  flex-shrink: 0;
  color: var(--muted);
}
.row-del:hover {
  color: #d1242f;
  border-color: #d1242f;
}

/* ===== tag suggest ===== */
.suggest {
  border: 1px solid var(--border-light);
  background: var(--surface);
  max-height: 160px;
  overflow-y: auto;
}
.suggest-item {
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.suggest-item:last-child {
  border-bottom: none;
}
.suggest-item:hover {
  background: var(--bg);
  color: var(--text);
}
.chip.removable {
  cursor: default;
}
.chip .x {
  cursor: pointer;
  color: var(--muted);
  margin-left: 2px;
}
.chip .x:hover {
  color: #d1242f;
}

/* ===== color config ===== */
.color-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border: 1px solid var(--border);
  padding: 12px;
}
.color-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.color-row .swatch {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-light);
  background: none;
  cursor: pointer;
  flex-shrink: 0;
}
.color-row .color-hex {
  flex: 1;
  font-family: ui-monospace, monospace;
}
.color-row .c-name {
  width: 140px;
  font-size: 13px;
  color: var(--text);
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.color-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
}
.cat-dot {
  width: 12px;
  height: 12px;
  display: inline-block;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
}
.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.mini-row:last-child {
  border-bottom: none;
}

@media (max-width: 860px) {
  .editor-body {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 110px;
  }
  .field-row {
    flex-direction: column;
  }
}

/* ===== animations (MONO: opacity only, <=500ms, no overshoot) ===== */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== toast (bottom-right) ===== */
.toast-box {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, 90vw);
}
.toast {
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 0 !important;
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  animation: fade-in 0.2s ease both;
}
.toast.show {
  opacity: 1;
  transform: translateX(0);
}
.toast-success {
  border-left: 3px solid var(--text);
}
.toast-error {
  border-left: 3px solid #d1242f;
  color: #d1242f;
}
.toast-info {
  border-left: 3px solid var(--secondary);
}

