:root {
  --bg: #f2f2f7;
  --sidebar-bg: #ededf2;
  --panel-bg: #ffffff;
  --border: rgba(60, 60, 67, 0.12);
  --text: #1c1c1e;
  --text-secondary: rgba(60, 60, 67, 0.6);
  --accent: #ffcc00;
  --accent-soft: #fff8d6;
  --danger: #ff3b30;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --note-default: #ffffff;
  --note-yellow: #fff7cc;
  --note-green: #e8f8e8;
  --note-blue: #e8f2ff;
  --note-pink: #ffe8f0;
  --note-purple: #f3e8ff;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: transparent;
}

.app {
  position: relative;
  display: grid;
  grid-template-columns: 240px 300px 1fr;
  height: 100vh;
  overflow: hidden;
}

.app.is-booting {
  /* UI stays visible while booting; corner indicator only */
}

.app-loading {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.18);
  pointer-events: none;
}

.app-loading-mark {
  font-size: 22px;
}

.app-loading.hidden {
  display: none;
}

.polyanka-loading-mark {
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
  color: #7c3aed;
  animation: polyanka-p-loading 1.15s ease-in-out infinite;
}

.polyanka-loading-text {
  margin: 0;
  font-size: 15px;
  color: var(--text-secondary);
}

.auth-ui-disabled .auth-dock {
  display: none !important;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 16px 8px;
}

.sidebar-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sidebar-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-version {
  font-size: 11px;
  line-height: 1;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.auth-dock {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  margin-top: auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--sidebar-bg);
}

.auth-dock-card {
  position: relative;
  display: block;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: none;
}

.auth-dock-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-dock-summary {
  min-width: 0;
  flex: 1;
}

.auth-dock-title {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-dock-subtitle {
  margin-top: 1px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-circle {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: none;
  flex-shrink: 0;
}

.auth-circle:hover {
  border-color: rgba(60, 60, 67, 0.28);
}

.auth-circle-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-circle-guest {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--text-secondary);
  background: rgba(118, 118, 128, 0.12);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.auth-circle-guest svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.auth-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  top: auto;
  z-index: 80;
  min-width: 0;
  width: auto;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.auth-popover-user {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.auth-popover-actions {
  display: grid;
  gap: 6px;
}

.auth-popover-switch,
.auth-popover-logout {
  justify-self: stretch;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  text-align: left;
}

.auth-popover-switch {
  color: var(--text);
  background: rgba(0, 0, 0, 0.05);
}

.auth-popover-switch:hover {
  background: rgba(0, 0, 0, 0.08);
}

.auth-popover-login {
  display: grid;
  gap: 8px;
}

.auth-popover-login-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
}

.auth-popover-login-copy {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.auth-account-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
}

.auth-account-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.auth-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-popover-user .auth-name {
  font-size: 15px;
  font-weight: 600;
}

.auth-popover-user .auth-username {
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-popover-logout {
  justify-self: start;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--danger);
}

.auth-popover-logout:hover {
  background: rgba(255, 59, 48, 0.08);
}

.auth-popover-status {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.auth-popover .telegram-widget {
  display: grid;
  gap: 8px;
}

.auth-login-popup-btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #2aabee;
  cursor: pointer;
}

.auth-login-popup-btn:hover {
  background: #229ed9;
}

.auth-other-account-btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(120, 120, 128, 0.12);
  cursor: pointer;
}

.auth-other-account-btn:hover {
  background: rgba(120, 120, 128, 0.18);
}

.auth-other-account-hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.settings-section .telegram-widget {
  display: grid;
  gap: 8px;
  max-width: 320px;
}

.auth-popover .telegram-widget {
  min-height: 0;
  transform: none;
}

.saved-accounts-list {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.saved-account-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.saved-account-item.active .saved-account-main {
  background: var(--accent-soft);
}

.saved-account-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  text-align: left;
  background: rgba(0, 0, 0, 0.04);
}

.saved-account-main:hover {
  background: rgba(0, 0, 0, 0.07);
}

.saved-account-avatar,
.saved-account-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.saved-account-fallback {
  display: grid;
  place-items: center;
  background: rgba(118, 118, 128, 0.12);
  font-size: 12px;
  font-weight: 700;
}

.saved-account-body {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.saved-account-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-account-username {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-account-remove {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
}

.saved-account-remove:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--danger);
}

.settings-section .saved-accounts-list {
  margin-bottom: 12px;
}

.folder-list {
  flex: 1;
  overflow: auto;
  min-height: 0;
  padding: 0 8px 8px;
}

.search-wrap {
  position: relative;
  margin: 8px 12px 12px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  stroke: var(--text-secondary);
  fill: none;
  stroke-width: 2;
}

#searchInput {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 8px 10px 8px 32px;
  background: rgba(118, 118, 128, 0.12);
  color: var(--text);
}

#searchInput:focus {
  outline: none;
  background: rgba(118, 118, 128, 0.18);
}


.folder-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  text-align: left;
}

.folder-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.folder-item.active {
  background: rgba(255, 204, 0, 0.35);
  font-weight: 600;
}

.folder-item .folder-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  font-size: 16px;
  line-height: 1;
  text-align: center;
}

.folder-item > span:last-child {
  min-width: 0;
}

.list-auth-hint {
  padding: 20px 16px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.settings-panel {
  flex: 1;
  overflow: auto;
  padding: 8px 24px 32px;
  background: var(--panel-bg);
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 20px;
}

.settings-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.settings-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.settings-tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.settings-tab.active {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}

.settings-tab-panel {
  display: block;
}

.settings-tab-panel.hidden {
  display: none;
}

.settings-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.settings-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.settings-copy {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.settings-copy code {
  font-size: 13px;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}

.auth-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #ddd;
}

.auth-name {
  font-size: 16px;
  font-weight: 600;
}

.auth-username {
  font-size: 14px;
  color: var(--text-secondary);
}

.telegram-widget {
  min-height: 40px;
}

.settings-btn {
  justify-self: start;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
  white-space: nowrap;
}

.settings-btn.primary {
  background: var(--accent);
  font-weight: 600;
}

.settings-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.storage-status-card {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
}

.storage-status-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.storage-status-row.ok strong {
  color: var(--text);
}

.storage-status-row.warn strong {
  color: #b45309;
}

.storage-status-warning {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 149, 0, 0.1);
  color: #9a6700;
  font-size: 13px;
  line-height: 1.45;
}

.settings-btn.primary:hover {
  background: #f2c200;
}

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

.settings-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
}

.settings-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.settings-item-body {
  flex: 1;
  min-width: 0;
}

.settings-item-title {
  font-size: 15px;
  font-weight: 600;
}

.settings-item-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-item-action {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--accent, #007aff);
  font-size: 13px;
}

.settings-item-action.danger {
  color: var(--danger);
}

.settings-item-action:hover {
  background: rgba(0, 122, 255, 0.08);
}

.settings-item-action.danger:hover {
  background: rgba(255, 59, 48, 0.08);
}

