:root {
  --bg: #fafafa;
  --panel: #fbfbfa;
  --card: #ffffff;
  --ink: #323232;
  --muted: #949494;
  --line: #e8e8e8;
  --green: #35c979;
  --green-deep: #23b968;
  --tag-bg: #eef3fe;
  --tag-ink: #5783f7;
  --danger: #dc5757;
  --shadow: 0 2px 10px rgba(232, 232, 232, 0.2);
  font-family:
    "BarlowF", "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  font-weight: 400;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 312px minmax(0, 620px);
  gap: 18px;
  min-height: 100vh;
  width: min(100%, 950px);
  margin: 0 auto;
}

.side-panel {
  padding: 27px 0 26px 10px;
  background: transparent;
  border-right: 0;
  height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
}

.profile {
  margin: 0 0 26px;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stats div {
  display: grid;
  gap: 4px;
}

.stats div:first-child {
  cursor: pointer;
}

.stats strong {
  color: #939393;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
}

.stats span,
.month-row,
.section-title,
.result-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(12, 16px);
  grid-auto-rows: 16px;
  gap: 8px;
  margin-bottom: 12px;
}

.activity-cell {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: #efefef;
}

.activity-cell[data-level="1"] {
  background: #c9f2da;
}

.activity-cell[data-level="2"] {
  background: #83dfa9;
}

.activity-cell[data-level="3"] {
  background: #35c979;
}

.month-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 24px;
}

.tag-list {
  display: grid;
  gap: 4px;
}

.tag-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #3f3f42;
  min-height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 44px 0 10px;
  text-align: left;
}

.tag-section {
  margin-top: 20px;
}

.section-title {
  margin: 0 0 10px 11px;
}

.tag-item {
  position: relative;
  font-size: 14px;
}

.tag-item.active {
  background: var(--green);
  color: #fff;
}

.tag-item:hover {
  background: #f1f1f1;
}

.tag-item.active:hover {
  background: var(--green);
}

.tag-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
  color: inherit;
}

.tag-avatar:hover {
  background: #e7e7e5;
}

.tag-count {
  margin-left: auto;
  min-width: 18px;
  color: inherit;
  opacity: 0.72;
  font-size: 13px;
  text-align: right;
}

.tag-kebab {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #aaa;
  opacity: 0;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 1px;
}

.tag-item:hover .tag-kebab {
  opacity: 1;
}

.content-panel {
  position: relative;
  padding: 0 0 42px;
  max-width: 620px;
  width: 100%;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: 60px;
  margin-bottom: 0;
}

.title-button {
  border: 0;
  background: transparent;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  min-height: 36px;
  padding: 0;
}

.chevron {
  display: none;
  color: var(--muted);
}

.search-box {
  min-width: 220px;
  width: 268px;
  max-width: 268px;
  height: 36px;
  border-radius: 12px;
  background: #ebebeb;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 15px;
  color: #a6a6a6;
  font-size: 18px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #2e2e2e;
  font-size: 14px;
  font-weight: 400;
}

.composer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 92px;
  height: 92px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 15px 16px 0;
  font-size: 14px;
  line-height: 25.2px;
  color: var(--ink);
}

.composer textarea::placeholder {
  color: #77a5ff;
}

.composer-toolbar {
  min-height: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  padding: 0 10px;
}

.tool-button {
  border: 1px solid transparent;
  background: transparent;
  color: #777;
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  line-height: 1;
  padding: 0;
  transition:
    background 120ms ease,
    color 120ms ease;
}

.tool-button:hover {
  background: #f0f0ef;
  color: #202020;
}

.tag-tool {
  color: #111;
  background: #f1f1f1;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  padding-bottom: 2px;
}

.image-tool {
  position: relative;
}

.image-tool span {
  width: 17px;
  height: 15px;
  border: 2px solid #b8b8b8;
  border-radius: 4px;
  position: relative;
  display: block;
}

.image-tool span::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #b8b8b8;
}

.image-tool span::after {
  content: "";
  position: absolute;
  left: 3px;
  bottom: 2px;
  width: 10px;
  height: 7px;
  background: #b8b8b8;
  clip-path: polygon(0 100%, 42% 30%, 62% 54%, 82% 24%, 100% 100%);
}

.image-tool:hover span {
  border-color: #202020;
}

.image-tool:hover span::before,
.image-tool:hover span::after {
  background: #202020;
}

.text-tool {
  color: #777;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.composer-toolbar input {
  border: 0;
  outline: 0;
  min-width: 0;
  color: #555;
  background: transparent;
  font-size: 14px;
}

#composerSourceInput {
  flex: 1 1 auto;
  max-width: 180px;
  margin-left: 10px;
}

.divider {
  width: 1px;
  height: 20px;
  background: #ececec;
  margin: 0 8px;
}

.composer .send-button {
  margin-left: auto;
  border: 0;
  width: 44px;
  height: 28px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.composer .send-button:hover,
.shuffle-button:hover {
  background: var(--green-deep);
}

.filter-bar {
  position: static;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 14px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.filter-pill,
.utility-button {
  border: 0;
  border-radius: 999px;
  min-height: 28px;
  padding: 0 12px;
  background: #ececea;
  color: #777;
  font-size: 13px;
  font-weight: 600;
}

.filter-pill.active,
.utility-button {
  background: #e7f8ef;
  color: #24a960;
}

.utility-button {
  margin-left: 4px;
}

.result-count {
  display: none;
  margin-left: auto;
}

.note-list {
  display: grid;
  gap: 10px;
}

.note-card {
  position: relative;
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  box-shadow: none;
  border: 0;
  outline: none;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.note-card:hover {
  box-shadow: 0 0 0 1px rgba(232, 232, 232, 0.9);
}

.note-card.active,
.note-card:focus-visible {
  outline: 1px solid rgba(53, 201, 121, 0.72);
  outline-offset: -1px;
  box-shadow:
    0 0 0 1px rgba(53, 201, 121, 0.18),
    0 6px 18px rgba(53, 201, 121, 0.08);
}

.note-header,
.note-actions,
.note-line {
  display: flex;
  align-items: center;
}

.note-header {
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  line-height: 20px;
  font-weight: 400;
  margin-bottom: 10px;
  padding-right: 108px;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.note-header-tags {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex-wrap: wrap;
}

.note-actions {
  position: absolute;
  right: 12px;
  top: 12px;
  gap: 8px;
  opacity: 0;
  transition: opacity 120ms ease;
}

.note-card:hover .note-actions,
.note-card.active .note-actions {
  opacity: 1;
}

.note-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #9d9d9d;
  line-height: 1;
  padding: 0;
}

.note-actions button:hover {
  background: #f1f1ef;
  color: #333;
}

.note-line {
  display: block;
  gap: 5px;
  flex-wrap: wrap;
}

.note-content {
  font-size: 14px;
  line-height: 25.2px;
  font-weight: 400;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-image {
  display: block;
  max-width: 100%;
  max-height: 380px;
  border-radius: 10px;
  margin: 8px 0;
  object-fit: contain;
}

.note-bold {
  font-weight: 800;
}

.tag-chip {
  display: inline;
  min-height: 0;
  border-radius: 6px;
  padding: 1px 5px;
  margin-right: 0;
  background: var(--tag-bg);
  color: var(--tag-ink);
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  border-radius: 6px;
  padding: 1px 7px;
  background: #f4f4f2;
  color: #8a8a8a;
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  text-decoration: none;
  transition:
    background 120ms ease,
    color 120ms ease;
}

.source-chip:hover {
  background: #e7f8ef;
  color: #24a960;
}

.empty {
  background: var(--card);
  border-radius: 16px;
  padding: 38px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.empty-mini {
  padding: 6px 14px;
  color: var(--muted);
  font-size: 13px;
}

.tag-menu {
  position: fixed;
  z-index: 50;
  min-width: 158px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.11);
  padding: 8px;
}

.tag-editor {
  position: fixed;
  z-index: 51;
  width: 360px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 66px;
  column-gap: 10px;
  align-items: start;
  border: 1px solid #dcdcdc;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.13);
  padding: 14px 16px 14px;
}

.tag-editor::before {
  content: "";
  position: absolute;
  left: var(--tag-editor-arrow-left, 42px);
  top: -10px;
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
  background: #fff;
  border-left: 1px solid #dcdcdc;
  border-top: 1px solid #dcdcdc;
}

.tag-editor-avatar,
.tag-editor > #tagEditorName,
.tag-editor > button:last-of-type {
  height: 42px;
  border: 0;
  border-radius: 9px;
}

.tag-editor-avatar {
  width: 42px;
  margin: 0;
  border: 1px solid #d8d8d8;
  background: #f0f0f0;
  font-size: 21px;
  vertical-align: top;
}

.tag-editor > #tagEditorName {
  width: 100%;
  padding: 0 14px;
  background: #f0f0f0;
  color: #303133;
  font-size: 19px;
  outline: 0;
}

.tag-editor > button:last-of-type {
  width: 66px;
  margin: 0;
  background: var(--green);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}

.tag-editor p {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  color: #929292;
  font-size: 14px;
}

.tag-editor p span {
  color: #5b8cff;
}

.emoji-picker {
  grid-column: 1 / -1;
  margin-top: 12px;
  border-top: 1px solid #f0f0ef;
  padding-top: 12px;
}

.emoji-controls {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 62px;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.emoji-tool,
.emoji-clear {
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: #f0f0ef;
  color: #999;
  font-size: 15px;
  font-weight: 700;
}

.emoji-search {
  height: 38px;
  border-radius: 9px;
  background: #f0f0ef;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: #b7bec9;
  font-size: 18px;
}

.emoji-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #444;
  font-size: 15px;
}

.emoji-category {
  color: #8e8e8e;
  font-size: 15px;
  margin: 0 0 10px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 34px);
  gap: 6px;
  max-height: 178px;
  overflow: auto;
  padding-right: 4px;
}

.emoji-option {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 24px;
  line-height: 1;
}

.emoji-option:hover,
.emoji-option.active {
  background: #f0f0ef;
}

.tag-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 7px;
  min-height: 36px;
  text-align: left;
  padding: 0 10px;
  color: #333;
}

.tag-menu button:hover {
  background: #f4f4f2;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  background: #252527;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  transition: 160ms ease;
  max-width: min(420px, calc(100vw - 28px));
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.access-token-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(35, 35, 35, 0.32);
  backdrop-filter: blur(6px);
}

.access-token-dialog {
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 26px 80px rgba(24, 24, 24, 0.2);
  padding: 28px;
}

.access-token-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 18px;
  border-radius: 13px;
  background: rgba(53, 201, 121, 0.13);
  color: var(--green-deep);
  font-size: 21px;
}

