:root {
  --panel: rgba(255, 251, 246, 0.82);
  --panel-strong: rgba(255, 251, 246, 0.96);
  --line: rgba(90, 70, 48, 0.12);
  --line-strong: rgba(22, 93, 87, 0.22);
  --text: #2d241d;
  --muted: #77695d;
  --accent: #165d57;
  --accent-2: #2e8479;
  --accent-soft: rgba(22, 93, 87, 0.09);
  --danger: #b24c3d;
  --danger-soft: rgba(178, 76, 61, 0.1);
  --shadow: 0 30px 70px rgba(48, 34, 20, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Avenir Next", "SF Pro Text", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(252, 196, 135, 0.34), transparent 28%),
    linear-gradient(180deg, #f8f2e8 0%, #f2eee7 46%, #ece8df 100%);
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(32px);
  opacity: 0.35;
  pointer-events: none;
}

.orb-a {
  width: 320px;
  height: 320px;
  top: -70px;
  right: -20px;
  background: #b7ded8;
}

.orb-b {
  width: 260px;
  height: 260px;
  bottom: -40px;
  left: -40px;
  background: #f6bd90;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(60, 40, 20, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(60, 40, 20, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.62), transparent 96%);
  pointer-events: none;
}

.shell {
  position: relative;
  height: 100vh;
  padding: 16px;
  overflow: hidden;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--muted);
}

h1,
h2,
h3,
.title-input {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
}

p {
  margin: 0;
}

.subtitle {
  color: var(--muted);
  line-height: 1.7;
  margin-top: 12px;
  max-width: 620px;
}

.subtitle.compact {
  margin-top: 8px;
  max-width: 440px;
}

.login-wrap {
  min-height: calc(100vh - 32px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  align-items: stretch;
}

.hero-card,
.login-panel,
.topbar,
.sidebar,
.editor,
.inspector {
  border-radius: var(--radius-xl);
}

.hero-card {
  padding: 34px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 22px;
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -60px -120px auto;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(22, 93, 87, 0.16), transparent 70%);
}

.hero-copy h1 {
  font-size: clamp(40px, 5vw, 68px);
  line-height: 0.96;
  max-width: 740px;
}

.hero-pills {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-pills span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(22, 93, 87, 0.08);
  color: var(--text);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.metric-card p,
.tool-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.metric-card strong {
  display: block;
  font-size: 28px;
  margin: 10px 0 8px;
}

.metric-card span {
  color: var(--muted);
  line-height: 1.5;
}

.login-panel {
  padding: 32px;
  display: grid;
  align-content: center;
  gap: 28px;
}

.brand-block,
.brand-line,
.section-head,
.sidebar-top,
.editor-topbar,
.topbar-main,
.topbar-side,
.user-card,
.title-status {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 74px;
  height: 74px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 700;
  font-size: 32px;
  box-shadow: 0 20px 32px rgba(22, 93, 87, 0.24);
}

.brand-mark.small {
  width: 48px;
  height: 48px;
  font-size: 20px;
  border-radius: 16px;
}

.brand-mark.tiny {
  width: 38px;
  height: 38px;
  font-size: 17px;
  border-radius: 14px;
  box-shadow: 0 12px 20px rgba(22, 93, 87, 0.18);
}

.stack,
.field,
.editor-meta,
.inspector-section,
.empty-state,
.meta-list {
  display: grid;
  gap: 10px;
}

.field span {
  font-size: 13px;
  color: var(--muted);
}

.field input,
.search-box input,
.title-input,
.content-input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(85, 66, 53, 0.14);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.field input,
.search-box input {
  height: 50px;
  padding: 0 16px;
}

.field input:focus,
.search-box input:focus,
.title-input:focus,
.content-input:focus {
  border-color: rgba(22, 93, 87, 0.38);
  box-shadow: 0 0 0 5px rgba(22, 93, 87, 0.08);
}

.primary-btn,
.ghost-btn,
.danger-btn,
.segment-btn,
.tool-btn,
.action-tile {
  border: none;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, opacity 150ms ease;
}

.primary-btn:hover,
.ghost-btn:hover,
.danger-btn:hover,
.segment-btn:hover,
.tool-btn:hover,
.action-tile:hover {
  transform: translateY(-1px);
}

.primary-btn,
.ghost-btn,
.danger-btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 14px;
}

.small-btn,
.topbar-btn {
  height: 38px;
  padding: 0 14px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 600;
}

.ghost-btn {
  background: var(--accent-soft);
  color: var(--accent);
}

.danger-btn {
  background: var(--danger-soft);
  color: var(--danger);
}

.primary-btn:disabled,
.ghost-btn:disabled,
.danger-btn:disabled,
.segment-btn:disabled,
.tool-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.error-text {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

.workspace {
  display: grid;
  gap: 10px;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.topbar {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar-main,
.topbar-side {
  flex: 0 0 auto;
}

.topbar-brand {
  gap: 10px;
}

.topbar-copy {
  display: grid;
  gap: 2px;
}

.topbar-title {
  font-size: 15px;
  line-height: 1.1;
}

.topbar-subtitle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.status-text,
.muted-text,
.empty-list p,
.meta-list p,
.action-tile span {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.user-card {
  padding: 6px 8px 6px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  gap: 10px;
}

.user-card span {
  display: block;
  font-size: 14px;
}

.notes-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 292px;
  gap: 10px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.sidebar,
.editor,
.inspector {
  padding: 14px;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 10px;
}

.editor {
  display: grid;
  grid-template-rows: 1fr;
}

.inspector {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.notes-list,
.attachment-list {
  min-height: 0;
  overflow: auto;
}

.notes-list {
  display: grid;
  gap: 10px;
  padding-right: 4px;
  align-content: start;
  grid-auto-rows: max-content;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(85, 66, 53, 0.1);
  border-radius: 16px;
  padding: 4px;
}

.segment-btn {
  height: 34px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
}

.segment-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 20px rgba(48, 34, 20, 0.08);
}

.note-card,
.attachment-card {
  border-radius: 18px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.58);
}

.note-card {
  padding: 14px 15px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
  min-height: 84px;
  text-align: left;
  align-content: start;
}

.note-card:hover {
  border-color: rgba(22, 93, 87, 0.18);
}

.note-card.active {
  background: var(--panel-strong);
  border-color: var(--line-strong);
  box-shadow: 0 18px 30px rgba(22, 93, 87, 0.08);
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.note-card h4 {
  margin: 0;
  font-size: 17px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-meta-line {
  color: var(--muted);
  line-height: 1.4;
  font-size: 12px;
  display: block;
}

.note-badge {
  padding: 6px 10px;
  font-size: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(22, 93, 87, 0.08);
}

.editor-body {
  display: grid;
  gap: 10px;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.editor-toolbar {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(85, 66, 53, 0.08);
}

.tool-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(22, 93, 87, 0.08);
  color: var(--text);
  font-size: 13px;
}

.editor-surface {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.title-input {
  height: 54px;
  padding: 0 18px;
  font-size: 26px;
}

.content-input {
  min-height: 0;
  height: 100%;
  resize: none;
  padding: 16px 18px;
  line-height: 1.75;
  white-space: pre-wrap;
  tab-size: 8;
  font-family: "SF Mono", "JetBrains Mono", "Menlo", "Consolas", monospace;
  font-size: 14px;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.empty-state {
  place-content: center;
  min-height: 100%;
  text-align: center;
}

.empty-state h3 {
  font-size: 28px;
}

.inspector-section {
  padding: 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.5);
  min-height: 0;
  overflow: hidden;
}

.attachments-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.cheatsheet-list {
  display: grid;
  gap: 8px;
}

.cheatsheet-item {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(22, 93, 87, 0.08);
}

.cheatsheet-item strong {
  font-size: 15px;
  color: var(--text);
}

.cheatsheet-item span {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.attachment-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

#attachmentsList {
  min-height: 0;
  overflow: auto;
}

.section-head {
  justify-content: space-between;
  align-items: center;
}

.empty-list {
  padding: 12px 0;
}

.attachment-card {
  padding: 12px 14px;
  border: 1px solid rgba(22, 93, 87, 0.08);
  background: rgba(255, 255, 255, 0.74);
  border-radius: 16px;
}

.attachment-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.attachment-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.attachment-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.5;
}

.attachment-copy p {
  color: var(--muted);
  line-height: 1.5;
  font-size: 12px;
}

.attachment-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.text-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
}

.text-btn.danger {
  color: var(--danger);
}

@media (max-width: 1280px) {
  .notes-layout {
    grid-template-columns: 232px minmax(0, 1fr) 272px;
  }

  .inspector {
    grid-template-rows: auto minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .shell {
    height: auto;
    overflow: visible;
  }

  .login-wrap,
  .notes-layout {
    grid-template-columns: 1fr;
  }

  .workspace {
    height: auto;
    grid-template-rows: auto auto;
    overflow: visible;
  }

  .notes-layout {
    height: auto;
    overflow: visible;
  }

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

  .topbar-main,
  .topbar-side {
    flex-direction: column;
    align-items: stretch;
  }

  .inspector {
    grid-template-columns: 1fr;
  }
}

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

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

  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .brand-block,
  .brand-line,
  .sidebar-top,
  .editor-topbar,
  .topbar-main {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor-actions,
  .editor-footer {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

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