.settings-empty {
  margin: 0;
  padding: 12px 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.pair-code-card {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid rgba(255, 204, 0, 0.35);
}

.pair-code-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.pair-code-value {
  margin-top: 6px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.pair-code-hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.pair-model-label {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.pair-model-select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.settings-item-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-item-action.subtle {
  color: var(--text-secondary);
}

.guide-intro {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: 15px;
  line-height: 1.55;
}

.guide-intro p {
  margin: 0;
}

.guide-block {
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.guide-block:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.guide-block h3 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
}

.guide-steps,
.guide-commands,
.guide-faq {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  line-height: 1.6;
}

.guide-steps li,
.guide-commands li,
.guide-faq li {
  margin-bottom: 8px;
}

.guide-note {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.guide-link {
  padding: 0;
  color: #007aff;
  text-decoration: underline;
  font: inherit;
}

.guide-inline-code {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 13px;
}

.guide-code-card {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
}

.guide-code-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.guide-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.guide-code-row code {
  flex: 1;
  min-width: 0;
  word-break: break-all;
  font-size: 13px;
}

.guide-code {
  margin: 12px 0;
  padding: 14px;
  border-radius: var(--radius);
  background: #1c1c1e;
  color: #f5f5f7;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
}

.guide-copy-btn {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 12px;
}

.guide-copy-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.list-auth-hint .guide-link,
.editor-empty .guide-link {
  margin-top: 8px;
  display: inline-block;
}

.settings-status {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.app.settings-mode .list-panel .list-auth-hint {
  display: none;
}

.app.settings-mode .settings-nav {
  display: none;
}

.app.settings-mode #newNoteBtn {
  visibility: hidden;
  pointer-events: none;
}

.settings-apps-row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.settings-tab-card-apps {
  width: 100%;
}

.apps-sub-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.apps-sub-tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.apps-sub-tab.active {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}

.apps-sub-panel.hidden {
  display: none;
}

.list-panel {
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.list-header h2 {
  margin: 0;
  flex: 1;
  font-size: 17px;
  font-weight: 600;
}

.note-count {
  color: var(--text-secondary);
  font-size: 13px;
}

.notes-list {
  overflow: auto;
  flex: 1;
}

.group-label {
  padding: 14px 16px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.note-card {
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  transition: background 0.15s ease;
}

.note-card:hover {
  background: rgba(0, 0, 0, 0.03);
}

.note-card.active {
  background: var(--accent-soft);
}

.note-card-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.note-card-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-card-date {
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.note-card-preview {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-card-badges {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  font-size: 11px;
}

.badge {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
}

.editor-panel {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--note-default);
}

.editor-loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
}

.editor-loading.hidden {
  display: none;
}

@keyframes polyanka-p-loading {
  0%, 100% {
    opacity: 0.35;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

#newNoteBtn.loading {
  pointer-events: none;
  opacity: 0.85;
}

#newNoteBtn.loading svg {
  opacity: 0;
}

#newNoteBtn.loading::after {
  content: "P";
  font-size: 18px;
  font-weight: 800;
  color: #7c3aed;
  animation: polyanka-p-loading 1.15s ease-in-out infinite;
}

.editor-panel.color-yellow { background: var(--note-yellow); }
.editor-panel.color-green { background: var(--note-green); }
.editor-panel.color-blue { background: var(--note-blue); }
.editor-panel.color-pink { background: var(--note-pink); }
.editor-panel.color-purple { background: var(--note-purple); }

.editor-empty {
  flex: 1;
  display: grid;
  place-content: center;
  gap: 8px;
  color: var(--text-secondary);
  text-align: center;
}

.empty-icon {
  font-size: 48px;
}

.editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(8px);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.tool-btn {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
}

.tool-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.tool-btn.active {
  background: rgba(255, 204, 0, 0.45);
}

.tool-btn.danger {
  color: var(--danger);
  margin-left: auto;
}

.save-status {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 72px;
  text-align: right;
}

.editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  padding: 8px 24px 24px;
  position: relative;
}

.title-input {
  border: 0;
  background: transparent;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 12px 0 0;
  color: var(--text);
  width: 100%;
  resize: none;
  overflow: hidden;
  line-height: 1.25;
  min-height: calc(1.25em * 2 + 4px);
  max-height: calc(1.25em * 2 + 4px);
  font-family: inherit;
}

.title-input:focus {
  outline: none;
}

.editor-compose {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.editor-time-row {
  display: flex;
  align-items: center;
  padding-top: 6px;
  min-height: 34px;
}

.body-input {
  flex: 1;
  border: 0;
  resize: none;
  background: transparent;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  min-height: 200px;
  padding: 0;
}

.body-input:focus {
  outline: none;
}

.time-insert-btn {
  height: auto;
  min-width: 72px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
}

.time-insert-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

.time-insert-label {
  pointer-events: none;
}

.time-insert-hint {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  line-height: 1;
  white-space: nowrap;
}

.time-insert-btn:hover {
  background: #fff;
}

.time-insert-btn:active {
  transform: scale(0.96);
}

.color-picker {
  display: flex;
  gap: 4px;
  align-items: center;
}

.color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.08);
}

.color-dot.active {
  box-shadow: 0 0 0 2px var(--text);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.sort-cycle-btn {
  position: relative;
}

.sort-cycle-btn span {
  position: absolute;
  right: -4px;
  bottom: -3px;
  min-width: 24px;
  padding: 1px 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #1c1c1e;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 0 0 2px var(--panel-bg);
}

.hidden {
  display: none !important;
}

.mobile-only {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: rgba(28, 28, 30, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 20;
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: 260px 1fr;
  }

  .list-panel.hidden-mobile {
    display: none;
  }

  .editor-panel.hidden-mobile {
    display: none;
  }

  .mobile-only {
    display: grid;
  }
}

@media (max-width: 720px) {
  html, body {
    background: #f2f2f7;
  }

  .app {
    grid-template-columns: 1fr;
    height: 100dvh;
    background: #f2f2f7;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 318px);
    z-index: 30;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 20px 0 44px rgba(0, 0, 0, 0.16);
    border-right: 0;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: 25;
  }

  .list-panel {
    min-height: 100dvh;
    border-right: 0;
    background: #f2f2f7;
  }

  .list-header {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
    border-bottom: 0;
    background: rgba(242, 242, 247, 0.86);
    backdrop-filter: blur(18px);
  }

  .list-header h2 {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.04em;
  }

  .note-count {
    align-self: center;
    min-width: 22px;
    font-size: 15px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 18px;
    color: #1c1c1e;
  }

  .icon-btn:hover,
  .icon-btn:active {
    background: rgba(120, 120, 128, 0.16);
  }

  .sort-cycle-btn span {
    right: -5px;
    bottom: -3px;
    box-shadow: 0 0 0 2px #f2f2f7;
  }

  .notes-list {
    padding: 0 10px 18px;
  }

  .group-label {
    padding: 18px 10px 7px;
    font-size: 12px;
  }

  .note-card {
    margin: 0;
    padding: 13px 14px;
    border-bottom: 1px solid rgba(60, 60, 67, 0.12);
    background: #fff;
  }

  .note-card:first-of-type {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }

  .note-card:last-child {
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    border-bottom: 0;
  }

  .note-card.active {
    background: #fff5bd;
  }

  .note-card-title {
    font-size: 16px;
  }

  .note-card-preview {
    font-size: 14px;
  }

  .editor-panel {
    min-height: 100dvh;
  }

  .editor-toolbar {
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  }

  .editor-body {
    padding: 10px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  }

  .title-input {
    font-size: 30px;
  }

  .body-input {
    font-size: 17px;
    line-height: 1.48;
  }
}