.access-token-dialog h2 {
  margin: 0 0 8px;
  font-size: 23px;
}

.access-token-dialog > p {
  margin: 0 0 22px;
  color: #777;
  font-size: 14px;
  line-height: 1.6;
}

.access-token-dialog label {
  display: grid;
  gap: 8px;
  color: #555;
  font-size: 13px;
  font-weight: 600;
}

.access-token-dialog input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #dedede;
  border-radius: 12px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
}

.access-token-dialog input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(53, 201, 121, 0.12);
}

.access-token-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.access-token-actions button {
  min-width: 82px;
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  background: #f0f0ee;
  color: #555;
  font-weight: 700;
}

.access-token-actions button[type="submit"] {
  background: var(--green);
  color: #fff;
}

.mobile-fab {
  display: none;
}

.mobile-tag-button,
.mobile-logo,
.drawer-backdrop {
  display: none;
}

.app-update-notice {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(460px, calc(100vw - 36px));
  border: 1px solid rgba(53, 201, 121, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 52px rgba(25, 25, 25, 0.16);
  padding: 14px 16px;
}

.app-update-notice div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.app-update-notice strong {
  color: var(--ink);
  font-size: 15px;
}

.app-update-notice span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.app-update-notice a {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.app-update-notice button {
  border: 0;
  background: transparent;
  color: #aaa;
  font-size: 20px;
}

.import-page {
  width: min(620px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.import-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 42px;
  margin-bottom: 18px;
}

.import-header h1 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
}

.back-link {
  color: #777;
  text-decoration: none;
  font-size: 14px;
}

.back-link:hover {
  color: var(--green-deep);
}

.import-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.import-field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.import-field input,
.import-field textarea {
  width: 100%;
  border: 0;
  border-radius: 10px;
  outline: 0;
  background: #f1f1f1;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
}

.import-field input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.import-field input {
  height: 42px;
  padding: 0 14px;
}

.import-field textarea {
  min-height: 260px;
  padding: 14px;
  line-height: 1.7;
  resize: vertical;
}

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

.file-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 42px;
  border-radius: 10px;
  background: #f1f1f1;
  padding: 0 12px;
  overflow: hidden;
}

.file-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: inset 0 0 0 1px #dedede;
}

