:root {
  --bg: #0b3d5c;
  --bg2: #1565a0;
  --list-bg: #ebecf0;
  --card-bg: #ffffff;
  --ink: #172b4d;
  --muted: #5e6c84;
  --line: #dfe1e6;
  --accent: #0079bf;
  --shadow: 0 1px 2px rgba(9,30,66,.25);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, var(--bg), var(--bg2));
  display: flex; flex-direction: column; overflow: hidden;
}

/* top bar */
#topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: rgba(0,0,0,.18); color: #fff;
  backdrop-filter: blur(4px);
}
#topbar .brand { font-weight: 700; font-size: 18px; letter-spacing: .2px; }
#topbar .spacer { flex: 1; }
#boardPicker {
  background: rgba(255,255,255,.2); color: #fff; border: 0; border-radius: 6px;
  padding: 6px 10px; font-size: 14px; font-weight: 600; cursor: pointer;
}
#boardPicker option { color: #172b4d; }
#who { font-size: 13px; opacity: .9; margin-left: 6px; }

button { font-family: inherit; cursor: pointer; border: 0; border-radius: 6px; font-size: 14px; }
button.ghost { background: rgba(255,255,255,.2); color: #fff; padding: 6px 12px; }
button.ghost:hover { background: rgba(255,255,255,.32); }
button.ghost.small { padding: 3px 8px; font-size: 12px; }
button.primary { background: var(--accent); color: #fff; padding: 8px 16px; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { background: #eb5a46; color: #fff; padding: 8px 16px; }
button.danger:hover { filter: brightness(1.05); }

/* board */
#board {
  flex: 1; display: flex; align-items: flex-start; gap: 12px;
  padding: 16px; overflow-x: auto; overflow-y: hidden;
}
.list {
  background: var(--list-bg); border-radius: 10px; width: 280px; flex: 0 0 auto;
  max-height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.list-head {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px 4px;
}
.list-head input {
  flex: 1; border: 0; background: transparent; font-weight: 700; font-size: 14px;
  color: var(--ink); padding: 4px 6px; border-radius: 4px;
}
.list-head input:focus { background: #fff; outline: 2px solid var(--accent); }
.list-count { color: var(--muted); font-size: 12px; }
.list-del { background: transparent; color: var(--muted); padding: 2px 6px; }
.list-del:hover { background: #d6d8de; color: #172b4d; }
.cards { padding: 4px 8px; overflow-y: auto; flex: 1; min-height: 8px; }
.card {
  background: var(--card-bg); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px;
  box-shadow: var(--shadow); cursor: pointer; font-size: 14px; line-height: 1.35;
}
.card:hover { background: #f7f8f9; }
.card .labels { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.card .chip { height: 8px; width: 34px; border-radius: 4px; }
.card .due {
  display: inline-block; margin-top: 6px; font-size: 12px; padding: 2px 7px;
  border-radius: 4px; background: #e4e6ea; color: var(--muted);
}
.card .due.soon { background: #fdf3d1; color: #97700a; }
.card .due.over { background: #fce8e6; color: #b3261e; }
.add-card, .add-list-btn {
  margin: 4px 8px 8px; padding: 8px 10px; text-align: left; color: var(--muted);
  background: transparent; border-radius: 6px;
}
.add-card:hover { background: #d6d8de; color: #172b4d; }
.add-list {
  width: 280px; flex: 0 0 auto; background: rgba(255,255,255,.24); border-radius: 10px;
}
.add-list-btn { width: 100%; color: #fff; }
.add-list-btn:hover { background: rgba(255,255,255,.16); }
.composer { padding: 6px 8px 8px; }
.composer textarea {
  width: 100%; border: 0; border-radius: 6px; padding: 8px; font-family: inherit;
  font-size: 14px; resize: vertical; box-shadow: var(--shadow); margin-bottom: 6px;
}
.composer .row { display: flex; gap: 6px; align-items: center; }

/* drag state */
.sortable-ghost { opacity: .4; }
.sortable-drag { transform: rotate(2deg); }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 50;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 520px; padding: 22px;
  position: relative; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.modal-close { position: absolute; top: 12px; right: 12px; background: transparent; color: var(--muted); font-size: 16px; }
.card-title-input {
  width: 100%; font-size: 19px; font-weight: 700; border: 0; border-bottom: 2px solid transparent;
  padding: 4px 2px; margin: 4px 0 16px; color: var(--ink);
}
.card-title-input:focus { outline: none; border-bottom-color: var(--accent); }
.modal-section { margin-bottom: 16px; }
.modal-section > label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.modal-section textarea, .modal-section input[type=date] {
  width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px; font-family: inherit; font-size: 14px;
}
.modal-section input[type=date] { width: auto; }
.label-row { display: flex; gap: 6px; flex-wrap: wrap; }
.label-pill {
  padding: 6px 12px; border-radius: 6px; color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; opacity: .45; user-select: none;
}
.label-pill.on { opacity: 1; box-shadow: inset 0 0 0 2px rgba(0,0,0,.25); }
.modal-actions { display: flex; justify-content: space-between; margin-top: 18px; }

.share-add { display: flex; gap: 8px; margin: 12px 0; }
.share-add input { flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 8px; font-size: 14px; }
.hint { color: var(--muted); font-size: 12px; margin: 0 0 12px; }
.member {
  display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.member .role { color: var(--muted); font-size: 12px; }
.member .rm { margin-left: auto; background: transparent; color: #eb5a46; }
#memberList .member:first-child { border-top: 0; }
h3 { margin: 0 0 4px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #172b4d; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.3); z-index: 100;
}
.toast.hidden { display: none; }
.hidden { display: none; }
