:root {
    --bg: #f6f7f9;
    --card: #fff;
    --ink: #22303f;
    --muted: #7a8694;
    --line: #dde3ea;
    --accent: #2563eb;
    --accent-ink: #fff;
    --danger: #b91c1c;
    --ok: #166534;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
.view { min-height: 100vh; }

/* auth */
#view-auth { display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px 28px; width: 380px; box-shadow: 0 6px 24px rgba(30,40,60,.08); }
.auth-card h1 { margin: 0 0 12px; font-size: 22px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab { flex: 1; padding: 7px 4px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; color: var(--muted); }
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pane { display: none; }
.pane.active { display: block; }
label { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
input, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }
input:focus, button:focus, textarea:focus { outline: 2px solid #bcd3ff; }
textarea { resize: none; overflow: hidden; line-height: 1.45; }
button { font: inherit; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--danger); border-color: #efc7c7; }
.pane button.primary { width: 100%; margin-top: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 10px; }
details { margin-top: 10px; }
.msg { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 16px; }
.msg.ok { color: var(--ok); }

/* main */
header { display: flex; align-items: center; justify-content: space-between; background: #1c2b3a; color: #fff; padding: 10px 18px; }
header h1 { font-size: 18px; margin: 0; }
.whoami { display: flex; align-items: center; gap: 10px; }
.whoami button { padding: 5px 10px; }
header .badge { background: #2e7d32; color: #fff; border-radius: 10px; padding: 2px 10px; font-size: 12px; }
.hidden { display: none !important; }
.verify-banner { background: #fff7e0; border-bottom: 1px solid #ecd9a0; color: #6c5310; padding: 8px 18px; font-size: 13px; }
.columns { display: flex; min-height: calc(100vh - 110px); }
.sidebar { width: 260px; border-right: 1px solid var(--line); background: #fbfcfe; padding: 14px; }
.columns.sidebar-collapsed .sidebar { display: none; }
.sidebar-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.sidebar-row h2 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sidebar-toggle, .sidebar-expand { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.sidebar-toggle:hover, .sidebar-expand:hover { background: #eef2f8; color: var(--ink); }
.sidebar-expand { align-self: flex-start; margin-top: 14px; padding: 8px 6px; border-left: none; border-radius: 0 6px 6px 0; background: #fbfcfe; }
.inline-form { display: flex; gap: 6px; margin: 6px 0 10px; }
.inline-form input { min-width: 0; }
.inline-form .grow { flex: 1; }
#list-menu { list-style: none; margin: 0; padding: 0; }
#list-menu li { margin: 2px 0; }
#list-menu li.current { background: #e8efff; color: #1b3a86; }
#list-menu button { display: block; width: 100%; text-align: left; background: transparent; border: none; padding: 7px 9px; border-radius: 6px; color: var(--ink); }
#list-menu li.current button { font-weight: 600; }
.content { flex: 1; padding: 18px 24px; }
.toolbar { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px; }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.toolbar h2 { margin: 0; font-size: 19px; }
.menu-wrap { position: relative; }
#btn-toolbar-menu { padding: 5px 12px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 22px rgba(30,40,60,.18); padding: 10px; min-width: 230px; z-index: 40; display: flex; flex-direction: column; gap: 8px; }
.dropdown button { width: 100%; text-align: left; }
.dropdown .showdone { gap: 5px; }
.dropdown .danger { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 2px; }
.toolbar .showdone { display: flex; gap: 5px; align-items: center; color: var(--muted); font-size: 13px; margin: 0; }
.toolbar .showdone input, .toolbar .showdone select { width: auto; }
.toolbar .showdone select { padding: 2px 4px; }
.item-form { margin: 10px 0 14px; }
#item-list, #list-menu { margin: 0; }
#item-list { list-style: none; padding: 0; columns: 2; column-gap: 14px; }
#item-list li { background: #fff; padding: 3px 8px; margin: 0 0 2px; display: flex; align-items: flex-start; gap: 8px; break-inside: avoid; cursor: grab; }
#item-list li button, #item-list li input, #item-list li textarea { cursor: auto; }
#item-list li.dragging { opacity: .35; cursor: grabbing; }
#item-list li.drop-above { box-shadow: 0 -2px 0 0 var(--accent); }
#item-list li.drop-below { box-shadow: 0 2px 0 0 var(--accent); }
.drag-ghost { position: fixed; z-index: 20; pointer-events: none; opacity: .9; background: #fff; box-shadow: 0 8px 22px rgba(30,40,60,.25); border: 1px solid var(--accent); border-radius: 6px; padding: 3px 8px; margin: 0; display: flex; align-items: flex-start; gap: 8px; box-sizing: border-box; }
body.dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
#item-list li.checked { background: #f3f6f4; color: #66727e; }
#item-list li.hidechecked { display: none; }
.item-check { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 2px; flex: none; }
.item-text { flex: 1; cursor: pointer; }
.item-actions { display: flex; gap: 4px; }
#item-list li .item-actions { visibility: hidden; opacity: 0; transition: opacity .12s ease; }
#item-list li:hover .item-actions, #item-list li.actions-open .item-actions { visibility: visible; opacity: 1; }
.item-actions button { padding: 3px 8px; font-size: 12px; }
#item-list li .item-line { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
#item-list li .item-line .item-text { cursor: default; }
#item-list li .item-sub { font-size: 12px; color: var(--muted); margin-top: 1px; max-width: 60ch; overflow-wrap: anywhere; }
.editbox { flex: 1; display: none; gap: 6px; flex-direction: column; padding: 4px 0 2px; }
li.editing .editbox { display: flex; }
.editbtns { display: flex; gap: 4px; }
.editbox button { padding: 1px 7px; font-size: 11px; }
li.editing .item-text, li.editing .item-actions, li.editing .item-detail { display: none; }
.empty { color: var(--muted); padding: 24px 4px; }
.banner { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #202b38; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.25); font-size: 14px; max-width: 80vw; }
.confirm-card { position: fixed; inset: 0; background: rgba(16,24,34,.45); display: flex; align-items: center; justify-content: center; }
.confirm-card > div { background: #fff; border-radius: 10px; padding: 22px 24px; width: 360px; }
.confirm-card h3 { margin: 0 0 8px; }
.confirm-card .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