.file-picker-name {
  min-width: 0;
  overflow: hidden;
  color: #777;
  font-size: 14px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-send {
  margin-left: 0;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  width: auto;
  min-width: 76px;
  height: 32px;
  padding: 0 16px;
  font-size: 15px;
}

.import-send:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.import-status {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.excerpt-page {
  width: min(620px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.excerpt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  margin-bottom: 18px;
}

.excerpt-time {
  color: var(--muted);
  font-size: 13px;
}

.excerpt-header-meta,
.excerpt-edit-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.excerpt-action-button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: #f1f1ef;
  color: #666;
  padding: 0 15px;
  font-size: 14px;
  font-weight: 600;
}

.excerpt-action-button:hover {
  background: #e9e9e6;
  color: #333;
}

.excerpt-action-button.primary {
  background: var(--green);
  color: #fff;
}

.excerpt-action-button.primary:hover {
  background: var(--green-deep);
}

.excerpt-action-button.danger {
  background: #fff0f0;
  color: var(--danger);
}

.excerpt-action-button.danger:hover {
  background: #ffe5e5;
}

.excerpt-detail-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.excerpt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.excerpt-detail-content {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.78;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.excerpt-edit-form {
  display: grid;
  gap: 14px;
}

.excerpt-edit-field {
  display: grid;
  gap: 8px;
  color: #999;
  font-size: 13px;
  font-weight: 600;
}

.excerpt-edit-field input,
.excerpt-edit-field textarea {
  width: 100%;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #f7f7f5;
  color: var(--ink);
  outline: 0;
  padding: 12px 13px;
  font-size: 15px;
  line-height: 1.7;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.excerpt-edit-field textarea {
  min-height: 180px;
  resize: vertical;
}

.excerpt-edit-field input:focus,
.excerpt-edit-field textarea:focus {
  border-color: rgba(53, 201, 121, 0.7);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(53, 201, 121, 0.12);
}

.excerpt-edit-spacer {
  flex: 1;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(100%, 680px);
    gap: 0;
  }

  .side-panel {
    position: static;
    height: auto;
    padding: 20px;
  }

  .content-panel {
    padding: 20px;
    max-width: none;
  }

  .topbar {
    height: auto;
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .tag-editor {
    width: min(360px, calc(100vw - 28px));
    left: 14px !important;
  }

  .tag-editor > #tagEditorName {
    width: 100%;
  }
}

@media (max-width: 640px) {
  body {
    background: #fafafa;
  }

  .app-shell {
    width: 100%;
  }

  .side-panel {
    padding: 18px 16px 8px;
  }

  .profile {
    margin-bottom: 18px;
  }

  .profile-name {
    font-size: 19px;
  }

  .stats {
    gap: 10px;
    margin-bottom: 18px;
  }

  .stats strong {
    font-size: 26px;
  }

  .activity-grid {
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: auto;
    gap: 5px;
  }

  .activity-cell {
    width: 100%;
    aspect-ratio: 1;
    height: auto;
  }

  .month-row {
    margin-bottom: 14px;
  }

  .tag-section {
    margin-top: 14px;
  }

  .tag-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .tag-list::-webkit-scrollbar {
    display: none;
  }

  .tag-item {
    flex: 0 0 auto;
    width: auto;
    max-width: 220px;
    min-height: 34px;
    padding: 0 34px 0 9px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(232, 232, 232, 0.82);
  }

  .tag-item.active {
    box-shadow: none;
  }

  .tag-avatar {
    width: 22px;
    height: 22px;
  }

  .tag-kebab {
    right: 5px;
  }

  .content-panel {
    padding: 10px 16px 36px;
  }

  .topbar {
    height: auto;
    gap: 10px;
    margin-bottom: 12px;
  }

  .title-button {
    width: 100%;
    justify-content: space-between;
    min-height: 32px;
  }

  .search-box {
    height: 38px;
    width: 100%;
    max-width: none;
  }

  .composer {
    margin-bottom: 10px;
  }

  .composer textarea {
    height: 118px;
    min-height: 118px;
  }

  .composer-toolbar {
    height: auto;
    min-height: 46px;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 10px 8px;
  }

  #composerSourceInput {
    order: 8;
    flex: 1 0 100%;
    max-width: none;
    height: 30px;
    margin-left: 0;
    padding-left: 4px;
  }

  .divider {
    display: none;
  }

  .composer .send-button {
    margin-left: auto;
  }

  .filter-bar {
    gap: 7px;
    margin: 10px 0 12px;
  }

  .filter-pill,
  .utility-button {
    min-height: 32px;
    padding: 0 13px;
  }

  .note-list {
    gap: 10px;
  }

  .note-card {
    padding: 14px;
  }

  .note-header {
    align-items: flex-start;
    padding-right: 84px;
  }

  .note-meta {
    gap: 7px;
  }

  .note-actions {
    right: 8px;
    top: 8px;
    opacity: 1;
  }

  .note-actions button {
    width: 24px;
    height: 24px;
  }

  .note-content {
    font-size: 14px;
    line-height: 1.72;
  }

  .tag-chip {
    line-height: 17px;
  }

  .tag-editor {
    grid-template-columns: 42px minmax(0, 1fr) 66px;
    column-gap: 8px;
    width: min(360px, calc(100vw - 24px));
    left: 12px !important;
    padding: 14px;
  }

  .tag-editor-avatar,
  .tag-editor > #tagEditorName,
  .tag-editor > button:last-of-type {
    height: 42px;
  }

  .tag-editor > #tagEditorName {
    width: 100%;
    font-size: 18px;
    padding: 0 12px;
  }

  .tag-editor > button:last-of-type {
    width: 66px;
    font-size: 16px;
  }

  .tag-editor p {
    font-size: 15px;
  }

  .emoji-controls {
    grid-template-columns: 42px minmax(0, 1fr) 68px;
    gap: 8px;
  }

  .emoji-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    max-height: 260px;
  }

  .emoji-option {
    width: 100%;
    height: 34px;
    font-size: 24px;
  }

  .tag-menu {
    max-width: calc(100vw - 24px);
  }

  .import-page {
    width: 100%;
    padding: 20px 16px 40px;
  }

  .excerpt-page {
    width: 100%;
    padding: 20px 16px 40px;
  }

  .import-header {
    height: auto;
    margin-bottom: 14px;
  }

  .import-card {
    padding: 16px;
  }

  .excerpt-detail-card {
    padding: 16px;
  }

  .excerpt-header {
    align-items: flex-start;
    gap: 10px;
    flex-direction: column;
  }

  .excerpt-header-meta,
  .excerpt-edit-actions {
    width: 100%;
  }

  .excerpt-header-meta {
    justify-content: space-between;
  }

  .excerpt-edit-actions {
    flex-wrap: wrap;
  }

  .excerpt-detail-content {
    font-size: 15px;
  }

  .excerpt-edit-field textarea {
    min-height: 220px;
  }

  .import-field textarea {
    min-height: 220px;
  }

  .import-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .import-actions .utility-button,
  .import-send {
    flex: 1 1 calc(50% - 5px);
    height: 34px;
  }

  .import-status {
    flex: 1 0 100%;
    margin-left: 0;
    line-height: 1.5;
  }
}

