:root {
  --bg: #1f1f1f; --panel: #262626; --panel2: #2e2e2e; --card: #333;
  --text: #e8eaed; --muted: #9aa0a6; --accent: #4285f4; --green: #34a853;
}
* { box-sizing: border-box; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 'Segoe UI', Roboto, sans-serif; height: 100vh; overflow: hidden; }
.hidden { display: none !important; }

/* login */
.login { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card { background: var(--panel); padding: 48px 56px; border-radius: 16px; text-align: center; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.logo-plate { background: #fff; padding: 20px 26px; border-radius: 14px; margin-bottom: 22px; display: inline-block; }
.login-logo { display: block; max-width: 280px; width: 100%; height: auto; }
.login-card h1 { font-size: 28px; font-weight: 600; }
.login-card h1 span { color: var(--accent); font-weight: 300; }
.login-card p { color: var(--muted); margin: 8px 0 24px; }
.gbtn { display: inline-block; background: var(--accent); color: #fff; text-decoration: none; padding: 12px 28px; border-radius: 24px; font-weight: 600; }
.login-card small { display: block; margin-top: 16px; color: var(--muted); }

/* chrome */
header { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: #171717; border-bottom: 1px solid #000; }
.brand { font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.hlogo { height: 26px; width: auto; background: #fff; padding: 3px 7px; border-radius: 6px; display: block; }
.logo { display: inline-block; width: 14px; height: 14px; background: var(--accent); border-radius: 3px; margin-right: 8px; }
#boardTitle { font-size: 16px; color: var(--muted); }
#boardCount { font-size: 12px; color: var(--text); background: var(--panel2); border-radius: 12px; padding: 3px 10px; white-space: nowrap; }
#boardCount:empty { display: none; }
.spacer { flex: 1; }
#search { background: var(--panel2); border: 0; border-radius: 20px; color: var(--text); padding: 8px 16px; width: 260px; }
header button { background: var(--panel2); color: var(--text); border: 0; border-radius: 18px; padding: 8px 16px; cursor: pointer; }
header button:hover { background: #3a3a3a; }
#avatar { width: 32px; height: 32px; border-radius: 50%; cursor: pointer; }
.body { display: flex; height: calc(100vh - 53px); }

/* sidebar */
nav { width: 210px; background: #171717; padding: 12px 8px; flex-shrink: 0; overflow-y: auto; }
nav .bitem { padding: 10px 14px; border-radius: 0 20px 20px 0; cursor: pointer; color: var(--text); display: flex; gap: 8px; align-items: center; }
nav .bitem.active, nav .bitem:hover { background: var(--panel2); }
nav .addboard { color: var(--muted); }

/* board */
main { flex: 1; display: flex; gap: 14px; padding: 16px; overflow-x: auto; align-items: flex-start; }
.list { background: var(--panel); border-radius: 12px; width: 300px; flex-shrink: 0; max-height: 100%; display: flex; flex-direction: column; border-left: 4px solid var(--accent); }
.list-head { display: flex; align-items: center; padding: 12px 14px 6px; gap: 8px; cursor: grab; }
.list-head:active { cursor: grabbing; }
.list-head h3 { font-size: 15px; font-weight: 600; flex: 1; }
.list-head .count { color: var(--muted); font-size: 12px; }
.addtask { color: var(--accent); background: none; border: 0; text-align: left; padding: 4px 14px 10px; cursor: pointer; font-size: 13px; }
.cards { overflow-y: auto; padding: 0 8px 12px; }

.card { background: var(--panel2); border: 1px solid #3d3d3d; border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.card:hover { background: #343434; }
.card-title { display: flex; gap: 8px; align-items: baseline; cursor: pointer; font-weight: 600; }
.card-title .circle { width: 16px; height: 16px; border: 2px solid var(--muted); border-radius: 50%; flex-shrink: 0; position: relative; top: 2px; cursor: pointer; }
.card-title .circle:hover { border-color: var(--green); }
.card-title .circle.checked { background: var(--green); border-color: var(--green); }
.card-title .circle.checked::after { content: '✓'; position: absolute; inset: 0; color: #fff; font-size: 11px; line-height: 13px; text-align: center; }
.card-done .card-title > span:last-child { color: var(--muted); text-decoration: line-through; }
.done-cards .card { opacity: .8; }
.card-notes { color: var(--muted); font-size: 12px; margin: 2px 0 4px 24px; white-space: pre-line; max-height: 54px; overflow: hidden; }
.due { display: inline-block; background: #103a63; color: #9cc3f5; font-size: 11px; border-radius: 12px; padding: 2px 10px; margin: 2px 0 2px 24px; }
.due.today { background: #5c1a1a; color: #f5a9a9; }

.subtask { margin: 6px 0 0 18px; padding: 7px 9px; background: var(--card); border: 1px solid #4a4a4a; border-radius: 8px; display: flex; gap: 8px; align-items: flex-start; }
.subtask input[type=checkbox] { accent-color: var(--green); width: 15px; height: 15px; margin-top: 2px; cursor: pointer; }
.subtask .st-title { cursor: pointer; }
.subtask.done .st-title { color: var(--muted); }
.subtask .st-notes { color: var(--muted); font-size: 11px; white-space: pre-line; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.chip { font-size: 10px; border-radius: 10px; padding: 1px 8px; background: #444; color: #fff; cursor: pointer; }
.chip.off { opacity: .38; }
.chip.lbl-edit, .chip.done-lbl { background: #3a3a3a; color: var(--muted); }

/* inline editing (no popup) */
.card-title > .edit-title { flex: 1; cursor: text; border-radius: 4px; }
.edit-title:hover, .st-title:hover, .card-notes.editable:hover, .st-notes.editable:hover { background: rgba(255,255,255,.06); }
.card-notes.editable, .st-notes.editable, .st-title { cursor: text; }
.st-body { flex: 1; min-width: 0; }
.inline-edit { width: 100%; background: #1b1b1b; color: var(--text); border: 1px solid var(--accent); border-radius: 6px; padding: 8px 10px; font: inherit; line-height: 1.4; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
input.inline-edit { min-height: 34px; }
textarea.inline-edit, .inline-edit.ml { min-height: 84px; resize: vertical; overflow-y: auto; max-height: 420px; }
.card-del, .st-del { margin-left: auto; color: var(--muted); cursor: pointer; opacity: 0; padding: 0 2px 0 6px; flex-shrink: 0; }
.card:hover .card-del, .subtask:hover .st-del { opacity: .55; }
.card-del:hover, .st-del:hover { color: #f5a9a9; opacity: 1; }
.due.add { background: #333; color: var(--muted); }
.add-sub { margin: 8px 0 0 18px; }
.add-sub-inp { font-size: 12px; padding: 3px 6px; }

/* modal */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.dialog { background: var(--panel); border-radius: 14px; padding: 24px; width: 520px; max-height: 84vh; overflow-y: auto; box-shadow: 0 12px 48px rgba(0,0,0,.6); }
.dialog h2 { font-size: 17px; margin-bottom: 14px; }
.dialog label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
.dialog input[type=text], .dialog input[type=date], .dialog input[type=email], .dialog textarea, .dialog select {
  width: 100%; background: var(--panel2); border: 1px solid #444; border-radius: 8px; color: var(--text); padding: 8px 10px; font: inherit; }
.dialog textarea { min-height: 140px; }
.dialog .row { display: flex; gap: 8px; align-items: center; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog button { border: 0; border-radius: 18px; padding: 8px 18px; cursor: pointer; background: var(--panel2); color: var(--text); }
.dialog button.primary { background: var(--accent); color: #fff; }
.dialog button.danger { background: #5c1a1a; color: #f5a9a9; }
#f-subs .sub-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid #333; }
.dialog button.link { background: none; color: var(--accent); padding: 2px 6px; border-radius: 6px; }
.label-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.label-pick .chip { cursor: pointer; font-size: 12px; padding: 4px 12px; opacity: .45; }
.label-pick .chip.on { opacity: 1; outline: 2px solid #fff3; }
.member { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #333; }
.member .m-email { flex: 1; }
.completed-toggle { color: var(--muted); cursor: pointer; padding: 8px 14px; font-size: 13px; border-top: 1px solid #333; }
.drag-ghost { opacity: .4; }
