:root {
  --bg: #f4efe8;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-border: rgba(65, 44, 24, 0.12);
  --text: #24160d;
  --muted: #6d5d52;
  --shadow: 0 18px 50px rgba(64, 39, 18, 0.14);
  --accent: #243b4a;
  --accent-2: #d27c4c;
  --danger: #b83b3b;
  --sand: #f6e3b5;
  --mint: #c8ead9;
  --sky: #cbe4f7;
  --peach: #f8d7c3;
  --lavender: #ded4f8;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(210, 124, 76, 0.2), transparent 24%),
    radial-gradient(circle at bottom right, rgba(36, 59, 74, 0.18), transparent 28%),
    linear-gradient(180deg, #f7f3ee 0%, #efe6db 100%);
}

.shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 24px;
  background: rgba(255, 250, 244, 0.78);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--panel-border);
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--accent), #506c7e);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.brand h1,
.topbar h2,
.panel h2 {
  margin: 0;
}

.brand p,
.eyebrow,
.status,
.panel p,
label,
.project-item span,
.chip {
  color: var(--muted);
}

.panel {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel.small {
  font-size: 0.95rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(36, 59, 74, 0.08);
  font-size: 0.8rem;
  white-space: nowrap;
}

label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.9rem;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(36, 22, 13, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

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

button:disabled,
input:disabled,
textarea:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.primary {
  width: 100%;
  margin-top: 14px;
  background: linear-gradient(135deg, var(--accent), #425d6f);
  color: #fff;
  box-shadow: 0 12px 26px rgba(36, 59, 74, 0.24);
}

.danger {
  background: linear-gradient(135deg, #c54c4c, var(--danger));
  color: #fff;
}

.project-list {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.project-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(36, 22, 13, 0.1);
  background: rgba(255, 255, 255, 0.6);
}

.project-item.active {
  border-color: rgba(36, 59, 74, 0.28);
  background: rgba(36, 59, 74, 0.08);
  box-shadow: 0 12px 24px rgba(36, 59, 74, 0.12);
}

.project-item strong {
  text-align: left;
}

.share-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.canvas-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 22px 24px 10px;
}

.eyebrow {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
}

.status {
  font-size: 0.95rem;
}

.canvas {
  position: relative;
  flex: 1;
  margin: 0 24px 24px;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(36, 22, 13, 0.12);
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.3), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.25));
  box-shadow: var(--shadow);
  min-height: 78vh;
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(36, 22, 13, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(36, 22, 13, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.note {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(36, 22, 13, 0.12);
  box-shadow: 0 14px 26px rgba(48, 29, 10, 0.16);
  cursor: grab;
  user-select: none;
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.note.readonly {
  cursor: default;
}

.note:active {
  cursor: grabbing;
}

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

.note-title {
  font-size: 1rem;
}

.note-hint {
  font-size: 0.75rem;
  opacity: 0.6;
}

.note-body {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
  color: rgba(36, 22, 13, 0.86);
}

.note.sand {
  background: linear-gradient(145deg, #f8e6ba, var(--sand));
}

.note.mint {
  background: linear-gradient(145deg, #d7f3e5, var(--mint));
}

.note.sky {
  background: linear-gradient(145deg, #d8eefc, var(--sky));
}

.note.peach {
  background: linear-gradient(145deg, #fbe0d2, var(--peach));
}

.note.lavender {
  background: linear-gradient(145deg, #e9defa, var(--lavender));
}

dialog {
  border: 0;
  border-radius: 24px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(31, 22, 12, 0.38);
  backdrop-filter: blur(3px);
}

.editor {
  width: min(520px, calc(100vw - 32px));
  padding: 20px;
  background: #fffaf3;
}

.editor h3 {
  margin-top: 0;
}

.editor-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--panel-border);
  }

  .canvas {
    min-height: 70vh;
  }
}

@media (max-width: 640px) {
  .topbar,
  .sidebar,
  .canvas {
    padding-left: 16px;
    padding-right: 16px;
  }

  .canvas {
    margin: 0 16px 16px;
  }
}