@media (max-width: 380px) {
  .side-panel,
  .content-panel,
  .import-page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .excerpt-page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .stats strong {
    font-size: 24px;
  }

  .filter-pill,
  .utility-button {
    padding: 0 10px;
  }

  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 640px) {
  body {
    background: #f7f7f5;
  }

  .app-shell {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
  }

  .side-panel {
    padding: 20px 16px 6px;
  }

  .profile {
    min-height: 50px;
    margin-bottom: 16px;
  }

  .profile-name {
    font-size: 28px;
    font-weight: 800;
  }

  .stats,
  .activity-grid,
  .month-row,
  .section-title {
    display: none;
  }

  .tag-section {
    margin: 0 0 10px;
  }

  .tag-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .tag-list::-webkit-scrollbar {
    display: none;
  }

  .tag-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 54px;
    max-width: 240px;
    border-radius: 16px;
    background: #fff;
    box-shadow: none;
    padding: 0 18px 0 14px;
    font-size: 16px;
  }

  .tag-avatar {
    width: 26px;
    height: 26px;
    font-size: 20px;
  }

  .tag-kebab {
    display: none;
  }

  .content-panel {
    padding: 0 16px 96px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 54px;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    margin: 0 -16px 12px;
    padding: 0 16px;
    background: rgba(247, 247, 245, 0.94);
    backdrop-filter: blur(12px);
  }

  .title-button {
    width: auto;
    min-height: 42px;
    justify-content: flex-start;
    font-size: 23px;
    font-weight: 800;
  }

  .search-box {
    margin-left: auto;
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 999px;
    background: transparent;
    padding: 0;
    justify-content: center;
  }

  .search-box span {
    font-size: 28px;
  }

  .search-box input {
    display: none;
  }

  body.search-open .search-box {
    width: min(240px, calc(100vw - 110px));
    padding: 0 14px;
    background: var(--card);
  }

  body.search-open .search-box input {
    display: block;
  }

  .composer {
    display: none;
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: 92px;
    z-index: 25;
    max-width: 452px;
    margin: 0 auto;
    border-radius: 18px;
    box-shadow: 0 20px 72px rgba(32, 32, 32, 0.18);
  }

  body.composer-open .composer {
    display: block;
  }

  .composer textarea {
    height: 156px;
    min-height: 156px;
  }

  .filter-bar {
    gap: 8px;
    margin: 8px 0 14px;
  }

  .filter-pill,
  .utility-button {
    min-height: 38px;
    border-radius: 999px;
    padding: 0 15px;
    font-size: 14px;
  }

  #importButton,
  #exportButton,
  .result-count {
    display: none;
  }

  .note-list {
    gap: 12px;
  }

  .note-card {
    border-radius: 18px;
    box-shadow: none;
    padding: 18px 16px 20px;
  }

  .note-content {
    font-size: 17px;
    line-height: 1.72;
  }

  .tag-chip {
    line-height: 20px;
    padding: 1px 8px;
    font-size: 14px;
  }

  .mobile-fab {
    position: fixed;
    left: 50%;
    bottom: max(28px, env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    place-items: center;
    width: 66px;
    height: 66px;
    border: 0;
    border-radius: 20px;
    background: #0dcc70;
    color: #fff;
    box-shadow: 0 18px 42px rgba(13, 204, 112, 0.34);
    font-size: 48px;
    font-weight: 300;
    line-height: 1;
    transform: translateX(-50%);
  }

  .app-update-notice {
    left: 14px;
    right: 14px;
    bottom: 104px;
    max-width: none;
    border-radius: 18px;
  }
}

