[data-cloak] { display: none !important; }

:root {
    --card: #16213e;
    --line: rgba(95, 166, 166, 0.2);
    --ink: #eee;
    --muted: rgba(255, 255, 255, 0.6);
    --accent: #5fa6a6;
    --accent-ink: #1a1a2e;
    --chip: #0f1a30;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%;
    min-height: 100%;
    background: #1a1a2e;
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}

.demo-toolbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; display: flex; justify-content: space-between; align-items: center; padding: 8px 20px; background: rgba(26,26,46,0.95); border-bottom: 1px solid rgba(255,255,255,0.1); }
.demo-toolbar a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #5fa6a6; font-size: 1rem; }
.demo-toolbar .logo { height: 32px; }
.demo-toolbar .brand-wf { font-weight: 520; }
.demo-toolbar .brand-js { font-weight: 700; }
.demo-toolbar .demo-info { font-size: 11px; color: rgba(255,255,255,0.6); text-align: right; }
.demo-toolbar .demo-info strong { color: rgba(255,255,255,0.9); }

[data-component="task-desk"] {
    max-width: 860px;
    margin: 0 auto;
    padding: 84px 24px 48px;
}

.app-header {
    /* Chips live on their own row below the titles, always: letting them
       wrap beside the subtitle makes the layout shift as chip widths
       change (the estimate figure, the syncError chip appearing). */
    display: block;
    margin-bottom: 1.25rem;
}

.app-header h1 { margin: 0; font-size: 1.6rem; }
.subtitle { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.95rem; }
.app-header .chips { margin-top: 0.8rem; }

.v-badge {
    display: inline-block;
    background: #3F51B5;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1em 0.45em;
    border-radius: 4px;
    vertical-align: middle;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.chip {
    background: var(--chip);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.25em 0.8em;
    font-size: 0.85rem;
    white-space: nowrap;
    color: var(--muted);
}

.chip b { font-variant-numeric: tabular-nums; color: var(--ink); }
.chip-sync { background: rgba(240, 180, 60, 0.12); border-color: rgba(240, 180, 60, 0.3); color: #d9a441; }
.chip-err { background: rgba(224, 100, 100, 0.12); border-color: rgba(224, 100, 100, 0.35); color: #e08585; }

.add-form, .edit-panel {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.add-form input, .edit-panel input {
    flex: 1;
    padding: 0.55em 0.8em;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--chip);
    color: var(--ink);
}

.add-form input:focus, .edit-panel input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.add-form select {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--chip);
    color: var(--ink);
    padding: 0 0.6em;
}

button {
    font: inherit;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    border-radius: 9px;
    padding: 0.5em 0.9em;
    cursor: pointer;
}

button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
button.primary:hover { background: #6fb5b5; }
button.danger { color: #e08585; }
button.danger:hover { border-color: rgba(224, 100, 100, 0.5); }

.edit-panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.6rem;
}

.tasks { list-style: none; margin: 0 0 1.5rem; padding: 0; }

.task-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.55rem 0.8rem;
    margin-bottom: 0.5rem;
    transition: opacity 0.15s;
}

.task-row.pending { opacity: 0.55; }
.task-row.done .title { text-decoration: line-through; color: var(--muted); }

.check {
    width: 1.5rem;
    height: 1.5rem;
    min-width: 1.5rem;
    border-radius: 50%;
    border: 2px solid rgba(95, 166, 166, 0.5);
    background: transparent;
    padding: 0;
}

.check.checked { background: var(--accent); border-color: var(--accent); }
.check.checked::after { content: "✓"; color: var(--accent-ink); font-size: 0.9rem; font-weight: 700; }

.title { flex: 1; }

.size-tag {
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 5px;
    padding: 0.1em 0.5em;
}

.size-S { background: rgba(95, 166, 106, 0.18); color: #8fce9d; }
.size-M { background: rgba(90, 140, 220, 0.18); color: #9db8e8; }
.size-L { background: rgba(220, 140, 90, 0.18); color: #e0af8f; }

.row-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.72rem;
    color: var(--muted);
    min-width: 6.5em;
    text-align: right;
}

.row-actions { display: flex; gap: 0.35rem; }
.row-actions button { padding: 0.3em 0.6em; font-size: 0.85rem; }

.lower {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.server-panel, .try-it {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem 1.2rem;
}

.server-panel h2, .try-it h2 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.server-panel p, .try-it p { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.6rem; }

.arm-row { margin: 0 0 0.7rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
button.ghost { border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--accent); border-color: var(--line); }
button.arm { border-color: rgba(240, 180, 60, 0.45); color: #d9a441; }
button.arm:hover { border-color: #d9a441; }
button.armed {
    background: #b3261e;
    border-color: transparent;
    color: #fff;
}

.log {
    list-style: none;
    margin: 0.8rem 0 0;
    padding: 0.6rem 0.8rem;
    background: var(--chip);
    border: 1px solid var(--line);
    color: #cfe3cc;
    border-radius: 9px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem;
    min-height: 3.2em;
}

.log li { margin: 0.15em 0; }

.try-it ol { padding-left: 1.2rem; font-size: 0.9rem; color: var(--muted); }
.try-it li { margin-bottom: 0.35rem; }
.try-it code { background: var(--chip); padding: 0.05em 0.3em; border-radius: 4px; }
.try-it em { color: var(--ink); }
.try-it strong { color: var(--ink); }

.demo-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.88rem;
    color: var(--muted);
}

.demo-footer a { color: var(--accent); }

@media (max-width: 700px) {
    .lower { grid-template-columns: 1fr; }
    .demo-toolbar { padding: 8px 12px; }
    .demo-toolbar a { font-size: 0.85rem; gap: 6px; }
    .demo-toolbar .logo { height: 26px; }
}
