:root {
  --ink: #26312d;
  --muted: #64726c;
  --paper: #fff8bf;
  --paper-edge: rgba(80, 70, 35, 0.2);
  --shadow: rgba(53, 45, 22, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: #f7f1e6;
}

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

button,
select {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 58px 1fr;
}

.sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  min-width: 0;
  padding: 20px;
  border-right: 1px solid rgba(56, 68, 59, 0.14);
  background: #fffaf0;
  box-shadow: 8px 0 28px rgba(71, 60, 35, 0.08);
  z-index: 5;
}

.brand h1,
.panel-heading h2,
.brand p,
.menu-label {
  margin: 0;
}

.brand h1 {
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

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

.sidebar-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(47, 58, 52, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.sidebar-toggle:hover {
  background: rgba(220, 234, 223, 0.58);
}

.sidebar-toggle span {
  position: absolute;
  width: 9px;
  height: 2px;
  border-radius: 999px;
  background: rgba(38, 49, 45, 0.78);
  transform-origin: center;
}

.sidebar-toggle span:first-child {
  transform: translateX(-2px) rotate(45deg);
}

.sidebar-toggle span:last-child {
  transform: translateX(-2px) rotate(-45deg);
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 14px 11px;
}

.app-shell.sidebar-collapsed .brand-row {
  justify-content: center;
}

.app-shell.sidebar-collapsed .brand h1,
.app-shell.sidebar-collapsed .brand p,
.app-shell.sidebar-collapsed .board-list-panel,
.app-shell.sidebar-collapsed .new-board-form {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.brand p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.board-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

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

.panel-heading h2 {
  font-size: 13px;
  text-transform: uppercase;
  color: rgba(38, 49, 45, 0.68);
  letter-spacing: 0.08em;
}

.board-total {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: rgba(38, 49, 45, 0.72);
  background: rgba(57, 88, 75, 0.1);
  font-size: 13px;
  font-weight: 800;
}

.board-list {
  display: grid;
  align-content: start;
  gap: 8px;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.board-list-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 58px;
  padding: 6px;
  border: 1px solid rgba(47, 58, 52, 0.12);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.46);
}

.board-list-item:hover,
.board-list-item.active {
  border-color: rgba(57, 88, 75, 0.32);
  background: rgba(220, 234, 223, 0.58);
}

.board-select-button {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 46px;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.board-select-button:hover {
  background: rgba(255, 255, 255, 0.36);
}

.board-list-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-list-meta {
  color: var(--muted);
  font-size: 12px;
}

.board-menu {
  position: relative;
}

.board-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.board-menu-button:hover,
.board-menu-button[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.66);
}

.board-menu-button span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(43, 43, 35, 0.7);
}

.board-menu-panel {
  position: fixed;
  display: none;
  width: 210px;
  padding: 12px;
  border: 1px solid rgba(48, 48, 37, 0.16);
  border-radius: 8px;
  background: rgba(255, 252, 239, 0.98);
  box-shadow: 0 14px 28px rgba(53, 45, 22, 0.2);
  z-index: 40;
}

.board-menu.open .board-menu-panel {
  display: grid;
  gap: 8px;
}

.board-menu-panel label {
  color: rgba(38, 49, 45, 0.68);
  font-size: 12px;
  font-weight: 800;
}

.board-menu-panel input,
.board-menu-panel select {
  min-height: 36px;
  width: 100%;
  border: 1px solid rgba(47, 58, 52, 0.16);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  outline: 0;
}

.board-menu-panel input:focus,
.board-menu-panel select:focus {
  border-color: rgba(57, 88, 75, 0.45);
  box-shadow: 0 0 0 3px rgba(57, 88, 75, 0.1);
}

.new-board-form {
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(56, 68, 59, 0.12);
}

.new-board-form label {
  color: rgba(38, 49, 45, 0.68);
  font-size: 12px;
  font-weight: 800;
}

.new-board-form input,
.new-board-form select {
  min-height: 38px;
  border: 1px solid rgba(47, 58, 52, 0.16);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  outline: 0;
}

.new-board-form input,
.new-board-form select {
  width: 100%;
  padding: 0 10px;
}

.new-board-form input:focus,
.new-board-form select:focus {
  border-color: rgba(57, 88, 75, 0.45);
  box-shadow: 0 0 0 3px rgba(57, 88, 75, 0.1);
}

.create-board-button,
.add-note-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid rgba(42, 56, 49, 0.18);
  border-radius: 8px;
  color: #f9f7ef;
  background: #39584b;
  box-shadow: 0 8px 18px rgba(45, 69, 58, 0.16);
}

.create-board-button:hover,
.add-note-button:hover {
  background: #2f4d40;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(56, 68, 59, 0.14);
  background: rgba(255, 251, 242, 0.9);
  z-index: 4;
}

.current-board-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 26px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-note-button {
  flex: 0 0 auto;
  padding: 0 16px;
}