@media (max-width: 640px) {
  .mobile-tag-button,
  .mobile-logo {
    display: inline-flex;
    align-items: center;
  }

  .mobile-tag-button {
    width: 42px;
    height: 42px;
    border: 0;
    background: transparent;
    color: #3d3d3d;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
  }

  .mobile-logo {
    color: #202020;
    font-size: 23px;
    font-weight: 800;
    white-space: nowrap;
  }

  .topbar {
    height: 58px;
    margin: 0 -16px 10px;
    padding: 0 16px;
  }

  .topbar .title-button {
    display: none;
  }

  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 18;
    display: block;
    background: rgba(0, 0, 0, 0.38);
  }

  .drawer-backdrop[hidden] {
    display: none;
  }

  .side-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 19;
    width: min(82vw, 320px);
    height: 100vh;
    overflow-y: auto;
    padding: 24px 16px;
    background: #f8f8f5;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.16);
    transform: translateX(-104%);
    transition: transform 0.18s ease;
  }

  body.tag-drawer-open .side-panel {
    transform: translateX(0);
  }

  .side-panel .profile {
    display: block;
  }

  .side-panel .profile-name {
    font-size: 22px;
  }

  .side-panel .section-title {
    display: block;
    margin: 18px 0 8px;
  }

  .side-panel .tag-list {
    display: grid;
    gap: 8px;
    overflow: visible;
  }

  .side-panel .tag-item {
    width: 100%;
    min-height: 44px;
    max-width: none;
    justify-content: flex-start;
    border-radius: 12px;
    padding: 0 12px;
  }

  .side-panel .tag-kebab {
    display: inline-flex;
    opacity: 1;
  }

  body.composer-open {
    overflow: hidden;
  }

  body.composer-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 22;
    background: rgba(0, 0, 0, 0.56);
  }

  .composer {
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    max-width: 480px;
    margin: 0 auto;
    border: 0;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -18px 70px rgba(32, 32, 32, 0.18);
    padding-top: 20px;
  }

  .composer::before {
    content: "••••";
    position: absolute;
    top: 8px;
    left: 50%;
    color: #e5e5e1;
    font-size: 20px;
    letter-spacing: 3px;
    transform: translateX(-50%);
  }

  .composer textarea {
    height: 196px;
    min-height: 196px;
    border-radius: 24px 24px 0 0;
    padding: 34px 22px 14px;
    font-size: 18px;
    line-height: 1.7;
  }

  .composer-toolbar {
    height: 80px;
    min-height: 80px;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 10px 22px calc(12px + env(safe-area-inset-bottom));
  }

  .tool-button {
    width: 36px;
    height: 36px;
    font-size: 30px;
  }

  .text-tool {
    font-size: 26px;
    font-weight: 800;
  }

  #composerSourceInput {
    display: none;
  }

  .composer .send-button {
    margin-left: auto;
    width: 62px;
    height: 48px;
    border-radius: 20px;
    font-size: 34px;
  }

  body.composer-open .mobile-fab {
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%) scale(0.84);
  }

  .note-actions {
    right: 18px;
    top: 18px;
    gap: 12px;
    height: 28px;
    align-items: center;
    opacity: 1;
  }

  .note-actions button {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 20px;
    line-height: 1;
  }

  .note-actions button[data-action="copy"] {
    font-size: 22px;
  }

  .note-actions button[data-action="edit"] {
    font-size: 18px;
  }

  .note-actions button[data-action="delete"] {
    letter-spacing: 2px;
    text-indent: 2px;
  }

  .drawer-backdrop {
    z-index: 38;
    background: rgba(0, 0, 0, 0.18);
    backdrop-filter: none;
  }

  .side-panel {
    z-index: 39;
  }

  body.tag-drawer-open .mobile-fab {
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%) scale(0.84);
  }

  .composer::before {
    content: "";
    top: 10px;
    width: 32px;
    height: 8px;
    background-image: radial-gradient(circle, #deded9 2px, transparent 2.5px);
    background-size: 8px 8px;
    background-repeat: repeat-x;
    letter-spacing: 0;
  }
}
