:root {
  --bg: #eceff3;
  --panel: rgba(252, 252, 253, 0.9);
  --panel-strong: #ffffff;
  --paper: #fffefc;
  --text: #111827;
  --muted: #6b7280;
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(100, 116, 139, 0.3);
  --accent: #f6d567;
  --accent-deep: #e8bf3b;
  --success: #2f7d4a;
  --danger: #b33838;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f5f7fb 0%, var(--bg) 100%);
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  padding: 22px;
}

.login-shell {
  display: grid;
  place-items: center;
}

.card {
  width: min(100%, 440px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.login-card {
  padding: 32px;
}

.login-head {
  margin-bottom: 8px;
}

.title {
  margin: 0;
  font-size: clamp(30px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.login-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.icloud-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  width: min(100%, 1360px);
  min-height: calc(100vh - 44px);
  margin: 0 auto;
}

.sidebar-panel,
.editor-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.sidebar-panel {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.editor-panel {
  padding: 22px 26px;
}

.sidebar-top,
.editor-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.sidebar-title {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.sidebar-subtitle,
.editor-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.time-chip,
.editor-status,
.notes-summary {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.notes-summary {
  margin-top: 18px;
}

.notes-panel {
  margin-top: 14px;
}

.trash-panel {
  margin-top: 18px;
}

.notes-panel-head h2,
.editor-panel-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.notes-panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.trash-toggle-icon {
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.notes-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.note-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid transparent;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.note-row:hover {
  background: rgba(255, 255, 255, 0.94);
  border-color: var(--line);
}

.note-row.is-active {
  background: rgba(255, 247, 204, 0.9);
  border-color: rgba(232, 191, 59, 0.45);
  box-shadow: 0 10px 20px rgba(232, 191, 59, 0.12);
}

.note-row.is-trashed {
  opacity: 0.9;
  background: rgba(248, 250, 252, 0.74);
}

.note-row-main {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 4px 6px;
  color: inherit;
  cursor: pointer;
}

.note-row-static {
  cursor: default;
}

.note-row-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.note-row-preview {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-row-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.note-row-actions {
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.icon-action:hover {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

.icon-action-danger:hover {
  color: var(--danger);
}

.icon-action svg,
.toolbar-icon svg {
  width: 16px;
  height: 16px;
}

.form {
  margin-top: 18px;
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.title-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 4px 0 14px;
  background: transparent;
  color: var(--text);
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.title-input:focus {
  outline: none;
  border-color: var(--line-strong);
}

.editor-surface {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.92);
}

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

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--line);
}

.toolbar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.toolbar-icon:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--line);
  color: var(--text);
  transform: translateY(-1px);
}

.toolbar-icon.is-active {
  background: rgba(246, 213, 103, 0.26);
  border-color: rgba(232, 191, 59, 0.5);
  color: #7c5a08;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.editor-canvas {
  padding: 22px 22px 26px;
  background: var(--paper);
}

.rich-editor {
  min-height: 420px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.95;
  overflow-wrap: break-word;
}

.rich-editor:focus {
  outline: none;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #9ca3af;
}

.rich-editor h1,
.rich-editor h2,
.rich-editor h3 {
  margin: 0.8em 0 0.4em;
  line-height: 1.3;
}

.rich-editor p,
.rich-editor ul,
.rich-editor ol,
.rich-editor blockquote {
  margin: 0.7em 0;
}

.rich-editor a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rich-editor a:hover {
  color: #1d4ed8;
}

.rich-editor ul,
.rich-editor ol {
  padding-left: 1.4em;
}

.rich-editor blockquote {
  margin-left: 0;
  padding-left: 1em;
  border-left: 3px solid rgba(232, 191, 59, 0.8);
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.button {
  border: 0;
  border-radius: 14px;
  padding: 13px 20px;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #3d3212;
  background: linear-gradient(180deg, #fde68a 0%, var(--accent-deep) 100%);
  box-shadow: 0 10px 20px rgba(232, 191, 59, 0.2);
}

.button-primary:hover {
  background: linear-gradient(180deg, #fdeca5 0%, #efc951 100%);
}

.login-submit {
  width: 100%;
  margin-top: 6px;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
  border: 1px solid var(--line);
}

.button-danger {
  background: rgba(179, 56, 56, 0.08);
  color: var(--danger);
  border: 1px solid rgba(179, 56, 56, 0.24);
}

.message {
  min-height: 24px;
  margin-top: 14px;
  font-size: 14px;
}

.message[data-state="success"] {
  color: var(--success);
}

.message[data-state="error"] {
  color: var(--danger);
}

.message[data-state="pending"] {
  color: var(--muted);
}

.empty-state {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 980px) {
  .icloud-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 12px;
  }

  .login-card,
  .sidebar-panel,
  .editor-panel {
    padding: 16px;
  }

  .sidebar-actions,
  .actions {
    grid-template-columns: 1fr;
  }

  .toolbar-divider {
    display: none;
  }

  .editor-toolbar {
    flex-wrap: wrap;
  }

  .button {
    width: 100%;
    text-align: center;
  }
}