.add-note-button span {
  font-size: 22px;
  line-height: 1;
}

.board {
  --column-count: 3;
  display: grid;
  grid-template-columns: repeat(var(--column-count), minmax(210px, 1fr));
  min-height: 0;
  overflow: hidden;
}

.zone {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border-right: 1px solid rgba(47, 58, 52, 0.12);
}

.zone:last-child {
  border-right: 0;
}

.zone-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 16px 16px 10px;
}

.zone-name {
  min-width: 0;
  flex: 1;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 4px 6px;
  color: var(--ink);
  background: transparent;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: 0;
  outline: 0;
}

.zone-name:hover,
.zone-name:focus {
  border-color: rgba(47, 58, 52, 0.18);
  background: rgba(255, 255, 255, 0.34);
}

.zone-colour-control {
  position: relative;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid rgba(47, 58, 52, 0.16);
  border-radius: 999px;
  background: var(--zone-colour);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.42);
}

.zone-colour-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
}

.note-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: rgba(38, 49, 45, 0.72);
  background: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  font-weight: 700;
}

.zone-surface {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.zone-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.45;
  pointer-events: none;
}

.sticky-note {
  position: absolute;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  width: clamp(158px, 44%, 230px);
  min-height: 176px;
  padding: 12px;
  border: 1px solid var(--paper-edge);
  border-radius: 7px 7px 12px 7px;
  background: var(--paper);
  box-shadow: 0 12px 24px var(--shadow), inset 0 -18px 30px rgba(97, 81, 33, 0.05);
  touch-action: none;
  transform-origin: center;
  transition: box-shadow 120ms ease, transform 120ms ease;
  z-index: 1;
}

.sticky-note.dragging {
  box-shadow: 0 18px 34px rgba(53, 45, 22, 0.26);
  transform: rotate(0deg) scale(1.015);
  z-index: 10000 !important;
}

.note-grip {
  width: 42px;
  height: 8px;
  justify-self: center;
  margin: -3px 0 6px;
  border-radius: 999px;
  background: rgba(61, 53, 31, 0.2);
  cursor: grab;
}

.sticky-note.dragging .note-grip {
  cursor: grabbing;
}

.note-title,
.note-body {
  width: 100%;
  border: 0;
  color: #2f3025;
  background: transparent;
  outline: 0;
}

.note-title {
  min-height: 30px;
  font-size: 16px;
  font-weight: 750;
}

.note-title::placeholder,
.note-body::placeholder {
  color: rgba(48, 48, 37, 0.48);
}

.note-body {
  min-height: 76px;
  resize: none;
  line-height: 1.35;
  font-size: 14px;
}

.note-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 8px;
}

.note-menu {
  position: relative;
}

.note-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 32px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
}

.note-menu-button:hover,
.note-menu-button[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.62);
}

.note-menu-button span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(43, 43, 35, 0.7);
}

.note-menu-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  display: none;
  width: 152px;
  padding: 10px;
  border: 1px solid rgba(48, 48, 37, 0.16);
  border-radius: 8px;
  background: rgba(255, 252, 239, 0.98);
  box-shadow: 0 14px 28px rgba(53, 45, 22, 0.2);
  z-index: 30;
}

.note-menu.open .note-menu-panel {
  display: block;
}

.menu-label {
  margin-bottom: 8px;
  color: rgba(47, 48, 37, 0.64);
  font-size: 12px;
  font-weight: 700;
}

.colour-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.colour-swatch {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(48, 48, 37, 0.2);
  border-radius: 999px;
  padding: 0;
  background: var(--swatch);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.colour-swatch.selected {
  outline: 2px solid rgba(47, 58, 52, 0.7);
  outline-offset: 2px;
}

.delete-note {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(150, 57, 45, 0.18);
  border-radius: 7px;
  color: #7a3028;
  background: rgba(255, 238, 232, 0.76);
  font-size: 13px;
  font-weight: 750;
}

.delete-note:hover {
  color: #63231d;
  background: rgba(255, 223, 213, 0.92);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: 62px 1fr;
  }

  .sidebar {
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1.4fr) minmax(180px, 0.9fr);
    grid-template-rows: auto;
    align-items: start;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(56, 68, 59, 0.14);
  }

  .app-shell.sidebar-collapsed .sidebar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 14px;
  }

  .app-shell.sidebar-collapsed .brand-row {
    justify-content: flex-start;
  }

  .board-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(170px, 1fr);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .workspace {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .sidebar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
  }

  .add-note-button {
    width: 100%;
  }

  .board {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(var(--column-count), minmax(260px, 1fr));
    overflow-y: auto;
  }

  .zone {
    min-height: 320px;
    border-right: 0;
    border-bottom: 1px solid rgba(47, 58, 52, 0.12);
  }

  .sticky-note {
    width: clamp(160px, 54%, 220px);
  }
}
