*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: #fafaf8;
  color: #263240;
  line-height: 1.6;
  font-size: 15px;
}

a { color: inherit; text-decoration: none; }

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 248, 0.96);
  border-bottom: 1px solid #e8e8e4;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  backdrop-filter: blur(10px);
}

.header_title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.header_title small {
  margin-left: 8px;
  color: #79828e;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.header_status {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status_dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status_dot.unsaved { background: #d4a014; }
.status_dot.saving { background: #3b82f6; animation: pulse 0.8s infinite; }
.status_dot.saved { background: #22c55e; }
.status_dot.failed { background: #ef4444; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(310px, 390px) minmax(0, 1fr);
  gap: 18px 24px;
  align-items: start;
}

.toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.btn {
  padding: 8px 16px;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: #263240;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn:hover { background: #f0f0ec; border-color: #bbb; }
.btn_primary { background: #263240; color: #fff; border-color: #263240; }
.btn_primary:hover { background: #3a4a5a; border-color: #3a4a5a; }
.btn_danger { color: #ef4444; border-color: #fca5a5; }
.btn_danger:hover { background: #fef2f2; border-color: #ef4444; }
.btn_small { padding: 4px 10px; font-size: 12px; }
.btn_small.active { background: #263240; color: #fff; border-color: #263240; }

select.btn {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2379828e' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.search_wrap {
  grid-column: 2;
  position: relative;
  margin-bottom: 2px;
}

.search_input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.search_input:focus { border-color: #79828e; }

.search_icon {
  position: absolute;
  left: 12px;
  top: 22px;
  transform: translateY(-50%);
  color: #79828e;
  font-size: 14px;
  pointer-events: none;
}

.search_count {
  font-size: 12px;
  color: #79828e;
  margin-top: 6px;
}

.editor {
  grid-column: 1;
  grid-row: 2 / span 3;
  position: sticky;
  top: 72px;
  background: #fff;
  border: 1px solid #e0e0dc;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 28px;
}

.editor_textarea {
  width: 100%;
  min-height: 220px;
  padding: 14px;
  border: 1px solid #e0e0dc;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.8;
  font-family: inherit;
  resize: vertical;
  outline: none;
  background: #fdfdfc;
  transition: border-color 0.15s;
}

.editor_textarea:focus { border-color: #79828e; }

.editor_fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.editor_fields.full { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field_wide { grid-column: 1 / -1; }

.field label {
  font-size: 12px;
  color: #79828e;
  font-weight: 500;
}

.field input, .field select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  background: #fff;
  font-family: inherit;
}

.field input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.field input:focus, .field select:focus { border-color: #79828e; }

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

.field_row label { white-space: nowrap; }

.preview_grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.preview_item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e0e0dc;
}

.preview_item img, .preview_item video { width: 100%; height: 100%; object-fit: cover; }

.preview_del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.preview_del:hover { background: rgba(239,68,68,0.85); }
.file_count { font-size: 12px; color: #79828e; margin-top: 4px; }
.file_input { font-size: 13px; }

.editor_actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.publish_hint {
  background: #f0f4ff;
  border: 1px solid #c8d6f0;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #3a4a6a;
  margin-bottom: 20px;
  display: none;
}

.publish_hint.show { display: block; }
.publish_hint code { background: #e0e8f8; padding: 2px 6px; border-radius: 3px; font-size: 12px; }

#listContainer {
  grid-column: 2;
  min-width: 0;
}

.list_item {
  background: #fff;
  border: 1px solid #e8e8e4;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.list_item:hover { border-color: #bbb; }
.list_item.private { opacity: 0.7; }

.list_meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.list_type {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.type_murmur { background: #fce8f0; color: #db2777; }
.type_thought { background: #f0ebe0; color: #92400e; }
.type_photo { background: #e0f5e8; color: #16a34a; }
.type_quote { background: #f0e0f0; color: #7c3aed; }
.type_link { background: #e8e0f0; color: #6366f1; }
.type_status { background: #f0f0e0; color: #a16207; }
.type_video { background: #fce0e0; color: #dc2626; }

.list_content {
  font-size: 14px;
  line-height: 1.7;
  margin: 6px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.list_tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.list_tag {
  font-size: 11px;
  color: #79828e;
  background: #f0f0ec;
  padding: 2px 8px;
  border-radius: 4px;
}

.list_footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.list_date { font-size: 12px; color: #79828e; }
.list_actions { display: flex; gap: 6px; flex-wrap: wrap; }
.list_private_badge { font-size: 11px; color: #ef4444; border: 1px solid #fca5a5; padding: 1px 6px; border-radius: 3px; }
.list_pinned_icon { font-size: 12px; color: #d4a014; }
.list_media { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }

.list_media_thumb {
  max-width: 300px;
  max-height: 240px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #e8e8e4;
  cursor: pointer;
  transition: transform 0.15s;
}

.list_media_thumb:hover { transform: scale(1.02); }
.list_media_video { max-width: 480px; max-height: 320px; border-radius: 6px; }

.empty_state {
  text-align: center;
  padding: 60px 20px;
  color: #79828e;
  font-size: 14px;
}

.load_more {
  grid-column: 2;
  text-align: center;
  margin-top: 16px;
}

.loading {
  grid-column: 2;
  text-align: center;
  padding: 20px;
  color: #79828e;
  font-size: 13px;
}

.modal_overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.3);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal_overlay.show { display: flex; }

.modal_box {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.modal_box h3 { font-size: 16px; margin-bottom: 12px; }
.modal_box p { font-size: 14px; color: #555; margin-bottom: 20px; line-height: 1.6; }
.modal_actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.notification {
  position: fixed;
  bottom: 50%;
  left: 50%;
  transform: translate(-50%, 50%);
  z-index: 300;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  display: none;
  max-width: 360px;
  text-align: center;
}

.notification.show { display: block; animation: slideIn 0.25s ease; }
.notification.error { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.notification.success { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }

@keyframes slideIn {
  from { opacity: 0; transform: translate(-50%, calc(50% + 10px)); }
  to { opacity: 1; transform: translate(-50%, 50%); }
}

@media (max-width: 900px) {
  .shell {
    display: block;
    max-width: 720px;
    padding: 18px;
  }

  .toolbar, .search_wrap, .editor, #listContainer, .load_more, .loading {
    grid-column: auto;
  }

  .toolbar, .search_wrap, .editor { margin-bottom: 16px; }
  .editor { position: static; }
}

@media (max-width: 560px) {
  body { font-size: 14px; }
  .header { padding: 12px 16px; align-items: flex-start; }
  .header_title { display: flex; flex-wrap: wrap; gap: 6px; font-size: 17px; }
  .header_title small { margin-left: 0; }
  .shell { padding: 14px; }
  .toolbar { gap: 8px; }
  .toolbar .btn, .toolbar select.btn { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .editor { padding: 18px; }
  .editor_fields { grid-template-columns: 1fr; }
  .field_row { align-items: stretch; }
  .field_row .btn_small { flex: 1 1 auto; }
  .editor_actions .btn { flex: 1 1 auto; }
  .list_footer { align-items: flex-start; flex-direction: column; }
  .list_actions { width: 100%; }
  .list_actions .btn { flex: 1 1 auto; }
  .list_media_thumb { max-width: 100%; width: 100%; max-height: none; }
  .list_media_video { max-width: 100%; }
}
