/* Colours come from the active Standard Notes theme; the fallbacks are used when none is injected. */
:root {
  --bg: var(--sn-stylekit-background-color, #ffffff);
  --fg: var(--sn-stylekit-foreground-color, #37352f);
  --border: var(--sn-stylekit-border-color, #e4e3e0);
  --panel: var(--sn-stylekit-contrast-background-color, #f7f6f3);
  --muted: var(--sn-stylekit-neutral-color, #8b8a85);
  --accent: var(--sn-stylekit-info-color, #2383e2);
  --accent-fg: var(--sn-stylekit-info-contrast-color, #ffffff);
  --danger: var(--sn-stylekit-danger-color, #d9413b);
  --font: var(--sn-stylekit-sans-serif-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
  --shadow: 0 1px 2px rgba(15, 15, 15, 0.08);
  --col-w: min(280px, 84vw);
}

/* Opened directly in a browser (not inside Standard Notes): follow the OS colour scheme. */
@media (prefers-color-scheme: dark) {
  html.standalone {
    --sn-stylekit-background-color: #191919;
    --sn-stylekit-foreground-color: #e6e6e4;
    --sn-stylekit-border-color: #333332;
    --sn-stylekit-contrast-background-color: #222221;
    --sn-stylekit-neutral-color: #8f8f8c;
    --sn-stylekit-info-color: #4c9cf0;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 var(--font);
  -webkit-text-size-adjust: 100%;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- board ---------- */

.board {
  height: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  overflow-x: auto;
  overflow-y: hidden;
}
.board::after { content: ""; flex: 0 0 4px; }

.column {
  --tint: hsl(var(--hue) 70% 50%);
  position: relative;
  flex: 0 0 var(--col-w);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  background: var(--panel);
  background: color-mix(in srgb, var(--tint) 7%, var(--bg));
}

.col-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 6px 6px 8px;
  min-height: 44px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.locked .col-head { cursor: default; }

.col-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  background: hsl(var(--hue) 70% 50% / 0.2);
  font-weight: 600;
}
.col-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--hue) 62% 48%); }
.count { color: var(--muted); font-variant-numeric: tabular-nums; padding: 0 2px; }
.spacer { flex: 1; }

.icon-btn {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: hsl(var(--hue, 0) 20% 50% / 0.18); color: var(--fg); }

.col-input, .composer textarea {
  width: 100%;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--bg);
  padding: 6px 9px;
  outline: none;
}
.col-head .col-input { flex: 1; min-width: 0; font-weight: 600; padding: 3px 8px; }

.cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 4px;
  padding: 2px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.card {
  flex: none;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: var(--shadow);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overflow-wrap: anywhere;
}
.card:hover { border-color: color-mix(in srgb, var(--fg) 30%, var(--border)); }
.card.done .card-title { text-decoration: line-through; color: var(--muted); }
.card-title { font-weight: 500; }
.card-title.empty { color: var(--muted); }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.chip {
  padding: 0 6px;
  border-radius: 4px;
  background: hsl(var(--h) 70% 50% / 0.2);
  font-size: 12px;
  line-height: 18px;
}
.has-desc { color: var(--muted); font-size: 13px; line-height: 18px; }

.composer { flex: none; }
.composer textarea { display: block; resize: none; box-shadow: var(--shadow); }

.add-card {
  margin: 4px 8px 8px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--muted);
  text-align: left;
}
.add-card:hover, .add-column > button:hover { background: hsl(var(--hue, 0) 20% 50% / 0.16); color: var(--fg); }
.col-foot-pad { flex: none; height: 8px; }

.add-column { flex: 0 0 var(--col-w); }
.add-column > button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  text-align: left;
}
.empty-hint { color: var(--muted); padding: 10px 12px; }

/* ---------- column menu ---------- */

.menu {
  position: absolute;
  top: 40px;
  right: 6px;
  z-index: 5;
  min-width: 170px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
.menu button {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border-radius: 5px;
  text-align: left;
}
.menu button:hover:not(:disabled) { background: var(--panel); }
.menu button:disabled { color: var(--muted); opacity: 0.6; cursor: default; }
.menu .danger, .btn.danger { color: var(--danger); }

/* ---------- drag and drop ---------- */

.drag-source { opacity: 0.35; }
.drag-source.card { border-style: dashed; box-shadow: none; }
.ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  margin: 0;
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
body.dragging, body.dragging * { cursor: grabbing !important; }

/* ---------- card dialog ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(16px, 7vh) 16px 16px;
  background: rgba(0, 0, 0, 0.4);
  overflow-y: auto;
}
.dialog {
  width: 100%;
  max-width: 560px;
  padding: 16px 20px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}
.dialog:focus { outline: none; }
.m-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--muted); }
.m-title {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  padding: 2px 0;
  resize: none;
  overflow: hidden;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}
.m-title:focus, .m-field input:focus, .m-field select:focus, .m-desc:focus { outline: none; }
.m-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
}
.m-field > span { flex: 0 0 76px; }
.m-field input[type="text"], .m-field select {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--fg);
}
.m-field select { background: var(--bg); }
.m-field input[type="text"]:hover, .m-field select:hover { background-color: var(--panel); }
.m-field input[type="text"]:focus, .m-field select:focus, .m-desc:focus { border-color: var(--accent); }
.m-field input[type="checkbox"] { width: 16px; height: 16px; margin: 6px 8px; accent-color: var(--accent); }
.m-desc {
  display: block;
  width: 100%;
  min-height: 150px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  resize: vertical;
}
.m-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; }
.btn { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; }
.btn:hover { background: var(--panel); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }
